From 898a70df9704858431ec4e9cafde6c65559387aa Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 17 Sep 2016 11:11:49 +0900 Subject: [PATCH 001/125] change error message for assigning from object --- src/compiler/checker.ts | 6 ++- src/compiler/diagnosticMessages.json | 4 ++ ...ssigningFromObjecToAnythingElse.errors.txt | 38 +++++++++++++++++++ .../assigningFromObjecToAnythingElse.js | 18 +++++++++ .../reference/intTypeCheck.errors.txt | 36 ++++++++++++------ ...embersOfObjectAssignmentCompat2.errors.txt | 28 ++++++++------ ...mbersOfFunctionAssignmentCompat.errors.txt | 12 ++++-- ...mbersOfFunctionAssignmentCompat.errors.txt | 12 ++++-- ...serAutomaticSemicolonInsertion1.errors.txt | 12 ++++-- .../typeParametersShouldNotBeEqual.errors.txt | 2 + ...typeParametersShouldNotBeEqual2.errors.txt | 2 + ...typeParametersShouldNotBeEqual3.errors.txt | 4 ++ .../assigningFromObjecToAnythingElse.ts | 8 ++++ 13 files changed, 144 insertions(+), 38 deletions(-) create mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt create mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.js create mode 100644 tests/cases/compiler/assigningFromObjecToAnythingElse.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5aae3beb415..a952f5a7c95 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19,7 +19,7 @@ namespace ts { export function getSymbolId(symbol: Symbol): number { if (!symbol.id) { - symbol.id = nextSymbolId; + symbol.id = nextSymbolId; nextSymbolId++; } @@ -6365,7 +6365,7 @@ namespace ts { } function tryElaborateErrorsForPrimitivesAndObjects(source: Type, target: Type) { - const sourceType = typeToString(source); + const sourceType = typeToString(source); const targetType = typeToString(target); if ((globalStringType === source && stringType === target) || @@ -6501,6 +6501,8 @@ namespace ts { if (reportErrors) { 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); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 0f3e90405a6..be4ee2fa07d 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1959,6 +1959,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", diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt new file mode 100644 index 00000000000..2188474d9c9 --- /dev/null +++ b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt @@ -0,0 +1,38 @@ +tests/cases/compiler/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.ts(6,5): error TS2322: Type 'Number' is not assignable to type 'String'. + Property 'charAt' is missing in type 'Number'. +tests/cases/compiler/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.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(""); + ~ +!!! 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(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'. + \ No newline at end of file diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.js b/tests/baselines/reference/assigningFromObjecToAnythingElse.js new file mode 100644 index 00000000000..ec6dc0c789d --- /dev/null +++ b/tests/baselines/reference/assigningFromObjecToAnythingElse.js @@ -0,0 +1,18 @@ +//// [assigningFromObjecToAnythingElse.ts] +var x: Object; +var y: RegExp; +y = x; + +var a: String = Object.create(""); +var c: String = Object.create(1); + +var w: Error = new Object(); + + +//// [assigningFromObjecToAnythingElse.js] +var x; +var y; +y = x; +var a = Object.create(""); +var c = Object.create(1); +var w = new Object(); diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index 2214c685956..f8b4fef7310 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -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 = new Base; ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt index a88796b390e..3e27b22240e 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt +++ b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt @@ -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: () => { } diff --git a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt index e296f2113fb..caeca11edf8 100644 --- a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt @@ -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' \ No newline at end of file +!!! 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' \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt index 227ccc99603..ad0e801e435 100644 --- a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt @@ -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' \ No newline at end of file +!!! 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' \ No newline at end of file diff --git a/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt b/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt index 9ffdc614ab1..a2bbb98fbf4 100644 --- a/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt +++ b/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt @@ -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' \ No newline at end of file diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt index 6f5e2766c8c..b5c9fd60206 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/typeParametersShouldNotBeEqual.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'. tests/cases/compiler/typeParametersShouldNotBeEqual.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'T'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? ==== tests/cases/compiler/typeParametersShouldNotBeEqual.ts (2 errors) ==== @@ -12,6 +13,7 @@ tests/cases/compiler/typeParametersShouldNotBeEqual.ts(5,5): error TS2322: Type x = z; // Error ~ !!! error TS2322: Type 'Object' is not assignable to type 'T'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? z = x; // Ok } \ No newline at end of file diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt index 27ac1e07eab..d452b997980 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt @@ -7,6 +7,7 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(7,5): error TS2322: Type tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(8,5): error TS2322: Type 'U' is not assignable to type 'V'. Type 'Date' is not assignable to type 'V'. tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type 'Object' is not assignable to type 'T'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? ==== tests/cases/compiler/typeParametersShouldNotBeEqual2.ts (6 errors) ==== @@ -34,6 +35,7 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type x = zz; // Error ~ !!! error TS2322: Type 'Object' is not assignable to type 'T'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? zz = x; // Ok } \ No newline at end of file diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt index 0169f57c06f..816db440a4c 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt @@ -1,6 +1,8 @@ tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'. Type 'Object' is not assignable to type 'T'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'T'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? ==== tests/cases/compiler/typeParametersShouldNotBeEqual3.ts (2 errors) ==== @@ -11,9 +13,11 @@ tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(5,5): error TS2322: Type ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. !!! error TS2322: Type 'Object' is not assignable to type 'T'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? x = z; // Ok ~ !!! error TS2322: Type 'Object' is not assignable to type 'T'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? z = x; // Ok } \ No newline at end of file diff --git a/tests/cases/compiler/assigningFromObjecToAnythingElse.ts b/tests/cases/compiler/assigningFromObjecToAnythingElse.ts new file mode 100644 index 00000000000..ebf1a0a8763 --- /dev/null +++ b/tests/cases/compiler/assigningFromObjecToAnythingElse.ts @@ -0,0 +1,8 @@ +var x: Object; +var y: RegExp; +y = x; + +var a: String = Object.create(""); +var c: String = Object.create(1); + +var w: Error = new Object(); From e65cdc3953eaf766aa691655dafbe8e845a86c2d Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 24 Sep 2016 10:18:49 +0900 Subject: [PATCH 002/125] change error message --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- .../parserExportAssignment5.errors.txt | 4 ++-- .../parserExportAssignment9.errors.txt | 16 ++++++++++++++++ .../reference/parserExportAssignment9.js | 18 ++++++++++++++++++ .../parserExportAssignment9.ts | 7 +++++++ 6 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 tests/baselines/reference/parserExportAssignment9.errors.txt create mode 100644 tests/baselines/reference/parserExportAssignment9.js create mode 100644 tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 903d18e2331..74b9330c1b7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17650,7 +17650,7 @@ namespace ts { const container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent; if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) { - error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); return; } // Grammar checking diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index be4ee2fa07d..29bea6c3d33 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -195,7 +195,7 @@ "category": "Error", "code": 1062 }, - "An export assignment cannot be used in a namespace.": { + "A default export can only be used in an ECMAScript-style module.": { "category": "Error", "code": 1063 }, diff --git a/tests/baselines/reference/parserExportAssignment5.errors.txt b/tests/baselines/reference/parserExportAssignment5.errors.txt index 7b07e1d225f..adef4b88f38 100644 --- a/tests/baselines/reference/parserExportAssignment5.errors.txt +++ b/tests/baselines/reference/parserExportAssignment5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts(2,5): error TS1063: An export assignment cannot be used in a namespace. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts(2,5): error TS1063: A default export can only be used in an ECMAScript-style module. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts (1 errors) ==== module M { export = A; ~~~~~~~~~~~ -!!! error TS1063: An export assignment cannot be used in a namespace. +!!! error TS1063: A default export can only be used in an ECMAScript-style module. } \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment9.errors.txt b/tests/baselines/reference/parserExportAssignment9.errors.txt new file mode 100644 index 00000000000..9fc978537a6 --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment9.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1063: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1063: A default export can only be used in an ECMAScript-style module. + + +==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts (2 errors) ==== + namespace Foo { + export default foo; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1063: A default export can only be used in an ECMAScript-style module. + } + + module Bar { + export default bar; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1063: A default export can only be used in an ECMAScript-style module. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment9.js b/tests/baselines/reference/parserExportAssignment9.js new file mode 100644 index 00000000000..2600ae629e9 --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment9.js @@ -0,0 +1,18 @@ +//// [parserExportAssignment9.ts] +namespace Foo { + export default foo; +} + +module Bar { + export default bar; +} + +//// [parserExportAssignment9.js] +var Foo; +(function (Foo) { + export default foo; +})(Foo || (Foo = {})); +var Bar; +(function (Bar) { + export default bar; +})(Bar || (Bar = {})); diff --git a/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts b/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts new file mode 100644 index 00000000000..dc3aad85335 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts @@ -0,0 +1,7 @@ +namespace Foo { + export default foo; +} + +module Bar { + export default bar; +} \ No newline at end of file From 83acef7309bc862780ed5d47d9a5df5656c36621 Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 24 Sep 2016 10:48:57 +0900 Subject: [PATCH 003/125] fix linting error --- src/compiler/checker.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 74b9330c1b7..2872f728fd5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19,7 +19,7 @@ namespace ts { export function getSymbolId(symbol: Symbol): number { if (!symbol.id) { - symbol.id = nextSymbolId; + symbol.id = nextSymbolId; nextSymbolId++; } @@ -6367,7 +6367,7 @@ namespace ts { } function tryElaborateErrorsForPrimitivesAndObjects(source: Type, target: Type) { - const sourceType = typeToString(source); + const sourceType = typeToString(source); const targetType = typeToString(target); if ((globalStringType === source && stringType === target) || @@ -6503,7 +6503,8 @@ namespace ts { if (reportErrors) { if (source.flags & TypeFlags.ObjectType && target.flags & TypeFlags.Primitive) { tryElaborateErrorsForPrimitivesAndObjects(source, target); - } else if (source.symbol && source.flags & TypeFlags.ObjectType && globalObjectType === source) { + } + 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); } else if (source.symbol && source.flags & TypeFlags.ObjectType && globalObjectType === source) { From 0faf32b27949e06739f6a41ad64922af1bc949e7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 13 Oct 2016 09:27:20 -0700 Subject: [PATCH 004/125] Add spread syntax to JsxExpression. This allows you to specify that a JsxExpression should be a list that will be flattened by the JSX consumer. --- src/compiler/checker.ts | 6 +++++- src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/emitter.ts | 3 +++ src/compiler/factory.ts | 7 ++++--- src/compiler/parser.ts | 4 +++- src/compiler/types.ts | 1 + 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a1a8ae0da5c..db318e4eb17 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10904,7 +10904,11 @@ namespace ts { function checkJsxExpression(node: JsxExpression) { if (node.expression) { - return checkExpression(node.expression); + const type = checkExpression(node.expression); + if (node.dotDotDotToken && !isArrayType(type)) { + error(node, Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 1b8c995ea05..f0ccc7f33e2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1787,6 +1787,10 @@ "category": "Error", "code": 2608 }, + "JSX spread child must be an array type.": { + "category": "Error", + "code": 2609 + }, "Cannot emit namespaced JSX elements in React": { "category": "Error", "code": 2650 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 270fb0ca624..dae75e2516c 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1969,6 +1969,9 @@ const _super = (function (geti, seti) { function emitJsxExpression(node: JsxExpression) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 97a36f46b13..d050739470f 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1318,15 +1318,16 @@ namespace ts { return node; } - export function createJsxExpression(expression: Expression, location?: TextRange) { + export function createJsxExpression(expression: Expression, dotDotDotToken: Token, location?: TextRange) { const node = createNode(SyntaxKind.JsxExpression, location); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } export function updateJsxExpression(node: JsxExpression, expression: Expression) { if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); + return updateNode(createJsxExpression(expression, node.dotDotDotToken, node), node); } return node; } @@ -2910,4 +2911,4 @@ namespace ts { function tryGetModuleNameFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration, host: EmitHost, resolver: EmitResolver, compilerOptions: CompilerOptions) { return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); } -} \ No newline at end of file +} diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 62ae61e4cb4..1133a5bafd6 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -362,7 +362,8 @@ namespace ts { case SyntaxKind.JsxSpreadAttribute: return visitNode(cbNode, (node).expression); case SyntaxKind.JsxExpression: - return visitNode(cbNode, (node).expression); + return visitNode(cbNode, (node as JsxExpression).dotDotDotToken) || + visitNode(cbNode, (node as JsxExpression).expression); case SyntaxKind.JsxClosingElement: return visitNode(cbNode, (node).tagName); @@ -3821,6 +3822,7 @@ namespace ts { parseExpected(SyntaxKind.OpenBraceToken); if (token() !== SyntaxKind.CloseBraceToken) { + node.dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 638504e613f..e54157ba986 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1396,6 +1396,7 @@ namespace ts { export interface JsxExpression extends Expression { kind: SyntaxKind.JsxExpression; + dotDotDotToken?: Token; expression?: Expression; } From d29c78e7189fcbcc13bd54f88d52948ddf65ff9f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 13 Oct 2016 09:28:39 -0700 Subject: [PATCH 005/125] Add spread syntax tests for JsxExpressions And baselines --- .../baselines/reference/tsxSpreadChildren.js | 41 ++++++++ .../reference/tsxSpreadChildren.symbols | 86 +++++++++++++++++ .../reference/tsxSpreadChildren.types | 94 +++++++++++++++++++ .../tsxSpreadChildrenInvalidType.errors.txt | 32 +++++++ .../reference/tsxSpreadChildrenInvalidType.js | 46 +++++++++ .../conformance/jsx/tsxSpreadChildren.tsx | 27 ++++++ .../jsx/tsxSpreadChildrenInvalidType.tsx | 26 +++++ 7 files changed, 352 insertions(+) create mode 100644 tests/baselines/reference/tsxSpreadChildren.js create mode 100644 tests/baselines/reference/tsxSpreadChildren.symbols create mode 100644 tests/baselines/reference/tsxSpreadChildren.types create mode 100644 tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt create mode 100644 tests/baselines/reference/tsxSpreadChildrenInvalidType.js create mode 100644 tests/cases/conformance/jsx/tsxSpreadChildren.tsx create mode 100644 tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx diff --git a/tests/baselines/reference/tsxSpreadChildren.js b/tests/baselines/reference/tsxSpreadChildren.js new file mode 100644 index 00000000000..bcc62de0566 --- /dev/null +++ b/tests/baselines/reference/tsxSpreadChildren.js @@ -0,0 +1,41 @@ +//// [tsxSpreadChildren.tsx] + +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +interface TodoProp { + id: number; + todo: string; +} +interface TodoListProps { + todos: TodoProp[]; +} +function Todo(prop: { key: number, todo: string }) { + return
{prop.key.toString() + prop.todo}
; +} +function TodoList({ todos }: TodoListProps) { + return
+ {...todos.map(todo => )} +
; +} +let x: TodoListProps; + + + +//// [tsxSpreadChildren.jsx] +function Todo(prop) { + return
{prop.key.toString() + prop.todo}
; +} +function TodoList(_a) { + var todos = _a.todos; + return
+ {...todos.map(function (todo) { return ; })} +
; +} +var x; +; diff --git a/tests/baselines/reference/tsxSpreadChildren.symbols b/tests/baselines/reference/tsxSpreadChildren.symbols new file mode 100644 index 00000000000..6e726e93217 --- /dev/null +++ b/tests/baselines/reference/tsxSpreadChildren.symbols @@ -0,0 +1,86 @@ +=== tests/cases/conformance/jsx/tsxSpreadChildren.tsx === + +declare module JSX { +>JSX : Symbol(JSX, Decl(tsxSpreadChildren.tsx, 0, 0)) + + interface Element { } +>Element : Symbol(Element, Decl(tsxSpreadChildren.tsx, 1, 20)) + + interface IntrinsicElements { +>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxSpreadChildren.tsx, 2, 22)) + + [s: string]: any; +>s : Symbol(s, Decl(tsxSpreadChildren.tsx, 4, 3)) + } +} +declare var React: any; +>React : Symbol(React, Decl(tsxSpreadChildren.tsx, 7, 11)) + +interface TodoProp { +>TodoProp : Symbol(TodoProp, Decl(tsxSpreadChildren.tsx, 7, 23)) + + id: number; +>id : Symbol(TodoProp.id, Decl(tsxSpreadChildren.tsx, 9, 20)) + + todo: string; +>todo : Symbol(TodoProp.todo, Decl(tsxSpreadChildren.tsx, 10, 15)) +} +interface TodoListProps { +>TodoListProps : Symbol(TodoListProps, Decl(tsxSpreadChildren.tsx, 12, 1)) + + todos: TodoProp[]; +>todos : Symbol(TodoListProps.todos, Decl(tsxSpreadChildren.tsx, 13, 25)) +>TodoProp : Symbol(TodoProp, Decl(tsxSpreadChildren.tsx, 7, 23)) +} +function Todo(prop: { key: number, todo: string }) { +>Todo : Symbol(Todo, Decl(tsxSpreadChildren.tsx, 15, 1)) +>prop : Symbol(prop, Decl(tsxSpreadChildren.tsx, 16, 14)) +>key : Symbol(key, Decl(tsxSpreadChildren.tsx, 16, 21)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 16, 34)) + + return
{prop.key.toString() + prop.todo}
; +>div : Symbol(JSX.IntrinsicElements, Decl(tsxSpreadChildren.tsx, 2, 22)) +>prop.key.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>prop.key : Symbol(key, Decl(tsxSpreadChildren.tsx, 16, 21)) +>prop : Symbol(prop, Decl(tsxSpreadChildren.tsx, 16, 14)) +>key : Symbol(key, Decl(tsxSpreadChildren.tsx, 16, 21)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>prop.todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 16, 34)) +>prop : Symbol(prop, Decl(tsxSpreadChildren.tsx, 16, 14)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 16, 34)) +>div : Symbol(JSX.IntrinsicElements, Decl(tsxSpreadChildren.tsx, 2, 22)) +} +function TodoList({ todos }: TodoListProps) { +>TodoList : Symbol(TodoList, Decl(tsxSpreadChildren.tsx, 18, 1)) +>todos : Symbol(todos, Decl(tsxSpreadChildren.tsx, 19, 19)) +>TodoListProps : Symbol(TodoListProps, Decl(tsxSpreadChildren.tsx, 12, 1)) + + return
+>div : Symbol(JSX.IntrinsicElements, Decl(tsxSpreadChildren.tsx, 2, 22)) + + {...todos.map(todo => )} +>todos.map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>todos : Symbol(todos, Decl(tsxSpreadChildren.tsx, 19, 19)) +>map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 21, 22)) +>Todo : Symbol(Todo, Decl(tsxSpreadChildren.tsx, 15, 1)) +>key : Symbol(key, Decl(tsxSpreadChildren.tsx, 16, 21)) +>todo.id : Symbol(TodoProp.id, Decl(tsxSpreadChildren.tsx, 9, 20)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 21, 22)) +>id : Symbol(TodoProp.id, Decl(tsxSpreadChildren.tsx, 9, 20)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 16, 34)) +>todo.todo : Symbol(TodoProp.todo, Decl(tsxSpreadChildren.tsx, 10, 15)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 21, 22)) +>todo : Symbol(TodoProp.todo, Decl(tsxSpreadChildren.tsx, 10, 15)) + +
; +>div : Symbol(JSX.IntrinsicElements, Decl(tsxSpreadChildren.tsx, 2, 22)) +} +let x: TodoListProps; +>x : Symbol(x, Decl(tsxSpreadChildren.tsx, 24, 3)) +>TodoListProps : Symbol(TodoListProps, Decl(tsxSpreadChildren.tsx, 12, 1)) + + +>TodoList : Symbol(TodoList, Decl(tsxSpreadChildren.tsx, 18, 1)) +>x : Symbol(x, Decl(tsxSpreadChildren.tsx, 24, 3)) + diff --git a/tests/baselines/reference/tsxSpreadChildren.types b/tests/baselines/reference/tsxSpreadChildren.types new file mode 100644 index 00000000000..fbf76d0679d --- /dev/null +++ b/tests/baselines/reference/tsxSpreadChildren.types @@ -0,0 +1,94 @@ +=== tests/cases/conformance/jsx/tsxSpreadChildren.tsx === + +declare module JSX { +>JSX : any + + interface Element { } +>Element : Element + + interface IntrinsicElements { +>IntrinsicElements : IntrinsicElements + + [s: string]: any; +>s : string + } +} +declare var React: any; +>React : any + +interface TodoProp { +>TodoProp : TodoProp + + id: number; +>id : number + + todo: string; +>todo : string +} +interface TodoListProps { +>TodoListProps : TodoListProps + + todos: TodoProp[]; +>todos : TodoProp[] +>TodoProp : TodoProp +} +function Todo(prop: { key: number, todo: string }) { +>Todo : (prop: { key: number; todo: string; }) => JSX.Element +>prop : { key: number; todo: string; } +>key : number +>todo : string + + return
{prop.key.toString() + prop.todo}
; +>
{prop.key.toString() + prop.todo}
: JSX.Element +>div : any +>prop.key.toString() + prop.todo : string +>prop.key.toString() : string +>prop.key.toString : (radix?: number) => string +>prop.key : number +>prop : { key: number; todo: string; } +>key : number +>toString : (radix?: number) => string +>prop.todo : string +>prop : { key: number; todo: string; } +>todo : string +>div : any +} +function TodoList({ todos }: TodoListProps) { +>TodoList : ({todos}: TodoListProps) => JSX.Element +>todos : TodoProp[] +>TodoListProps : TodoListProps + + return
+>
{...todos.map(todo => )}
: JSX.Element +>div : any + + {...todos.map(todo => )} +>todos.map(todo => ) : JSX.Element[] +>todos.map : { (this: [TodoProp, TodoProp, TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U, U, U]; (this: [TodoProp, TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U, U]; (this: [TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U]; (this: [TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U]; (callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): U[]; } +>todos : TodoProp[] +>map : { (this: [TodoProp, TodoProp, TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U, U, U]; (this: [TodoProp, TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U, U]; (this: [TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U]; (this: [TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U]; (callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): U[]; } +>todo => : (todo: TodoProp) => JSX.Element +>todo : TodoProp +> : JSX.Element +>Todo : (prop: { key: number; todo: string; }) => JSX.Element +>key : any +>todo.id : number +>todo : TodoProp +>id : number +>todo : any +>todo.todo : string +>todo : TodoProp +>todo : string + +
; +>div : any +} +let x: TodoListProps; +>x : TodoListProps +>TodoListProps : TodoListProps + + +> : JSX.Element +>TodoList : ({todos}: TodoListProps) => JSX.Element +>x : TodoListProps + diff --git a/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt b/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt new file mode 100644 index 00000000000..d0526541673 --- /dev/null +++ b/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt @@ -0,0 +1,32 @@ +tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx(21,9): error TS2609: JSX spread child must be an array type. + + +==== tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx (1 errors) ==== + declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } + } + declare var React: any; + + interface TodoProp { + id: number; + todo: string; + } + interface TodoListProps { + todos: TodoProp[]; + } + function Todo(prop: { key: number, todo: string }) { + return
{prop.key.toString() + prop.todo}
; + } + function TodoList({ todos }: TodoListProps) { + return
+ {...} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2609: JSX spread child must be an array type. +
; + } + let x: TodoListProps; + + \ No newline at end of file diff --git a/tests/baselines/reference/tsxSpreadChildrenInvalidType.js b/tests/baselines/reference/tsxSpreadChildrenInvalidType.js new file mode 100644 index 00000000000..507b36665d5 --- /dev/null +++ b/tests/baselines/reference/tsxSpreadChildrenInvalidType.js @@ -0,0 +1,46 @@ +//// [tsxSpreadChildrenInvalidType.tsx] +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +interface TodoProp { + id: number; + todo: string; +} +interface TodoListProps { + todos: TodoProp[]; +} +function Todo(prop: { key: number, todo: string }) { + return
{prop.key.toString() + prop.todo}
; +} +function TodoList({ todos }: TodoListProps) { + return
+ {...} +
; +} +let x: TodoListProps; + + + +//// [tsxSpreadChildrenInvalidType.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +function Todo(prop) { + return React.createElement("div", null, prop.key.toString() + prop.todo); +} +function TodoList(_a) { + var todos = _a.todos; + return React.createElement("div", null, React.createElement(Todo, { key: todos[0].id, todo: todos[0].todo })); +} +var x; +React.createElement(TodoList, __assign({}, x)); diff --git a/tests/cases/conformance/jsx/tsxSpreadChildren.tsx b/tests/cases/conformance/jsx/tsxSpreadChildren.tsx new file mode 100644 index 00000000000..3be0b3b99e4 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxSpreadChildren.tsx @@ -0,0 +1,27 @@ +//@jsx: preserve + +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +interface TodoProp { + id: number; + todo: string; +} +interface TodoListProps { + todos: TodoProp[]; +} +function Todo(prop: { key: number, todo: string }) { + return
{prop.key.toString() + prop.todo}
; +} +function TodoList({ todos }: TodoListProps) { + return
+ {...todos.map(todo => )} +
; +} +let x: TodoListProps; + diff --git a/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx b/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx new file mode 100644 index 00000000000..20f7d4fae87 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx @@ -0,0 +1,26 @@ +// @jsx: react +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +interface TodoProp { + id: number; + todo: string; +} +interface TodoListProps { + todos: TodoProp[]; +} +function Todo(prop: { key: number, todo: string }) { + return
{prop.key.toString() + prop.todo}
; +} +function TodoList({ todos }: TodoListProps) { + return
+ {...} +
; +} +let x: TodoListProps; + From 7eb39cc80ce7725afacb1b75763fd7fcd505d964 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 13 Oct 2016 10:17:01 -0700 Subject: [PATCH 006/125] Allow any type for spreads in JsxExpression --- src/compiler/checker.ts | 2 +- .../reference/tsxSpreadChildrenInvalidType.errors.txt | 6 ++++++ .../reference/tsxSpreadChildrenInvalidType.js | 11 +++++++++++ .../conformance/jsx/tsxSpreadChildrenInvalidType.tsx | 6 ++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index db318e4eb17..78481c17d1f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10905,7 +10905,7 @@ namespace ts { function checkJsxExpression(node: JsxExpression) { if (node.expression) { const type = checkExpression(node.expression); - if (node.dotDotDotToken && !isArrayType(type)) { + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { error(node, Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); } return type; diff --git a/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt b/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt index d0526541673..d1524c6bf3a 100644 --- a/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt +++ b/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt @@ -27,6 +27,12 @@ tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx(21,9): error TS2609 !!! error TS2609: JSX spread child must be an array type. ; } + function TodoListNoError({ todos }: TodoListProps) { + // any is not checked + return
+ {...( as any)} +
; + } let x: TodoListProps; \ No newline at end of file diff --git a/tests/baselines/reference/tsxSpreadChildrenInvalidType.js b/tests/baselines/reference/tsxSpreadChildrenInvalidType.js index 507b36665d5..e9873bfb233 100644 --- a/tests/baselines/reference/tsxSpreadChildrenInvalidType.js +++ b/tests/baselines/reference/tsxSpreadChildrenInvalidType.js @@ -22,6 +22,12 @@ function TodoList({ todos }: TodoListProps) { {...} ; } +function TodoListNoError({ todos }: TodoListProps) { + // any is not checked + return
+ {...( as any)} +
; +} let x: TodoListProps; @@ -42,5 +48,10 @@ function TodoList(_a) { var todos = _a.todos; return React.createElement("div", null, React.createElement(Todo, { key: todos[0].id, todo: todos[0].todo })); } +function TodoListNoError(_a) { + var todos = _a.todos; + // any is not checked + return React.createElement("div", null, React.createElement(Todo, { key: todos[0].id, todo: todos[0].todo })); +} var x; React.createElement(TodoList, __assign({}, x)); diff --git a/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx b/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx index 20f7d4fae87..41181618ce0 100644 --- a/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx +++ b/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx @@ -22,5 +22,11 @@ function TodoList({ todos }: TodoListProps) { {...} ; } +function TodoListNoError({ todos }: TodoListProps) { + // any is not checked + return
+ {...( as any)} +
; +} let x: TodoListProps; From 2e8bbf0c9660330c42a2df41dd1fee7d403cfe52 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Wed, 2 Nov 2016 20:27:53 +0800 Subject: [PATCH 007/125] fix #11480, disallow delete operator on readonly property or index signature --- src/compiler/checker.ts | 3 +++ src/compiler/diagnosticMessages.json | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 006b87cb542..7b4fd5803e3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -13550,6 +13550,9 @@ namespace ts { function checkDeleteExpression(node: DeleteExpression): Type { checkExpression(node.expression); + checkReferenceExpression(node.expression, + Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference, + Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); return booleanType; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 5290782c156..187a3a60d16 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1983,6 +1983,14 @@ "category": "Error", "code": 2697 }, + "The operand of a delete operator must be a property reference": { + "category": "Error", + "code": 2698 + }, + "The operand of a delete operator cannot be a read-only property": { + "category": "Error", + "code": 2699 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", From 8ea8044f80f18417a9c1f09c0268ee0ecf7cd115 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Wed, 2 Nov 2016 20:47:46 +0800 Subject: [PATCH 008/125] add new tests and accept baselines --- .../await_unaryExpression_es2017_1.errors.txt | 29 +++++++ .../await_unaryExpression_es2017_2.errors.txt | 21 +++++ .../await_unaryExpression_es6_1.errors.txt | 29 +++++++ .../await_unaryExpression_es6_2.errors.txt | 21 +++++ .../deleteOperatorWithAnyOtherType.errors.txt | 44 +++++++++- .../deleteOperatorWithBooleanType.errors.txt | 65 ++++++++++++++ .../deleteOperatorWithEnumType.errors.txt | 64 ++++++++++++++ .../deleteOperatorWithNumberType.errors.txt | 84 ++++++++++++++++++ .../deleteOperatorWithStringType.errors.txt | 86 +++++++++++++++++++ .../reference/deleteReadonly.errors.txt | 28 ++++++ tests/baselines/reference/deleteReadonly.js | 30 +++++++ ...onentiationOperatorSyntaxError2.errors.txt | 26 +++++- ...idSimpleUnaryExpressionOperands.errors.txt | 28 +++++- .../reference/parserStrictMode16.errors.txt | 20 +++++ .../reference/symbolType3.errors.txt | 5 +- ...emplateStringInDeleteExpression.errors.txt | 7 ++ ...lateStringInDeleteExpressionES6.errors.txt | 7 ++ tests/cases/compiler/deleteReadonly.ts | 18 ++++ 18 files changed, 607 insertions(+), 5 deletions(-) create mode 100644 tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt create mode 100644 tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt create mode 100644 tests/baselines/reference/await_unaryExpression_es6_1.errors.txt create mode 100644 tests/baselines/reference/await_unaryExpression_es6_2.errors.txt create mode 100644 tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt create mode 100644 tests/baselines/reference/deleteOperatorWithEnumType.errors.txt create mode 100644 tests/baselines/reference/deleteOperatorWithNumberType.errors.txt create mode 100644 tests/baselines/reference/deleteOperatorWithStringType.errors.txt create mode 100644 tests/baselines/reference/deleteReadonly.errors.txt create mode 100644 tests/baselines/reference/deleteReadonly.js create mode 100644 tests/baselines/reference/parserStrictMode16.errors.txt create mode 100644 tests/baselines/reference/templateStringInDeleteExpression.errors.txt create mode 100644 tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt create mode 100644 tests/cases/compiler/deleteReadonly.ts diff --git a/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt b/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt new file mode 100644 index 00000000000..60e786cbad1 --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt @@ -0,0 +1,29 @@ +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(7,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(11,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts (2 errors) ==== + + async function bar() { + !await 42; // OK + } + + async function bar1() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } + + async function bar4() { + +await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt b/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt new file mode 100644 index 00000000000..1c1072fd86c --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(3,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(7,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts (2 errors) ==== + + async function bar1() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt b/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt new file mode 100644 index 00000000000..90bd23b7597 --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt @@ -0,0 +1,29 @@ +tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(7,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(11,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts (2 errors) ==== + + async function bar() { + !await 42; // OK + } + + async function bar1() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } + + async function bar4() { + +await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt b/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt new file mode 100644 index 00000000000..9386d206eee --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(3,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(7,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts (2 errors) ==== + + async function bar1() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt index 73ddab1a33c..d92f1ffb1e7 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt @@ -1,9 +1,23 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(27,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(28,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(33,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(34,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(42,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(43,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,39): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,46): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (3 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (17 errors) ==== // delete operator on any type var ANY: any; @@ -31,13 +45,21 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean1 = delete ANY1; var ResultIsBoolean2 = delete ANY2; var ResultIsBoolean3 = delete A; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean4 = delete M; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean5 = delete obj; var ResultIsBoolean6 = delete obj1; // any type literal var ResultIsBoolean7 = delete undefined; + ~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean8 = delete null; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // any type expressions var ResultIsBoolean9 = delete ANY2[0]; @@ -46,21 +68,41 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean12 = delete objA.a; var ResultIsBoolean13 = delete M.n; var ResultIsBoolean14 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean15 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean16 = delete (ANY + ANY1); + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean17 = delete (null + undefined); + ~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsBoolean18 = delete (null + null); + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var ResultIsBoolean19 = delete (undefined + undefined); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. // multiple delete operators var ResultIsBoolean20 = delete delete ANY; + ~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean21 = delete delete delete (ANY + ANY1); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators delete ANY; diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt new file mode 100644 index 00000000000..3f653671e2e --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt @@ -0,0 +1,65 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(20,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(21,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(26,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(27,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(33,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(35,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(36,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts (8 errors) ==== + // delete operator on boolean type + var BOOLEAN: boolean; + + function foo(): boolean { return true; } + + class A { + public a: boolean; + static foo() { return false; } + } + module M { + export var n: boolean; + } + + var objA = new A(); + + // boolean type var + var ResultIsBoolean1 = delete BOOLEAN; + + // boolean type literal + var ResultIsBoolean2 = delete true; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean3 = delete { x: true, y: false }; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // boolean type expressions + var ResultIsBoolean4 = delete objA.a; + var ResultIsBoolean5 = delete M.n; + var ResultIsBoolean6 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean7 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operator + var ResultIsBoolean8 = delete delete BOOLEAN; + ~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete true; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete BOOLEAN; + delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete true, false; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete objA.a; + delete M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt new file mode 100644 index 00000000000..103070d15dc --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt @@ -0,0 +1,64 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(7,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(8,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(11,31): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(12,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,38): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,38): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,45): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(19,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(20,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(21,8): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(22,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts (13 errors) ==== + // delete operator on enum type + + enum ENUM { }; + enum ENUM1 { A, B, "" }; + + // enum type var + var ResultIsBoolean1 = delete ENUM; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean2 = delete ENUM1; + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // enum type expressions + var ResultIsBoolean3 = delete ENUM1["A"]; + ~~~~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operators + var ResultIsBoolean5 = delete delete ENUM; + ~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete ENUM; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete ENUM1; + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete ENUM1.B; + ~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + delete ENUM, ENUM1; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt new file mode 100644 index 00000000000..bb35f3338b9 --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt @@ -0,0 +1,84 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(22,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(23,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(24,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(31,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(32,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,39): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(39,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(42,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts (12 errors) ==== + // delete operator on number type + var NUMBER: number; + var NUMBER1: number[] = [1, 2]; + + function foo(): number { return 1; } + + class A { + public a: number; + static foo() { return 1; } + } + module M { + export var n: number; + } + + var objA = new A(); + + // number type var + var ResultIsBoolean1 = delete NUMBER; + var ResultIsBoolean2 = delete NUMBER1; + + // number type literal + var ResultIsBoolean3 = delete 1; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean4 = delete { x: 1, y: 2}; + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // number type expressions + var ResultIsBoolean6 = delete objA.a; + var ResultIsBoolean7 = delete M.n; + var ResultIsBoolean8 = delete NUMBER1[0]; + var ResultIsBoolean9 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean10 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean11 = delete (NUMBER + NUMBER); + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operator + var ResultIsBoolean12 = delete delete NUMBER; + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete 1; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete NUMBER; + delete NUMBER1; + delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete objA.a; + delete M.n; + delete objA.a, M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt new file mode 100644 index 00000000000..9ffde0a8f97 --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt @@ -0,0 +1,86 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(22,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(23,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(24,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(31,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(32,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(33,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,39): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(40,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(43,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts (13 errors) ==== + // delete operator on string type + var STRING: string; + var STRING1: string[] = ["", "abc"]; + + function foo(): string { return "abc"; } + + class A { + public a: string; + static foo() { return ""; } + } + module M { + export var n: string; + } + + var objA = new A(); + + // string type var + var ResultIsBoolean1 = delete STRING; + var ResultIsBoolean2 = delete STRING1; + + // string type literal + var ResultIsBoolean3 = delete ""; + ~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean4 = delete { x: "", y: "" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // string type expressions + var ResultIsBoolean6 = delete objA.a; + var ResultIsBoolean7 = delete M.n; + var ResultIsBoolean8 = delete STRING1[0]; + var ResultIsBoolean9 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean10 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean11 = delete (STRING + STRING); + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean12 = delete STRING.charAt(0); + ~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operator + var ResultIsBoolean13 = delete delete STRING; + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean14 = delete delete delete (STRING + STRING); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete ""; + ~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete STRING; + delete STRING1; + delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete objA.a,M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteReadonly.errors.txt b/tests/baselines/reference/deleteReadonly.errors.txt new file mode 100644 index 00000000000..c0fc3ee7dc3 --- /dev/null +++ b/tests/baselines/reference/deleteReadonly.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/deleteReadonly.ts(8,8): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/compiler/deleteReadonly.ts(18,8): error TS2699: The operand of a delete operator cannot be a read-only property + + +==== tests/cases/compiler/deleteReadonly.ts (2 errors) ==== + interface A { + readonly b + } + var a: A = { + b: 123 + }; + + delete a.b; + ~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + + interface B { + readonly [k: string]: string + } + + var b: B = { + 'test': 'test' + }; + + delete b['test']; + ~~~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + \ No newline at end of file diff --git a/tests/baselines/reference/deleteReadonly.js b/tests/baselines/reference/deleteReadonly.js new file mode 100644 index 00000000000..fd16bf270f6 --- /dev/null +++ b/tests/baselines/reference/deleteReadonly.js @@ -0,0 +1,30 @@ +//// [deleteReadonly.ts] +interface A { + readonly b +} +var a: A = { + b: 123 +}; + +delete a.b; + +interface B { + readonly [k: string]: string +} + +var b: B = { + 'test': 'test' +}; + +delete b['test']; + + +//// [deleteReadonly.js] +var a = { + b: 123 +}; +delete a.b; +var b = { + 'test': 'test' +}; +delete b['test']; diff --git a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt index 134a883540e..c08335f8598 100644 --- a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt @@ -1,19 +1,27 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(16,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(16,1): error TS17006: An unary expression with the 'typeof' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(17,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -81,7 +89,7 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(68,1): error TS17007: A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts (81 errors) ==== +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts (89 errors) ==== // Error: early syntax error using ES7 SimpleUnaryExpression on left-hand side without () var temp: any; @@ -91,21 +99,29 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete ++temp ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete temp-- ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete temp++ ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete --temp ** 3; @@ -113,21 +129,29 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete ++temp ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete temp-- ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete temp++ ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference typeof --temp ** 3; ~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt index f43cbd0042a..24145c81158 100644 --- a/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt @@ -19,16 +19,24 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInv tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(25,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(26,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(28,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(28,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(29,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(29,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(30,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(31,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(31,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(33,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(33,14): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(34,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(34,14): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(35,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(35,14): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(36,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(36,14): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts (28 errors) ==== +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts (36 errors) ==== var temp: any; // Error: incorrect type on left-hand side @@ -99,25 +107,41 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInv (delete --temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference (delete ++temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference (delete temp--) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference (delete temp++) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete --temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete ++temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete temp--) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete temp++) ** 3; ~~~~~~~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/parserStrictMode16.errors.txt b/tests/baselines/reference/parserStrictMode16.errors.txt new file mode 100644 index 00000000000..edcda2787e1 --- /dev/null +++ b/tests/baselines/reference/parserStrictMode16.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(2,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(3,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(4,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(5,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts (4 errors) ==== + "use strict"; + delete this; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete 1; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete null; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete "a"; + ~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/symbolType3.errors.txt b/tests/baselines/reference/symbolType3.errors.txt index 7cc9e82b3b3..bf7a5cf0438 100644 --- a/tests/baselines/reference/symbolType3.errors.txt +++ b/tests/baselines/reference/symbolType3.errors.txt @@ -1,3 +1,4 @@ +tests/cases/conformance/es6/Symbols/symbolType3.ts(2,8): error TS2699: The operand of a delete operator cannot be a read-only property tests/cases/conformance/es6/Symbols/symbolType3.ts(5,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType3.ts(6,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType3.ts(7,3): error TS2469: The '+' operator cannot be applied to type 'symbol'. @@ -6,9 +7,11 @@ tests/cases/conformance/es6/Symbols/symbolType3.ts(9,3): error TS2469: The '~' o tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' operator cannot be applied to type 'symbol'. -==== tests/cases/conformance/es6/Symbols/symbolType3.ts (6 errors) ==== +==== tests/cases/conformance/es6/Symbols/symbolType3.ts (7 errors) ==== var s = Symbol(); delete Symbol.iterator; + ~~~~~~~~~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property void Symbol.toPrimitive; typeof Symbol.toStringTag; ++s; diff --git a/tests/baselines/reference/templateStringInDeleteExpression.errors.txt b/tests/baselines/reference/templateStringInDeleteExpression.errors.txt new file mode 100644 index 00000000000..9218b93b650 --- /dev/null +++ b/tests/baselines/reference/templateStringInDeleteExpression.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts(1,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts (1 errors) ==== + delete `abc${0}abc`; + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt b/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt new file mode 100644 index 00000000000..9ea14c39f2b --- /dev/null +++ b/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts(1,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts (1 errors) ==== + delete `abc${0}abc`; + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/cases/compiler/deleteReadonly.ts b/tests/cases/compiler/deleteReadonly.ts new file mode 100644 index 00000000000..b7d35b3261b --- /dev/null +++ b/tests/cases/compiler/deleteReadonly.ts @@ -0,0 +1,18 @@ +interface A { + readonly b +} +var a: A = { + b: 123 +}; + +delete a.b; + +interface B { + readonly [k: string]: string +} + +var b: B = { + 'test': 'test' +}; + +delete b['test']; From 747f50f447a9f28b707c31607594a2e3ef13d058 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Thu, 3 Nov 2016 13:19:16 +0800 Subject: [PATCH 009/125] migrate checkDelete to new property checking --- src/compiler/checker.ts | 15 +++++++++++---- src/compiler/types.ts | 1 - src/compiler/utilities.ts | 14 +++++++++++++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7b4fd5803e3..b105721ba13 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5777,7 +5777,7 @@ namespace ts { getIndexInfoOfType(objectType, IndexKind.String) || undefined; if (indexInfo) { - if (accessExpression && isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) { error(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } @@ -13550,9 +13550,16 @@ namespace ts { function checkDeleteExpression(node: DeleteExpression): Type { checkExpression(node.expression); - checkReferenceExpression(node.expression, - Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference, - Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + const expr = skipParentheses(node.expression); + if (expr.kind !== SyntaxKind.PropertyAccessExpression && expr.kind !== SyntaxKind.ElementAccessExpression) { + error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + const links = getNodeLinks(expr); + const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e4c92c502a4..9e1b35c60da 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2651,7 +2651,6 @@ namespace ts { resolvedType?: Type; // Cached type of type node resolvedSignature?: Signature; // Cached signature of signature node or call expression resolvedSymbol?: Symbol; // Cached name resolution result - resolvedIndexInfo?: IndexInfo; // Cached indexing info resolution result enumMemberValue?: number; // Constant value of enum member isVisible?: boolean; // Is this node visible hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 299f91be662..8e7b11ccf91 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,4 +1,4 @@ -/// +/// /* @internal */ namespace ts { @@ -1666,6 +1666,18 @@ namespace ts { return getAssignmentTargetKind(node) !== AssignmentKind.None; } + // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped + export function isDeleteTarget(node: Node): boolean { + if (node.kind !== SyntaxKind.PropertyAccessExpression && node.kind !== SyntaxKind.ElementAccessExpression) { + return false; + } + node = node.parent; + while (node && node.kind === SyntaxKind.ParenthesizedExpression) { + node = node.parent; + } + return node && node.kind === SyntaxKind.DeleteExpression; + } + export function isNodeDescendantOf(node: Node, ancestor: Node): boolean { while (node) { if (node === ancestor) return true; From 023d5caf3b4e51871ae73849be2dc60961c2012d Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Thu, 3 Nov 2016 13:25:58 +0800 Subject: [PATCH 010/125] accept new baseline --- .../computedPropertyNames3_ES5.errors.txt | 5 +- .../computedPropertyNames3_ES6.errors.txt | 5 +- .../controlFlowDeleteOperator.errors.txt | 23 ++++++++ .../reference/deleteOperator1.errors.txt | 13 ++++- .../deleteOperatorInStrictMode.errors.txt | 7 ++- ...deleteOperatorInvalidOperations.errors.txt | 11 +++- .../deleteOperatorWithAnyOtherType.errors.txt | 52 ++++++++++++++----- .../deleteOperatorWithBooleanType.errors.txt | 11 +++- .../deleteOperatorWithEnumType.errors.txt | 8 +-- .../deleteOperatorWithNumberType.errors.txt | 25 +++++++-- .../deleteOperatorWithStringType.errors.txt | 25 +++++++-- .../reference/deleteReadonly.errors.txt | 11 ++-- tests/baselines/reference/deleteReadonly.js | 3 ++ .../reference/parserStrictMode15.errors.txt | 7 ++- tests/cases/compiler/deleteReadonly.ts | 2 + 15 files changed, 167 insertions(+), 41 deletions(-) create mode 100644 tests/baselines/reference/controlFlowDeleteOperator.errors.txt diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt index fd6f8e8bdc1..86e363c9377 100644 --- a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -2,12 +2,13 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,1 tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (7 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (8 errors) ==== var id; class C { [0 + 1]() { } @@ -21,6 +22,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,1 !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ~~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. + ~~ +!!! error TS2698: The operand of a delete operator must be a property reference set [[0, 1]](v) { } ~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. diff --git a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt index 4299437777d..f287138661a 100644 --- a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt @@ -2,12 +2,13 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(4,1 tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,17): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts (7 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts (8 errors) ==== var id; class C { [0 + 1]() { } @@ -21,6 +22,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,1 !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ~~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. + ~~ +!!! error TS2698: The operand of a delete operator must be a property reference set [[0, 1]](v) { } ~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. diff --git a/tests/baselines/reference/controlFlowDeleteOperator.errors.txt b/tests/baselines/reference/controlFlowDeleteOperator.errors.txt new file mode 100644 index 00000000000..720b368219c --- /dev/null +++ b/tests/baselines/reference/controlFlowDeleteOperator.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts(15,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts (1 errors) ==== + + function f() { + let x: { a?: number | string, b: number | string } = { b: 1 }; + x.a; + x.b; + x.a = 1; + x.b = 1; + x.a; + x.b; + delete x.a; + delete x.b; + x.a; + x.b; + x; + delete x; // No effect + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + x; + } \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperator1.errors.txt b/tests/baselines/reference/deleteOperator1.errors.txt index 964bdec9ea2..5cf2a63925d 100644 --- a/tests/baselines/reference/deleteOperator1.errors.txt +++ b/tests/baselines/reference/deleteOperator1.errors.txt @@ -1,10 +1,19 @@ +tests/cases/compiler/deleteOperator1.ts(2,25): error TS2698: The operand of a delete operator must be a property reference +tests/cases/compiler/deleteOperator1.ts(3,21): error TS2698: The operand of a delete operator must be a property reference tests/cases/compiler/deleteOperator1.ts(4,5): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/compiler/deleteOperator1.ts(4,24): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/compiler/deleteOperator1.ts (1 errors) ==== +==== tests/cases/compiler/deleteOperator1.ts (4 errors) ==== var a; var x: boolean = delete a; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference var y: any = delete a; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference var z: number = delete a; ~ -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. + ~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt b/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt index 5952d8b8296..9d9e04d154c 100644 --- a/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt +++ b/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt @@ -1,9 +1,12 @@ tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. +tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/compiler/deleteOperatorInStrictMode.ts (1 errors) ==== +==== tests/cases/compiler/deleteOperatorInStrictMode.ts (2 errors) ==== "use strict" var a; delete a; ~ -!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. \ No newline at end of file +!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. + ~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt b/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt index d50be713d0a..2ff0c764c51 100644 --- a/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt @@ -1,10 +1,13 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,20): error TS1005: ',' expected. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,26): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,27): error TS1109: Expression expected. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(8,22): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(8,23): error TS1109: Expression expected. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(13,16): error TS1102: 'delete' cannot be called on an identifier in strict mode. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(13,16): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts (4 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts (7 errors) ==== // Unary operator delete var ANY; @@ -12,11 +15,15 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var BOOLEAN1 = ANY delete ; //expect error ~~~~~~ !!! error TS1005: ',' expected. + +!!! error TS2698: The operand of a delete operator must be a property reference ~ !!! error TS1109: Expression expected. // miss an operand var BOOLEAN2 = delete ; + +!!! error TS2698: The operand of a delete operator must be a property reference ~ !!! error TS1109: Expression expected. @@ -26,5 +33,7 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator delete s; //expect error ~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. + ~ +!!! error TS2698: The operand of a delete operator must be a property reference } } \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt index d92f1ffb1e7..64f41c84a0d 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt @@ -1,23 +1,31 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(25,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(26,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(27,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(28,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(29,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(33,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(34,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(42,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(43,32): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,32): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,39): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,39): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,47): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(54,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(55,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(57,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (17 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (25 errors) ==== // delete operator on any type var ANY: any; @@ -43,7 +51,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // any type var var ResultIsBoolean1 = delete ANY1; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean2 = delete ANY2; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean3 = delete A; ~ !!! error TS2698: The operand of a delete operator must be a property reference @@ -51,7 +63,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean5 = delete obj; + ~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean6 = delete obj1; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // any type literal var ResultIsBoolean7 = delete undefined; @@ -74,41 +90,49 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean16 = delete (ANY + ANY1); - ~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean17 = delete (null + undefined); - ~~~~~~~~~~~~~~~~~~ -!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. - var ResultIsBoolean18 = delete (null + null); - ~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean18 = delete (null + null); ~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. - var ResultIsBoolean19 = delete (undefined + undefined); - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean19 = delete (undefined + undefined); ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // multiple delete operators var ResultIsBoolean20 = delete delete ANY; ~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean21 = delete delete delete (ANY + ANY1); ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference - ~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators delete ANY; + ~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete ANY1; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete ANY2[0]; delete ANY, ANY1; + ~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete obj1.x; delete obj1.y; delete objA.a; diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt index 3f653671e2e..5d65f8f718a 100644 --- a/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt @@ -1,14 +1,17 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(17,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(20,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(21,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(26,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(27,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,38): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(33,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(34,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(35,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(36,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts (8 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts (11 errors) ==== // delete operator on boolean type var BOOLEAN: boolean; @@ -26,6 +29,8 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // boolean type var var ResultIsBoolean1 = delete BOOLEAN; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // boolean type literal var ResultIsBoolean2 = delete true; @@ -49,12 +54,16 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean8 = delete delete BOOLEAN; ~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators delete true; ~~~~ !!! error TS2698: The operand of a delete operator must be a property reference delete BOOLEAN; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete foo(); ~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt index 103070d15dc..f515e3b7b70 100644 --- a/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt @@ -1,12 +1,12 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(7,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(8,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(11,31): error TS2699: The operand of a delete operator cannot be a read-only property -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(12,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(12,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,38): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,38): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,45): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,46): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(19,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(20,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(21,8): error TS2699: The operand of a delete operator cannot be a read-only property @@ -32,7 +32,7 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~~~~~~~~~ !!! error TS2699: The operand of a delete operator cannot be a read-only property var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // multiple delete operators @@ -46,7 +46,7 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator !!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt index bb35f3338b9..f908bee9686 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt @@ -1,18 +1,23 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(18,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(19,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(22,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(23,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(24,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(31,32): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(32,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(32,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,39): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,39): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,47): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(39,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(40,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(41,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(42,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts (12 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts (17 errors) ==== // delete operator on number type var NUMBER: number; var NUMBER1: number[] = [1, 2]; @@ -31,7 +36,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // number type var var ResultIsBoolean1 = delete NUMBER; + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean2 = delete NUMBER1; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // number type literal var ResultIsBoolean3 = delete 1; @@ -55,19 +64,21 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean11 = delete (NUMBER + NUMBER); - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // multiple delete operator var ResultIsBoolean12 = delete delete NUMBER; ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators @@ -75,7 +86,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~ !!! error TS2698: The operand of a delete operator must be a property reference delete NUMBER; + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete NUMBER1; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete foo(); ~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference diff --git a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt index 9ffde0a8f97..c15e6b47433 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt @@ -1,19 +1,24 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(18,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(19,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(22,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(23,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(24,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(31,32): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(32,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(32,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(33,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,39): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,39): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,47): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(40,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(41,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(42,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(43,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts (13 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts (18 errors) ==== // delete operator on string type var STRING: string; var STRING1: string[] = ["", "abc"]; @@ -32,7 +37,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // string type var var ResultIsBoolean1 = delete STRING; + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean2 = delete STRING1; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // string type literal var ResultIsBoolean3 = delete ""; @@ -56,7 +65,7 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean11 = delete (STRING + STRING); - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean12 = delete STRING.charAt(0); ~~~~~~~~~~~~~~~~ @@ -65,13 +74,15 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // multiple delete operator var ResultIsBoolean13 = delete delete STRING; ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean14 = delete delete delete (STRING + STRING); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators @@ -79,7 +90,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~ !!! error TS2698: The operand of a delete operator must be a property reference delete STRING; + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete STRING1; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete foo(); ~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference diff --git a/tests/baselines/reference/deleteReadonly.errors.txt b/tests/baselines/reference/deleteReadonly.errors.txt index c0fc3ee7dc3..1846f139d86 100644 --- a/tests/baselines/reference/deleteReadonly.errors.txt +++ b/tests/baselines/reference/deleteReadonly.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/deleteReadonly.ts(8,8): error TS2699: The operand of a delete operator cannot be a read-only property -tests/cases/compiler/deleteReadonly.ts(18,8): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/compiler/deleteReadonly.ts(18,8): error TS2542: Index signature in type 'B' only permits reading. +tests/cases/compiler/deleteReadonly.ts(20,12): error TS2542: Index signature in type 'B' only permits reading. -==== tests/cases/compiler/deleteReadonly.ts (2 errors) ==== +==== tests/cases/compiler/deleteReadonly.ts (3 errors) ==== interface A { readonly b } @@ -24,5 +25,9 @@ tests/cases/compiler/deleteReadonly.ts(18,8): error TS2699: The operand of a del delete b['test']; ~~~~~~~~~ -!!! error TS2699: The operand of a delete operator cannot be a read-only property +!!! error TS2542: Index signature in type 'B' only permits reading. + + delete ((((b['test'])))); + ~~~~~~~~~ +!!! error TS2542: Index signature in type 'B' only permits reading. \ No newline at end of file diff --git a/tests/baselines/reference/deleteReadonly.js b/tests/baselines/reference/deleteReadonly.js index fd16bf270f6..bdfdf155546 100644 --- a/tests/baselines/reference/deleteReadonly.js +++ b/tests/baselines/reference/deleteReadonly.js @@ -17,6 +17,8 @@ var b: B = { }; delete b['test']; + +delete ((((b['test'])))); //// [deleteReadonly.js] @@ -28,3 +30,4 @@ var b = { 'test': 'test' }; delete b['test']; +delete ((((b['test'])))); diff --git a/tests/baselines/reference/parserStrictMode15.errors.txt b/tests/baselines/reference/parserStrictMode15.errors.txt index 0bcaaf33786..82175901236 100644 --- a/tests/baselines/reference/parserStrictMode15.errors.txt +++ b/tests/baselines/reference/parserStrictMode15.errors.txt @@ -1,11 +1,14 @@ tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS2304: Cannot find name 'a'. +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts (3 errors) ==== "use strict"; delete a; ~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. ~ -!!! error TS2304: Cannot find name 'a'. \ No newline at end of file +!!! error TS2304: Cannot find name 'a'. + ~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/cases/compiler/deleteReadonly.ts b/tests/cases/compiler/deleteReadonly.ts index b7d35b3261b..cdab3f2eb23 100644 --- a/tests/cases/compiler/deleteReadonly.ts +++ b/tests/cases/compiler/deleteReadonly.ts @@ -16,3 +16,5 @@ var b: B = { }; delete b['test']; + +delete ((((b['test'])))); From 94c78961ef3e340c617334597bf2c1b04d25f87f Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 19 Nov 2016 16:18:20 +0900 Subject: [PATCH 011/125] modify error message --- src/compiler/checker.ts | 10 ++++++---- src/compiler/diagnosticMessages.json | 6 +++++- .../parserExportAssignment10.errors.txt | 11 +++++++++++ .../reference/parserExportAssignment10.js | 16 ++++++++++++++++ .../reference/parserExportAssignment5.errors.txt | 4 ++-- .../reference/parserExportAssignment9.errors.txt | 8 ++++---- .../parserExportAssignment10.ts | 5 +++++ 7 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 tests/baselines/reference/parserExportAssignment10.errors.txt create mode 100644 tests/baselines/reference/parserExportAssignment10.js create mode 100644 tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 824ce784909..cb10e8fbf13 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7293,9 +7293,6 @@ namespace ts { if (source.flags & TypeFlags.Object && 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); - } else if (source.symbol && source.flags & TypeFlags.Object && globalObjectType === source) { reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); } @@ -18764,7 +18761,12 @@ namespace ts { const container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent; if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) { - error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + if (node.isExportEquals) { + error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } else { + error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } + return; } // Grammar checking diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 03f1e5e8388..03be26ff954 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -195,7 +195,7 @@ "category": "Error", "code": 1062 }, - "A default export can only be used in an ECMAScript-style module.": { + "An export assignment cannot be used in a namespace.": { "category": "Error", "code": 1063 }, @@ -851,6 +851,10 @@ "category": "Error", "code": 1317 }, + "A default export can only be used in an ECMAScript-style module.": { + "category": "Error", + "code": 1318 + }, "Duplicate identifier '{0}'.": { "category": "Error", "code": 2300 diff --git a/tests/baselines/reference/parserExportAssignment10.errors.txt b/tests/baselines/reference/parserExportAssignment10.errors.txt new file mode 100644 index 00000000000..db00da3e8b0 --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment10.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts(4,3): error TS1128: Declaration or statement expected. + + +==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts (1 errors) ==== + export default "123"; + namespace Foo { + var foo; + export foo; + ~~~~~~ +!!! error TS1128: Declaration or statement expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment10.js b/tests/baselines/reference/parserExportAssignment10.js new file mode 100644 index 00000000000..58bd2c82a9e --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment10.js @@ -0,0 +1,16 @@ +//// [parserExportAssignment10.ts] +export default "123"; +namespace Foo { + var foo; + export foo; +} + +//// [parserExportAssignment10.js] +"use strict"; +exports.__esModule = true; +exports["default"] = "123"; +var Foo; +(function (Foo) { + var foo; + foo; +})(Foo || (Foo = {})); diff --git a/tests/baselines/reference/parserExportAssignment5.errors.txt b/tests/baselines/reference/parserExportAssignment5.errors.txt index adef4b88f38..7b07e1d225f 100644 --- a/tests/baselines/reference/parserExportAssignment5.errors.txt +++ b/tests/baselines/reference/parserExportAssignment5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts(2,5): error TS1063: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts(2,5): error TS1063: An export assignment cannot be used in a namespace. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts (1 errors) ==== module M { export = A; ~~~~~~~~~~~ -!!! error TS1063: A default export can only be used in an ECMAScript-style module. +!!! error TS1063: An export assignment cannot be used in a namespace. } \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment9.errors.txt b/tests/baselines/reference/parserExportAssignment9.errors.txt index 9fc978537a6..5d84ee9836c 100644 --- a/tests/baselines/reference/parserExportAssignment9.errors.txt +++ b/tests/baselines/reference/parserExportAssignment9.errors.txt @@ -1,16 +1,16 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1063: A default export can only be used in an ECMAScript-style module. -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1063: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1318: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1318: A default export can only be used in an ECMAScript-style module. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts (2 errors) ==== namespace Foo { export default foo; ~~~~~~~~~~~~~~~~~~~ -!!! error TS1063: A default export can only be used in an ECMAScript-style module. +!!! error TS1318: A default export can only be used in an ECMAScript-style module. } module Bar { export default bar; ~~~~~~~~~~~~~~~~~~~ -!!! error TS1063: A default export can only be used in an ECMAScript-style module. +!!! error TS1318: A default export can only be used in an ECMAScript-style module. } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts b/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts new file mode 100644 index 00000000000..a5bf22dd854 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts @@ -0,0 +1,5 @@ +export default "123"; +namespace Foo { + var foo; + export foo; +} \ No newline at end of file From 13f52c9148e8e302551cf4671e6861608435d03d Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Fri, 25 Nov 2016 00:40:50 +0900 Subject: [PATCH 012/125] fix linting error --- src/compiler/checker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b30250fabd6..11085532794 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18756,10 +18756,11 @@ namespace ts { if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) { if (node.isExportEquals) { error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); - } else { + } + else { error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } - + return; } // Grammar checking From 40252248e0d2d55c21fc216cae7047b0c1b0d9de Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Fri, 25 Nov 2016 07:10:05 +0900 Subject: [PATCH 013/125] remove extra tests --- .../parserExportAssignment10.errors.txt | 11 ----------- .../reference/parserExportAssignment10.js | 16 ---------------- .../parserExportAssignment10.ts | 5 ----- 3 files changed, 32 deletions(-) delete mode 100644 tests/baselines/reference/parserExportAssignment10.errors.txt delete mode 100644 tests/baselines/reference/parserExportAssignment10.js delete mode 100644 tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts diff --git a/tests/baselines/reference/parserExportAssignment10.errors.txt b/tests/baselines/reference/parserExportAssignment10.errors.txt deleted file mode 100644 index db00da3e8b0..00000000000 --- a/tests/baselines/reference/parserExportAssignment10.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts(4,3): error TS1128: Declaration or statement expected. - - -==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts (1 errors) ==== - export default "123"; - namespace Foo { - var foo; - export foo; - ~~~~~~ -!!! error TS1128: Declaration or statement expected. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment10.js b/tests/baselines/reference/parserExportAssignment10.js deleted file mode 100644 index 58bd2c82a9e..00000000000 --- a/tests/baselines/reference/parserExportAssignment10.js +++ /dev/null @@ -1,16 +0,0 @@ -//// [parserExportAssignment10.ts] -export default "123"; -namespace Foo { - var foo; - export foo; -} - -//// [parserExportAssignment10.js] -"use strict"; -exports.__esModule = true; -exports["default"] = "123"; -var Foo; -(function (Foo) { - var foo; - foo; -})(Foo || (Foo = {})); diff --git a/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts b/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts deleted file mode 100644 index a5bf22dd854..00000000000 --- a/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default "123"; -namespace Foo { - var foo; - export foo; -} \ No newline at end of file From b293257640e608c09055e033e8b3b7b8dda342cb Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 26 Nov 2016 01:19:41 +0900 Subject: [PATCH 014/125] remove extra files --- ...ssigningFromObjecToAnythingElse.errors.txt | 38 ------------------ .../assigningFromObjecToAnythingElse.js | 18 --------- .../compiler/asiPublicPrivateProtected.ts | 39 ------------------- 3 files changed, 95 deletions(-) delete mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt delete mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.js delete mode 100644 tests/cases/compiler/asiPublicPrivateProtected.ts diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt deleted file mode 100644 index 2188474d9c9..00000000000 --- a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt +++ /dev/null @@ -1,38 +0,0 @@ -tests/cases/compiler/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.ts(6,5): error TS2322: Type 'Number' is not assignable to type 'String'. - Property 'charAt' is missing in type 'Number'. -tests/cases/compiler/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.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(""); - ~ -!!! 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(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'. - \ No newline at end of file diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.js b/tests/baselines/reference/assigningFromObjecToAnythingElse.js deleted file mode 100644 index ec6dc0c789d..00000000000 --- a/tests/baselines/reference/assigningFromObjecToAnythingElse.js +++ /dev/null @@ -1,18 +0,0 @@ -//// [assigningFromObjecToAnythingElse.ts] -var x: Object; -var y: RegExp; -y = x; - -var a: String = Object.create(""); -var c: String = Object.create(1); - -var w: Error = new Object(); - - -//// [assigningFromObjecToAnythingElse.js] -var x; -var y; -y = x; -var a = Object.create(""); -var c = Object.create(1); -var w = new Object(); diff --git a/tests/cases/compiler/asiPublicPrivateProtected.ts b/tests/cases/compiler/asiPublicPrivateProtected.ts deleted file mode 100644 index 4ccd4c1c01b..00000000000 --- a/tests/cases/compiler/asiPublicPrivateProtected.ts +++ /dev/null @@ -1,39 +0,0 @@ -public -class NonPublicClass { - public s() { - } -} - -class NonPublicClass2 { - public - private nonPublicFunction() { - } -} -private -class NonPrivateClass { - private s() { - } -} - -class NonPrivateClass2 { - private - public nonPrivateFunction() { - } -} -protected -class NonProtectedClass { - protected s() { - } -} - -class NonProtectedClass2 { - protected - public nonProtectedFunction() { - } -} - -class ClassWithThreeMembers { - public - private - protected -} From e18901a61ef165fa5c1d73047c32a84403d53c55 Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 26 Nov 2016 08:03:42 +0900 Subject: [PATCH 015/125] Revert "remove extra files" This reverts commit b293257640e608c09055e033e8b3b7b8dda342cb. --- ...ssigningFromObjecToAnythingElse.errors.txt | 38 ++++++++++++++++++ .../assigningFromObjecToAnythingElse.js | 18 +++++++++ .../compiler/asiPublicPrivateProtected.ts | 39 +++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt create mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.js create mode 100644 tests/cases/compiler/asiPublicPrivateProtected.ts diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt new file mode 100644 index 00000000000..2188474d9c9 --- /dev/null +++ b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt @@ -0,0 +1,38 @@ +tests/cases/compiler/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.ts(6,5): error TS2322: Type 'Number' is not assignable to type 'String'. + Property 'charAt' is missing in type 'Number'. +tests/cases/compiler/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.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(""); + ~ +!!! 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(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'. + \ No newline at end of file diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.js b/tests/baselines/reference/assigningFromObjecToAnythingElse.js new file mode 100644 index 00000000000..ec6dc0c789d --- /dev/null +++ b/tests/baselines/reference/assigningFromObjecToAnythingElse.js @@ -0,0 +1,18 @@ +//// [assigningFromObjecToAnythingElse.ts] +var x: Object; +var y: RegExp; +y = x; + +var a: String = Object.create(""); +var c: String = Object.create(1); + +var w: Error = new Object(); + + +//// [assigningFromObjecToAnythingElse.js] +var x; +var y; +y = x; +var a = Object.create(""); +var c = Object.create(1); +var w = new Object(); diff --git a/tests/cases/compiler/asiPublicPrivateProtected.ts b/tests/cases/compiler/asiPublicPrivateProtected.ts new file mode 100644 index 00000000000..4ccd4c1c01b --- /dev/null +++ b/tests/cases/compiler/asiPublicPrivateProtected.ts @@ -0,0 +1,39 @@ +public +class NonPublicClass { + public s() { + } +} + +class NonPublicClass2 { + public + private nonPublicFunction() { + } +} +private +class NonPrivateClass { + private s() { + } +} + +class NonPrivateClass2 { + private + public nonPrivateFunction() { + } +} +protected +class NonProtectedClass { + protected s() { + } +} + +class NonProtectedClass2 { + protected + public nonProtectedFunction() { + } +} + +class ClassWithThreeMembers { + public + private + protected +} From 67b621eae4a8b7fdaafb8e13fa5c6b20b94c0f01 Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 26 Nov 2016 08:06:44 +0900 Subject: [PATCH 016/125] remove extra files --- ...ssigningFromObjecToAnythingElse.errors.txt | 38 ------------------- .../assigningFromObjecToAnythingElse.js | 18 --------- .../assigningFromObjecToAnythingElse.ts | 8 ---- 3 files changed, 64 deletions(-) delete mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt delete mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.js delete mode 100644 tests/cases/compiler/assigningFromObjecToAnythingElse.ts diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt deleted file mode 100644 index 2188474d9c9..00000000000 --- a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt +++ /dev/null @@ -1,38 +0,0 @@ -tests/cases/compiler/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.ts(6,5): error TS2322: Type 'Number' is not assignable to type 'String'. - Property 'charAt' is missing in type 'Number'. -tests/cases/compiler/assigningFromObjecToAnythingElse.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/assigningFromObjecToAnythingElse.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(""); - ~ -!!! 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(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'. - \ No newline at end of file diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.js b/tests/baselines/reference/assigningFromObjecToAnythingElse.js deleted file mode 100644 index ec6dc0c789d..00000000000 --- a/tests/baselines/reference/assigningFromObjecToAnythingElse.js +++ /dev/null @@ -1,18 +0,0 @@ -//// [assigningFromObjecToAnythingElse.ts] -var x: Object; -var y: RegExp; -y = x; - -var a: String = Object.create(""); -var c: String = Object.create(1); - -var w: Error = new Object(); - - -//// [assigningFromObjecToAnythingElse.js] -var x; -var y; -y = x; -var a = Object.create(""); -var c = Object.create(1); -var w = new Object(); diff --git a/tests/cases/compiler/assigningFromObjecToAnythingElse.ts b/tests/cases/compiler/assigningFromObjecToAnythingElse.ts deleted file mode 100644 index ebf1a0a8763..00000000000 --- a/tests/cases/compiler/assigningFromObjecToAnythingElse.ts +++ /dev/null @@ -1,8 +0,0 @@ -var x: Object; -var y: RegExp; -y = x; - -var a: String = Object.create(""); -var c: String = Object.create(1); - -var w: Error = new Object(); From 41057d3d3191828486ef8f8b42aa7bc2d1be736f Mon Sep 17 00:00:00 2001 From: chico Date: Wed, 30 Nov 2016 23:45:15 +0300 Subject: [PATCH 017/125] Add Node.js 6 LTS to CI --- .travis.yml | 1 + netci.groovy | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2751337c708..08bd7817c79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: node_js node_js: - 'stable' + - '6' - '4' sudo: false diff --git a/netci.groovy b/netci.groovy index 9f2a96cdeef..bc512f6b245 100644 --- a/netci.groovy +++ b/netci.groovy @@ -5,7 +5,7 @@ import jobs.generation.Utilities; def project = GithubProject def branch = GithubBranchName -def nodeVersions = ['stable', '4'] +def nodeVersions = ['stable', '6', '4'] nodeVersions.each { nodeVer -> From 1c2ad3eb6ea5bf9dc6f5c44b36299aa681928c45 Mon Sep 17 00:00:00 2001 From: chico Date: Wed, 30 Nov 2016 23:47:34 +0300 Subject: [PATCH 018/125] Drop unmaintained versions of Node.js from package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 175c1675f2c..fdb85ea764b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "tsserver": "./bin/tsserver" }, "engines": { - "node": ">=0.8.0" + "node": ">=4.2.0" }, "devDependencies": { "@types/browserify": "latest", From fee777dd9c6d794f84b24ca9254a5f20ba73542e Mon Sep 17 00:00:00 2001 From: Benjamin Bock Date: Mon, 5 Dec 2016 11:35:38 +0100 Subject: [PATCH 019/125] fixes #9123 like https://github.com/otbe/TypeScript/blob/1f43720026c824151217e6ea9991b19e449c85cc/src/compiler/commandLineParser.ts but without removing the open-curly of the function --- src/compiler/commandLineParser.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index e9f9ff210a9..b577b7671d4 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -850,6 +850,7 @@ namespace ts { */ export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string, resolutionStack: Path[] = []): ParsedCommandLine { const errors: Diagnostic[] = []; + basePath = normalizeSlashes(basePath); const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames); const resolvedPath = toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { From 8434fdef2d83d4c51ec31de842ba385c2597ccb1 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 5 Dec 2016 12:30:14 -0800 Subject: [PATCH 020/125] Improve SourceMap emit for down-level async functions --- src/compiler/emitter.ts | 40 ++++++--- src/compiler/transformers/generators.ts | 114 +++++++++++++++--------- 2 files changed, 96 insertions(+), 58 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 90738d828be..2f19c9b3d32 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1305,28 +1305,28 @@ namespace ts { writeToken(SyntaxKind.OpenParenToken, openParenPos, node); emitExpression(node.expression); writeToken(SyntaxKind.CloseParenToken, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(SyntaxKind.ElseKeyword, node.thenStatement.end, node); if (node.elseStatement.kind === SyntaxKind.IfStatement) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node: DoStatement) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); @@ -1338,7 +1338,7 @@ namespace ts { write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node: ForStatement) { @@ -1351,7 +1351,7 @@ namespace ts { write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node: ForInStatement) { @@ -1362,7 +1362,7 @@ namespace ts { write(" in "); emitExpression(node.expression); writeToken(SyntaxKind.CloseParenToken, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node: ForOfStatement) { @@ -1373,7 +1373,7 @@ namespace ts { write(" of "); emitExpression(node.expression); writeToken(SyntaxKind.CloseParenToken, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node: VariableDeclarationList | Expression) { @@ -1409,7 +1409,7 @@ namespace ts { write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node: SwitchStatement) { @@ -1437,9 +1437,12 @@ namespace ts { function emitTryStatement(node: TryStatement) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -2125,8 +2128,8 @@ namespace ts { } } - function emitEmbeddedStatement(node: Statement) { - if (isBlock(node)) { + function emitEmbeddedStatement(parent: Node, node: Statement) { + if (isBlock(node) || getEmitFlags(parent) & EmitFlags.SingleLine) { write(" "); emit(node); } @@ -2291,6 +2294,15 @@ namespace ts { } } + function writeLineOrSpace(node: Node) { + if (getEmitFlags(node) & EmitFlags.SingleLine) { + write(" "); + } + else { + writeLine(); + } + } + function writeIfAny(nodes: NodeArray, text: string) { if (nodes && nodes.length > 0) { write(text); diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index c383902d495..1b909da4f6a 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -938,7 +938,7 @@ namespace ts { } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(/*location*/ node); } /** @@ -1234,7 +1234,9 @@ namespace ts { function transformAndEmitVariableDeclarationList(node: VariableDeclarationList): VariableDeclarationList { for (const variable of node.declarations) { - hoistVariableDeclaration(variable.name); + const name = getSynthesizedClone(variable.name); + setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } const variables = getInitializedVariables(node); @@ -1287,7 +1289,7 @@ namespace ts { if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { const endLabel = defineLabel(); const elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, visitNode(node.expression, visitor, isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, visitNode(node.expression, visitor, isExpression), /*location*/ node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -2965,12 +2967,15 @@ namespace ts { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; writeStatement( - createReturn( - createArrayLiteral(expression - ? [createInstruction(Instruction.Return), expression] - : [createInstruction(Instruction.Return)] + setEmitFlags( + createReturn( + createArrayLiteral(expression + ? [createInstruction(Instruction.Return), expression] + : [createInstruction(Instruction.Return)] + ), + operationLocation ), - operationLocation + EmitFlags.NoTokenSourceMaps ) ); } @@ -2984,12 +2989,15 @@ namespace ts { function writeBreak(label: Label, operationLocation: TextRange): void { lastOperationWasAbrupt = true; writeStatement( - createReturn( - createArrayLiteral([ - createInstruction(Instruction.Break), - createLabel(label) - ]), - operationLocation + setEmitFlags( + createReturn( + createArrayLiteral([ + createInstruction(Instruction.Break), + createLabel(label) + ]), + operationLocation + ), + EmitFlags.NoTokenSourceMaps ) ); } @@ -3003,15 +3011,21 @@ namespace ts { */ function writeBreakWhenTrue(label: Label, condition: Expression, operationLocation: TextRange): void { writeStatement( - createIf( - condition, - createReturn( - createArrayLiteral([ - createInstruction(Instruction.Break), - createLabel(label) - ]), - operationLocation - ) + setEmitFlags( + createIf( + condition, + setEmitFlags( + createReturn( + createArrayLiteral([ + createInstruction(Instruction.Break), + createLabel(label) + ]), + operationLocation + ), + EmitFlags.NoTokenSourceMaps + ) + ), + EmitFlags.SingleLine ) ); } @@ -3025,15 +3039,21 @@ namespace ts { */ function writeBreakWhenFalse(label: Label, condition: Expression, operationLocation: TextRange): void { writeStatement( - createIf( - createLogicalNot(condition), - createReturn( - createArrayLiteral([ - createInstruction(Instruction.Break), - createLabel(label) - ]), - operationLocation - ) + setEmitFlags( + createIf( + createLogicalNot(condition), + setEmitFlags( + createReturn( + createArrayLiteral([ + createInstruction(Instruction.Break), + createLabel(label) + ]), + operationLocation + ), + EmitFlags.NoTokenSourceMaps + ) + ), + EmitFlags.SingleLine ) ); } @@ -3047,13 +3067,16 @@ namespace ts { function writeYield(expression: Expression, operationLocation: TextRange): void { lastOperationWasAbrupt = true; writeStatement( - createReturn( - createArrayLiteral( - expression - ? [createInstruction(Instruction.Yield), expression] - : [createInstruction(Instruction.Yield)] + setEmitFlags( + createReturn( + createArrayLiteral( + expression + ? [createInstruction(Instruction.Yield), expression] + : [createInstruction(Instruction.Yield)] + ), + operationLocation ), - operationLocation + EmitFlags.NoTokenSourceMaps ) ); } @@ -3067,12 +3090,15 @@ namespace ts { function writeYieldStar(expression: Expression, operationLocation: TextRange): void { lastOperationWasAbrupt = true; writeStatement( - createReturn( - createArrayLiteral([ - createInstruction(Instruction.YieldStar), - expression - ]), - operationLocation + setEmitFlags( + createReturn( + createArrayLiteral([ + createInstruction(Instruction.YieldStar), + expression + ]), + operationLocation + ), + EmitFlags.NoTokenSourceMaps ) ); } From b195ef8ec57ec8ebd9611df2626854fdd4b77a8d Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 5 Dec 2016 13:13:50 -0800 Subject: [PATCH 021/125] Updated baselines --- .../asyncAwaitWithCapturedBlockScopeVar.js | 12 ++-- .../es5-asyncFunctionBinaryExpressions.js | 3 +- .../es5-asyncFunctionConditionals.js | 6 +- .../es5-asyncFunctionDoStatements.js | 42 +++++--------- .../es5-asyncFunctionForInStatements.js | 21 +++---- .../es5-asyncFunctionForOfStatements.js | 57 +++++++------------ .../es5-asyncFunctionForStatements.js | 12 ++-- .../es5-asyncFunctionIfStatements.js | 6 +- .../reference/es5-asyncFunctionNestedLoops.js | 3 +- .../es5-asyncFunctionWhileStatements.js | 42 +++++--------- .../reference/exportStarForValues10.js | 3 +- .../reference/generatorTransformFinalLabel.js | 3 +- .../sourceMapValidationStatements.js.map | 2 +- ...ourceMapValidationStatements.sourcemap.txt | 12 ++-- .../sourceMapValidationTryCatchFinally.js.map | 2 +- ...MapValidationTryCatchFinally.sourcemap.txt | 14 ++--- tests/baselines/reference/systemModule11.js | 12 ++-- tests/baselines/reference/systemModule16.js | 3 +- tests/baselines/reference/systemModule9.js | 3 +- 19 files changed, 91 insertions(+), 167 deletions(-) diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js index 49566904ae1..6d167a00089 100644 --- a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js +++ b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js @@ -57,8 +57,7 @@ function fn1() { i = 0; _a.label = 1; case 1: - if (!(i < 1)) - return [3 /*break*/, 4]; + if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_1(i)]; case 2: _a.sent(); @@ -92,8 +91,7 @@ function fn2() { i = 0; _a.label = 1; case 1: - if (!(i < 1)) - return [3 /*break*/, 4]; + if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_2(i)]; case 2: state_1 = _a.sent(); @@ -129,8 +127,7 @@ function fn3() { i = 0; _a.label = 1; case 1: - if (!(i < 1)) - return [3 /*break*/, 4]; + if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_3(i)]; case 2: _a.sent(); @@ -164,8 +161,7 @@ function fn4() { i = 0; _a.label = 1; case 1: - if (!(i < 1)) - return [3 /*break*/, 4]; + if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_4(i)]; case 2: state_2 = _a.sent(); diff --git a/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js b/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js index a7aff630256..23a79cef343 100644 --- a/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js +++ b/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js @@ -169,8 +169,7 @@ function binaryLogicalAnd1() { switch (_b.label) { case 0: _a = x; - if (!_a) - return [3 /*break*/, 2]; + if (!_a) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a = (_b.sent()); diff --git a/tests/baselines/reference/es5-asyncFunctionConditionals.js b/tests/baselines/reference/es5-asyncFunctionConditionals.js index b42b0c07b0a..e9fc995fc2d 100644 --- a/tests/baselines/reference/es5-asyncFunctionConditionals.js +++ b/tests/baselines/reference/es5-asyncFunctionConditionals.js @@ -32,8 +32,7 @@ function conditional1() { return __generator(this, function (_b) { switch (_b.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a = _b.sent(); @@ -54,8 +53,7 @@ function conditional2() { return __generator(this, function (_b) { switch (_b.label) { case 0: - if (!x) - return [3 /*break*/, 1]; + if (!x) return [3 /*break*/, 1]; _a = y; return [3 /*break*/, 3]; case 1: return [4 /*yield*/, z]; diff --git a/tests/baselines/reference/es5-asyncFunctionDoStatements.js b/tests/baselines/reference/es5-asyncFunctionDoStatements.js index 7151446dddf..32a7e9b0435 100644 --- a/tests/baselines/reference/es5-asyncFunctionDoStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionDoStatements.js @@ -97,8 +97,7 @@ function doStatement1() { _a.sent(); _a.label = 2; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -114,8 +113,7 @@ function doStatement2() { _a.label = 1; case 1: return [4 /*yield*/, y]; case 2: - if (_a.sent()) - return [3 /*break*/, 0]; + if (_a.sent()) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -141,8 +139,7 @@ function doStatement4() { _a.sent(); return [3 /*break*/, 2]; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -161,8 +158,7 @@ function doStatement5() { _a.sent(); _a.label = 2; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -176,8 +172,7 @@ function doStatement6() { case 0: return [3 /*break*/, 1]; case 1: return [4 /*yield*/, y]; case 2: - if (_a.sent()) - return [3 /*break*/, 0]; + if (_a.sent()) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -203,8 +198,7 @@ function doStatement8() { _a.sent(); return [3 /*break*/, 2]; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -223,8 +217,7 @@ function doStatement9() { _a.sent(); _a.label = 2; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -238,8 +231,7 @@ function doStatement10() { case 0: return [3 /*break*/, 1]; case 1: return [4 /*yield*/, y]; case 2: - if (_a.sent()) - return [3 /*break*/, 0]; + if (_a.sent()) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -265,8 +257,7 @@ function doStatement12() { _a.sent(); return [3 /*break*/, 3]; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -285,8 +276,7 @@ function doStatement13() { _a.sent(); _a.label = 2; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -300,8 +290,7 @@ function doStatement14() { case 0: return [3 /*break*/, 3]; case 1: return [4 /*yield*/, y]; case 2: - if (_a.sent()) - return [3 /*break*/, 0]; + if (_a.sent()) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -327,8 +316,7 @@ function doStatement16() { _a.sent(); return [3 /*break*/, 3]; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -347,8 +335,7 @@ function doStatement17() { _a.sent(); _a.label = 2; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -362,8 +349,7 @@ function doStatement18() { case 0: return [3 /*break*/, 3]; case 1: return [4 /*yield*/, y]; case 2: - if (_a.sent()) - return [3 /*break*/, 0]; + if (_a.sent()) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } diff --git a/tests/baselines/reference/es5-asyncFunctionForInStatements.js b/tests/baselines/reference/es5-asyncFunctionForInStatements.js index 30946fca56d..ec6bfbb97e1 100644 --- a/tests/baselines/reference/es5-asyncFunctionForInStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForInStatements.js @@ -62,8 +62,7 @@ function forInStatement1() { _i = 0; _c.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x = _a[_i]; z; _c.label = 3; @@ -87,8 +86,7 @@ function forInStatement2() { _i = 0; _c.label = 1; case 1: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x = _a[_i]; return [4 /*yield*/, z]; case 2: @@ -114,8 +112,7 @@ function forInStatement3() { _i = 0; _c.label = 1; case 1: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; return [4 /*yield*/, x]; case 2: (_c.sent()).a = _a[_i]; @@ -143,8 +140,7 @@ function forInStatement4() { _i = 0; _c.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x.a = _a[_i]; z; _c.label = 3; @@ -168,8 +164,7 @@ function forInStatement5() { _i = 0; _c.label = 1; case 1: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x.a = _a[_i]; return [4 /*yield*/, z]; case 2: @@ -208,8 +203,7 @@ function forInStatement7() { _i = 0; _c.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; b = _a[_i]; z; _c.label = 3; @@ -233,8 +227,7 @@ function forInStatement8() { _i = 0; _c.label = 1; case 1: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; c = _a[_i]; return [4 /*yield*/, z]; case 2: diff --git a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js index e12f1e18d44..9cf1d0098b2 100644 --- a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js @@ -102,8 +102,7 @@ function forOfStatement1() { _a = _b.sent(); _b.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x = _a[_i]; z; _b.label = 3; @@ -124,8 +123,7 @@ function forOfStatement2() { _i = 0, y_2 = y; _a.label = 1; case 1: - if (!(_i < y_2.length)) - return [3 /*break*/, 4]; + if (!(_i < y_2.length)) return [3 /*break*/, 4]; x = y_2[_i]; return [4 /*yield*/, z]; case 2: @@ -148,8 +146,7 @@ function forOfStatement3() { _i = 0, y_3 = y; _a.label = 1; case 1: - if (!(_i < y_3.length)) - return [3 /*break*/, 4]; + if (!(_i < y_3.length)) return [3 /*break*/, 4]; return [4 /*yield*/, x]; case 2: (_a.sent()).a = y_3[_i]; @@ -175,8 +172,7 @@ function forOfStatement4() { _a = _b.sent(); _b.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x.a = _a[_i]; z; _b.label = 3; @@ -197,8 +193,7 @@ function forOfStatement5() { _i = 0, y_4 = y; _a.label = 1; case 1: - if (!(_i < y_4.length)) - return [3 /*break*/, 4]; + if (!(_i < y_4.length)) return [3 /*break*/, 4]; x.a = y_4[_i]; return [4 /*yield*/, z]; case 2: @@ -236,8 +231,7 @@ function forOfStatement7() { _a = _b.sent(); _b.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; c = _a[_i]; z; _b.label = 3; @@ -258,8 +252,7 @@ function forOfStatement8() { _i = 0, y_6 = y; _a.label = 1; case 1: - if (!(_i < y_6.length)) - return [3 /*break*/, 4]; + if (!(_i < y_6.length)) return [3 /*break*/, 4]; d = y_6[_i]; return [4 /*yield*/, z]; case 2: @@ -285,8 +278,7 @@ function forOfStatement9() { _a = _b.sent(); _b.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x = _a[_i][0]; z; _b.label = 3; @@ -307,8 +299,7 @@ function forOfStatement10() { _i = 0, y_7 = y; _a.label = 1; case 1: - if (!(_i < y_7.length)) - return [3 /*break*/, 4]; + if (!(_i < y_7.length)) return [3 /*break*/, 4]; x = y_7[_i][0]; return [4 /*yield*/, z]; case 2: @@ -331,11 +322,9 @@ function forOfStatement11() { _i = 0, y_8 = y; _c.label = 1; case 1: - if (!(_i < y_8.length)) - return [3 /*break*/, 6]; + if (!(_i < y_8.length)) return [3 /*break*/, 6]; _b = y_8[_i][0]; - if (!(_b === void 0)) - return [3 /*break*/, 3]; + if (!(_b === void 0)) return [3 /*break*/, 3]; return [4 /*yield*/, a]; case 2: _a = _c.sent(); @@ -367,8 +356,7 @@ function forOfStatement12() { _a = _c.sent(); _c.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; _b = _a[_i][0], x = _b === void 0 ? a : _b; z; _c.label = 3; @@ -389,8 +377,7 @@ function forOfStatement13() { _i = 0, y_9 = y; _b.label = 1; case 1: - if (!(_i < y_9.length)) - return [3 /*break*/, 4]; + if (!(_i < y_9.length)) return [3 /*break*/, 4]; _a = y_9[_i][0], x = _a === void 0 ? a : _a; return [4 /*yield*/, z]; case 2: @@ -416,8 +403,7 @@ function forOfStatement14() { _a = _b.sent(); _b.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x = _a[_i].x; z; _b.label = 3; @@ -438,8 +424,7 @@ function forOfStatement15() { _i = 0, y_10 = y; _a.label = 1; case 1: - if (!(_i < y_10.length)) - return [3 /*break*/, 4]; + if (!(_i < y_10.length)) return [3 /*break*/, 4]; x = y_10[_i].x; return [4 /*yield*/, z]; case 2: @@ -462,11 +447,9 @@ function forOfStatement16() { _i = 0, y_11 = y; _c.label = 1; case 1: - if (!(_i < y_11.length)) - return [3 /*break*/, 6]; + if (!(_i < y_11.length)) return [3 /*break*/, 6]; _b = y_11[_i].x; - if (!(_b === void 0)) - return [3 /*break*/, 3]; + if (!(_b === void 0)) return [3 /*break*/, 3]; return [4 /*yield*/, a]; case 2: _a = _c.sent(); @@ -498,8 +481,7 @@ function forOfStatement17() { _a = _c.sent(); _c.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; _b = _a[_i].x, x = _b === void 0 ? a : _b; z; _c.label = 3; @@ -520,8 +502,7 @@ function forOfStatement18() { _i = 0, y_12 = y; _b.label = 1; case 1: - if (!(_i < y_12.length)) - return [3 /*break*/, 4]; + if (!(_i < y_12.length)) return [3 /*break*/, 4]; _a = y_12[_i].x, x = _a === void 0 ? a : _a; return [4 /*yield*/, z]; case 2: diff --git a/tests/baselines/reference/es5-asyncFunctionForStatements.js b/tests/baselines/reference/es5-asyncFunctionForStatements.js index e02d20c7864..aad8a1f46ef 100644 --- a/tests/baselines/reference/es5-asyncFunctionForStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForStatements.js @@ -49,8 +49,7 @@ function forStatement1() { _a.sent(); _a.label = 2; case 2: - if (!y) - return [3 /*break*/, 4]; + if (!y) return [3 /*break*/, 4]; a; _a.label = 3; case 3: @@ -70,8 +69,7 @@ function forStatement2() { _a.label = 1; case 1: return [4 /*yield*/, y]; case 2: - if (!_a.sent()) - return [3 /*break*/, 4]; + if (!_a.sent()) return [3 /*break*/, 4]; a; _a.label = 3; case 3: @@ -90,8 +88,7 @@ function forStatement3() { x; _a.label = 1; case 1: - if (!y) - return [3 /*break*/, 4]; + if (!y) return [3 /*break*/, 4]; a; _a.label = 2; case 2: return [4 /*yield*/, z]; @@ -111,8 +108,7 @@ function forStatement4() { x; _a.label = 1; case 1: - if (!y) - return [3 /*break*/, 4]; + if (!y) return [3 /*break*/, 4]; return [4 /*yield*/, a]; case 2: _a.sent(); diff --git a/tests/baselines/reference/es5-asyncFunctionIfStatements.js b/tests/baselines/reference/es5-asyncFunctionIfStatements.js index 7ac35c995e7..39fc2ade726 100644 --- a/tests/baselines/reference/es5-asyncFunctionIfStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionIfStatements.js @@ -36,8 +36,7 @@ function ifStatement2() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -55,8 +54,7 @@ function ifStatement3() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 1]; + if (!x) return [3 /*break*/, 1]; y; return [3 /*break*/, 3]; case 1: return [4 /*yield*/, z]; diff --git a/tests/baselines/reference/es5-asyncFunctionNestedLoops.js b/tests/baselines/reference/es5-asyncFunctionNestedLoops.js index 28ccc288b7e..36408e241a0 100644 --- a/tests/baselines/reference/es5-asyncFunctionNestedLoops.js +++ b/tests/baselines/reference/es5-asyncFunctionNestedLoops.js @@ -19,8 +19,7 @@ function nestedLoops() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); diff --git a/tests/baselines/reference/es5-asyncFunctionWhileStatements.js b/tests/baselines/reference/es5-asyncFunctionWhileStatements.js index c85aabb01e3..750673fb6c4 100644 --- a/tests/baselines/reference/es5-asyncFunctionWhileStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionWhileStatements.js @@ -94,8 +94,7 @@ function whileStatement1() { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: - if (!_a.sent()) - return [3 /*break*/, 2]; + if (!_a.sent()) return [3 /*break*/, 2]; y; return [3 /*break*/, 0]; case 2: return [2 /*return*/]; @@ -108,8 +107,7 @@ function whileStatement2() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -135,8 +133,7 @@ function whileStatement4() { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: - if (!_a.sent()) - return [3 /*break*/, 2]; + if (!_a.sent()) return [3 /*break*/, 2]; return [3 /*break*/, 0]; case 2: return [2 /*return*/]; } @@ -148,8 +145,7 @@ function whileStatement5() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -164,8 +160,7 @@ function whileStatement6() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; if (1) return [3 /*break*/, 0]; return [4 /*yield*/, y]; @@ -193,8 +188,7 @@ function whileStatement8() { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: - if (!_a.sent()) - return [3 /*break*/, 2]; + if (!_a.sent()) return [3 /*break*/, 2]; return [3 /*break*/, 0]; case 2: return [2 /*return*/]; } @@ -206,8 +200,7 @@ function whileStatement9() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -222,8 +215,7 @@ function whileStatement10() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; if (1) return [3 /*break*/, 0]; return [4 /*yield*/, y]; @@ -251,8 +243,7 @@ function whileStatement12() { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: - if (!_a.sent()) - return [3 /*break*/, 2]; + if (!_a.sent()) return [3 /*break*/, 2]; return [3 /*break*/, 2]; case 2: return [2 /*return*/]; } @@ -264,8 +255,7 @@ function whileStatement13() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -280,8 +270,7 @@ function whileStatement14() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; if (1) return [3 /*break*/, 2]; return [4 /*yield*/, y]; @@ -309,8 +298,7 @@ function whileStatement16() { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: - if (!_a.sent()) - return [3 /*break*/, 2]; + if (!_a.sent()) return [3 /*break*/, 2]; return [3 /*break*/, 2]; case 2: return [2 /*return*/]; } @@ -322,8 +310,7 @@ function whileStatement17() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -338,8 +325,7 @@ function whileStatement18() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; if (1) return [3 /*break*/, 2]; return [4 /*yield*/, y]; diff --git a/tests/baselines/reference/exportStarForValues10.js b/tests/baselines/reference/exportStarForValues10.js index 3da80002780..f7dd6e94ce5 100644 --- a/tests/baselines/reference/exportStarForValues10.js +++ b/tests/baselines/reference/exportStarForValues10.js @@ -42,8 +42,7 @@ System.register(["file0"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default") - exports[n] = m[n]; + if (n !== "default") exports[n] = m[n]; } exports_1(exports); } diff --git a/tests/baselines/reference/generatorTransformFinalLabel.js b/tests/baselines/reference/generatorTransformFinalLabel.js index 32272ae0748..58cffc80bee 100644 --- a/tests/baselines/reference/generatorTransformFinalLabel.js +++ b/tests/baselines/reference/generatorTransformFinalLabel.js @@ -14,8 +14,7 @@ function test(skip) { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!!skip) - return [3 /*break*/, 2]; + if (!!skip) return [3 /*break*/, 2]; return [4 /*yield*/, 1]; case 1: _a.sent(); diff --git a/tests/baselines/reference/sourceMapValidationStatements.js.map b/tests/baselines/reference/sourceMapValidationStatements.js.map index 464ab4dc002..5841f329e5e 100644 --- a/tests/baselines/reference/sourceMapValidationStatements.js.map +++ b/tests/baselines/reference/sourceMapValidationStatements.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationStatements.js.map] -{"version":3,"file":"sourceMapValidationStatements.js","sourceRoot":"","sources":["sourceMapValidationStatements.ts"],"names":[],"mappings":"AAAA;IACI,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1B,CAAC,IAAI,CAAC,CAAC;QACP,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IACD,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACT,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,CAAC,IAAI,EAAE,CAAC;QACR,CAAC,EAAE,CAAC;IACR,CAAC;IACD,IAAI,CAAC,GAAG;QACJ,CAAC;QACD,CAAC;QACD,CAAC;KACJ,CAAC;IACF,IAAI,GAAG,GAAG;QACN,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,OAAO;KACb,CAAC;IACF,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACD,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IACnB,CAAE;IAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACT,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACb,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACf,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QAClB,CAAC;IACL,CAAC;IACD,IAAI,CAAC;QACD,MAAM,IAAI,KAAK,EAAE,CAAC;IACtB,CAAE;IAAA,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACV,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;YAAS,CAAC;QACP,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,GAAG,EAAE,CAAC;QACR,CAAC,GAAG,CAAC,CAAC;QACN,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACZ,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,SAAS,CAAC;YACN,CAAC,IAAI,CAAC,CAAC;YACP,CAAC,GAAG,EAAE,CAAC;YACP,KAAK,CAAC;QAEV,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACZ,CAAC,EAAE,CAAC;IACR,CAAC;IACD,GAAG,CAAC;QACA,CAAC,EAAE,CAAC;IACR,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC;IACf,CAAC,GAAG,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC,KAAK,CAAC,CAAC;IACR,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IACX,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC;AACX,CAAC;AACD,IAAI,CAAC,GAAG;IACJ,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC;AACF,CAAC,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationStatements.js","sourceRoot":"","sources":["sourceMapValidationStatements.ts"],"names":[],"mappings":"AAAA;IACI,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1B,CAAC,IAAI,CAAC,CAAC;QACP,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IACD,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACT,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,CAAC,IAAI,EAAE,CAAC;QACR,CAAC,EAAE,CAAC;IACR,CAAC;IACD,IAAI,CAAC,GAAG;QACJ,CAAC;QACD,CAAC;QACD,CAAC;KACJ,CAAC;IACF,IAAI,GAAG,GAAG;QACN,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,OAAO;KACb,CAAC;IACF,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACD,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IACnB,CAAC;IAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACT,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACb,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACf,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QAClB,CAAC;IACL,CAAC;IACD,IAAI,CAAC;QACD,MAAM,IAAI,KAAK,EAAE,CAAC;IACtB,CAAC;IAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACV,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;YAAS,CAAC;QACP,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,GAAG,EAAE,CAAC;QACR,CAAC,GAAG,CAAC,CAAC;QACN,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACZ,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,SAAS,CAAC;YACN,CAAC,IAAI,CAAC,CAAC;YACP,CAAC,GAAG,EAAE,CAAC;YACP,KAAK,CAAC;QAEV,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACZ,CAAC,EAAE,CAAC;IACR,CAAC;IACD,GAAG,CAAC;QACA,CAAC,EAAE,CAAC;IACR,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC;IACf,CAAC,GAAG,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC,KAAK,CAAC,CAAC;IACR,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IACX,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC;AACX,CAAC;AACD,IAAI,CAAC,GAAG;IACJ,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC;AACF,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt b/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt index ed7c9395d2f..7c5c5bfcfeb 100644 --- a/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt @@ -525,9 +525,9 @@ sourceFile:sourceMapValidationStatements.ts 3 > ^^^^^^^^^^^-> 1 > > -2 > } +2 > } 1 >Emitted(30, 5) Source(29, 5) + SourceIndex(0) -2 >Emitted(30, 6) Source(29, 7) + SourceIndex(0) +2 >Emitted(30, 6) Source(29, 6) + SourceIndex(0) --- >>> catch (e) { 1->^^^^ @@ -539,7 +539,7 @@ sourceFile:sourceMapValidationStatements.ts 7 > ^ 8 > ^ 9 > ^^^^^^^^^^^-> -1-> +1-> 2 > catch 3 > 4 > ( @@ -727,9 +727,9 @@ sourceFile:sourceMapValidationStatements.ts 3 > ^^^^^^^^^^^^-> 1 > > -2 > } +2 > } 1 >Emitted(41, 5) Source(38, 5) + SourceIndex(0) -2 >Emitted(41, 6) Source(38, 7) + SourceIndex(0) +2 >Emitted(41, 6) Source(38, 6) + SourceIndex(0) --- >>> catch (e1) { 1->^^^^ @@ -741,7 +741,7 @@ sourceFile:sourceMapValidationStatements.ts 7 > ^ 8 > ^ 9 > ^^^^-> -1-> +1-> 2 > catch 3 > 4 > ( diff --git a/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map b/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map index 46506410856..8b8690b470d 100644 --- a/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map +++ b/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationTryCatchFinally.js.map] -{"version":3,"file":"sourceMapValidationTryCatchFinally.js","sourceRoot":"","sources":["sourceMapValidationTryCatchFinally.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC;AACX,IAAI,CAAC;IACD,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAE;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACT,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAAS,CAAC;IACP,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC;AACD,IACA,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,IAAI,KAAK,EAAE,CAAC;AACtB,CACA;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CACT,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAED,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationTryCatchFinally.js","sourceRoot":"","sources":["sourceMapValidationTryCatchFinally.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC;AACX,IAAI,CAAC;IACD,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACT,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAAS,CAAC;IACP,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC;AACD,IACA,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,IAAI,KAAK,EAAE,CAAC;AACtB,CAAC;AACD,KAAK,CAAC,CAAC,CAAC,CAAC,CACT,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAED,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt b/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt index d625e74c262..845ec5eeb27 100644 --- a/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt @@ -71,9 +71,9 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 3 > ^^^^^^^^^^^-> 1 > > -2 >} +2 >} 1 >Emitted(4, 1) Source(4, 1) + SourceIndex(0) -2 >Emitted(4, 2) Source(4, 3) + SourceIndex(0) +2 >Emitted(4, 2) Source(4, 2) + SourceIndex(0) --- >>>catch (e) { 1-> @@ -85,7 +85,7 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 7 > ^ 8 > ^ 9 > ^^^^-> -1-> +1-> 2 >catch 3 > 4 > ( @@ -245,10 +245,9 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 3 > ^^^^^^^^^^^-> 1 > > -2 >} - > +2 >} 1 >Emitted(14, 1) Source(13, 1) + SourceIndex(0) -2 >Emitted(14, 2) Source(14, 1) + SourceIndex(0) +2 >Emitted(14, 2) Source(13, 2) + SourceIndex(0) --- >>>catch (e) { 1-> @@ -260,7 +259,8 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 7 > ^ 8 > ^ 9 > ^^^^-> -1-> +1-> + > 2 >catch 3 > 4 > ( diff --git a/tests/baselines/reference/systemModule11.js b/tests/baselines/reference/systemModule11.js index 41574af1d9a..212a24b5e20 100644 --- a/tests/baselines/reference/systemModule11.js +++ b/tests/baselines/reference/systemModule11.js @@ -55,8 +55,7 @@ System.register(["bar"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } @@ -83,8 +82,7 @@ System.register(["bar"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } @@ -111,8 +109,7 @@ System.register(["a", "bar"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } @@ -162,8 +159,7 @@ System.register(["a"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default") - exports[n] = m[n]; + if (n !== "default") exports[n] = m[n]; } exports_1(exports); } diff --git a/tests/baselines/reference/systemModule16.js b/tests/baselines/reference/systemModule16.js index 8058e0f2ea1..86b6a448215 100644 --- a/tests/baselines/reference/systemModule16.js +++ b/tests/baselines/reference/systemModule16.js @@ -27,8 +27,7 @@ System.register(["foo", "bar"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } diff --git a/tests/baselines/reference/systemModule9.js b/tests/baselines/reference/systemModule9.js index 9e497140083..fce3aa1bdf4 100644 --- a/tests/baselines/reference/systemModule9.js +++ b/tests/baselines/reference/systemModule9.js @@ -33,8 +33,7 @@ System.register(["file1", "file2", "file3", "file4", "file5", "file6", "file7"], function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } From 7a9c11c72beec980b19bc9962ecbdde3208e37b0 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 5 Dec 2016 16:27:59 -0800 Subject: [PATCH 022/125] Test:destructuring array initialisers refer to previous elements --- .../destructuringArrayBindingPatternAndAssignment3.ts | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts diff --git a/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts b/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts new file mode 100644 index 00000000000..f0537456891 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts @@ -0,0 +1,4 @@ +const [a, b = a] = [1]; // ok +const [a, b = a, c = c] = [1]; // error for c +const [a, b = a, c = d, d = a] = [1]; // error for c + From 92f2721b4619bfe956c64acace0130dc4ffa0bf1 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 6 Dec 2016 11:48:14 -0800 Subject: [PATCH 023/125] Binding initialisers can refer to previous elements --- src/compiler/checker.ts | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 903c8cfda1c..7ea84d093ec 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -638,11 +638,24 @@ namespace ts { if (declaration.pos <= usage.pos) { // declaration is before usage - // still might be illegal if usage is in the initializer of the variable declaration - return declaration.kind !== SyntaxKind.VariableDeclaration || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === SyntaxKind.BindingElement) { + // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) + const errorBindingElement = getAncestor(usage, SyntaxKind.BindingElement) as BindingElement; + if (errorBindingElement) { + return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || + declaration.pos < errorBindingElement.pos; + } + // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) + return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, SyntaxKind.VariableDeclaration) as Declaration, usage); + } + else if (declaration.kind === SyntaxKind.VariableDeclaration) { + // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration as VariableDeclaration, usage); + } + return true; } + // declaration is after usage // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) const container = getEnclosingBlockScopeContainer(declaration); @@ -699,6 +712,16 @@ namespace ts { } return false; } + + function getAncestorBindingPattern(node: Node): BindingPattern { + while (node) { + if (isBindingPattern(node)) { + return node; + } + node = node.parent; + } + return undefined; + } } // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and @@ -1065,7 +1088,7 @@ namespace ts { Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, SyntaxKind.VariableDeclaration), errorLocation)) { + if (!isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name)); } } From 72a1e85cd7f1b189b509a723ed8473ae265573ca Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 6 Dec 2016 13:04:45 -0800 Subject: [PATCH 024/125] Check binding initialisers in parameters as well --- src/compiler/checker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7ea84d093ec..61ccbff9bb0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17041,7 +17041,8 @@ namespace ts { // so we need to do a bit of extra work to check if reference is legal const enclosingContainer = getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === SyntaxKind.Parameter) { + if (symbol.valueDeclaration.kind === SyntaxKind.Parameter || + symbol.valueDeclaration.kind === SyntaxKind.BindingElement) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { From 4efa61cf80aa66512a892f8db40bfa1aee1c0fe7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 6 Dec 2016 13:05:52 -0800 Subject: [PATCH 025/125] More tests for binding elements referencing previous elements --- .../destructuringArrayBindingPatternAndAssignment3.ts | 10 ++++++++-- .../destructuringObjectBindingPatternAndAssignment4.ts | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts diff --git a/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts b/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts index f0537456891..243a297ed43 100644 --- a/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts +++ b/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts @@ -1,4 +1,10 @@ const [a, b = a] = [1]; // ok -const [a, b = a, c = c] = [1]; // error for c -const [a, b = a, c = d, d = a] = [1]; // error for c +const [c, d = c, e = e] = [1]; // error for e = e +const [f, g = f, h = i, i = f] = [1]; // error for h = i +(function ([a, b = a]) { // ok +})([1]); +(function ([c, d = c, e = e]) { // error for e = e +})([1]); +(function ([f, g = f, h = i, i = f]) { // error for h = i +})([1]) diff --git a/tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts b/tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts new file mode 100644 index 00000000000..d138c14db7a --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts @@ -0,0 +1,8 @@ +const { + a = 1, + b = 2, + c = b, // ok + d = a, // ok + e = f, // error + f = f // error +} = { } as any; From 77b6482936c44062d26eeb2099079049d278a1ef Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 6 Dec 2016 13:06:26 -0800 Subject: [PATCH 026/125] Add baselines for new tests --- ...rayBindingPatternAndAssignment3.errors.txt | 26 +++++++++++++++++++ ...turingArrayBindingPatternAndAssignment3.js | 26 +++++++++++++++++++ ...ectBindingPatternAndAssignment4.errors.txt | 18 +++++++++++++ ...uringObjectBindingPatternAndAssignment4.js | 21 +++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt create mode 100644 tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.js create mode 100644 tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt create mode 100644 tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.js diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt new file mode 100644 index 00000000000..a68affcf73d --- /dev/null +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(2,22): error TS2448: Block-scoped variable 'e' used before its declaration. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(3,22): error TS2448: Block-scoped variable 'i' used before its declaration. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(7,27): error TS2372: Parameter 'e' cannot be referenced in its initializer. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(9,27): error TS2373: Initializer of parameter 'h' cannot reference identifier 'i' declared after it. + + +==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts (4 errors) ==== + const [a, b = a] = [1]; // ok + const [c, d = c, e = e] = [1]; // error for e = e + ~ +!!! error TS2448: Block-scoped variable 'e' used before its declaration. + const [f, g = f, h = i, i = f] = [1]; // error for h = i + ~ +!!! error TS2448: Block-scoped variable 'i' used before its declaration. + + (function ([a, b = a]) { // ok + })([1]); + (function ([c, d = c, e = e]) { // error for e = e + ~ +!!! error TS2372: Parameter 'e' cannot be referenced in its initializer. + })([1]); + (function ([f, g = f, h = i, i = f]) { // error for h = i + ~ +!!! error TS2373: Initializer of parameter 'h' cannot reference identifier 'i' declared after it. + })([1]) + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.js b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.js new file mode 100644 index 00000000000..7073061dec6 --- /dev/null +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.js @@ -0,0 +1,26 @@ +//// [destructuringArrayBindingPatternAndAssignment3.ts] +const [a, b = a] = [1]; // ok +const [c, d = c, e = e] = [1]; // error for e = e +const [f, g = f, h = i, i = f] = [1]; // error for h = i + +(function ([a, b = a]) { // ok +})([1]); +(function ([c, d = c, e = e]) { // error for e = e +})([1]); +(function ([f, g = f, h = i, i = f]) { // error for h = i +})([1]) + + +//// [destructuringArrayBindingPatternAndAssignment3.js] +var _a = [1], a = _a[0], _b = _a[1], b = _b === void 0 ? a : _b; // ok +var _c = [1], c = _c[0], _d = _c[1], d = _d === void 0 ? c : _d, _e = _c[2], e = _e === void 0 ? e : _e; // error for e = e +var _f = [1], f = _f[0], _g = _f[1], g = _g === void 0 ? f : _g, _h = _f[2], h = _h === void 0 ? i : _h, _j = _f[3], i = _j === void 0 ? f : _j; // error for h = i +(function (_a) { + var a = _a[0], _b = _a[1], b = _b === void 0 ? a : _b; +})([1]); +(function (_a) { + var c = _a[0], _b = _a[1], d = _b === void 0 ? c : _b, _c = _a[2], e = _c === void 0 ? e : _c; +})([1]); +(function (_a) { + var f = _a[0], _b = _a[1], g = _b === void 0 ? f : _b, _c = _a[2], h = _c === void 0 ? i : _c, _d = _a[3], i = _d === void 0 ? f : _d; +})([1]); diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt new file mode 100644 index 00000000000..6a3f0f2b457 --- /dev/null +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts(6,9): error TS2448: Block-scoped variable 'f' used before its declaration. +tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts(7,9): error TS2448: Block-scoped variable 'f' used before its declaration. + + +==== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts (2 errors) ==== + const { + a = 1, + b = 2, + c = b, // ok + d = a, // ok + e = f, // error + ~ +!!! error TS2448: Block-scoped variable 'f' used before its declaration. + f = f // error + ~ +!!! error TS2448: Block-scoped variable 'f' used before its declaration. + } = { } as any; + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.js b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.js new file mode 100644 index 00000000000..c34cbb62c1c --- /dev/null +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.js @@ -0,0 +1,21 @@ +//// [destructuringObjectBindingPatternAndAssignment4.ts] +const { + a = 1, + b = 2, + c = b, // ok + d = a, // ok + e = f, // error + f = f // error +} = { } as any; + + +//// [destructuringObjectBindingPatternAndAssignment4.js] +var _a = {}, _b = _a.a, a = _b === void 0 ? 1 : _b, _c = _a.b, b = _c === void 0 ? 2 : _c, _d = _a.c, c = _d === void 0 ? b : _d, // ok +_e = _a.d, // ok +d = _e === void 0 ? a : _e, // ok +_f = _a.e, // ok +e = _f === void 0 ? f : _f, // error +_g = _a.f // error +, // error +f = _g === void 0 ? f : _g // error +; From 09761b5f075f3947a719151dddfd3a071fe3d857 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 8 Dec 2016 13:43:32 -0800 Subject: [PATCH 027/125] Fix error on extends in declaration file with importHelpers --- src/compiler/checker.ts | 2 +- .../reference/importHelpersDeclarations.symbols | 8 ++++++++ .../baselines/reference/importHelpersDeclarations.types | 8 ++++++++ tests/cases/compiler/importHelpersDeclarations.ts | 9 +++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/importHelpersDeclarations.symbols create mode 100644 tests/baselines/reference/importHelpersDeclarations.types create mode 100644 tests/cases/compiler/importHelpersDeclarations.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 778e31b9c5b..de9011c9dbd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17999,7 +17999,7 @@ namespace ts { const baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - if (languageVersion < ScriptTarget.ES2015) { + if (languageVersion < ScriptTarget.ES2015 && !isInAmbientContext(node)) { checkExternalEmitHelpers(baseTypeNode.parent, ExternalEmitHelpers.Extends); } diff --git a/tests/baselines/reference/importHelpersDeclarations.symbols b/tests/baselines/reference/importHelpersDeclarations.symbols new file mode 100644 index 00000000000..f578850cc4e --- /dev/null +++ b/tests/baselines/reference/importHelpersDeclarations.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/declaration.d.ts === +export declare class D { +>D : Symbol(D, Decl(declaration.d.ts, 0, 0)) +} +export declare class E extends D { +>E : Symbol(E, Decl(declaration.d.ts, 1, 1)) +>D : Symbol(D, Decl(declaration.d.ts, 0, 0)) +} diff --git a/tests/baselines/reference/importHelpersDeclarations.types b/tests/baselines/reference/importHelpersDeclarations.types new file mode 100644 index 00000000000..4b8c56d7869 --- /dev/null +++ b/tests/baselines/reference/importHelpersDeclarations.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/declaration.d.ts === +export declare class D { +>D : D +} +export declare class E extends D { +>E : E +>D : D +} diff --git a/tests/cases/compiler/importHelpersDeclarations.ts b/tests/cases/compiler/importHelpersDeclarations.ts new file mode 100644 index 00000000000..7b958cda789 --- /dev/null +++ b/tests/cases/compiler/importHelpersDeclarations.ts @@ -0,0 +1,9 @@ +// @importHelpers: true +// @target: es5 +// @module: commonjs +// @moduleResolution: classic +// @filename: declaration.d.ts +export declare class D { +} +export declare class E extends D { +} \ No newline at end of file From 25c7caaef96f1519fc475588af9c2b7214d5dac7 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 7 Dec 2016 13:46:04 -0800 Subject: [PATCH 028/125] Simplify es2015 visitor, replace function tracking with flags --- src/compiler/factory.ts | 13 + src/compiler/transformers/es2015.ts | 947 +++++++++++------- src/compiler/utilities.ts | 12 + tests/baselines/reference/superAccess2.js | 6 +- .../reference/superInConstructorParam1.js | 2 +- .../reference/superInObjectLiterals_ES5.js | 12 +- ...perPropertyInConstructorBeforeSuperCall.js | 2 +- ...side-object-literal-getters-and-setters.js | 6 +- 8 files changed, 598 insertions(+), 402 deletions(-) diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index ebcea221f9e..3bd88d78447 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1754,6 +1754,19 @@ namespace ts { // Utilities + export function restoreEnclosingLabels(node: Statement, enclosingLabeledStatements: LabeledStatement[]) { + if (enclosingLabeledStatements) { + for (const labeledStatement of enclosingLabeledStatements) { + node = updateLabel( + labeledStatement, + labeledStatement.label, + node + ); + } + } + return node; + } + export interface CallBinding { target: LeftHandSideExpression; thisArg: Expression; diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index c1398f75da6..094261f7002 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -162,6 +162,67 @@ namespace ts { ReplaceWithReturn, } + type LoopConverter = (node: IterationStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]) => Statement; + + // Facts we track as we descend the tree + const enum AncestorFacts { + None = 0, + Function = 1 << 0, // Enclosed in a non-arrow function + ArrowFunction = 1 << 1, // Enclosed in an arrow function + AsyncFunctionBody = 1 << 2, // Enclosed in an async function body + NonStaticClassElement = 1 << 3, // Enclosed in a non-static, non-async class element + CapturesThis = 1 << 4, // Enclosed in a function that captures the lexical 'this' (used in substitution) + ExportedVariableStatement = 1 << 5, // Enclosed in an exported variable statement in the current scope + TopLevel = 1 << 6, // Enclosing block-scoped container is a top-level container + Block = 1 << 7, // Enclosing block-scoped container is a Block + IterationStatement = 1 << 8, // Enclosed in an IterationStatement + IterationStatementBlock = 1 << 9, // Enclosing Block is enclosed in an IterationStatement + ForStatement = 1 << 10, // Enclosing block-scoped container is a ForStatement + ForInOrForOfStatement = 1 << 11, // Enclosing block-scoped container is a ForInStatement or ForOfStatement + ConstructorWithCapturedSuper = 1 << 12, // Enclosed in a constructor that captures 'this' for use with 'super' + + // We are always in *some* kind of block scope, but only specific block-scope containers are + // top-level or Blocks. + BlockScopeIncludes = None, + BlockScopeExcludes = TopLevel | Block | IterationStatement | IterationStatementBlock | ForStatement | ForInOrForOfStatement, + + // A source file is a top-level block scope. + SourceFileIncludes = TopLevel, + SourceFileExcludes = BlockScopeExcludes & ~TopLevel, + + // Functions, methods, and accessors are both new lexical scopes and new block scopes. + FunctionIncludes = Function | TopLevel, + FunctionExcludes = BlockScopeExcludes & ~TopLevel | ArrowFunction | AsyncFunctionBody | CapturesThis | NonStaticClassElement | ConstructorWithCapturedSuper, + + // Arrow functions are lexically scoped to their container, but are new block scopes. + ArrowFunctionIncludes = ArrowFunction | TopLevel, + ArrowFunctionExcludes = BlockScopeExcludes & ~TopLevel | ConstructorWithCapturedSuper, + + // Constructors are both new lexical scopes and new block scopes. Constructors are also + // always considered non-static members of a class. + ConstructorIncludes = FunctionIncludes | NonStaticClassElement, + ConstructorExcludes = FunctionExcludes & ~NonStaticClassElement, + + // 'do' and 'while' statements are not block scopes. We track that the subtree is contained + // within an IterationStatement to indicate whether the embedded statement is an + // IterationStatementBlock. + DoOrWhileStatementIncludes = IterationStatement, + DoOrWhileStatementExcludes = None, + + // 'for' statements are new block scopes and have special handling for 'let' declarations. + ForStatementIncludes = IterationStatement | ForStatement, + ForStatementExcludes = BlockScopeExcludes & ~ForStatement, + + // 'for-in' and 'for-of' statements are new block scopes and have special handling for + // 'let' declarations. + ForInOrForOfStatementIncludes = IterationStatement | ForInOrForOfStatement, + ForInOrForOfStatementExcludes = BlockScopeExcludes & ~ForInOrForOfStatement, + + // Blocks (other than function bodies) are new block scopes. + BlockIncludes = Block, + BlockExcludes = BlockScopeExcludes & ~Block, + } + export function transformES2015(context: TransformationContext) { const { startLexicalEnvironment, @@ -178,15 +239,7 @@ namespace ts { let currentSourceFile: SourceFile; let currentText: string; - let currentParent: Node; - let currentNode: Node; - let enclosingVariableStatement: VariableStatement; - let enclosingBlockScopeContainer: Node; - let enclosingBlockScopeContainerParent: Node; - let enclosingFunction: FunctionLikeDeclaration; - let enclosingNonArrowFunction: FunctionLikeDeclaration; - let enclosingNonAsyncFunctionBody: FunctionLikeDeclaration | ClassElement; - let isInConstructorWithCapturedSuper: boolean; + let ancestorFacts: AncestorFacts; /** * Used to track if we are emitting body of the converted loop @@ -210,166 +263,86 @@ namespace ts { currentSourceFile = node; currentText = node.text; - const visited = saveStateAndInvoke(node, visitSourceFile); + const visited = visitSourceFile(node); addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + ancestorFacts = AncestorFacts.None; return visited; } - function visitor(node: Node): VisitResult { - return saveStateAndInvoke(node, dispatcher); - } - - function dispatcher(node: Node): VisitResult { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - - function saveStateAndInvoke(node: T, f: (node: T) => U): U { - 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; - const savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (nodeStartsNewLexicalEnvironment(node)) { - // don't treat content of nodes that start new lexical environment as part of converted loop copy or constructor body - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - - onBeforeVisitNode(node); - const visited = f(node); - - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - - function onBeforeVisitNode(node: Node) { - if (currentNode) { - if (isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - - if (isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== SyntaxKind.ArrowFunction) { - enclosingNonArrowFunction = currentNode; - if (!(getEmitFlags(currentNode) & EmitFlags.AsyncFunctionBody)) { - enclosingNonAsyncFunctionBody = currentNode; + function setAncestorFacts(excludeFacts: AncestorFacts, includeFacts: AncestorFacts, node?: Node, container?: Node) { + if (node) { + switch (node.kind) { + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + if (container && isClassLike(container) && !hasModifier(node, ModifierFlags.Static)) { + includeFacts |= AncestorFacts.NonStaticClassElement; } - } - } - - // 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 = currentNode; break; - case SyntaxKind.VariableDeclarationList: - case SyntaxKind.VariableDeclaration: - case SyntaxKind.BindingElement: - case SyntaxKind.ObjectBindingPattern: - case SyntaxKind.ArrayBindingPattern: + case SyntaxKind.FunctionExpression: + const emitFlags = getEmitFlags(node); + if (emitFlags & EmitFlags.CapturesThis) { + includeFacts |= AncestorFacts.CapturesThis; + } + if (emitFlags & EmitFlags.AsyncFunctionBody) { + excludeFacts &= ~AncestorFacts.NonStaticClassElement; + includeFacts |= AncestorFacts.AsyncFunctionBody; + } + break; + case SyntaxKind.FunctionDeclaration: + if (getEmitFlags(node) & EmitFlags.CapturesThis) { + includeFacts |= AncestorFacts.CapturesThis; + } + break; + case SyntaxKind.Block: + if (ancestorFacts & AncestorFacts.IterationStatement) { + includeFacts = includeFacts & ~AncestorFacts.Block | AncestorFacts.IterationStatementBlock; + excludeFacts |= AncestorFacts.Block; + } break; - - default: - enclosingVariableStatement = undefined; } } - - currentParent = currentNode; - currentNode = node; - } - - function returnCapturedThis(node: Node): Node { - return setOriginalNode(createReturn(createIdentifier("_this")), node); + ancestorFacts = ancestorFacts & ~excludeFacts | includeFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node: Node): boolean { - return isInConstructorWithCapturedSuper && node.kind === SyntaxKind.ReturnStatement && !(node).expression; + return ancestorFacts & AncestorFacts.ConstructorWithCapturedSuper + && node.kind === SyntaxKind.ReturnStatement + && !(node).expression; } - function shouldCheckNode(node: Node): boolean { - return (node.transformFlags & TransformFlags.ES2015) !== 0 || - node.kind === SyntaxKind.LabeledStatement || - (isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node: Node): boolean { + return (node.transformFlags & TransformFlags.ContainsES2015) !== 0 + || convertedLoopState !== undefined + || (ancestorFacts & AncestorFacts.ConstructorWithCapturedSuper && isStatement(node)) + || (isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node: Node): VisitResult { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node: Node): VisitResult { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & TransformFlags.ContainsES2015 || (isInConstructorWithCapturedSuper && !isExpression(node))) { - // we want to dive in this branch either if node has children with ES2015 specific syntax - // or we are inside constructor that captures result of the super call so all returns without expression should be - // rewritten. Note: we skip expressions since returns should never appear there - return visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node: Node): VisitResult { - let result: VisitResult; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); + function functionBodyVisitor(node: Block): Block { + if (shouldVisitNode(node)) { + return visitBlock(node, /*isFunctionBody*/ true); } - else { - result = visitNodesInConvertedLoop(node); - } - return result; + return node; } - function visitNodesInConvertedLoop(node: Node): VisitResult { - switch (node.kind) { - case SyntaxKind.ReturnStatement: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - - case SyntaxKind.VariableStatement: - return visitVariableStatement(node); - - case SyntaxKind.SwitchStatement: - return visitSwitchStatement(node); - - case SyntaxKind.BreakStatement: - case SyntaxKind.ContinueStatement: - return visitBreakOrContinueStatement(node); - - case SyntaxKind.ThisKeyword: - return visitThisKeyword(node); - - case SyntaxKind.Identifier: - return visitIdentifier(node); - - default: - return visitEachChild(node, visitor, context); + function callExpressionVisitor(node: Node): VisitResult { + if (node.kind === SyntaxKind.SuperKeyword) { + return visitSuperKeyword(/*isExpressionOfCall*/ true); } + return visitor(node); } function visitJavaScript(node: Node): VisitResult { @@ -404,23 +377,34 @@ namespace ts { case SyntaxKind.VariableDeclarationList: return visitVariableDeclarationList(node); + case SyntaxKind.SwitchStatement: + return visitSwitchStatement(node); + + case SyntaxKind.CaseBlock: + return visitCaseBlock(node); + + case SyntaxKind.Block: + return visitBlock(node, /*isFunctionBody*/ false); + + case SyntaxKind.BreakStatement: + case SyntaxKind.ContinueStatement: + return visitBreakOrContinueStatement(node); + case SyntaxKind.LabeledStatement: return visitLabeledStatement(node); case SyntaxKind.DoStatement: - return visitDoStatement(node); - case SyntaxKind.WhileStatement: - return visitWhileStatement(node); + return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); case SyntaxKind.ForStatement: - return visitForStatement(node); + return visitForStatement(node, /*outermostLabeledStatement*/ undefined); case SyntaxKind.ForInStatement: - return visitForInStatement(node); + return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); case SyntaxKind.ForOfStatement: - return visitForOfStatement(node); + return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); case SyntaxKind.ExpressionStatement: return visitExpressionStatement(node); @@ -434,6 +418,9 @@ namespace ts { case SyntaxKind.ShorthandPropertyAssignment: return visitShorthandPropertyAssignment(node); + case SyntaxKind.ComputedPropertyName: + return visitComputedPropertyName(node); + case SyntaxKind.ArrayLiteralExpression: return visitArrayLiteralExpression(node); @@ -468,31 +455,39 @@ namespace ts { return visitSpreadElement(node); case SyntaxKind.SuperKeyword: - return visitSuperKeyword(); + return visitSuperKeyword(/*isExpressionOfCall*/ false); - case SyntaxKind.YieldExpression: - // `yield` will be handled by a generators transform. - return visitEachChild(node, visitor, context); + case SyntaxKind.ThisKeyword: + return visitThisKeyword(node); case SyntaxKind.MethodDeclaration: return visitMethodDeclaration(node); + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return visitAccessorDeclaration(node); + case SyntaxKind.VariableStatement: return visitVariableStatement(node); + case SyntaxKind.ReturnStatement: + return visitReturnStatement(node); + default: - Debug.failBadSyntaxKind(node); return visitEachChild(node, visitor, context); } } function visitSourceFile(node: SourceFile): SourceFile { + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(AncestorFacts.SourceFileExcludes, AncestorFacts.SourceFileIncludes); const statements: Statement[] = []; startLexicalEnvironment(); const statementOffset = addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); addCaptureThisForNodeIfNeeded(statements, node); addRange(statements, visitNodes(node.statements, visitor, isStatement, statementOffset)); addRange(statements, endLexicalEnvironment()); + ancestorFacts = savedAncestorFacts; return updateSourceFileNode( node, createNodeArray(statements, node.statements) @@ -500,44 +495,64 @@ namespace ts { } function visitSwitchStatement(node: SwitchStatement): SwitchStatement { - Debug.assert(convertedLoopState !== undefined); + if (convertedLoopState !== undefined) { + const savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + // for switch statement allow only non-labeled break + convertedLoopState.allowedNonLabeledJumps |= Jump.Break; + const result = visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return visitEachChild(node, visitor, context); + } - const savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - // for switch statement allow only non-labeled break - convertedLoopState.allowedNonLabeledJumps |= Jump.Break; + function visitCaseBlock(node: CaseBlock): CaseBlock { + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(AncestorFacts.BlockScopeExcludes, AncestorFacts.BlockScopeIncludes); + const updated = visitEachChild(node, visitor, context); + ancestorFacts = savedAncestorFacts; + return updated; + } - const result = visitEachChild(node, visitor, context); - - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + function returnCapturedThis(node: Node): ReturnStatement { + return setOriginalNode(createReturn(createIdentifier("_this")), node); } function visitReturnStatement(node: ReturnStatement): Statement { - Debug.assert(convertedLoopState !== undefined); - - convertedLoopState.nonLocalJumps |= Jump.Return; - return createReturn( - createObjectLiteral( - [ - createPropertyAssignment( - createIdentifier("value"), - node.expression - ? visitNode(node.expression, visitor, isExpression) - : createVoidZero() - ) - ] - ) - ); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= Jump.Return; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return createReturn( + createObjectLiteral( + [ + createPropertyAssignment( + createIdentifier("value"), + node.expression + ? visitNode(node.expression, visitor, isExpression) + : createVoidZero() + ) + ] + ) + ); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return visitEachChild(node, visitor, context); } function visitThisKeyword(node: Node): Node { - Debug.assert(convertedLoopState !== undefined); - 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; + if (convertedLoopState) { + if (ancestorFacts & AncestorFacts.ArrowFunction) { + // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = createUniqueName("this")); + return node; } function visitIdentifier(node: Identifier): Identifier { @@ -811,9 +826,14 @@ namespace ts { * @param extendsClauseElement The expression for the class `extends` clause. */ function addConstructor(statements: Statement[], node: ClassExpression | ClassDeclaration, extendsClauseElement: ExpressionWithTypeArguments): void { + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.ConstructorExcludes, AncestorFacts.ConstructorIncludes); + convertedLoopState = undefined; + const constructor = getFirstConstructorWithBody(node); const hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); - const constructorFunction = createFunctionDeclaration( /*decorators*/ undefined, @@ -830,7 +850,11 @@ namespace ts { if (extendsClauseElement) { setEmitFlags(constructorFunction, EmitFlags.CapturesThis); } + statements.push(constructorFunction); + + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; } /** @@ -890,11 +914,11 @@ namespace ts { } if (constructor) { - const body = saveStateAndInvoke(constructor, constructor => { - isInConstructorWithCapturedSuper = superCaptureStatus === SuperCaptureResult.ReplaceSuperCapture; - return visitNodes(constructor.body.statements, visitor, isStatement, /*start*/ statementOffset); - }); - addRange(statements, body); + if (superCaptureStatus === SuperCaptureResult.ReplaceSuperCapture) { + ancestorFacts |= AncestorFacts.ConstructorWithCapturedSuper; + } + + addRange(statements, visitNodes(constructor.body.statements, visitor, isStatement, /*start*/ statementOffset)); } // Return `_this` unless we're sure enough that it would be pointless to add a return statement. @@ -1016,11 +1040,7 @@ namespace ts { firstStatement = ctorStatements[statementOffset]; if (firstStatement.kind === SyntaxKind.ExpressionStatement && isSuperCall((firstStatement as ExpressionStatement).expression)) { - const superCall = (firstStatement as ExpressionStatement).expression as CallExpression; - superCallExpression = setOriginalNode( - saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), - superCall - ); + superCallExpression = visitImmediateSuperCallInBody((firstStatement as ExpressionStatement).expression as CallExpression); } } @@ -1369,14 +1389,14 @@ namespace ts { break; case SyntaxKind.MethodDeclaration: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: const accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; @@ -1407,11 +1427,11 @@ namespace ts { * @param receiver The receiver for the member. * @param member The MethodDeclaration node. */ - function transformClassMethodDeclarationToStatement(receiver: LeftHandSideExpression, member: MethodDeclaration) { + function transformClassMethodDeclarationToStatement(receiver: LeftHandSideExpression, member: MethodDeclaration, container: Node) { const commentRange = getCommentRange(member); const sourceMapRange = getSourceMapRange(member); const memberName = createMemberAccessForPropertyName(receiver, visitNode(member.name, visitor, isPropertyName), /*location*/ member.name); - const memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); + const memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined, container); setEmitFlags(memberFunction, EmitFlags.NoComments); setSourceMapRange(memberFunction, sourceMapRange); @@ -1436,9 +1456,9 @@ namespace ts { * @param receiver The receiver for the member. * @param accessors The set of related get/set accessors. */ - function transformAccessorsToStatement(receiver: LeftHandSideExpression, accessors: AllAccessorDeclarations): Statement { + function transformAccessorsToStatement(receiver: LeftHandSideExpression, accessors: AllAccessorDeclarations, container: Node): Statement { const statement = createStatement( - transformAccessorsToExpression(receiver, accessors, /*startsOnNewLine*/ false), + transformAccessorsToExpression(receiver, accessors, container, /*startsOnNewLine*/ false), /*location*/ getSourceMapRange(accessors.firstAccessor) ); @@ -1455,7 +1475,7 @@ namespace ts { * * @param receiver The receiver for the member. */ - function transformAccessorsToExpression(receiver: LeftHandSideExpression, { firstAccessor, getAccessor, setAccessor }: AllAccessorDeclarations, startsOnNewLine: boolean): Expression { + function transformAccessorsToExpression(receiver: LeftHandSideExpression, { firstAccessor, getAccessor, setAccessor }: AllAccessorDeclarations, container: Node, startsOnNewLine: boolean): Expression { // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. const target = getMutableClone(receiver); @@ -1468,7 +1488,7 @@ namespace ts { const properties: ObjectLiteralElementLike[] = []; if (getAccessor) { - const getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined); + const getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined, container); setSourceMapRange(getterFunction, getSourceMapRange(getAccessor)); setEmitFlags(getterFunction, EmitFlags.NoLeadingComments); const getter = createPropertyAssignment("get", getterFunction); @@ -1477,7 +1497,7 @@ namespace ts { } if (setAccessor) { - const setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined); + const setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined, container); setSourceMapRange(setterFunction, getSourceMapRange(setAccessor)); setEmitFlags(setterFunction, EmitFlags.NoLeadingComments); const setter = createPropertyAssignment("set", setterFunction); @@ -1514,6 +1534,13 @@ namespace ts { if (node.transformFlags & TransformFlags.ContainsLexicalThis) { enableSubstitutionsForCapturedThis(); } + + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.ArrowFunctionExcludes, AncestorFacts.ArrowFunctionIncludes); + convertedLoopState = undefined; + const func = createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, @@ -1524,8 +1551,11 @@ namespace ts { transformFunctionBody(node), node ); + setOriginalNode(func, node); setEmitFlags(func, EmitFlags.CapturesThis); + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; return func; } @@ -1535,7 +1565,13 @@ namespace ts { * @param node a FunctionExpression node. */ function visitFunctionExpression(node: FunctionExpression): Expression { - return updateFunctionExpression( + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + convertedLoopState = undefined; + + const updated = updateFunctionExpression( node, /*modifiers*/ undefined, node.name, @@ -1544,8 +1580,12 @@ namespace ts { /*type*/ undefined, node.transformFlags & TransformFlags.ES2015 ? transformFunctionBody(node) - : visitFunctionBody(node.body, visitor, context) + : visitFunctionBody(node.body, functionBodyVisitor, context) ); + + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; + return updated; } /** @@ -1554,18 +1594,28 @@ namespace ts { * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node: FunctionDeclaration): FunctionDeclaration { - return updateFunctionDeclaration( + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + convertedLoopState = undefined; + + const updated = updateFunctionDeclaration( node, /*decorators*/ undefined, - node.modifiers, + visitNodes(node.modifiers, visitor, isModifier), node.name, /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, node.transformFlags & TransformFlags.ES2015 ? transformFunctionBody(node) - : visitFunctionBody(node.body, visitor, context) + : visitFunctionBody(node.body, functionBodyVisitor, context) ); + + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; + return updated; } /** @@ -1575,11 +1625,12 @@ namespace ts { * @param location The source-map location for the new FunctionExpression. * @param name The name of the new FunctionExpression. */ - function transformFunctionLikeToExpression(node: FunctionLikeDeclaration, location: TextRange, name: Identifier): FunctionExpression { - const savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== SyntaxKind.ArrowFunction) { - enclosingNonArrowFunction = node; - } + function transformFunctionLikeToExpression(node: FunctionLikeDeclaration, location: TextRange, name: Identifier, container: Node): FunctionExpression { + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node, container); + convertedLoopState = undefined; const expression = setOriginalNode( createFunctionExpression( @@ -1589,13 +1640,14 @@ namespace ts { /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, - saveStateAndInvoke(node, transformFunctionBody), + transformFunctionBody(node), location ), /*original*/ node ); - enclosingNonArrowFunction = savedContainingNonArrowFunction; + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; return expression; } @@ -1689,6 +1741,19 @@ namespace ts { return block; } + function visitBlock(node: Block, isFunctionBody: boolean): Block { + if (!isFunctionBody) { + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(AncestorFacts.BlockExcludes, AncestorFacts.BlockIncludes, node); + const updated = visitEachChild(node, visitor, context); + ancestorFacts = savedAncestorFacts; + return updated; + } + + // A function body is not a block scope. + return visitEachChild(node, visitor, context); + } + /** * Visits an ExpressionStatement that contains a destructuring assignment. * @@ -1742,9 +1807,16 @@ namespace ts { FlattenLevel.All, needsDestructuringValue); } + return visitEachChild(node, visitor, context); } function visitVariableStatement(node: VariableStatement): Statement { + const savedAncestorFacts = ancestorFacts; + if (hasModifier(node, ModifierFlags.Export)) { + ancestorFacts |= AncestorFacts.ExportedVariableStatement; + } + + let updated: Statement; if (convertedLoopState && (getCombinedNodeFlags(node.declarationList) & NodeFlags.BlockScoped) == 0) { // we are inside a converted loop - hoist variable declarations let assignments: Expression[]; @@ -1767,15 +1839,19 @@ namespace ts { } } if (assignments) { - return createStatement(reduceLeft(assignments, (acc, v) => createBinary(v, SyntaxKind.CommaToken, acc)), node); + updated = createStatement(reduceLeft(assignments, (acc, v) => createBinary(v, SyntaxKind.CommaToken, acc)), node); } else { // none of declarations has initializer - the entire variable statement can be deleted - return undefined; + updated = undefined; } } + else { + updated = visitEachChild(node, visitor, context); + } - return visitEachChild(node, visitor, context); + ancestorFacts = savedAncestorFacts; + return updated; } /** @@ -1784,29 +1860,32 @@ namespace ts { * @param node A VariableDeclarationList node. */ function visitVariableDeclarationList(node: VariableDeclarationList): VariableDeclarationList { - if (node.flags & NodeFlags.BlockScoped) { - enableSubstitutionsForBlockScopedBindings(); + if (node.transformFlags & TransformFlags.ES2015) { + if (node.flags & NodeFlags.BlockScoped) { + enableSubstitutionsForBlockScopedBindings(); + } + + const declarations = flatten(map(node.declarations, node.flags & NodeFlags.Let + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + + const declarationList = createVariableDeclarationList(declarations, /*location*/ node); + setOriginalNode(declarationList, node); + setCommentRange(declarationList, node); + + if (node.transformFlags & TransformFlags.ContainsBindingPattern + && (isBindingPattern(node.declarations[0].name) + || isBindingPattern(lastOrUndefined(node.declarations).name))) { + // If the first or last declaration is a binding pattern, we need to modify + // the source map range for the declaration list. + const firstDeclaration = firstOrUndefined(declarations); + const lastDeclaration = lastOrUndefined(declarations); + setSourceMapRange(declarationList, createRange(firstDeclaration.pos, lastDeclaration.end)); + } + + return declarationList; } - - const declarations = flatten(map(node.declarations, node.flags & NodeFlags.Let - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - - const declarationList = createVariableDeclarationList(declarations, /*location*/ node); - setOriginalNode(declarationList, node); - setCommentRange(declarationList, node); - - if (node.transformFlags & TransformFlags.ContainsBindingPattern - && (isBindingPattern(node.declarations[0].name) - || isBindingPattern(lastOrUndefined(node.declarations).name))) { - // If the first or last declaration is a binding pattern, we need to modify - // the source map range for the declaration list. - const firstDeclaration = firstOrUndefined(declarations); - const lastDeclaration = lastOrUndefined(declarations); - setSourceMapRange(declarationList, createRange(firstDeclaration.pos, lastDeclaration.end)); - } - - return declarationList; + return visitEachChild(node, visitor, context); } /** @@ -1860,20 +1939,18 @@ namespace ts { const isCapturedInFunction = flags & NodeCheckFlags.CapturedBlockScopedBinding; const isDeclaredInLoop = flags & NodeCheckFlags.BlockScopedBindingInLoop; const emittedAsTopLevel = - isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + (ancestorFacts & AncestorFacts.TopLevel) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && isBlock(enclosingBlockScopeContainer) - && isIterationStatement(enclosingBlockScopeContainerParent, /*lookInLabeledStatements*/ false)); + && (ancestorFacts & AncestorFacts.IterationStatementBlock) !== 0); const emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== SyntaxKind.ForInStatement - && enclosingBlockScopeContainer.kind !== SyntaxKind.ForOfStatement + && (ancestorFacts & AncestorFacts.ForInOrForOfStatement) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !isIterationStatement(enclosingBlockScopeContainer, /*lookInLabeledStatements*/ false))); + && (ancestorFacts & (AncestorFacts.ForStatement | AncestorFacts.ForInOrForOfStatement)) === 0)); return emitExplicitInitializer; } @@ -1907,72 +1984,108 @@ namespace ts { * @param node A VariableDeclaration node. */ function visitVariableDeclaration(node: VariableDeclaration): VisitResult { - // If we are here it is because the name contains a binding pattern. + const savedAncestorFacts = ancestorFacts; + ancestorFacts &= ~AncestorFacts.ExportedVariableStatement; + + let updated: VisitResult; if (isBindingPattern(node.name)) { - const hoistTempVariables = enclosingVariableStatement - && hasModifier(enclosingVariableStatement, ModifierFlags.Export); - return flattenDestructuringBinding( + updated = flattenDestructuringBinding( node, visitor, context, FlattenLevel.All, /*value*/ undefined, - hoistTempVariables + (savedAncestorFacts & AncestorFacts.ExportedVariableStatement) !== 0 ); } + else { + updated = visitEachChild(node, visitor, context); + } - return visitEachChild(node, visitor, context); + ancestorFacts = savedAncestorFacts; + return updated; } function visitLabeledStatement(node: LabeledStatement): VisitResult { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = createMap(); + const statement = unwrapInnermostStatmentOfLabel(node); + return isIterationStatement(statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(statement) + ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) + : restoreEnclosingLabel(visitNode(statement, visitor, isStatement), node); + } + + function unwrapInnermostStatmentOfLabel(node: LabeledStatement) { + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = createMap(); + } + while (true) { + if (convertedLoopState) { + convertedLoopState.labels[node.label.text] = node.label.text; } - convertedLoopState.labels[node.label.text] = node.label.text; + if (node.statement.kind !== SyntaxKind.LabeledStatement) { + return node.statement; + } + node = node.statement; } + } - let result: VisitResult; - if (isIterationStatement(node.statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node.statement)) { - result = visitNodes(createNodeArray([node.statement]), visitor, isStatement); + function restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement): Statement { + if (!outermostLabeledStatement) { + return node; } - else { - result = visitEachChild(node, visitor, context); - } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + convertedLoopState.labels[outermostLabeledStatement.label.text] = undefined; } - - return result; + return updateLabel( + outermostLabeledStatement, + outermostLabeledStatement.label, + outermostLabeledStatement.statement.kind === SyntaxKind.LabeledStatement + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node + ); } - function visitDoStatement(node: DoStatement) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatementWithFacts(excludeFacts: AncestorFacts, includeFacts: AncestorFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter) { + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(excludeFacts, includeFacts, node); + const updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + ancestorFacts = savedAncestorFacts; + return updated; } - function visitWhileStatement(node: WhileStatement) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node: DoStatement | WhileStatement, outermostLabeledStatement: LabeledStatement) { + return visitIterationStatementWithFacts( + AncestorFacts.DoOrWhileStatementExcludes, + AncestorFacts.DoOrWhileStatementIncludes, + node, + outermostLabeledStatement); } - function visitForStatement(node: ForStatement) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node: ForStatement, outermostLabeledStatement: LabeledStatement) { + return visitIterationStatementWithFacts( + AncestorFacts.ForStatementExcludes, + AncestorFacts.ForStatementIncludes, + node, + outermostLabeledStatement); } - function visitForInStatement(node: ForInStatement) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node: ForInStatement, outermostLabeledStatement: LabeledStatement) { + return visitIterationStatementWithFacts( + AncestorFacts.ForInOrForOfStatementExcludes, + AncestorFacts.ForInOrForOfStatementIncludes, + node, + outermostLabeledStatement); } - /** - * Visits a ForOfStatement and converts it into a compatible ForStatement. - * - * @param node A ForOfStatement. - */ - function visitForOfStatement(node: ForOfStatement): VisitResult { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement): VisitResult { + return visitIterationStatementWithFacts( + AncestorFacts.ForInOrForOfStatementExcludes, + AncestorFacts.ForInOrForOfStatementIncludes, + node, + outermostLabeledStatement, + convertForOfToFor); } - function convertForOfToFor(node: ForOfStatement, convertedLoopBodyStatements: Statement[]): ForStatement { + function convertForOfToFor(node: ForOfStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]): Statement { // The following ES6 code: // // for (let v of expr) { } @@ -2139,7 +2252,21 @@ namespace ts { // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. setEmitFlags(forStatement, EmitFlags.NoTokenTrailingSourceMaps); - return forStatement; + return restoreEnclosingLabel(forStatement, outermostLabeledStatement); + } + + function visitIterationStatement(node: IterationStatement, outermostLabeledStatement: LabeledStatement) { + switch (node.kind) { + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case SyntaxKind.ForStatement: + return visitForStatement(node, outermostLabeledStatement); + case SyntaxKind.ForInStatement: + return visitForInStatement(node, outermostLabeledStatement); + case SyntaxKind.ForOfStatement: + return visitForOfStatement(node, outermostLabeledStatement); + } } /** @@ -2155,45 +2282,56 @@ namespace ts { // Find the first computed property. // Everything until that point can be emitted as part of the initial object literal. let numInitialProperties = numProperties; + let numInitialPropertiesWithoutYield = numProperties; for (let i = 0; i < numProperties; i++) { const property = properties[i]; - if (property.transformFlags & TransformFlags.ContainsYield - || property.name.kind === SyntaxKind.ComputedPropertyName) { + if ((property.transformFlags & TransformFlags.ContainsYield && ancestorFacts & AncestorFacts.AsyncFunctionBody) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === SyntaxKind.ComputedPropertyName) { numInitialProperties = i; break; } } - Debug.assert(numInitialProperties !== numProperties); + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } - // For computed properties, we need to create a unique handle to the object - // literal so we can modify it without risking internal assignments tainting the object. - const temp = createTempVariable(hoistVariableDeclaration); + // For computed properties, we need to create a unique handle to the object + // literal so we can modify it without risking internal assignments tainting the object. + const temp = createTempVariable(hoistVariableDeclaration); - // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. - const expressions: Expression[] = []; - const assignment = createAssignment( - temp, - setEmitFlags( - createObjectLiteral( - visitNodes(properties, visitor, isObjectLiteralElementLike, 0, numInitialProperties), - /*location*/ undefined, - node.multiLine - ), - EmitFlags.Indented - ) - ); - if (node.multiLine) { - assignment.startsOnNewLine = true; + // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. + const expressions: Expression[] = []; + const assignment = createAssignment( + temp, + setEmitFlags( + createObjectLiteral( + visitNodes(properties, visitor, isObjectLiteralElementLike, 0, numInitialProperties), + /*location*/ undefined, + node.multiLine + ), + EmitFlags.Indented + ) + ); + + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + + expressions.push(assignment); + + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + + // We need to clone the temporary identifier so that we can write it on a + // new line + expressions.push(node.multiLine ? startOnNewLine(getMutableClone(temp)) : temp); + return inlineExpressions(expressions); } - expressions.push(assignment); - - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - - // We need to clone the temporary identifier so that we can write it on a - // new line - expressions.push(node.multiLine ? startOnNewLine(getMutableClone(temp)) : temp); - return inlineExpressions(expressions); + return visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node: IterationStatement): boolean { @@ -2224,7 +2362,7 @@ namespace ts { } } - function convertIterationStatementBodyIfNecessary(node: IterationStatement, convert?: (node: IterationStatement, convertedLoopBodyStatements: Statement[]) => IterationStatement): VisitResult { + function convertIterationStatementBodyIfNecessary(node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter): VisitResult { if (!shouldConvertIterationStatementBody(node)) { let saveAllowedNonLabeledJumps: Jump; if (convertedLoopState) { @@ -2234,7 +2372,9 @@ namespace ts { convertedLoopState.allowedNonLabeledJumps = Jump.Break | Jump.Continue; } - const result = convert ? convert(node, /*convertedLoopBodyStatements*/ undefined) : visitEachChild(node, visitor, context); + const result = convert + ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined) + : restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; @@ -2302,8 +2442,7 @@ namespace ts { } const isAsyncBlockContainingAwait = - enclosingNonArrowFunction - && (getEmitFlags(enclosingNonArrowFunction) & EmitFlags.AsyncFunctionBody) !== 0 + ancestorFacts & AncestorFacts.AsyncFunctionBody && (node.statement.transformFlags & TransformFlags.ContainsYield) !== 0; let loopBodyFlags: EmitFlags = 0; @@ -2422,34 +2561,30 @@ namespace ts { } const convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); - let loop: IterationStatement; + let loop: Statement; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = getMutableClone(node); + let clone = getMutableClone(node); // clean statement part - loop.statement = undefined; + clone.statement = undefined; // visit childnodes to transform initializer/condition/incrementor parts - loop = visitEachChild(loop, visitor, context); + clone = visitEachChild(clone, visitor, context); // set loop statement - loop.statement = createBlock( + clone.statement = createBlock( convertedLoopBodyStatements, /*location*/ undefined, /*multiline*/ true ); // reset and re-aggregate the transform flags - loop.transformFlags = 0; - aggregateTransformFlags(loop); + clone.transformFlags = 0; + aggregateTransformFlags(clone); + loop = restoreEnclosingLabel(clone, outermostLabeledStatement); } - - statements.push( - currentParent.kind === SyntaxKind.LabeledStatement - ? createLabel((currentParent).label, loop) - : loop - ); + statements.push(loop); return statements; } @@ -2617,11 +2752,15 @@ namespace ts { case SyntaxKind.SetAccessor: const accessors = getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; + case SyntaxKind.MethodDeclaration: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); + break; + case SyntaxKind.PropertyAssignment: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; @@ -2630,10 +2769,6 @@ namespace ts { expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case SyntaxKind.MethodDeclaration: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); - break; - default: Debug.failBadSyntaxKind(node); break; @@ -2692,13 +2827,13 @@ namespace ts { * @param method The MethodDeclaration node. * @param receiver The receiver for the assignment. */ - function transformObjectLiteralMethodDeclarationToExpression(method: MethodDeclaration, receiver: Expression, startsOnNewLine: boolean) { + function transformObjectLiteralMethodDeclarationToExpression(method: MethodDeclaration, receiver: Expression, container: Node, startsOnNewLine: boolean) { const expression = createAssignment( createMemberAccessForPropertyName( receiver, visitNode(method.name, visitor, isPropertyName) ), - transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined), + transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined, container), /*location*/ method ); if (startsOnNewLine) { @@ -2708,22 +2843,28 @@ namespace ts { } function visitCatchClause(node: CatchClause): CatchClause { - Debug.assert(isBindingPattern(node.variableDeclaration.name)); - - const temp = createTempVariable(undefined); - const newVariableDeclaration = createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - - const vars = flattenDestructuringBinding( - node.variableDeclaration, - visitor, - context, - FlattenLevel.All, - temp - ); - const list = createVariableDeclarationList(vars, /*location*/node.variableDeclaration, /*flags*/node.variableDeclaration.flags); - const destructure = createVariableStatement(undefined, list); - - return updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(AncestorFacts.BlockScopeExcludes, AncestorFacts.BlockScopeIncludes); + let updated: CatchClause; + if (isBindingPattern(node.variableDeclaration.name)) { + const temp = createTempVariable(undefined); + const newVariableDeclaration = createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); + const vars = flattenDestructuringBinding( + node.variableDeclaration, + visitor, + context, + FlattenLevel.All, + temp + ); + const list = createVariableDeclarationList(vars, /*location*/node.variableDeclaration, /*flags*/node.variableDeclaration.flags); + const destructure = createVariableStatement(undefined, list); + updated = updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = visitEachChild(node, visitor, context); + } + ancestorFacts = savedAncestorFacts; + return updated; } function addStatementToStartOfBlock(block: Block, statement: Statement): Block { @@ -2742,7 +2883,7 @@ namespace ts { // Methods on classes are handled in visitClassDeclaration/visitClassExpression. // Methods with computed property names are handled in visitObjectLiteralExpression. Debug.assert(!isComputedPropertyName(node.name)); - const functionExpression = transformFunctionLikeToExpression(node, /*location*/ moveRangePos(node, -1), /*name*/ undefined); + const functionExpression = transformFunctionLikeToExpression(node, /*location*/ moveRangePos(node, -1), /*name*/ undefined, /*container*/ undefined); setEmitFlags(functionExpression, EmitFlags.NoLeadingComments | getEmitFlags(functionExpression)); return createPropertyAssignment( node.name, @@ -2751,6 +2892,25 @@ namespace ts { ); } + /** + * Visits an AccessorDeclaration of an ObjectLiteralExpression. + * + * @param node An AccessorDeclaration node. + */ + function visitAccessorDeclaration(node: AccessorDeclaration): AccessorDeclaration { + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + convertedLoopState = undefined; + + const updated = visitEachChild(node, visitor, context); + + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; + return updated; + } + /** * Visits a ShorthandPropertyAssignment and transforms it into a PropertyAssignment. * @@ -2764,6 +2924,10 @@ namespace ts { ); } + function visitComputedPropertyName(node: ComputedPropertyName) { + return visitEachChild(node, visitor, context); + } + /** * Visits a YieldExpression node. * @@ -2780,8 +2944,11 @@ namespace ts { * @param node An ArrayLiteralExpression node. */ function visitArrayLiteralExpression(node: ArrayLiteralExpression): Expression { - // We are here because we contain a SpreadElementExpression. - return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + if (node.transformFlags & TransformFlags.ES2015) { + // We are here because we contain a SpreadElementExpression. + return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + } + return visitEachChild(node, visitor, context); } /** @@ -2790,7 +2957,15 @@ namespace ts { * @param node a CallExpression. */ function visitCallExpression(node: CallExpression) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + if (node.transformFlags & TransformFlags.ES2015) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + } + return updateCall( + node, + visitNode(node.expression, callExpressionVisitor, isExpression), + /*typeArguments*/ undefined, + visitNodes(node.arguments, visitor, isExpression) + ); } function visitImmediateSuperCallInBody(node: CallExpression) { @@ -2822,7 +2997,7 @@ namespace ts { // _super.prototype.m.apply(this, a.concat([b])) resultingCall = createFunctionApply( - visitNode(target, visitor, isExpression), + visitNode(target, callExpressionVisitor, isExpression), visitNode(thisArg, visitor, isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false) ); @@ -2838,7 +3013,7 @@ namespace ts { // _super.m.call(this, a) // _super.prototype.m.call(this, a) resultingCall = createFunctionCall( - visitNode(target, visitor, isExpression), + visitNode(target, callExpressionVisitor, isExpression), visitNode(thisArg, visitor, isExpression), visitNodes(node.arguments, visitor, isExpression), /*location*/ node @@ -2853,11 +3028,11 @@ namespace ts { resultingCall, actualThis ); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? createAssignment(createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return setOriginalNode(resultingCall, node); } /** @@ -2866,25 +3041,26 @@ namespace ts { * @param node A NewExpression node. */ function visitNewExpression(node: NewExpression): LeftHandSideExpression { - // We are here because we contain a SpreadElementExpression. - Debug.assert((node.transformFlags & TransformFlags.ContainsSpread) !== 0); + if (node.transformFlags & TransformFlags.ContainsSpread) { + // We are here because we contain a SpreadElementExpression. + // [source] + // new C(...a) + // + // [output] + // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() - // [source] - // new C(...a) - // - // [output] - // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() - - const { target, thisArg } = createCallBinding(createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration); - return createNew( - createFunctionApply( - visitNode(target, visitor, isExpression), - thisArg, - transformAndSpreadElements(createNodeArray([createVoidZero(), ...node.arguments]), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false) - ), - /*typeArguments*/ undefined, - [] - ); + const { target, thisArg } = createCallBinding(createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration); + return createNew( + createFunctionApply( + visitNode(target, visitor, isExpression), + thisArg, + transformAndSpreadElements(createNodeArray([createVoidZero(), ...node.arguments]), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false) + ), + /*typeArguments*/ undefined, + [] + ); + } + return visitEachChild(node, visitor, context); } /** @@ -3120,11 +3296,9 @@ namespace ts { /** * Visits the `super` keyword */ - function visitSuperKeyword(): LeftHandSideExpression { - return enclosingNonAsyncFunctionBody - && isClassElement(enclosingNonAsyncFunctionBody) - && !hasModifier(enclosingNonAsyncFunctionBody, ModifierFlags.Static) - && currentParent.kind !== SyntaxKind.CallExpression + function visitSuperKeyword(isExpressionOfCall: boolean): LeftHandSideExpression { + return ancestorFacts & AncestorFacts.NonStaticClassElement + && !isExpressionOfCall ? createPropertyAccess(createIdentifier("_super"), "prototype") : createIdentifier("_super"); } @@ -3135,16 +3309,15 @@ namespace ts { * @param node The node to be printed. */ function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { - const savedEnclosingFunction = enclosingFunction; - if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis && isFunctionLike(node)) { // If we are tracking a captured `this`, keep track of the enclosing function. - enclosingFunction = node; + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + previousOnEmitNode(emitContext, node, emitCallback); + ancestorFacts = savedAncestorFacts; + return; } - previousOnEmitNode(emitContext, node, emitCallback); - - enclosingFunction = savedEnclosingFunction; } /** @@ -3272,11 +3445,9 @@ namespace ts { */ function substituteThisKeyword(node: PrimaryExpression): PrimaryExpression { if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis - && enclosingFunction - && getEmitFlags(enclosingFunction) & EmitFlags.CapturesThis) { + && ancestorFacts & AncestorFacts.CapturesThis) { return createIdentifier("_this", /*location*/ node); } - return node; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ddfa85bc311..328f80abc5c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -883,6 +883,18 @@ namespace ts { return false; } + export function getAllLabeledStatements(node: LabeledStatement): { statement: Statement; labeledStatements: LabeledStatement[]; } { + switch (node.statement.kind) { + case SyntaxKind.LabeledStatement: + const result = getAllLabeledStatements(node.statement); + if (result) { + result.labeledStatements.push(node); + } + return result; + default: + return { statement: node.statement, labeledStatements: [node] }; + } + } export function isFunctionBlock(node: Node) { return node && node.kind === SyntaxKind.Block && isFunctionLike(node.parent); diff --git a/tests/baselines/reference/superAccess2.js b/tests/baselines/reference/superAccess2.js index da19770584a..fc3960fba3e 100644 --- a/tests/baselines/reference/superAccess2.js +++ b/tests/baselines/reference/superAccess2.js @@ -41,9 +41,9 @@ var Q = (function (_super) { __extends(Q, _super); // Super is not allowed in constructor args function Q(z, zz, zzz) { - if (z === void 0) { z = _super.; } - if (zz === void 0) { zz = _super.; } - if (zzz === void 0) { zzz = function () { return _super.; }; } + if (z === void 0) { z = _super.prototype.; } + if (zz === void 0) { zz = _super.prototype.; } + if (zzz === void 0) { zzz = function () { return _super.prototype.; }; } var _this = _super.call(this) || this; _this.z = z; _this.xx = _super.prototype.; diff --git a/tests/baselines/reference/superInConstructorParam1.js b/tests/baselines/reference/superInConstructorParam1.js index 8c99b649917..d345bbc8d3a 100644 --- a/tests/baselines/reference/superInConstructorParam1.js +++ b/tests/baselines/reference/superInConstructorParam1.js @@ -27,7 +27,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C(a) { - if (a === void 0) { a = _super.foo.call(_this); } + if (a === void 0) { a = _super.prototype.foo.call(_this); } var _this; return _this; } diff --git a/tests/baselines/reference/superInObjectLiterals_ES5.js b/tests/baselines/reference/superInObjectLiterals_ES5.js index 816277e4e9e..5bc2b64fe36 100644 --- a/tests/baselines/reference/superInObjectLiterals_ES5.js +++ b/tests/baselines/reference/superInObjectLiterals_ES5.js @@ -72,14 +72,14 @@ var obj = { } }, method: function () { - _super.prototype.method.call(this); + _super.method.call(this); }, get prop() { - _super.prototype.method.call(this); + _super.method.call(this); return 10; }, set prop(value) { - _super.prototype.method.call(this); + _super.method.call(this); }, p1: function () { _super.method.call(this); @@ -110,14 +110,14 @@ var B = (function (_super) { } }, method: function () { - _super.prototype.method.call(this); + _super.method.call(this); }, get prop() { - _super.prototype.method.call(this); + _super.method.call(this); return 10; }, set prop(value) { - _super.prototype.method.call(this); + _super.method.call(this); }, p1: function () { _super.method.call(this); diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js index 15bc0c40f37..a41400809d2 100644 --- a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js @@ -40,7 +40,7 @@ var C1 = (function (_super) { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.call(this, _super.x.call(_this)) || this; + return _super.call(this, _super.prototype.x.call(_this)) || this; } return C2; }(B)); diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index 6815b71ce11..d6f8e36c526 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -38,10 +38,10 @@ var ObjectLiteral; var ThisInObjectLiteral = { _foo: '1', get foo() { - return _super.prototype._foo; + return _super._foo; }, set foo(value) { - _super.prototype._foo = value; + _super._foo = value; }, test: function () { return _super._foo; @@ -62,7 +62,7 @@ var SuperObjectTest = (function (_super) { SuperObjectTest.prototype.testing = function () { var test = { get F() { - return _super.prototype.test.call(this); + return _super.test.call(this); } }; }; From 00abd7e28b9848b8afa1aff7834b2b03f162882a Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 8 Dec 2016 17:04:37 -0800 Subject: [PATCH 029/125] Fix paramtypes metadata emit --- src/compiler/transformers/ts.ts | 52 ++++--- .../decoratedClassExportsCommonJS1.js | 6 +- .../decoratedClassExportsCommonJS2.js | 6 +- .../reference/decoratedClassExportsSystem1.js | 6 +- .../reference/decoratedClassExportsSystem2.js | 6 +- .../reference/decoratorOnClassAccessor8.js | 135 ++++++++++++++++++ .../decoratorOnClassAccessor8.symbols | 76 ++++++++++ .../reference/decoratorOnClassAccessor8.types | 81 +++++++++++ .../reference/decoratorOnClassConstructor4.js | 58 ++++++++ .../decoratorOnClassConstructor4.symbols | 28 ++++ .../decoratorOnClassConstructor4.types | 28 ++++ tests/baselines/reference/importHelpers.js | 6 +- .../importHelpersInIsolatedModules.js | 6 +- .../reference/importHelpersNoHelpers.js | 6 +- .../reference/importHelpersNoModule.js | 6 +- .../accessor/decoratorOnClassAccessor8.ts | 32 +++++ .../decoratorOnClassConstructor4.ts | 18 +++ 17 files changed, 501 insertions(+), 55 deletions(-) create mode 100644 tests/baselines/reference/decoratorOnClassAccessor8.js create mode 100644 tests/baselines/reference/decoratorOnClassAccessor8.symbols create mode 100644 tests/baselines/reference/decoratorOnClassAccessor8.types create mode 100644 tests/baselines/reference/decoratorOnClassConstructor4.js create mode 100644 tests/baselines/reference/decoratorOnClassConstructor4.symbols create mode 100644 tests/baselines/reference/decoratorOnClassConstructor4.types create mode 100644 tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts create mode 100644 tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 77af854269e..a357781ca30 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1277,7 +1277,7 @@ namespace ts { * @param node The declaration node. * @param allDecorators An object containing all of the decorators for the declaration. */ - function transformAllDecoratorsOfDeclaration(node: Declaration, allDecorators: AllDecorators) { + function transformAllDecoratorsOfDeclaration(node: Declaration, container: ClassLikeDeclaration, allDecorators: AllDecorators) { if (!allDecorators) { return undefined; } @@ -1285,7 +1285,7 @@ namespace ts { const decoratorExpressions: Expression[] = []; addRange(decoratorExpressions, map(allDecorators.decorators, transformDecorator)); addRange(decoratorExpressions, flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } @@ -1334,7 +1334,7 @@ namespace ts { */ function generateClassElementDecorationExpression(node: ClassExpression | ClassDeclaration, member: ClassElement) { const allDecorators = getAllDecoratorsOfClassElement(node, member); - const decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + const decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -1415,7 +1415,7 @@ namespace ts { */ function generateConstructorDecorationExpression(node: ClassExpression | ClassDeclaration) { const allDecorators = getAllDecoratorsOfConstructor(node); - const decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + const decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -1468,22 +1468,22 @@ namespace ts { * @param node The declaration node. * @param decoratorExpressions The destination array to which to add new decorator expressions. */ - function addTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) { + function addTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) { + function addOldTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); @@ -1491,14 +1491,14 @@ namespace ts { } } - function addNewTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) { + function addNewTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) { if (compilerOptions.emitDecoratorMetadata) { let properties: ObjectLiteralElementLike[]; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(createPropertyAssignment("type", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(createPropertyAssignment("paramTypes", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(createPropertyAssignment("paramTypes", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(createPropertyAssignment("returnType", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeReturnTypeOfNode(node)))); @@ -1543,12 +1543,16 @@ namespace ts { * @param node The node to test. */ function shouldAddParamTypesMetadata(node: Declaration): boolean { - const kind = node.kind; - return kind === SyntaxKind.ClassDeclaration - || kind === SyntaxKind.ClassExpression - || kind === SyntaxKind.MethodDeclaration - || kind === SyntaxKind.GetAccessor - || kind === SyntaxKind.SetAccessor; + switch (node.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: + return getFirstConstructorWithBody(node) !== undefined; + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return true; + } + return false; } /** @@ -1596,7 +1600,7 @@ namespace ts { * * @param node The node that should have its parameter types serialized. */ - function serializeParameterTypesOfNode(node: Node): Expression { + function serializeParameterTypesOfNode(node: Node, container: ClassLikeDeclaration): Expression { const valueDeclaration = isClassLike(node) ? getFirstConstructorWithBody(node) @@ -1606,7 +1610,7 @@ namespace ts { const expressions: Expression[] = []; if (valueDeclaration) { - const parameters = valueDeclaration.parameters; + const parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); const numParameters = parameters.length; for (let i = 0; i < numParameters; i++) { const parameter = parameters[i]; @@ -1625,6 +1629,16 @@ namespace ts { return createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node: FunctionLikeDeclaration, container: ClassLikeDeclaration) { + if (container && node.kind === SyntaxKind.GetAccessor) { + const { setAccessor } = getAllAccessorDeclarations(container.members, node); + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } + /** * Serializes the return type of a node for use with decorator type metadata. * diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS1.js b/tests/baselines/reference/decoratedClassExportsCommonJS1.js index 2b20c7ec168..7ef4369f975 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS1.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS1.js @@ -14,15 +14,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; let Testing123 = Testing123_1 = class Testing123 { }; Testing123.prop1 = Testing123_1.prop0; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports.Testing123 = Testing123; var Testing123_1; diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS2.js b/tests/baselines/reference/decoratedClassExportsCommonJS2.js index 9e8b8693109..994178cbb79 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS2.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS2.js @@ -13,14 +13,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; let Testing123 = Testing123_1 = class Testing123 { }; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports.Testing123 = Testing123; var Testing123_1; diff --git a/tests/baselines/reference/decoratedClassExportsSystem1.js b/tests/baselines/reference/decoratedClassExportsSystem1.js index 6f7fcbd144a..2f33feb28fb 100644 --- a/tests/baselines/reference/decoratedClassExportsSystem1.js +++ b/tests/baselines/reference/decoratedClassExportsSystem1.js @@ -17,9 +17,6 @@ System.register([], function (exports_1, context_1) { else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; - var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); - }; var __moduleName = context_1 && context_1.id; var Testing123, Testing123_1; return { @@ -29,8 +26,7 @@ System.register([], function (exports_1, context_1) { }; Testing123.prop1 = Testing123_1.prop0; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports_1("Testing123", Testing123); } diff --git a/tests/baselines/reference/decoratedClassExportsSystem2.js b/tests/baselines/reference/decoratedClassExportsSystem2.js index 2a1a394a1f3..2c9c62cadb2 100644 --- a/tests/baselines/reference/decoratedClassExportsSystem2.js +++ b/tests/baselines/reference/decoratedClassExportsSystem2.js @@ -14,9 +14,6 @@ System.register([], function (exports_1, context_1) { else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; - var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); - }; var __moduleName = context_1 && context_1.id; var Testing123, Testing123_1; return { @@ -25,8 +22,7 @@ System.register([], function (exports_1, context_1) { Testing123 = Testing123_1 = class Testing123 { }; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports_1("Testing123", Testing123); } diff --git a/tests/baselines/reference/decoratorOnClassAccessor8.js b/tests/baselines/reference/decoratorOnClassAccessor8.js new file mode 100644 index 00000000000..7347e630eab --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor8.js @@ -0,0 +1,135 @@ +//// [decoratorOnClassAccessor8.ts] +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + +class A { + @dec get x() { return 0; } + set x(value: number) { } +} + +class B { + get x() { return 0; } + @dec set x(value: number) { } +} + +class C { + @dec set x(value: number) { } + get x() { return 0; } +} + +class D { + set x(value: number) { } + @dec get x() { return 0; } +} + +class E { + @dec get x() { return 0; } +} + +class F { + @dec set x(value: number) { } +} + +//// [decoratorOnClassAccessor8.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var A = (function () { + function A() { + } + Object.defineProperty(A.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return A; +}()); +__decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", [Number]) +], A.prototype, "x", null); +var B = (function () { + function B() { + } + Object.defineProperty(B.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return B; +}()); +__decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) +], B.prototype, "x", null); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return C; +}()); +__decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) +], C.prototype, "x", null); +var D = (function () { + function D() { + } + Object.defineProperty(D.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return D; +}()); +__decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", [Number]) +], D.prototype, "x", null); +var E = (function () { + function E() { + } + Object.defineProperty(E.prototype, "x", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + return E; +}()); +__decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", []) +], E.prototype, "x", null); +var F = (function () { + function F() { + } + Object.defineProperty(F.prototype, "x", { + set: function (value) { }, + enumerable: true, + configurable: true + }); + return F; +}()); +__decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) +], F.prototype, "x", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor8.symbols b/tests/baselines/reference/decoratorOnClassAccessor8.symbols new file mode 100644 index 00000000000..d1e22d586fc --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor8.symbols @@ -0,0 +1,76 @@ +=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts === +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClassAccessor8.ts, 0, 24)) +>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassAccessor8.ts, 0, 36)) +>descriptor : Symbol(descriptor, Decl(decoratorOnClassAccessor8.ts, 0, 57)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21)) + +class A { +>A : Symbol(A, Decl(decoratorOnClassAccessor8.ts, 0, 126)) + + @dec get x() { return 0; } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(A.x, Decl(decoratorOnClassAccessor8.ts, 2, 9), Decl(decoratorOnClassAccessor8.ts, 3, 30)) + + set x(value: number) { } +>x : Symbol(A.x, Decl(decoratorOnClassAccessor8.ts, 2, 9), Decl(decoratorOnClassAccessor8.ts, 3, 30)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 4, 10)) +} + +class B { +>B : Symbol(B, Decl(decoratorOnClassAccessor8.ts, 5, 1)) + + get x() { return 0; } +>x : Symbol(B.x, Decl(decoratorOnClassAccessor8.ts, 7, 9), Decl(decoratorOnClassAccessor8.ts, 8, 25)) + + @dec set x(value: number) { } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(B.x, Decl(decoratorOnClassAccessor8.ts, 7, 9), Decl(decoratorOnClassAccessor8.ts, 8, 25)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 9, 15)) +} + +class C { +>C : Symbol(C, Decl(decoratorOnClassAccessor8.ts, 10, 1)) + + @dec set x(value: number) { } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(C.x, Decl(decoratorOnClassAccessor8.ts, 12, 9), Decl(decoratorOnClassAccessor8.ts, 13, 33)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 13, 15)) + + get x() { return 0; } +>x : Symbol(C.x, Decl(decoratorOnClassAccessor8.ts, 12, 9), Decl(decoratorOnClassAccessor8.ts, 13, 33)) +} + +class D { +>D : Symbol(D, Decl(decoratorOnClassAccessor8.ts, 15, 1)) + + set x(value: number) { } +>x : Symbol(D.x, Decl(decoratorOnClassAccessor8.ts, 17, 9), Decl(decoratorOnClassAccessor8.ts, 18, 28)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 18, 10)) + + @dec get x() { return 0; } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(D.x, Decl(decoratorOnClassAccessor8.ts, 17, 9), Decl(decoratorOnClassAccessor8.ts, 18, 28)) +} + +class E { +>E : Symbol(E, Decl(decoratorOnClassAccessor8.ts, 20, 1)) + + @dec get x() { return 0; } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(E.x, Decl(decoratorOnClassAccessor8.ts, 22, 9)) +} + +class F { +>F : Symbol(F, Decl(decoratorOnClassAccessor8.ts, 24, 1)) + + @dec set x(value: number) { } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(F.x, Decl(decoratorOnClassAccessor8.ts, 26, 9)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 27, 15)) +} diff --git a/tests/baselines/reference/decoratorOnClassAccessor8.types b/tests/baselines/reference/decoratorOnClassAccessor8.types new file mode 100644 index 00000000000..e8f46ee460d --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor8.types @@ -0,0 +1,81 @@ +=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts === +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>T : T +>target : any +>propertyKey : string +>descriptor : TypedPropertyDescriptor +>TypedPropertyDescriptor : TypedPropertyDescriptor +>T : T +>TypedPropertyDescriptor : TypedPropertyDescriptor +>T : T + +class A { +>A : A + + @dec get x() { return 0; } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>0 : 0 + + set x(value: number) { } +>x : number +>value : number +} + +class B { +>B : B + + get x() { return 0; } +>x : number +>0 : 0 + + @dec set x(value: number) { } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>value : number +} + +class C { +>C : C + + @dec set x(value: number) { } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>value : number + + get x() { return 0; } +>x : number +>0 : 0 +} + +class D { +>D : D + + set x(value: number) { } +>x : number +>value : number + + @dec get x() { return 0; } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>0 : 0 +} + +class E { +>E : E + + @dec get x() { return 0; } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>0 : 0 +} + +class F { +>F : F + + @dec set x(value: number) { } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>value : number +} diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.js b/tests/baselines/reference/decoratorOnClassConstructor4.js new file mode 100644 index 00000000000..22414e89e43 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor4.js @@ -0,0 +1,58 @@ +//// [decoratorOnClassConstructor4.ts] +declare var dec: any; + +@dec +class A { +} + +@dec +class B { + constructor(x: number) {} +} + +@dec +class C extends A { +} + +//// [decoratorOnClassConstructor4.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var A = (function () { + function A() { + } + return A; +}()); +A = __decorate([ + dec +], A); +var B = (function () { + function B(x) { + } + return B; +}()); +B = __decorate([ + dec, + __metadata("design:paramtypes", [Number]) +], B); +var C = (function (_super) { + __extends(C, _super); + function C() { + return _super.apply(this, arguments) || this; + } + return C; +}(A)); +C = __decorate([ + dec +], C); diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.symbols b/tests/baselines/reference/decoratorOnClassConstructor4.symbols new file mode 100644 index 00000000000..8a414abd7b1 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor4.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts === +declare var dec: any; +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +class A { +>A : Symbol(A, Decl(decoratorOnClassConstructor4.ts, 0, 21)) +} + +@dec +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +class B { +>B : Symbol(B, Decl(decoratorOnClassConstructor4.ts, 4, 1)) + + constructor(x: number) {} +>x : Symbol(x, Decl(decoratorOnClassConstructor4.ts, 8, 16)) +} + +@dec +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +class C extends A { +>C : Symbol(C, Decl(decoratorOnClassConstructor4.ts, 9, 1)) +>A : Symbol(A, Decl(decoratorOnClassConstructor4.ts, 0, 21)) +} diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.types b/tests/baselines/reference/decoratorOnClassConstructor4.types new file mode 100644 index 00000000000..f4203bd5d7d --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor4.types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts === +declare var dec: any; +>dec : any + +@dec +>dec : any + +class A { +>A : A +} + +@dec +>dec : any + +class B { +>B : B + + constructor(x: number) {} +>x : number +} + +@dec +>dec : any + +class C extends A { +>C : C +>A : A +} diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index ae4d3127010..762f0778945 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -64,8 +64,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { @@ -111,6 +110,5 @@ __decorate([ __metadata("design:returntype", void 0) ], C.prototype, "method", null); C = __decorate([ - dec, - __metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/importHelpersInIsolatedModules.js b/tests/baselines/reference/importHelpersInIsolatedModules.js index 28c00f97554..5c395ea0b9f 100644 --- a/tests/baselines/reference/importHelpersInIsolatedModules.js +++ b/tests/baselines/reference/importHelpersInIsolatedModules.js @@ -64,8 +64,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); //// [script.js] "use strict"; @@ -96,6 +95,5 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index a9c2deb76b6..560e16d1cca 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -63,8 +63,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); var o = { a: 1 }; var y = tslib_1.__assign({}, o); @@ -113,6 +112,5 @@ __decorate([ __metadata("design:returntype", void 0) ], C.prototype, "method", null); C = __decorate([ - dec, - __metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index 41df9710f33..65a004eb66c 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -56,8 +56,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { @@ -103,6 +102,5 @@ __decorate([ __metadata("design:returntype", void 0) ], C.prototype, "method", null); C = __decorate([ - dec, - __metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts b/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts new file mode 100644 index 00000000000..3caf4b406d2 --- /dev/null +++ b/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts @@ -0,0 +1,32 @@ +// @target:es5 +// @experimentaldecorators: true +// @emitdecoratormetadata: true +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + +class A { + @dec get x() { return 0; } + set x(value: number) { } +} + +class B { + get x() { return 0; } + @dec set x(value: number) { } +} + +class C { + @dec set x(value: number) { } + get x() { return 0; } +} + +class D { + set x(value: number) { } + @dec get x() { return 0; } +} + +class E { + @dec get x() { return 0; } +} + +class F { + @dec set x(value: number) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts b/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts new file mode 100644 index 00000000000..55e3a1423fa --- /dev/null +++ b/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts @@ -0,0 +1,18 @@ +// @target: es5 +// @module: commonjs +// @experimentaldecorators: true +// @emitdecoratormetadata: true +declare var dec: any; + +@dec +class A { +} + +@dec +class B { + constructor(x: number) {} +} + +@dec +class C extends A { +} \ No newline at end of file From a52805f641f0f3edf7f48040bfb48b9b8daabc29 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 9 Dec 2016 10:50:14 -0800 Subject: [PATCH 030/125] Use checkExpression in checkSpreadExpression Not checkExpressionCached. checkExpressionCached ignores ongoing control flow analysis, which causes the following loop to make the compiler recur infinitely: ```ts let a = [] for (const x of []) { a = [...a] } ``` --- src/compiler/checker.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 778e31b9c5b..a81cf64fa15 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11252,13 +11252,7 @@ namespace ts { } function checkSpreadExpression(node: SpreadElement, contextualMapper?: TypeMapper): Type { - // It is usually not safe to call checkExpressionCached if we can be contextually typing. - // You can tell that we are contextually typing because of the contextualMapper parameter. - // While it is true that a spread element can have a contextual type, it does not do anything - // with this type. It is neither affected by it, nor does it propagate it to its operand. - // So the fact that contextualMapper is passed is not important, because the operand of a spread - // element is not contextually typed. - const arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); + const arrayOrIterableType = checkExpression(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } From 809706ba006bf19fd4cc1f0932f9bbeee075c1bd Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 9 Dec 2016 10:52:49 -0800 Subject: [PATCH 031/125] Test self-assignment w/array spread in loop --- .../selfReferencingSpreadInLoop.errors.txt | 14 ++++++++++++++ .../reference/selfReferencingSpreadInLoop.js | 13 +++++++++++++ .../cases/compiler/selfReferencingSpreadInLoop.ts | 5 +++++ 3 files changed, 32 insertions(+) create mode 100644 tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt create mode 100644 tests/baselines/reference/selfReferencingSpreadInLoop.js create mode 100644 tests/cases/compiler/selfReferencingSpreadInLoop.ts diff --git a/tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt b/tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt new file mode 100644 index 00000000000..599c9fbedb0 --- /dev/null +++ b/tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/selfReferencingSpreadInLoop.ts(1,5): error TS7034: Variable 'additional' implicitly has type 'any[]' in some locations where its type cannot be determined. +tests/cases/compiler/selfReferencingSpreadInLoop.ts(3,22): error TS7005: Variable 'additional' implicitly has an 'any[]' type. + + +==== tests/cases/compiler/selfReferencingSpreadInLoop.ts (2 errors) ==== + let additional = []; + ~~~~~~~~~~ +!!! error TS7034: Variable 'additional' implicitly has type 'any[]' in some locations where its type cannot be determined. + for (const subcomponent of [1, 2, 3]) { + additional = [...additional, subcomponent]; + ~~~~~~~~~~ +!!! error TS7005: Variable 'additional' implicitly has an 'any[]' type. + } + \ No newline at end of file diff --git a/tests/baselines/reference/selfReferencingSpreadInLoop.js b/tests/baselines/reference/selfReferencingSpreadInLoop.js new file mode 100644 index 00000000000..1b8d5ace4f3 --- /dev/null +++ b/tests/baselines/reference/selfReferencingSpreadInLoop.js @@ -0,0 +1,13 @@ +//// [selfReferencingSpreadInLoop.ts] +let additional = []; +for (const subcomponent of [1, 2, 3]) { + additional = [...additional, subcomponent]; +} + + +//// [selfReferencingSpreadInLoop.js] +var additional = []; +for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) { + var subcomponent = _a[_i]; + additional = additional.concat([subcomponent]); +} diff --git a/tests/cases/compiler/selfReferencingSpreadInLoop.ts b/tests/cases/compiler/selfReferencingSpreadInLoop.ts new file mode 100644 index 00000000000..0900e6cad63 --- /dev/null +++ b/tests/cases/compiler/selfReferencingSpreadInLoop.ts @@ -0,0 +1,5 @@ +// @noImplicitAny: true +let additional = []; +for (const subcomponent of [1, 2, 3]) { + additional = [...additional, subcomponent]; +} From 52291762d7ac36254bdf999b419656b97d22273d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 11 Dec 2016 17:43:46 -0800 Subject: [PATCH 032/125] Additional tweak to mapped type property modifier propagation --- src/compiler/checker.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 075f3062de8..8eb82c66bf3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4577,12 +4577,22 @@ namespace ts { function getModifiersTypeFromMappedType(type: MappedType) { if (!type.modifiersType) { - // If the mapped type was declared as { [P in keyof T]: X } or as { [P in K]: X }, where - // K is constrained to 'K extends keyof T', then we will copy property modifiers from T. - const declaredType = getTypeFromMappedTypeNode(type.declaration); - const constraint = getConstraintTypeFromMappedType(declaredType); - const extendedConstraint = constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint.flags & TypeFlags.Index ? instantiateType((extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType; + const constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === SyntaxKind.TypeOperator) { + // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check + // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves + // 'keyof T' to a literal union type and we can't recover T from that type. + type.modifiersType = instantiateType(getTypeFromTypeNode((constraintDeclaration).type), type.mapper || identityMapper); + } + else { + // Otherwise, get the declared constraint type, and if the constraint type is a type parameter, + // get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T', + // the modifiers type is T. Otherwise, the modifiers type is {}. + const declaredType = getTypeFromMappedTypeNode(type.declaration); + const constraint = getConstraintTypeFromMappedType(declaredType); + const extendedConstraint = constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint.flags & TypeFlags.Index ? instantiateType((extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType; + } } return type.modifiersType; } From cedc53eb27a9ab558c9b8e9980737bdcb04c9758 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 11 Dec 2016 17:44:29 -0800 Subject: [PATCH 033/125] Add more tests --- .../types/mapped/mappedTypeModifiers.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts b/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts index 30aa652f0d9..1fe6872965c 100644 --- a/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts +++ b/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts @@ -19,12 +19,14 @@ var v01: Pick, keyof T>; var v02: TP; var v02: { [P in keyof T]?: T[P] }; var v02: Partial; -var v02: Pick; +var v02: { [P in keyof TP]: TP[P] } +var v02: Pick; var v03: TR; var v03: { readonly [P in keyof T]: T[P] }; var v03: Readonly; -var v03: Pick; +var v03: { [P in keyof TR]: TR[P] } +var v03: Pick; var v04: TPR; var v04: { readonly [P in keyof T]?: T[P] }; @@ -32,6 +34,7 @@ var v04: Partial; var v04: Readonly; var v04: Partial>; var v04: Readonly>; +var v04: { [P in keyof TPR]: TPR[P] } var v04: Pick; type Boxified = { [P in keyof T]: { x: T[P] } }; @@ -55,12 +58,14 @@ var b01: Pick, keyof B>; var b02: BP; var b02: { [P in keyof B]?: B[P] }; var b02: Partial; -var b02: Pick; +var b02: { [P in keyof BP]: BP[P] } +var b02: Pick; var b03: BR; var b03: { readonly [P in keyof B]: B[P] }; var b03: Readonly; -var b03: Pick; +var b03: { [P in keyof BR]: BR[P] } +var b03: Pick; var b04: BPR; var b04: { readonly [P in keyof B]?: B[P] }; @@ -68,4 +73,5 @@ var b04: Partial
; var b04: Readonly; var b04: Partial>; var b04: Readonly>; -var b04: Pick; \ No newline at end of file +var b04: { [P in keyof BPR]: BPR[P] } +var b04: Pick; \ No newline at end of file From 4898b9e5d14fc14cb5a5d270875f67cdc8393512 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 11 Dec 2016 17:44:38 -0800 Subject: [PATCH 034/125] Accept new baselines --- .../reference/mappedTypeModifiers.js | 22 +- .../reference/mappedTypeModifiers.symbols | 278 ++++++++++-------- .../reference/mappedTypeModifiers.types | 62 +++- 3 files changed, 229 insertions(+), 133 deletions(-) diff --git a/tests/baselines/reference/mappedTypeModifiers.js b/tests/baselines/reference/mappedTypeModifiers.js index 9a99441b814..6291fb9c42b 100644 --- a/tests/baselines/reference/mappedTypeModifiers.js +++ b/tests/baselines/reference/mappedTypeModifiers.js @@ -19,12 +19,14 @@ var v01: Pick, keyof T>; var v02: TP; var v02: { [P in keyof T]?: T[P] }; var v02: Partial; -var v02: Pick; +var v02: { [P in keyof TP]: TP[P] } +var v02: Pick; var v03: TR; var v03: { readonly [P in keyof T]: T[P] }; var v03: Readonly; -var v03: Pick; +var v03: { [P in keyof TR]: TR[P] } +var v03: Pick; var v04: TPR; var v04: { readonly [P in keyof T]?: T[P] }; @@ -32,6 +34,7 @@ var v04: Partial; var v04: Readonly; var v04: Partial>; var v04: Readonly>; +var v04: { [P in keyof TPR]: TPR[P] } var v04: Pick; type Boxified = { [P in keyof T]: { x: T[P] } }; @@ -55,12 +58,14 @@ var b01: Pick, keyof B>; var b02: BP; var b02: { [P in keyof B]?: B[P] }; var b02: Partial; -var b02: Pick; +var b02: { [P in keyof BP]: BP[P] } +var b02: Pick; var b03: BR; var b03: { readonly [P in keyof B]: B[P] }; var b03: Readonly; -var b03: Pick; +var b03: { [P in keyof BR]: BR[P] } +var b03: Pick; var b04: BPR; var b04: { readonly [P in keyof B]?: B[P] }; @@ -68,7 +73,8 @@ var b04: Partial
; var b04: Readonly; var b04: Partial>; var b04: Readonly>; -var b04: Pick; +var b04: { [P in keyof BPR]: BPR[P] } +var b04: Pick; //// [mappedTypeModifiers.js] var v00; @@ -84,10 +90,13 @@ var v02; var v02; var v02; var v02; +var v02; var v03; var v03; var v03; var v03; +var v03; +var v04; var v04; var v04; var v04; @@ -108,6 +117,8 @@ var b02; var b02; var b02; var b02; +var b02; +var b03; var b03; var b03; var b03; @@ -119,3 +130,4 @@ var b04; var b04; var b04; var b04; +var b04; diff --git a/tests/baselines/reference/mappedTypeModifiers.symbols b/tests/baselines/reference/mappedTypeModifiers.symbols index 907f8ba8246..5138055d08b 100644 --- a/tests/baselines/reference/mappedTypeModifiers.symbols +++ b/tests/baselines/reference/mappedTypeModifiers.symbols @@ -65,249 +65,291 @@ var v01: Pick, keyof T>; >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) var v02: TP; ->v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3)) +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) >TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) var v02: { [P in keyof T]?: T[P] }; ->v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3)) +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) >P : Symbol(P, Decl(mappedTypeModifiers.ts, 18, 12)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) >P : Symbol(P, Decl(mappedTypeModifiers.ts, 18, 12)) var v02: Partial; ->v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3)) +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) -var v02: Pick; ->v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3)) +var v02: { [P in keyof TP]: TP[P] } +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 20, 12)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 20, 12)) + +var v02: Pick; +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) >TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) ->T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) var v03: TR; ->v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 22, 3), Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3)) +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) >TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) var v03: { readonly [P in keyof T]: T[P] }; ->v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 22, 3), Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 23, 21)) +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 24, 21)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 23, 21)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 24, 21)) var v03: Readonly; ->v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 22, 3), Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3)) +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) -var v03: Pick; ->v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 22, 3), Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3)) +var v03: { [P in keyof TR]: TR[P] } +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 26, 12)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 26, 12)) + +var v03: Pick; +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) >TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) ->T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) var v04: TPR; ->v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 27, 3), Decl(mappedTypeModifiers.ts, 28, 3), Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3)) +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) >TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) var v04: { readonly [P in keyof T]?: T[P] }; ->v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 27, 3), Decl(mappedTypeModifiers.ts, 28, 3), Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 28, 21)) +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 30, 21)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 28, 21)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 30, 21)) var v04: Partial; ->v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 27, 3), Decl(mappedTypeModifiers.ts, 28, 3), Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3)) +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) >TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) var v04: Readonly; ->v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 27, 3), Decl(mappedTypeModifiers.ts, 28, 3), Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3)) +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) >TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) var v04: Partial>; ->v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 27, 3), Decl(mappedTypeModifiers.ts, 28, 3), Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3)) +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) var v04: Readonly>; ->v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 27, 3), Decl(mappedTypeModifiers.ts, 28, 3), Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3)) +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +var v04: { [P in keyof TPR]: TPR[P] } +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 35, 12)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 35, 12)) + var v04: Pick; ->v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 27, 3), Decl(mappedTypeModifiers.ts, 28, 3), Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3)) +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) >TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) >T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) type Boxified = { [P in keyof T]: { x: T[P] } }; ->Boxified : Symbol(Boxified, Decl(mappedTypeModifiers.ts, 33, 28)) ->T : Symbol(T, Decl(mappedTypeModifiers.ts, 35, 14)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 35, 22)) ->T : Symbol(T, Decl(mappedTypeModifiers.ts, 35, 14)) ->x : Symbol(x, Decl(mappedTypeModifiers.ts, 35, 38)) ->T : Symbol(T, Decl(mappedTypeModifiers.ts, 35, 14)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 35, 22)) +>Boxified : Symbol(Boxified, Decl(mappedTypeModifiers.ts, 36, 28)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 38, 22)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 38, 38)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 38, 22)) type B = { a: { x: number }, b: { x: string } }; ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->a : Symbol(a, Decl(mappedTypeModifiers.ts, 37, 10)) ->x : Symbol(x, Decl(mappedTypeModifiers.ts, 37, 15)) ->b : Symbol(b, Decl(mappedTypeModifiers.ts, 37, 28)) ->x : Symbol(x, Decl(mappedTypeModifiers.ts, 37, 33)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 40, 10)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 40, 15)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 40, 28)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 40, 33)) type BP = { a?: { x: number }, b?: { x: string } }; ->BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 37, 48)) ->a : Symbol(a, Decl(mappedTypeModifiers.ts, 38, 11)) ->x : Symbol(x, Decl(mappedTypeModifiers.ts, 38, 17)) ->b : Symbol(b, Decl(mappedTypeModifiers.ts, 38, 30)) ->x : Symbol(x, Decl(mappedTypeModifiers.ts, 38, 36)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 41, 11)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 41, 17)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 41, 30)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 41, 36)) type BR = { readonly a: { x: number }, readonly b: { x: string } }; ->BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 38, 51)) ->a : Symbol(a, Decl(mappedTypeModifiers.ts, 39, 11)) ->x : Symbol(x, Decl(mappedTypeModifiers.ts, 39, 25)) ->b : Symbol(b, Decl(mappedTypeModifiers.ts, 39, 38)) ->x : Symbol(x, Decl(mappedTypeModifiers.ts, 39, 52)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 42, 11)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 42, 25)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 42, 38)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 42, 52)) type BPR = { readonly a?: { x: number }, readonly b?: { x: string } }; ->BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 39, 67)) ->a : Symbol(a, Decl(mappedTypeModifiers.ts, 40, 12)) ->x : Symbol(x, Decl(mappedTypeModifiers.ts, 40, 27)) ->b : Symbol(b, Decl(mappedTypeModifiers.ts, 40, 40)) ->x : Symbol(x, Decl(mappedTypeModifiers.ts, 40, 55)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 43, 12)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 43, 27)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 43, 40)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 43, 55)) var b00: "a" | "b"; ->b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 42, 3), Decl(mappedTypeModifiers.ts, 43, 3), Decl(mappedTypeModifiers.ts, 44, 3), Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3)) +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) var b00: keyof B; ->b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 42, 3), Decl(mappedTypeModifiers.ts, 43, 3), Decl(mappedTypeModifiers.ts, 44, 3), Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) var b00: keyof BP; ->b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 42, 3), Decl(mappedTypeModifiers.ts, 43, 3), Decl(mappedTypeModifiers.ts, 44, 3), Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3)) ->BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 37, 48)) +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) var b00: keyof BR; ->b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 42, 3), Decl(mappedTypeModifiers.ts, 43, 3), Decl(mappedTypeModifiers.ts, 44, 3), Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3)) ->BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 38, 51)) +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) var b00: keyof BPR; ->b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 42, 3), Decl(mappedTypeModifiers.ts, 43, 3), Decl(mappedTypeModifiers.ts, 44, 3), Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3)) ->BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 39, 67)) +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) var b01: B; ->b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3), Decl(mappedTypeModifiers.ts, 50, 3), Decl(mappedTypeModifiers.ts, 51, 3)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) var b01: { [P in keyof B]: B[P] }; ->b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3), Decl(mappedTypeModifiers.ts, 50, 3), Decl(mappedTypeModifiers.ts, 51, 3)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 49, 12)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 49, 12)) +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 52, 12)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 52, 12)) var b01: Pick; ->b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3), Decl(mappedTypeModifiers.ts, 50, 3), Decl(mappedTypeModifiers.ts, 51, 3)) +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) var b01: Pick, keyof B>; ->b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3), Decl(mappedTypeModifiers.ts, 50, 3), Decl(mappedTypeModifiers.ts, 51, 3)) +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) var b02: BP; ->b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3), Decl(mappedTypeModifiers.ts, 55, 3), Decl(mappedTypeModifiers.ts, 56, 3)) ->BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 37, 48)) +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) var b02: { [P in keyof B]?: B[P] }; ->b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3), Decl(mappedTypeModifiers.ts, 55, 3), Decl(mappedTypeModifiers.ts, 56, 3)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 54, 12)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 54, 12)) +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 57, 12)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 57, 12)) var b02: Partial; ->b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3), Decl(mappedTypeModifiers.ts, 55, 3), Decl(mappedTypeModifiers.ts, 56, 3)) +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) -var b02: Pick; ->b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3), Decl(mappedTypeModifiers.ts, 55, 3), Decl(mappedTypeModifiers.ts, 56, 3)) +var b02: { [P in keyof BP]: BP[P] } +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 59, 12)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 59, 12)) + +var b02: Pick; +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) ->BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 37, 48)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) var b03: BR; ->b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3), Decl(mappedTypeModifiers.ts, 61, 3)) ->BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 38, 51)) +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) var b03: { readonly [P in keyof B]: B[P] }; ->b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3), Decl(mappedTypeModifiers.ts, 61, 3)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 59, 21)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 59, 21)) +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 63, 21)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 63, 21)) var b03: Readonly; ->b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3), Decl(mappedTypeModifiers.ts, 61, 3)) +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) -var b03: Pick; ->b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3), Decl(mappedTypeModifiers.ts, 61, 3)) +var b03: { [P in keyof BR]: BR[P] } +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 65, 12)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 65, 12)) + +var b03: Pick; +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) ->BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 38, 51)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) var b04: BPR; ->b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3)) ->BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 39, 67)) +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) var b04: { readonly [P in keyof B]?: B[P] }; ->b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 64, 21)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) ->P : Symbol(P, Decl(mappedTypeModifiers.ts, 64, 21)) +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 69, 21)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 69, 21)) var b04: Partial
; ->b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3)) +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) ->BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 38, 51)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) var b04: Readonly; ->b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3)) +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) ->BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 37, 48)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) var b04: Partial>; ->b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3)) +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) var b04: Readonly>; ->b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3)) +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) -var b04: Pick; ->b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3)) +var b04: { [P in keyof BPR]: BPR[P] } +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 74, 12)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 74, 12)) + +var b04: Pick; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) ->BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 39, 67)) ->B : Symbol(B, Decl(mappedTypeModifiers.ts, 35, 51)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) diff --git a/tests/baselines/reference/mappedTypeModifiers.types b/tests/baselines/reference/mappedTypeModifiers.types index befda7e371e..7a30e227bd6 100644 --- a/tests/baselines/reference/mappedTypeModifiers.types +++ b/tests/baselines/reference/mappedTypeModifiers.types @@ -80,11 +80,18 @@ var v02: Partial; >Partial : Partial >T : T -var v02: Pick; +var v02: { [P in keyof TP]: TP[P] } +>v02 : TP +>P : P +>TP : TP +>TP : TP +>P : P + +var v02: Pick; >v02 : TP >Pick : Pick >TP : TP ->T : T +>TP : TP var v03: TR; >v03 : TR @@ -102,11 +109,18 @@ var v03: Readonly; >Readonly : Readonly >T : T -var v03: Pick; +var v03: { [P in keyof TR]: TR[P] } +>v03 : TR +>P : P +>TR : TR +>TR : TR +>P : P + +var v03: Pick; >v03 : TR >Pick : Pick >TR : TR ->T : T +>TR : TR var v04: TPR; >v04 : TPR @@ -141,6 +155,13 @@ var v04: Readonly>; >Partial : Partial >T : T +var v04: { [P in keyof TPR]: TPR[P] } +>v04 : TPR +>P : P +>TPR : TPR +>TPR : TPR +>P : P + var v04: Pick; >v04 : TPR >Pick : Pick @@ -244,11 +265,18 @@ var b02: Partial; >Partial : Partial >B : B -var b02: Pick; +var b02: { [P in keyof BP]: BP[P] } +>b02 : BP +>P : P +>BP : BP +>BP : BP +>P : P + +var b02: Pick; >b02 : BP >Pick : Pick >BP : BP ->B : B +>BP : BP var b03: BR; >b03 : BR @@ -266,11 +294,18 @@ var b03: Readonly; >Readonly : Readonly >B : B -var b03: Pick; +var b03: { [P in keyof BR]: BR[P] } +>b03 : BR +>P : P +>BR : BR +>BR : BR +>P : P + +var b03: Pick; >b03 : BR >Pick : Pick >BR : BR ->B : B +>BR : BR var b04: BPR; >b04 : BPR @@ -305,9 +340,16 @@ var b04: Readonly>; >Partial : Partial >B : B -var b04: Pick; +var b04: { [P in keyof BPR]: BPR[P] } +>b04 : BPR +>P : P +>BPR : BPR +>BPR : BPR +>P : P + +var b04: Pick; >b04 : BPR >Pick : Pick >BPR : BPR ->B : B +>BPR : BPR From 83eddb549e2b411cfffc77bbdc6ea9af2bdc8e05 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 12 Dec 2016 07:24:23 -0800 Subject: [PATCH 035/125] Produce an error for an augmentation of an untyped module even if `moduleNotFoundError` is not defined --- src/compiler/checker.ts | 3 +-- ...dModuleImport_withAugmentation2.errors.txt | 19 +++++++++++++++++++ .../untypedModuleImport_withAugmentation2.js | 19 +++++++++++++++++++ .../untypedModuleImport_withAugmentation2.ts | 14 ++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt create mode 100644 tests/baselines/reference/untypedModuleImport_withAugmentation2.js create mode 100644 tests/cases/compiler/untypedModuleImport_withAugmentation2.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 075f3062de8..f9398da74a6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1439,9 +1439,8 @@ namespace ts { // May be an untyped module. If so, ignore resolutionDiagnostic. if (!isRelative && resolvedModule && !extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - Debug.assert(!!moduleNotFoundError); const diag = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } else if (compilerOptions.noImplicitAny && moduleNotFoundError) { error(errorNode, diff --git a/tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt b/tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt new file mode 100644 index 00000000000..628533b93d5 --- /dev/null +++ b/tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt @@ -0,0 +1,19 @@ +/node_modules/augmenter/index.d.ts(3,16): error TS2665: Invalid module name in augmentation. Module 'js' resolves to an untyped module at '/node_modules/js/index.js', which cannot be augmented. + + +==== /a.ts (0 errors) ==== + import { } from "augmenter"; + +==== /node_modules/augmenter/index.d.ts (1 errors) ==== + // This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`. + + declare module "js" { + ~~~~ +!!! error TS2665: Invalid module name in augmentation. Module 'js' resolves to an untyped module at '/node_modules/js/index.js', which cannot be augmented. + export const j: number; + } + export {}; + +==== /node_modules/js/index.js (0 errors) ==== + This file is not processed. + \ No newline at end of file diff --git a/tests/baselines/reference/untypedModuleImport_withAugmentation2.js b/tests/baselines/reference/untypedModuleImport_withAugmentation2.js new file mode 100644 index 00000000000..f9fa7443224 --- /dev/null +++ b/tests/baselines/reference/untypedModuleImport_withAugmentation2.js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/untypedModuleImport_withAugmentation2.ts] //// + +//// [index.d.ts] +// This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`. + +declare module "js" { + export const j: number; +} +export {}; + +//// [index.js] +This file is not processed. + +//// [a.ts] +import { } from "augmenter"; + + +//// [a.js] +"use strict"; diff --git a/tests/cases/compiler/untypedModuleImport_withAugmentation2.ts b/tests/cases/compiler/untypedModuleImport_withAugmentation2.ts new file mode 100644 index 00000000000..8cbf75b662b --- /dev/null +++ b/tests/cases/compiler/untypedModuleImport_withAugmentation2.ts @@ -0,0 +1,14 @@ +// @noImplicitReferences: true +// This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`. + +// @Filename: /node_modules/augmenter/index.d.ts +declare module "js" { + export const j: number; +} +export {}; + +// @Filename: /node_modules/js/index.js +This file is not processed. + +// @Filename: /a.ts +import { } from "augmenter"; From a604d84f5c9e2253f5b2c52f87c8e2b9cb2181f2 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 12 Dec 2016 10:17:07 -0800 Subject: [PATCH 036/125] guard against visiting the same symbol table multiple times (#12818) --- src/compiler/checker.ts | 62 ++++++++++++------- .../reference/circularReferenceInImport.js | 27 ++++++++ .../circularReferenceInImport.symbols | 23 +++++++ .../reference/circularReferenceInImport.types | 24 +++++++ .../compiler/circularReferenceInImport.ts | 15 +++++ 5 files changed, 127 insertions(+), 24 deletions(-) create mode 100644 tests/baselines/reference/circularReferenceInImport.js create mode 100644 tests/baselines/reference/circularReferenceInImport.symbols create mode 100644 tests/baselines/reference/circularReferenceInImport.types create mode 100644 tests/cases/compiler/circularReferenceInImport.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 075f3062de8..c4fb6c8f0a1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1742,7 +1742,19 @@ namespace ts { } function getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] { - function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable): Symbol[] { + function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + + function getAccessibleSymbolChainFromSymbolTableWorker(symbols: SymbolTable, visitedSymbolTables: SymbolTable[]): Symbol[] { + if (contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + const result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; + function canQualifySymbol(symbolFromSymbolTable: Symbol, meaning: SymbolFlags) { // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { @@ -1764,34 +1776,36 @@ namespace ts { } } - // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } + function trySymbolTable(symbols: SymbolTable) { + // If symbol is directly available by its name in the symbol table + if (isAccessible(symbols[symbol.name])) { + return [symbol]; + } - // Check if symbol is any of the alias - return forEachProperty(symbols, symbolFromSymbolTable => { - if (symbolFromSymbolTable.flags & SymbolFlags.Alias - && symbolFromSymbolTable.name !== "export=" - && !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) { - if (!useOnlyExternalAliasing || // We can use any type of alias to get the name - // Is this external alias, then use it to name - ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) { + // Check if symbol is any of the alias + return forEachProperty(symbols, symbolFromSymbolTable => { + if (symbolFromSymbolTable.flags & SymbolFlags.Alias + && symbolFromSymbolTable.name !== "export=" + && !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) { + if (!useOnlyExternalAliasing || // We can use any type of alias to get the name + // Is this external alias, then use it to name + ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) { - const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } + const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } - // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain - // but only if the symbolFromSymbolTable can be qualified - const accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain + // but only if the symbolFromSymbolTable can be qualified + const accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { diff --git a/tests/baselines/reference/circularReferenceInImport.js b/tests/baselines/reference/circularReferenceInImport.js new file mode 100644 index 00000000000..a9cf0925c34 --- /dev/null +++ b/tests/baselines/reference/circularReferenceInImport.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/circularReferenceInImport.ts] //// + +//// [db.d.ts] + +declare namespace Db { + export import Types = Db; +} + +export = Db; + +//// [app.ts] +import * as Db from "./db" + +export function foo() { + return new Object() +} + +//// [app.js] +"use strict"; +function foo() { + return new Object(); +} +exports.foo = foo; + + +//// [app.d.ts] +export declare function foo(): Object; diff --git a/tests/baselines/reference/circularReferenceInImport.symbols b/tests/baselines/reference/circularReferenceInImport.symbols new file mode 100644 index 00000000000..b74ac14b5ab --- /dev/null +++ b/tests/baselines/reference/circularReferenceInImport.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/db.d.ts === + +declare namespace Db { +>Db : Symbol(Types, Decl(db.d.ts, 0, 0)) + + export import Types = Db; +>Types : Symbol(Types, Decl(db.d.ts, 1, 22)) +>Db : Symbol(Types, Decl(db.d.ts, 0, 0)) +} + +export = Db; +>Db : Symbol(Db, Decl(db.d.ts, 0, 0)) + +=== tests/cases/compiler/app.ts === +import * as Db from "./db" +>Db : Symbol(Db, Decl(app.ts, 0, 6)) + +export function foo() { +>foo : Symbol(foo, Decl(app.ts, 0, 26)) + + return new Object() +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +} diff --git a/tests/baselines/reference/circularReferenceInImport.types b/tests/baselines/reference/circularReferenceInImport.types new file mode 100644 index 00000000000..d8db7f56231 --- /dev/null +++ b/tests/baselines/reference/circularReferenceInImport.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/db.d.ts === + +declare namespace Db { +>Db : typeof Types + + export import Types = Db; +>Types : typeof Types +>Db : typeof Types +} + +export = Db; +>Db : typeof Db + +=== tests/cases/compiler/app.ts === +import * as Db from "./db" +>Db : typeof Db + +export function foo() { +>foo : () => Object + + return new Object() +>new Object() : Object +>Object : ObjectConstructor +} diff --git a/tests/cases/compiler/circularReferenceInImport.ts b/tests/cases/compiler/circularReferenceInImport.ts new file mode 100644 index 00000000000..869beeaa3a9 --- /dev/null +++ b/tests/cases/compiler/circularReferenceInImport.ts @@ -0,0 +1,15 @@ +// @declaration: true + +// @filename: db.d.ts +declare namespace Db { + export import Types = Db; +} + +export = Db; + +// @filename: app.ts +import * as Db from "./db" + +export function foo() { + return new Object() +} \ No newline at end of file From 496a14a02155d30277c324e16166ea7a1f4bffe5 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 12 Dec 2016 10:18:30 -0800 Subject: [PATCH 037/125] create new lexical environment for the body of converted loop (#12831) --- src/compiler/transformers/es2015.ts | 9 +++- .../reference/capturedLetConstInLoop9.js | 3 +- .../newLexicalEnvironmentForConvertedLoop.js | 31 +++++++++++++ ...LexicalEnvironmentForConvertedLoop.symbols | 30 +++++++++++++ ...ewLexicalEnvironmentForConvertedLoop.types | 45 +++++++++++++++++++ .../newLexicalEnvironmentForConvertedLoop.ts | 13 ++++++ 6 files changed, 128 insertions(+), 3 deletions(-) create mode 100644 tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js create mode 100644 tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols create mode 100644 tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types create mode 100644 tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index c1398f75da6..ad016972d0d 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -2286,14 +2286,19 @@ namespace ts { } } + startLexicalEnvironment(); let loopBody = visitNode(node.statement, visitor, isStatement); + const lexicalEnvironment = endLexicalEnvironment(); const currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { + if (loopOutParameters.length || lexicalEnvironment) { const statements = isBlock(loopBody) ? (loopBody).statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements); + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements); + } + addRange(statements, lexicalEnvironment) loopBody = createBlock(statements, /*location*/ undefined, /*multiline*/ true); } diff --git a/tests/baselines/reference/capturedLetConstInLoop9.js b/tests/baselines/reference/capturedLetConstInLoop9.js index 84f9a021054..8f88855a9ad 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.js +++ b/tests/baselines/reference/capturedLetConstInLoop9.js @@ -208,6 +208,7 @@ function foo() { } (function () { return b; }); return { value: 100 }; + var _a; }; for (var _c = 0, _d = []; _c < _d.length; _c++) { var b = _d[_c]; @@ -221,6 +222,7 @@ function foo() { } } (function () { return a; }); + var _b; }; var arguments_1 = arguments, x, z, x1, z1; l0: for (var _i = 0, _a = []; _i < _a.length; _i++) { @@ -238,7 +240,6 @@ function foo() { use(z); use(x1); use(z1); - var _b, _a; } function foo2() { for (var _i = 0, _a = []; _i < _a.length; _i++) { diff --git a/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js new file mode 100644 index 00000000000..8525352d415 --- /dev/null +++ b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js @@ -0,0 +1,31 @@ +//// [newLexicalEnvironmentForConvertedLoop.ts] +function baz(x: any) { + return [[x, x]]; +} + +function foo(set: any) { + for (const [value, i] of baz(set.values)) { + const bar: any = []; + (() => bar); + + set.values.push(...[]); + } +}; + +//// [newLexicalEnvironmentForConvertedLoop.js] +function baz(x) { + return [[x, x]]; +} +function foo(set) { + var _loop_1 = function (value, i) { + var bar = []; + (function () { return bar; }); + (_a = set.values).push.apply(_a, []); + var _a; + }; + for (var _i = 0, _a = baz(set.values); _i < _a.length; _i++) { + var _b = _a[_i], value = _b[0], i = _b[1]; + _loop_1(value, i); + } +} +; diff --git a/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols new file mode 100644 index 00000000000..19d657218d6 --- /dev/null +++ b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts === +function baz(x: any) { +>baz : Symbol(baz, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 0)) +>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13)) + + return [[x, x]]; +>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13)) +>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13)) +} + +function foo(set: any) { +>foo : Symbol(foo, Decl(newLexicalEnvironmentForConvertedLoop.ts, 2, 1)) +>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13)) + + for (const [value, i] of baz(set.values)) { +>value : Symbol(value, Decl(newLexicalEnvironmentForConvertedLoop.ts, 5, 14)) +>i : Symbol(i, Decl(newLexicalEnvironmentForConvertedLoop.ts, 5, 20)) +>baz : Symbol(baz, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 0)) +>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13)) + + const bar: any = []; +>bar : Symbol(bar, Decl(newLexicalEnvironmentForConvertedLoop.ts, 6, 9)) + + (() => bar); +>bar : Symbol(bar, Decl(newLexicalEnvironmentForConvertedLoop.ts, 6, 9)) + + set.values.push(...[]); +>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13)) + } +}; diff --git a/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types new file mode 100644 index 00000000000..dcc6f1375a3 --- /dev/null +++ b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts === +function baz(x: any) { +>baz : (x: any) => any[][] +>x : any + + return [[x, x]]; +>[[x, x]] : any[][] +>[x, x] : any[] +>x : any +>x : any +} + +function foo(set: any) { +>foo : (set: any) => void +>set : any + + for (const [value, i] of baz(set.values)) { +>value : any +>i : any +>baz(set.values) : any[][] +>baz : (x: any) => any[][] +>set.values : any +>set : any +>values : any + + const bar: any = []; +>bar : any +>[] : undefined[] + + (() => bar); +>(() => bar) : () => any +>() => bar : () => any +>bar : any + + set.values.push(...[]); +>set.values.push(...[]) : any +>set.values.push : any +>set.values : any +>set : any +>values : any +>push : any +>...[] : undefined +>[] : undefined[] + } +}; diff --git a/tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts b/tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts new file mode 100644 index 00000000000..25b351d62a1 --- /dev/null +++ b/tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts @@ -0,0 +1,13 @@ +// @target: es5 +function baz(x: any) { + return [[x, x]]; +} + +function foo(set: any) { + for (const [value, i] of baz(set.values)) { + const bar: any = []; + (() => bar); + + set.values.push(...[]); + } +}; \ No newline at end of file From 05b17255f69b11ca2911762e3a1fb6aa57854dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C4=81rlis=20Ga=C5=86=C4=A3is?= Date: Mon, 12 Dec 2016 21:40:00 +0200 Subject: [PATCH 038/125] Fixed missing whitespace in jsDoc comments. Fixes https://github.com/Microsoft/TypeScript/issues/12236 --- src/compiler/parser.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 4aefa160077..0100f9538bc 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -6358,7 +6358,9 @@ namespace ts { case SyntaxKind.WhitespaceTrivia: // only collect whitespace if we're already saving comments or have just crossed the comment indent margin const whitespace = scanner.getTokenText(); - if (state === JSDocState.SavingComments || margin !== undefined && indent + whitespace.length > margin) { + if (state === JSDocState.SavingComments) { + comments.push(whitespace); + } else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; From 19070648eb53614e38a456eb3cce0231486896bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C4=81rlis=20Ga=C5=86=C4=A3is?= Date: Mon, 12 Dec 2016 22:33:45 +0200 Subject: [PATCH 039/125] Added test for https://github.com/Microsoft/TypeScript/issues/12236 --- src/compiler/parser.ts | 3 ++- tests/cases/fourslash/commentsLinePreservation.ts | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 0100f9538bc..0fae515d837 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -6360,7 +6360,8 @@ namespace ts { const whitespace = scanner.getTokenText(); if (state === JSDocState.SavingComments) { comments.push(whitespace); - } else if (margin !== undefined && indent + whitespace.length > margin) { + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; diff --git a/tests/cases/fourslash/commentsLinePreservation.ts b/tests/cases/fourslash/commentsLinePreservation.ts index 6d085f71f80..78c86361162 100644 --- a/tests/cases/fourslash/commentsLinePreservation.ts +++ b/tests/cases/fourslash/commentsLinePreservation.ts @@ -105,6 +105,13 @@ //// * second time information about the param again //// */ ////function /*l*/l(param1: string) { /*9*/param1 = "hello"; } +//// /** +//// * This is firstLine +//// This is second Line +//// @param param1 first Line text +//// second line text +//// */ +////function /*m*/m(param1: string) { /*10*/param1 = "hello"; } verify.quickInfos({ a: ["var a: string", "This is firstLine\nThis is second Line\n\nThis is fourth Line"], @@ -136,5 +143,8 @@ verify.quickInfos({ 8: ["(parameter) param1: string", "hello "], l: ["function l(param1: string): void", "This is firstLine\nThis is second Line"], - 9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"] + 9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"], + + m: ["function m(param1: string): void", "This is firstLine\nThis is second Line"], + 10: ["(parameter) param1: string", "first Line text\nsecond line text"] }); From d0506735e370be1a9892e77318e18482bdc96ee1 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 12 Dec 2016 12:37:06 -0800 Subject: [PATCH 040/125] elaborate check before converting fresh literal type to regular (#12595) --- src/compiler/checker.ts | 21 ++++++++++++- .../reference/nestedFreshLiteral.errors.txt | 31 +++++++++++++++++++ .../baselines/reference/nestedFreshLiteral.js | 19 ++++++++++++ tests/cases/compiler/nestedFreshLiteral.ts | 14 +++++++++ 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/nestedFreshLiteral.errors.txt create mode 100644 tests/baselines/reference/nestedFreshLiteral.js create mode 100644 tests/cases/compiler/nestedFreshLiteral.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cd2b9b6f76b..c7b5b0f77c7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7211,6 +7211,25 @@ namespace ts { } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type: Type): boolean { + if (!(type.flags & TypeFlags.UnionOrIntersection)) { + return false; + } + // at this point we know that this is union or intersection type possibly with nullable constituents. + // check if we still will have compound type if we ignore nullable components. + let seenNonNullable = false; + for (const t of (type).types) { + if (t.flags & TypeFlags.Nullable) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } + // Compare two types and return // Ternary.True if they are related with no assumptions, // Ternary.Maybe if they are related with assumptions of other relationships, or @@ -7243,7 +7262,7 @@ namespace ts { // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - if (target.flags & TypeFlags.UnionOrIntersection) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } diff --git a/tests/baselines/reference/nestedFreshLiteral.errors.txt b/tests/baselines/reference/nestedFreshLiteral.errors.txt new file mode 100644 index 00000000000..6aff94ac0a6 --- /dev/null +++ b/tests/baselines/reference/nestedFreshLiteral.errors.txt @@ -0,0 +1,31 @@ +tests/cases/compiler/nestedFreshLiteral.ts(12,21): error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'. + Types of property 'nested' are incompatible. + Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector | undefined'. + Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'. + Types of property 'prop' are incompatible. + Type '{ colour: string; }' is not assignable to type 'CSSProps'. + Object literal may only specify known properties, and 'colour' does not exist in type 'CSSProps'. + + +==== tests/cases/compiler/nestedFreshLiteral.ts (1 errors) ==== + interface CSSProps { + color?: string + } + interface NestedCSSProps { + nested?: NestedSelector + } + interface NestedSelector { + prop: CSSProps; + } + + let stylen: NestedCSSProps = { + nested: { prop: { colour: 'red' } } + ~~~~~~~~~~~~~ +!!! error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'. +!!! error TS2322: Types of property 'nested' are incompatible. +!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector | undefined'. +!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'. +!!! error TS2322: Types of property 'prop' are incompatible. +!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'CSSProps'. +!!! error TS2322: Object literal may only specify known properties, and 'colour' does not exist in type 'CSSProps'. + } \ No newline at end of file diff --git a/tests/baselines/reference/nestedFreshLiteral.js b/tests/baselines/reference/nestedFreshLiteral.js new file mode 100644 index 00000000000..36d4743deae --- /dev/null +++ b/tests/baselines/reference/nestedFreshLiteral.js @@ -0,0 +1,19 @@ +//// [nestedFreshLiteral.ts] +interface CSSProps { + color?: string +} +interface NestedCSSProps { + nested?: NestedSelector +} +interface NestedSelector { + prop: CSSProps; +} + +let stylen: NestedCSSProps = { + nested: { prop: { colour: 'red' } } +} + +//// [nestedFreshLiteral.js] +var stylen = { + nested: { prop: { colour: 'red' } } +}; diff --git a/tests/cases/compiler/nestedFreshLiteral.ts b/tests/cases/compiler/nestedFreshLiteral.ts new file mode 100644 index 00000000000..bf3bf5df8d3 --- /dev/null +++ b/tests/cases/compiler/nestedFreshLiteral.ts @@ -0,0 +1,14 @@ +// @strictNullChecks: true +interface CSSProps { + color?: string +} +interface NestedCSSProps { + nested?: NestedSelector +} +interface NestedSelector { + prop: CSSProps; +} + +let stylen: NestedCSSProps = { + nested: { prop: { colour: 'red' } } +} \ No newline at end of file From aa4a0b64698c7e00e8ac801c8cf48decac3478ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C4=81rlis=20Ga=C5=86=C4=A3is?= Date: Tue, 13 Dec 2016 00:05:16 +0200 Subject: [PATCH 041/125] Fixed jsDoc parser - no longer omits asterisks in the middle (if the line does not start with asterisk) and additional case for whitespaces being ignored --- src/compiler/parser.ts | 4 +++- tests/cases/fourslash/commentsLinePreservation.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 0fae515d837..2f0d6a4d975 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -6337,7 +6337,7 @@ namespace ts { break; case SyntaxKind.AsteriskToken: const asterisk = scanner.getTokenText(); - if (state === JSDocState.SawAsterisk) { + if (state === JSDocState.SawAsterisk || state === JSDocState.SavingComments) { // If we've already seen an asterisk, then we can no longer parse a tag on this line state = JSDocState.SavingComments; pushComment(asterisk); @@ -6369,6 +6369,8 @@ namespace ts { case SyntaxKind.EndOfFileToken: break; default: + // anything other than whitespace or asterisk at the beginning of the line starts the comment text + state = JSDocState.SavingComments; pushComment(scanner.getTokenText()); break; } diff --git a/tests/cases/fourslash/commentsLinePreservation.ts b/tests/cases/fourslash/commentsLinePreservation.ts index 78c86361162..3f60bdbf43b 100644 --- a/tests/cases/fourslash/commentsLinePreservation.ts +++ b/tests/cases/fourslash/commentsLinePreservation.ts @@ -108,6 +108,7 @@ //// /** //// * This is firstLine //// This is second Line +//// [1]: third * line //// @param param1 first Line text //// second line text //// */ @@ -145,6 +146,6 @@ verify.quickInfos({ l: ["function l(param1: string): void", "This is firstLine\nThis is second Line"], 9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"], - m: ["function m(param1: string): void", "This is firstLine\nThis is second Line"], + m: ["function m(param1: string): void", "This is firstLine\nThis is second Line\n[1]: third * line"], 10: ["(parameter) param1: string", "first Line text\nsecond line text"] }); From 891159c6ac532fb090c6a01667c94d060b2623ce Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 12 Dec 2016 14:02:14 -0800 Subject: [PATCH 042/125] Make some code in checker neater --- src/compiler/checker.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ebe6693eb40..0fc7b0cde87 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -466,9 +466,7 @@ namespace ts { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } - forEach(source.declarations, node => { - target.declarations.push(node); - }); + addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = createMap(); mergeSymbolTable(target.members, source.members); @@ -1100,7 +1098,7 @@ namespace ts { } function getDeclarationOfAliasSymbol(symbol: Symbol): Declaration | undefined { - return forEach(symbol.declarations, d => isAliasSymbolDeclaration(d) ? d : undefined); + return find(symbol.declarations, isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node: ImportEqualsDeclaration): Symbol { From e5e1533d49a8415f16cad7a54e79982e541b9fe7 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 13 Dec 2016 11:46:06 -0800 Subject: [PATCH 043/125] mark types used in decorator metadata as referenced (#12890) --- src/compiler/checker.ts | 12 +- src/compiler/transformers/ts.ts | 18 --- src/compiler/utilities.ts | 17 +++ ...orMetadataRestParameterWithImportedType.js | 112 ++++++++++++++++++ ...adataRestParameterWithImportedType.symbols | 77 ++++++++++++ ...etadataRestParameterWithImportedType.types | 82 +++++++++++++ ...orMetadataRestParameterWithImportedType.ts | 42 +++++++ 7 files changed, 339 insertions(+), 21 deletions(-) create mode 100644 tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js create mode 100644 tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols create mode 100644 tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types create mode 100644 tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 686efaa758d..e6d21588db3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16581,6 +16581,10 @@ namespace ts { } } + function getParameterTypeNodeForDecoratorCheck(node: ParameterDeclaration): TypeNode { + return node.dotDotDotToken ? getRestParameterElementType(node.type) : node.type; + } + /** Check the decorators of a node */ function checkDecorators(node: Node): void { if (!node.decorators) { @@ -16612,7 +16616,7 @@ namespace ts { const constructor = getFirstConstructorWithBody(node); if (constructor) { for (const parameter of constructor.parameters) { - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; @@ -16621,15 +16625,17 @@ namespace ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: for (const parameter of (node).parameters) { - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced((node).type); break; case SyntaxKind.PropertyDeclaration: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; case SyntaxKind.Parameter: - markTypeNodeAsReferenced((node).type); + markTypeNodeAsReferenced((node).type); break; } } diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index a357781ca30..877131b369c 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1577,24 +1577,6 @@ namespace ts { } } - /** - * Gets the most likely element type for a TypeNode. This is not an exhaustive test - * as it assumes a rest argument can only be an array type (either T[], or Array). - * - * @param node The type node. - */ - function getRestParameterElementType(node: TypeNode) { - if (node && node.kind === SyntaxKind.ArrayType) { - return (node).elementType; - } - else if (node && node.kind === SyntaxKind.TypeReference) { - return singleOrUndefined((node).typeArguments); - } - else { - return undefined; - } - } - /** * Serializes the types of the parameters of a node for use with decorator type metadata. * diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 3dd7054a405..6f491f6708f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -803,6 +803,23 @@ namespace ts { } } + /** + * Gets the most likely element type for a TypeNode. This is not an exhaustive test + * as it assumes a rest argument can only be an array type (either T[], or Array). + * + * @param node The type node. + */ + export function getRestParameterElementType(node: TypeNode) { + if (node && node.kind === SyntaxKind.ArrayType) { + return (node).elementType; + } + else if (node && node.kind === SyntaxKind.TypeReference) { + return singleOrUndefined((node).typeArguments); + } + else { + return undefined; + } + } export function isVariableLike(node: Node): node is VariableLikeDeclaration { if (node) { diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js new file mode 100644 index 00000000000..be249800d57 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js @@ -0,0 +1,112 @@ +//// [tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts] //// + +//// [aux.ts] + +export class SomeClass { + field: string; +} + +//// [aux1.ts] +export class SomeClass1 { + field: string; +} + +//// [aux2.ts] +export class SomeClass2 { + field: string; +} +//// [main.ts] +import { SomeClass } from './aux'; +import { SomeClass1 } from './aux1'; + +function annotation(): ClassDecorator { + return (target: any): void => { }; +} + +function annotation1(): MethodDecorator { + return (target: any): void => { }; +} + +@annotation() +export class ClassA { + array: SomeClass[]; + + constructor(...init: SomeClass[]) { + this.array = init; + } + + @annotation1() + foo(... args: SomeClass1[]) { + } +} + +//// [aux.js] +"use strict"; +var SomeClass = (function () { + function SomeClass() { + } + return SomeClass; +}()); +exports.SomeClass = SomeClass; +//// [aux1.js] +"use strict"; +var SomeClass1 = (function () { + function SomeClass1() { + } + return SomeClass1; +}()); +exports.SomeClass1 = SomeClass1; +//// [aux2.js] +"use strict"; +var SomeClass2 = (function () { + function SomeClass2() { + } + return SomeClass2; +}()); +exports.SomeClass2 = SomeClass2; +//// [main.js] +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var aux_1 = require("./aux"); +var aux1_1 = require("./aux1"); +function annotation() { + return function (target) { }; +} +function annotation1() { + return function (target) { }; +} +var ClassA = (function () { + function ClassA() { + var init = []; + for (var _i = 0; _i < arguments.length; _i++) { + init[_i] = arguments[_i]; + } + this.array = init; + } + ClassA.prototype.foo = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + }; + return ClassA; +}()); +__decorate([ + annotation1(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [aux1_1.SomeClass1]), + __metadata("design:returntype", void 0) +], ClassA.prototype, "foo", null); +ClassA = __decorate([ + annotation(), + __metadata("design:paramtypes", [aux_1.SomeClass]) +], ClassA); +exports.ClassA = ClassA; diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols new file mode 100644 index 00000000000..9bd293cdfcb --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols @@ -0,0 +1,77 @@ +=== tests/cases/compiler/aux.ts === + +export class SomeClass { +>SomeClass : Symbol(SomeClass, Decl(aux.ts, 0, 0)) + + field: string; +>field : Symbol(SomeClass.field, Decl(aux.ts, 1, 24)) +} + +=== tests/cases/compiler/aux1.ts === +export class SomeClass1 { +>SomeClass1 : Symbol(SomeClass1, Decl(aux1.ts, 0, 0)) + + field: string; +>field : Symbol(SomeClass1.field, Decl(aux1.ts, 0, 25)) +} + +=== tests/cases/compiler/aux2.ts === +export class SomeClass2 { +>SomeClass2 : Symbol(SomeClass2, Decl(aux2.ts, 0, 0)) + + field: string; +>field : Symbol(SomeClass2.field, Decl(aux2.ts, 0, 25)) +} +=== tests/cases/compiler/main.ts === +import { SomeClass } from './aux'; +>SomeClass : Symbol(SomeClass, Decl(main.ts, 0, 8)) + +import { SomeClass1 } from './aux1'; +>SomeClass1 : Symbol(SomeClass1, Decl(main.ts, 1, 8)) + +function annotation(): ClassDecorator { +>annotation : Symbol(annotation, Decl(main.ts, 1, 36)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) + + return (target: any): void => { }; +>target : Symbol(target, Decl(main.ts, 4, 12)) +} + +function annotation1(): MethodDecorator { +>annotation1 : Symbol(annotation1, Decl(main.ts, 5, 1)) +>MethodDecorator : Symbol(MethodDecorator, Decl(lib.d.ts, --, --)) + + return (target: any): void => { }; +>target : Symbol(target, Decl(main.ts, 8, 12)) +} + +@annotation() +>annotation : Symbol(annotation, Decl(main.ts, 1, 36)) + +export class ClassA { +>ClassA : Symbol(ClassA, Decl(main.ts, 9, 1)) + + array: SomeClass[]; +>array : Symbol(ClassA.array, Decl(main.ts, 12, 21)) +>SomeClass : Symbol(SomeClass, Decl(main.ts, 0, 8)) + + constructor(...init: SomeClass[]) { +>init : Symbol(init, Decl(main.ts, 15, 16)) +>SomeClass : Symbol(SomeClass, Decl(main.ts, 0, 8)) + + this.array = init; +>this.array : Symbol(ClassA.array, Decl(main.ts, 12, 21)) +>this : Symbol(ClassA, Decl(main.ts, 9, 1)) +>array : Symbol(ClassA.array, Decl(main.ts, 12, 21)) +>init : Symbol(init, Decl(main.ts, 15, 16)) + } + + @annotation1() +>annotation1 : Symbol(annotation1, Decl(main.ts, 5, 1)) + + foo(... args: SomeClass1[]) { +>foo : Symbol(ClassA.foo, Decl(main.ts, 17, 5)) +>args : Symbol(args, Decl(main.ts, 20, 8)) +>SomeClass1 : Symbol(SomeClass1, Decl(main.ts, 1, 8)) + } +} diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types new file mode 100644 index 00000000000..6c27aa2c942 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types @@ -0,0 +1,82 @@ +=== tests/cases/compiler/aux.ts === + +export class SomeClass { +>SomeClass : SomeClass + + field: string; +>field : string +} + +=== tests/cases/compiler/aux1.ts === +export class SomeClass1 { +>SomeClass1 : SomeClass1 + + field: string; +>field : string +} + +=== tests/cases/compiler/aux2.ts === +export class SomeClass2 { +>SomeClass2 : SomeClass2 + + field: string; +>field : string +} +=== tests/cases/compiler/main.ts === +import { SomeClass } from './aux'; +>SomeClass : typeof SomeClass + +import { SomeClass1 } from './aux1'; +>SomeClass1 : typeof SomeClass1 + +function annotation(): ClassDecorator { +>annotation : () => ClassDecorator +>ClassDecorator : ClassDecorator + + return (target: any): void => { }; +>(target: any): void => { } : (target: any) => void +>target : any +} + +function annotation1(): MethodDecorator { +>annotation1 : () => MethodDecorator +>MethodDecorator : MethodDecorator + + return (target: any): void => { }; +>(target: any): void => { } : (target: any) => void +>target : any +} + +@annotation() +>annotation() : ClassDecorator +>annotation : () => ClassDecorator + +export class ClassA { +>ClassA : ClassA + + array: SomeClass[]; +>array : SomeClass[] +>SomeClass : SomeClass + + constructor(...init: SomeClass[]) { +>init : SomeClass[] +>SomeClass : SomeClass + + this.array = init; +>this.array = init : SomeClass[] +>this.array : SomeClass[] +>this : this +>array : SomeClass[] +>init : SomeClass[] + } + + @annotation1() +>annotation1() : MethodDecorator +>annotation1 : () => MethodDecorator + + foo(... args: SomeClass1[]) { +>foo : (...args: SomeClass1[]) => void +>args : SomeClass1[] +>SomeClass1 : SomeClass1 + } +} diff --git a/tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts b/tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts new file mode 100644 index 00000000000..3bc22df8928 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts @@ -0,0 +1,42 @@ +// @experimentalDecorators: true +// @emitDecoratorMetadata: true +// @target: es5 + +// @filename: aux.ts +export class SomeClass { + field: string; +} + +// @filename: aux1.ts +export class SomeClass1 { + field: string; +} + +// @filename: aux2.ts +export class SomeClass2 { + field: string; +} +// @filename: main.ts +import { SomeClass } from './aux'; +import { SomeClass1 } from './aux1'; + +function annotation(): ClassDecorator { + return (target: any): void => { }; +} + +function annotation1(): MethodDecorator { + return (target: any): void => { }; +} + +@annotation() +export class ClassA { + array: SomeClass[]; + + constructor(...init: SomeClass[]) { + this.array = init; + } + + @annotation1() + foo(... args: SomeClass1[]) { + } +} \ No newline at end of file From 7da4b857f2a0f05f0fe18694b64f0007783655cd Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 13 Dec 2016 11:58:58 -0800 Subject: [PATCH 044/125] Don't replace the last statement if 'this' is used/captured within the constructor. --- src/compiler/transformers/es2015.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index ad016972d0d..7f3f0bb8ba7 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -1024,8 +1024,11 @@ namespace ts { } } - // Return the result if we have an immediate super() call on the last statement. - if (superCallExpression && statementOffset === ctorStatements.length - 1) { + // Return the result if we have an immediate super() call on the last statement, + // but only if the constructor itself doesn't use 'this' elsewhere. + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (TransformFlags.ContainsLexicalThis | TransformFlags.ContainsCapturedLexicalThis))) { const returnStatement = createReturn(superCallExpression); if (superCallExpression.kind !== SyntaxKind.BinaryExpression From 0de57d9707cacdf265a80d528cb76b77510f2fc3 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 13 Dec 2016 11:59:10 -0800 Subject: [PATCH 045/125] Accepted baselines. --- tests/baselines/reference/arrowFunctionContexts.js | 6 ++++-- tests/baselines/reference/captureThisInSuperCall.js | 3 ++- .../reference/checkSuperCallBeforeThisAccessing5.js | 3 ++- .../reference/checkSuperCallBeforeThisAccessing7.js | 3 ++- .../reference/derivedClassSuperCallsWithThisArg.js | 3 ++- tests/baselines/reference/superCallBeforeThisAccessing2.js | 3 ++- tests/baselines/reference/superCallBeforeThisAccessing6.js | 3 ++- .../reference/superPropertyInConstructorBeforeSuperCall.js | 3 ++- tests/baselines/reference/thisInInvalidContexts.js | 3 ++- .../reference/thisInInvalidContextsExternalModule.js | 3 ++- tests/baselines/reference/thisInSuperCall.js | 3 ++- tests/baselines/reference/thisInSuperCall2.js | 3 ++- tests/baselines/reference/validUseOfThisInSuper.js | 3 ++- 13 files changed, 28 insertions(+), 14 deletions(-) diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index 64727398f72..1af0797b41f 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -116,7 +116,8 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.call(this, function () { return _this; }) || this; + var _this = _super.call(this, function () { return _this; }) || this; + return _this; } return Derived; }(Base)); @@ -157,7 +158,8 @@ var M2; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.call(this, function () { return _this; }) || this; + var _this = _super.call(this, function () { return _this; }) || this; + return _this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/captureThisInSuperCall.js b/tests/baselines/reference/captureThisInSuperCall.js index 2c4df5db961..069871f598e 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -22,7 +22,8 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.call(this, { test: function () { return _this.someMethod(); } }) || this; + var _this = _super.call(this, { test: function () { return _this.someMethod(); } }) || this; + return _this; } B.prototype.someMethod = function () { }; return B; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js index 4cce975d6d9..ded73f57baf 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js @@ -25,7 +25,8 @@ var Based = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.call(this, this.x) || this; + var _this = _super.call(this, _this.x) || this; + return _this; } return Derived; }(Based)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js index ca12c16e047..364aed4d4b0 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js @@ -23,7 +23,8 @@ var Base = (function () { var Super = (function (_super) { __extends(Super, _super); function Super() { - return _super.call(this, (function () { return _this; })) || this; + var _this = _super.call(this, (function () { return _this; })) || this; + return _this; } return Super; }(Base)); diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 504d414a608..039e25919f8 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -42,7 +42,8 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.call(this, _this) || this; + var _this = _super.call(this, _this) || this; + return _this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing2.js b/tests/baselines/reference/superCallBeforeThisAccessing2.js index 7331718a9ed..91cc3d28dd6 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing2.js @@ -24,7 +24,8 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.call(this, function () { _this._t; }) || this; + var _this = _super.call(this, function () { _this._t; }) || this; + return _this; } return D; }(Base)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing6.js b/tests/baselines/reference/superCallBeforeThisAccessing6.js index e4dfb3f714a..4eb8e5266c2 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing6.js @@ -24,7 +24,8 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.call(this, this) || this; + var _this = _super.call(this, _this) || this; + return _this; } return D; }(Base)); diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js index 15bc0c40f37..3fcf7167ee5 100644 --- a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js @@ -40,7 +40,8 @@ var C1 = (function (_super) { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.call(this, _super.x.call(_this)) || this; + var _this = _super.call(this, _super.x.call(_this)) || this; + return _this; } return C2; }(B)); diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index 1fc1c734639..7f299fd7e10 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -70,7 +70,8 @@ var ClassWithNoInitializer = (function (_super) { __extends(ClassWithNoInitializer, _super); //'this' in optional super call function ClassWithNoInitializer() { - return _super.call(this, _this) || this; + var _this = _super.call(this, _this) || this; + return _this; } return ClassWithNoInitializer; }(BaseErrClass)); diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index f8cb6d695dc..65a1ef1eee9 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -71,7 +71,8 @@ var ClassWithNoInitializer = (function (_super) { __extends(ClassWithNoInitializer, _super); //'this' in optional super call function ClassWithNoInitializer() { - return _super.call(this, _this) || this; + var _this = _super.call(this, _this) || this; + return _this; } return ClassWithNoInitializer; }(BaseErrClass)); diff --git a/tests/baselines/reference/thisInSuperCall.js b/tests/baselines/reference/thisInSuperCall.js index 2a4d15973ab..1c1f11ffbc8 100644 --- a/tests/baselines/reference/thisInSuperCall.js +++ b/tests/baselines/reference/thisInSuperCall.js @@ -36,7 +36,8 @@ var Base = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - return _super.call(this, _this) || this; + var _this = _super.call(this, _this) || this; + return _this; } return Foo; }(Base)); diff --git a/tests/baselines/reference/thisInSuperCall2.js b/tests/baselines/reference/thisInSuperCall2.js index eabfa9d562c..6288082ed64 100644 --- a/tests/baselines/reference/thisInSuperCall2.js +++ b/tests/baselines/reference/thisInSuperCall2.js @@ -33,7 +33,8 @@ var Base = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - return _super.call(this, _this) || this; + var _this = _super.call(this, _this) || this; + return _this; } return Foo; }(Base)); diff --git a/tests/baselines/reference/validUseOfThisInSuper.js b/tests/baselines/reference/validUseOfThisInSuper.js index 483e905b48a..bbd564db366 100644 --- a/tests/baselines/reference/validUseOfThisInSuper.js +++ b/tests/baselines/reference/validUseOfThisInSuper.js @@ -24,7 +24,8 @@ var Base = (function () { var Super = (function (_super) { __extends(Super, _super); function Super() { - return _super.call(this, (function () { return _this; })()) || this; + var _this = _super.call(this, (function () { return _this; })()) || this; + return _this; } return Super; }(Base)); From c71e6cc9ef9f9b8ae0f2036336b0489cdc61318b Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 13 Dec 2016 12:57:21 -0800 Subject: [PATCH 046/125] add a new line if after writing trailing comments (#12894) --- src/compiler/comments.ts | 3 +++ src/compiler/transformers/module/system.ts | 25 ++++++++++--------- .../reference/systemModuleTrailingComments.js | 18 +++++++++++++ .../systemModuleTrailingComments.symbols | 5 ++++ .../systemModuleTrailingComments.types | 6 +++++ .../compiler/systemModuleTrailingComments.ts | 4 +++ 6 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 tests/baselines/reference/systemModuleTrailingComments.js create mode 100644 tests/baselines/reference/systemModuleTrailingComments.symbols create mode 100644 tests/baselines/reference/systemModuleTrailingComments.types create mode 100644 tests/cases/compiler/systemModuleTrailingComments.ts diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index cd96981c093..bd9190dbec7 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -156,6 +156,9 @@ namespace ts { if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index 91e29e09886..0e3a42da0d2 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -101,20 +101,21 @@ namespace ts { // So the helper will be emit at the correct position instead of at the top of the source-file const moduleName = tryGetModuleNameFromFile(node, host, compilerOptions); const dependencies = createArrayLiteral(map(dependencyGroups, dependencyGroup => dependencyGroup.name)); - const updated = updateSourceFileNode( - node, - createNodeArray([ - createStatement( - createCall( - createPropertyAccess(createIdentifier("System"), "register"), + const updated = setEmitFlags( + updateSourceFileNode( + node, + createNodeArray([ + createStatement( + createCall( + createPropertyAccess(createIdentifier("System"), "register"), /*typeArguments*/ undefined, - moduleName - ? [moduleName, dependencies, moduleBodyFunction] - : [dependencies, moduleBodyFunction] + moduleName + ? [moduleName, dependencies, moduleBodyFunction] + : [dependencies, moduleBodyFunction] + ) ) - ) - ], node.statements) - ); + ], node.statements) + ), EmitFlags.NoTrailingComments); if (!(compilerOptions.outFile || compilerOptions.out)) { moveEmitHelpers(updated, moduleBodyBlock, helper => !helper.scoped); diff --git a/tests/baselines/reference/systemModuleTrailingComments.js b/tests/baselines/reference/systemModuleTrailingComments.js new file mode 100644 index 00000000000..41b0bd299a0 --- /dev/null +++ b/tests/baselines/reference/systemModuleTrailingComments.js @@ -0,0 +1,18 @@ +//// [systemModuleTrailingComments.ts] +export const test = "TEST"; + +//some comment + +//// [systemModuleTrailingComments.js] +System.register([], function (exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var test; + return { + setters: [], + execute: function () { + exports_1("test", test = "TEST"); + //some comment + } + }; +}); diff --git a/tests/baselines/reference/systemModuleTrailingComments.symbols b/tests/baselines/reference/systemModuleTrailingComments.symbols new file mode 100644 index 00000000000..4df59b45faa --- /dev/null +++ b/tests/baselines/reference/systemModuleTrailingComments.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/systemModuleTrailingComments.ts === +export const test = "TEST"; +>test : Symbol(test, Decl(systemModuleTrailingComments.ts, 0, 12)) + +//some comment diff --git a/tests/baselines/reference/systemModuleTrailingComments.types b/tests/baselines/reference/systemModuleTrailingComments.types new file mode 100644 index 00000000000..235b46e6e8f --- /dev/null +++ b/tests/baselines/reference/systemModuleTrailingComments.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/systemModuleTrailingComments.ts === +export const test = "TEST"; +>test : "TEST" +>"TEST" : "TEST" + +//some comment diff --git a/tests/cases/compiler/systemModuleTrailingComments.ts b/tests/cases/compiler/systemModuleTrailingComments.ts new file mode 100644 index 00000000000..32c29617832 --- /dev/null +++ b/tests/cases/compiler/systemModuleTrailingComments.ts @@ -0,0 +1,4 @@ +// @module: system +export const test = "TEST"; + +//some comment \ No newline at end of file From e68161adfa916ebf2f03d4e2bbdec637001044ef Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 13 Dec 2016 13:21:32 -0800 Subject: [PATCH 047/125] when language service is disabled - build program using only open files (#12809) --- .../unittests/tsserverProjectSystem.ts | 44 +++++++ src/server/builder.ts | 32 ++++- src/server/editorServices.ts | 41 +++++-- src/server/project.ts | 115 ++++-------------- src/server/protocol.ts | 5 + src/server/session.ts | 3 + 6 files changed, 132 insertions(+), 108 deletions(-) diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 59652f91d67..783a6016f7a 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -1238,6 +1238,7 @@ namespace ts.projectSystem { projectService.closeExternalProject(externalProjectName); checkNumberOfProjects(projectService, { configuredProjects: 0 }); }); + it("external project with included config file opened after configured project and then closed", () => { const file1 = { path: "/a/b/f1.ts", @@ -1797,6 +1798,49 @@ namespace ts.projectSystem { checkNumberOfProjects(projectService, { configuredProjects: 0 }); }); + it("language service disabled state is updated in external projects", () => { + debugger + const f1 = { + path: "/a/app.js", + content: "var x = 1" + }; + const f2 = { + path: "/a/largefile.js", + content: "" + }; + const host = createServerHost([f1, f2]); + const originalGetFileSize = host.getFileSize; + host.getFileSize = (filePath: string) => + filePath === f2.path ? server.maxProgramSizeForNonTsFiles + 1 : originalGetFileSize.call(host, filePath); + + const service = createProjectService(host); + const projectFileName = "/a/proj.csproj"; + + service.openExternalProject({ + projectFileName, + rootFiles: toExternalFiles([f1.path, f2.path]), + options: {} + }); + service.checkNumberOfProjects({ externalProjects: 1 }); + assert.isFalse(service.externalProjects[0].languageServiceEnabled, "language service should be disabled - 1"); + + service.openExternalProject({ + projectFileName, + rootFiles: toExternalFiles([f1.path]), + options: {} + }); + service.checkNumberOfProjects({ externalProjects: 1 }); + assert.isTrue(service.externalProjects[0].languageServiceEnabled, "language service should be enabled"); + + service.openExternalProject({ + projectFileName, + rootFiles: toExternalFiles([f1.path, f2.path]), + options: {} + }); + service.checkNumberOfProjects({ externalProjects: 1 }); + assert.isFalse(service.externalProjects[0].languageServiceEnabled, "language service should be disabled - 2"); + }); + it("language service disabled events are triggered", () => { const f1 = { path: "/a/app.js", diff --git a/src/server/builder.ts b/src/server/builder.ts index 5354e7ed508..60f56dc3241 100644 --- a/src/server/builder.ts +++ b/src/server/builder.ts @@ -75,17 +75,32 @@ namespace ts.server { getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; onProjectUpdateGraph(): void; emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean; + clear(): void; } abstract class AbstractBuilder implements Builder { - private fileInfos = createFileMap(); + /** + * stores set of files from the project. + * NOTE: this field is created on demand and should not be accessed directly. + * Use 'getFileInfos' instead. + */ + private fileInfos_doNotAccessDirectly: FileMap; constructor(public readonly project: Project, private ctor: { new (scriptInfo: ScriptInfo, project: Project): T }) { } + private getFileInfos() { + return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = createFileMap()); + } + + public clear() { + // drop the existing list - it will be re-created as necessary + this.fileInfos_doNotAccessDirectly = undefined; + } + protected getFileInfo(path: Path): T { - return this.fileInfos.get(path); + return this.getFileInfos().get(path); } protected getOrCreateFileInfo(path: Path): T { @@ -99,19 +114,19 @@ namespace ts.server { } protected getFileInfoPaths(): Path[] { - return this.fileInfos.getKeys(); + return this.getFileInfos().getKeys(); } protected setFileInfo(path: Path, info: T) { - this.fileInfos.set(path, info); + this.getFileInfos().set(path, info); } protected removeFileInfo(path: Path) { - this.fileInfos.remove(path); + this.getFileInfos().remove(path); } protected forEachFileInfo(action: (fileInfo: T) => any) { - this.fileInfos.forEachValue((_path, value) => action(value)); + this.getFileInfos().forEachValue((_path, value) => action(value)); } abstract getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; @@ -231,6 +246,11 @@ namespace ts.server { private projectVersionForDependencyGraph: string; + public clear() { + this.projectVersionForDependencyGraph = undefined; + super.clear(); + } + private getReferencedFileInfos(fileInfo: ModuleBuilderFileInfo): ModuleBuilderFileInfo[] { if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { return []; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index a70b16a5b1e..00df53e1e35 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -126,7 +126,7 @@ namespace ts.server { } export interface OpenConfiguredProjectResult { - configFileName?: string; + configFileName?: NormalizedPath; configFileErrors?: Diagnostic[]; } @@ -659,6 +659,13 @@ namespace ts.server { // open file in inferred project (projectsToRemove || (projectsToRemove = [])).push(p); } + + if (!p.languageServiceEnabled) { + // if project language service is disabled then we create a program only for open files. + // this means that project should be marked as dirty to force rebuilding of the program + // on the next request + p.markAsDirty(); + } } if (projectsToRemove) { for (const project of projectsToRemove) { @@ -1052,9 +1059,7 @@ namespace ts.server { project.stopWatchingDirectory(); } else { - if (!project.languageServiceEnabled) { - project.enableLanguageService(); - } + project.enableLanguageService(); this.watchConfigDirectoryForProject(project, projectOptions); this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors); } @@ -1226,9 +1231,22 @@ namespace ts.server { } openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): OpenConfiguredProjectResult { - const { configFileName = undefined, configFileErrors = undefined }: OpenConfiguredProjectResult = this.findContainingExternalProject(fileName) - ? {} - : this.openOrUpdateConfiguredProjectForFile(fileName); + let configFileName: NormalizedPath; + let configFileErrors: Diagnostic[]; + + let project: ConfiguredProject | ExternalProject = this.findContainingExternalProject(fileName); + if (!project) { + ({ configFileName, configFileErrors } = this.openOrUpdateConfiguredProjectForFile(fileName)); + if (configFileName) { + project = this.findConfiguredProjectByProjectName(configFileName); + } + } + if (project && !project.languageServiceEnabled) { + // if project language service is disabled then we create a program only for open files. + // this means that project should be marked as dirty to force rebuilding of the program + // on the next request + project.markAsDirty(); + } // at this point if file is the part of some configured/external project then this project should be created const info = this.getOrCreateScriptInfoForNormalizedPath(fileName, /*openedByClient*/ true, fileContent, scriptKind, hasMixedContent); @@ -1392,8 +1410,15 @@ namespace ts.server { let exisingConfigFiles: string[]; if (externalProject) { if (!tsConfigFiles) { + const compilerOptions = convertCompilerOptions(proj.options); + if (this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, proj.rootFiles, externalFilePropertyReader)) { + externalProject.disableLanguageService(); + } + else { + externalProject.enableLanguageService(); + } // external project already exists and not config files were added - update the project and return; - this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typeAcquisition, proj.options.compileOnSave, /*configFileErrors*/ undefined); + this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, /*configFileErrors*/ undefined); return; } // some config files were added to external project (that previously were not there) diff --git a/src/server/project.ts b/src/server/project.ts index 392008a9fd6..0037a470a49 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -90,87 +90,6 @@ namespace ts.server { } } - const emptyResult: any[] = []; - const getEmptyResult = () => emptyResult; - const getUndefined = () => undefined; - const emptyEncodedSemanticClassifications = { spans: emptyResult, endOfLineState: EndOfLineState.None }; - - export function createNoSemanticFeaturesWrapper(realLanguageService: LanguageService): LanguageService { - return { - cleanupSemanticCache: noop, - getSyntacticDiagnostics: (fileName) => - fileName ? realLanguageService.getSyntacticDiagnostics(fileName) : emptyResult, - getSemanticDiagnostics: getEmptyResult, - getCompilerOptionsDiagnostics: () => - realLanguageService.getCompilerOptionsDiagnostics(), - getSyntacticClassifications: (fileName, span) => - realLanguageService.getSyntacticClassifications(fileName, span), - getEncodedSyntacticClassifications: (fileName, span) => - realLanguageService.getEncodedSyntacticClassifications(fileName, span), - getSemanticClassifications: getEmptyResult, - getEncodedSemanticClassifications: () => - emptyEncodedSemanticClassifications, - getCompletionsAtPosition: getUndefined, - findReferences: getEmptyResult, - getCompletionEntryDetails: getUndefined, - getQuickInfoAtPosition: getUndefined, - findRenameLocations: getEmptyResult, - getNameOrDottedNameSpan: (fileName, startPos, endPos) => - realLanguageService.getNameOrDottedNameSpan(fileName, startPos, endPos), - getBreakpointStatementAtPosition: (fileName, position) => - realLanguageService.getBreakpointStatementAtPosition(fileName, position), - getBraceMatchingAtPosition: (fileName, position) => - realLanguageService.getBraceMatchingAtPosition(fileName, position), - getSignatureHelpItems: getUndefined, - getDefinitionAtPosition: getEmptyResult, - getRenameInfo: () => ({ - canRename: false, - localizedErrorMessage: getLocaleSpecificMessage(Diagnostics.Language_service_is_disabled), - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }), - getTypeDefinitionAtPosition: getUndefined, - getReferencesAtPosition: getEmptyResult, - getDocumentHighlights: getEmptyResult, - getOccurrencesAtPosition: getEmptyResult, - getNavigateToItems: getEmptyResult, - getNavigationBarItems: fileName => - realLanguageService.getNavigationBarItems(fileName), - getNavigationTree: fileName => - realLanguageService.getNavigationTree(fileName), - getOutliningSpans: fileName => - realLanguageService.getOutliningSpans(fileName), - getTodoComments: getEmptyResult, - getIndentationAtPosition: (fileName, position, options) => - realLanguageService.getIndentationAtPosition(fileName, position, options), - getFormattingEditsForRange: (fileName, start, end, options) => - realLanguageService.getFormattingEditsForRange(fileName, start, end, options), - getFormattingEditsForDocument: (fileName, options) => - realLanguageService.getFormattingEditsForDocument(fileName, options), - getFormattingEditsAfterKeystroke: (fileName, position, key, options) => - realLanguageService.getFormattingEditsAfterKeystroke(fileName, position, key, options), - getDocCommentTemplateAtPosition: (fileName, position) => - realLanguageService.getDocCommentTemplateAtPosition(fileName, position), - isValidBraceCompletionAtPosition: (fileName, position, openingBrace) => - realLanguageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace), - getEmitOutput: getUndefined, - getProgram: () => - realLanguageService.getProgram(), - getNonBoundSourceFile: fileName => - realLanguageService.getNonBoundSourceFile(fileName), - dispose: () => - realLanguageService.dispose(), - getCompletionEntrySymbol: getUndefined, - getImplementationAtPosition: getEmptyResult, - getSourceFile: fileName => - realLanguageService.getSourceFile(fileName), - getCodeFixesAtPosition: getEmptyResult - }; - } - export abstract class Project { private rootFiles: ScriptInfo[] = []; private rootFilesMap: FileMap = createFileMap(); @@ -181,8 +100,6 @@ namespace ts.server { private lastCachedUnresolvedImportsList: SortedReadonlyArray; private readonly languageService: LanguageService; - // wrapper over the real language service that will suppress all semantic operations - private readonly noSemanticFeaturesLanguageService: LanguageService; public languageServiceEnabled = true; @@ -258,7 +175,6 @@ namespace ts.server { this.lsHost.setCompilationSettings(this.compilerOptions); this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry); - this.noSemanticFeaturesLanguageService = createNoSemanticFeaturesWrapper(this.languageService); if (!languageServiceEnabled) { this.disableLanguageService(); @@ -282,9 +198,7 @@ namespace ts.server { if (ensureSynchronized) { this.updateGraph(); } - return this.languageServiceEnabled - ? this.languageService - : this.noSemanticFeaturesLanguageService; + return this.languageService; } getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[] { @@ -373,7 +287,10 @@ namespace ts.server { const result: string[] = []; if (this.rootFiles) { for (const f of this.rootFiles) { - result.push(f.fileName); + if (this.languageServiceEnabled || f.isScriptOpen()) { + // if language service is disabled - process only files that are open + result.push(f.fileName); + } } if (this.typingFiles) { for (const f of this.typingFiles) { @@ -389,6 +306,10 @@ namespace ts.server { } getScriptInfos() { + if (!this.languageServiceEnabled) { + // if language service is not enabled - return just root files + return this.rootFiles; + } return map(this.program.getSourceFiles(), sourceFile => { const scriptInfo = this.projectService.getScriptInfoForPath(sourceFile.path); if (!scriptInfo) { @@ -529,10 +450,6 @@ namespace ts.server { * @returns: true if set of files in the project stays the same and false - otherwise. */ updateGraph(): boolean { - if (!this.languageServiceEnabled) { - return true; - } - this.lsHost.startRecordingFilesWithChangedResolutions(); let hasChanges = this.updateGraphWorker(); @@ -564,6 +481,16 @@ namespace ts.server { if (this.setTypings(cachedTypings)) { hasChanges = this.updateGraphWorker() || hasChanges; } + + // update builder only if language service is enabled + // otherwise tell it to drop its internal state + if (this.languageServiceEnabled) { + this.builder.onProjectUpdateGraph(); + } + else { + this.builder.clear(); + } + if (hasChanges) { this.projectStructureVersion++; } @@ -602,7 +529,6 @@ namespace ts.server { } } } - this.builder.onProjectUpdateGraph(); return hasChanges; } @@ -673,7 +599,8 @@ namespace ts.server { projectName: this.getProjectName(), version: this.projectStructureVersion, isInferred: this.projectKind === ProjectKind.Inferred, - options: this.getCompilerOptions() + options: this.getCompilerOptions(), + languageServiceDisabled: !this.languageServiceEnabled }; const updatedFileNames = this.updatedFileNames; this.updatedFileNames = undefined; diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 27faf417282..39012e49fcd 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -904,6 +904,11 @@ namespace ts.server.protocol { * Current set of compiler options for project */ options: ts.CompilerOptions; + + /** + * true if project language service is disabled + */ + languageServiceDisabled: boolean; } /** diff --git a/src/server/session.ts b/src/server/session.ts index a1944e5e782..5c382aae7d3 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1026,6 +1026,9 @@ namespace ts.server { if (!project) { Errors.ThrowNoProject(); } + if (!project.languageServiceEnabled) { + return false; + } const scriptInfo = project.getScriptInfo(file); return project.builder.emitFile(scriptInfo, (path, data, writeByteOrderMark) => this.host.writeFile(path, data, writeByteOrderMark)); } From 8dc1747db7aae381b29b7f5f9d48d711f2df5ef5 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 13 Dec 2016 13:52:58 -0800 Subject: [PATCH 048/125] Set symbol/flags only on (fresh) object spreads If you spread any into an object, the type is any, which should not be changed. --- src/compiler/checker.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 686efaa758d..4c9780faa7f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11638,8 +11638,11 @@ namespace ts { if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; + if (spread.flags & TypeFlags.Object) { + // only set the symbol and flags if this is a (fresh) object type + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; + } return spread; } From 587ba8d0ae06025856178e1057ef1afbe72c485b Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 13 Dec 2016 13:55:13 -0800 Subject: [PATCH 049/125] Test:spreading any doesn't set flags on anyType And update baselines --- .../explicitAnyAfterSpreadNoImplicitAnyError.js | 16 ++++++++++++++++ ...licitAnyAfterSpreadNoImplicitAnyError.symbols | 7 +++++++ ...xplicitAnyAfterSpreadNoImplicitAnyError.types | 13 +++++++++++++ tests/baselines/reference/objectSpread.symbols | 1 - .../explicitAnyAfterSpreadNoImplicitAnyError.ts | 3 +++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js create mode 100644 tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols create mode 100644 tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types create mode 100644 tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts diff --git a/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js new file mode 100644 index 00000000000..8715fd9eaca --- /dev/null +++ b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js @@ -0,0 +1,16 @@ +//// [explicitAnyAfterSpreadNoImplicitAnyError.ts] +({ a: [], ...(null as any) }); +let x: any; + + +//// [explicitAnyAfterSpreadNoImplicitAnyError.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +(__assign({ a: [] }, null)); +var x; diff --git a/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols new file mode 100644 index 00000000000..c53845d99aa --- /dev/null +++ b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols @@ -0,0 +1,7 @@ +=== tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts === +({ a: [], ...(null as any) }); +>a : Symbol(a, Decl(explicitAnyAfterSpreadNoImplicitAnyError.ts, 0, 2)) + +let x: any; +>x : Symbol(x, Decl(explicitAnyAfterSpreadNoImplicitAnyError.ts, 1, 3)) + diff --git a/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types new file mode 100644 index 00000000000..5e463e77bbb --- /dev/null +++ b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts === +({ a: [], ...(null as any) }); +>({ a: [], ...(null as any) }) : any +>{ a: [], ...(null as any) } : any +>a : undefined[] +>[] : undefined[] +>(null as any) : any +>null as any : any +>null : null + +let x: any; +>x : any + diff --git a/tests/baselines/reference/objectSpread.symbols b/tests/baselines/reference/objectSpread.symbols index 0b2fce46b0d..35c10faa9c0 100644 --- a/tests/baselines/reference/objectSpread.symbols +++ b/tests/baselines/reference/objectSpread.symbols @@ -200,7 +200,6 @@ let cplus: { p: number, plus(): void } = { ...c, plus() { return this.p + 1; } } >plus : Symbol(plus, Decl(objectSpread.ts, 49, 23)) >c : Symbol(c, Decl(objectSpread.ts, 45, 3)) >plus : Symbol(plus, Decl(objectSpread.ts, 49, 48)) ->this : Symbol(__object, Decl(objectSpread.ts, 41, 15)) cplus.plus(); >cplus.plus : Symbol(plus, Decl(objectSpread.ts, 49, 23)) diff --git a/tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts b/tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts new file mode 100644 index 00000000000..1c5ebac3d91 --- /dev/null +++ b/tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts @@ -0,0 +1,3 @@ +// @noImplicitAny: true +({ a: [], ...(null as any) }); +let x: any; From c9111a0dbbf1e6fb6e1689a33b1d33847def5916 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 13 Dec 2016 16:36:54 -0800 Subject: [PATCH 050/125] Fix https://github.com/Microsoft/TypeScript/issues/12316: Add `method` to known tag names --- src/services/jsDoc.ts | 1 + tests/cases/fourslash/completionInJsDoc.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index a937294567b..0e65d3b264e 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -23,6 +23,7 @@ namespace ts.JsDoc { "lends", "link", "memberOf", + "method", "name", "namespace", "param", diff --git a/tests/cases/fourslash/completionInJsDoc.ts b/tests/cases/fourslash/completionInJsDoc.ts index e5cc7a3d2b6..8ab9dbd0131 100644 --- a/tests/cases/fourslash/completionInJsDoc.ts +++ b/tests/cases/fourslash/completionInJsDoc.ts @@ -30,6 +30,7 @@ goTo.marker('1'); verify.completionListContains("constructor"); verify.completionListContains("param"); verify.completionListContains("type"); +verify.completionListContains("method"); goTo.marker('2'); verify.completionListContains("constructor"); From 97641e7c3c335421cfb2a7222258f2697eaba095 Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Tue, 13 Dec 2016 16:24:14 -0800 Subject: [PATCH 051/125] NavigateTo is not working correctly for declarations in IIFEs Fix: visit the node's children even when the function declaration name is undefined --- src/services/services.ts | 3 +-- tests/cases/fourslash/navigateToIIFE.ts | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 tests/cases/fourslash/navigateToIIFE.ts diff --git a/src/services/services.ts b/src/services/services.ts index 7ad02de56e5..cf6df71d45b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -592,9 +592,8 @@ namespace ts { else { declarations.push(functionDeclaration); } - - forEachChild(node, visit); } + forEachChild(node, visit); break; case SyntaxKind.ClassDeclaration: diff --git a/tests/cases/fourslash/navigateToIIFE.ts b/tests/cases/fourslash/navigateToIIFE.ts new file mode 100644 index 00000000000..69632e5f1ec --- /dev/null +++ b/tests/cases/fourslash/navigateToIIFE.ts @@ -0,0 +1,19 @@ +/// + +// @Filename: file1.ts +/////*1*/(function () { +//// "use strict"; +//// function onResume() { +//// }; +////} )(); +// @Filename: file2.ts +/////*2*/class EventManager { +//// public onResume(name: string) { } +////} +////class MyOtherEventManager { +//// public onResume(name: string) { } +////} +verify.navigationItemsListCount(3, "onResume"); +verify.navigationItemsListCount(1, "onResume", undefined, test.marker("1").fileName); +verify.navigationItemsListContains("onResume", "function", "onResume", "exact", test.marker("1").fileName); +verify.navigationItemsListCount(2, "onResume", undefined, test.marker("2").fileName); From 7fce634e8547e3e54c75ee759824ab449bbd77ed Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Wed, 14 Dec 2016 23:54:59 +0900 Subject: [PATCH 052/125] merge --- .mailmap | 43 +- .travis.yml | 1 + AUTHORS.md | 33 + Jakefile.js | 1 + netci.groovy | 2 +- package.json | 2 +- src/compiler/binder.ts | 23 - src/compiler/checker.ts | 854 ++++++--- src/compiler/commandLineParser.ts | 19 +- src/compiler/comments.ts | 3 + src/compiler/core.ts | 36 +- src/compiler/declarationEmitter.ts | 7 + src/compiler/factory.ts | 14 +- src/compiler/parser.ts | 12 +- src/compiler/sourcemap.ts | 2 +- src/compiler/transformers/destructuring.ts | 2 +- src/compiler/transformers/es2015.ts | 10 +- src/compiler/transformers/module/system.ts | 25 +- src/compiler/transformers/ts.ts | 82 +- src/compiler/tsconfig.json | 3 +- src/compiler/types.ts | 85 +- src/compiler/utilities.ts | 71 +- src/harness/fourslash.ts | 65 +- src/harness/unittests/textStorage.ts | 70 + .../unittests/tsserverProjectSystem.ts | 335 +++- src/harness/unittests/typingsInstaller.ts | 114 +- src/lib/es2016.array.include.d.ts | 9 + src/lib/es2017.object.d.ts | 13 +- src/lib/es5.d.ts | 12 + src/server/builder.ts | 32 +- src/server/editorServices.ts | 160 +- src/server/lsHost.ts | 2 +- src/server/project.ts | 149 +- src/server/protocol.ts | 50 +- src/server/scriptInfo.ts | 232 ++- src/server/scriptVersionCache.ts | 5 +- src/server/server.ts | 84 +- src/server/session.ts | 15 +- src/server/shared.ts | 3 +- src/server/types.d.ts | 22 +- .../typingsInstaller/nodeTypingsInstaller.ts | 8 +- .../typingsInstaller/typingsInstaller.ts | 84 +- src/server/utilities.ts | 2 +- src/services/jsDoc.ts | 12 +- src/services/services.ts | 2 +- src/services/types.ts | 4 +- src/services/utilities.ts | 1 + .../reference/awaitInheritedPromise_es2017.js | 11 + .../awaitInheritedPromise_es2017.symbols | 15 + .../awaitInheritedPromise_es2017.types | 16 + .../reference/capturedLetConstInLoop9.js | 3 +- .../circularIndexedAccessErrors.errors.txt | 57 + .../reference/circularIndexedAccessErrors.js | 70 + .../reference/circularReferenceInImport.js | 27 + .../circularReferenceInImport.symbols | 23 + .../reference/circularReferenceInImport.types | 24 + .../classAbstractAccessor.errors.txt | 17 + .../reference/classAbstractAccessor.js | 28 + ...eclarationEmitIndexTypeNotFound.errors.txt | 17 + .../declarationEmitIndexTypeNotFound.js | 9 + .../decoratedClassExportsCommonJS1.js | 6 +- .../decoratedClassExportsCommonJS2.js | 6 +- .../reference/decoratedClassExportsSystem1.js | 6 +- .../reference/decoratedClassExportsSystem2.js | 6 +- ...orMetadataRestParameterWithImportedType.js | 112 ++ ...adataRestParameterWithImportedType.symbols | 77 + ...etadataRestParameterWithImportedType.types | 82 + .../decoratorOnClassAccessor7.errors.txt | 41 + .../reference/decoratorOnClassAccessor7.js | 125 ++ .../reference/decoratorOnClassAccessor8.js | 135 ++ .../decoratorOnClassAccessor8.symbols | 76 + .../reference/decoratorOnClassAccessor8.types | 81 + .../reference/decoratorOnClassConstructor4.js | 58 + .../decoratorOnClassConstructor4.symbols | 28 + .../decoratorOnClassConstructor4.types | 28 + .../decoratorWithUnderscoreMethod.js | 37 + .../decoratorWithUnderscoreMethod.symbols | 42 + .../decoratorWithUnderscoreMethod.types | 46 + .../reference/errorSuperCalls.errors.txt | 5 +- ...xhaustiveSwitchWithWideningLiteralTypes.js | 39 + ...tiveSwitchWithWideningLiteralTypes.symbols | 33 + ...ustiveSwitchWithWideningLiteralTypes.types | 40 + ...xplicitAnyAfterSpreadNoImplicitAnyError.js | 16 + ...itAnyAfterSpreadNoImplicitAnyError.symbols | 7 + ...icitAnyAfterSpreadNoImplicitAnyError.types | 13 + tests/baselines/reference/importHelpers.js | 6 +- .../importHelpersDeclarations.symbols | 8 + .../reference/importHelpersDeclarations.types | 8 + .../importHelpersInIsolatedModules.js | 6 +- .../importHelpersNoHelpers.errors.txt | 32 +- .../reference/importHelpersNoHelpers.js | 6 +- .../importHelpersNoModule.errors.txt | 7 +- .../reference/importHelpersNoModule.js | 6 +- .../inOperatorWithInvalidOperands.errors.txt | 8 +- .../intersectionTypeNormalization.js | 50 + .../intersectionTypeNormalization.symbols | 110 ++ .../intersectionTypeNormalization.types | 111 ++ .../intersectionTypeWithLeadingOperator.js | 10 + ...ntersectionTypeWithLeadingOperator.symbols | 20 + .../intersectionTypeWithLeadingOperator.types | 20 + .../invalidImportAliasIdentifiers.errors.txt | 4 +- .../invalidUseOfTypeAsNamespace.errors.txt | 11 + .../reference/invalidUseOfTypeAsNamespace.js | 8 + .../isomorphicMappedTypeInference.js | 330 ++++ .../isomorphicMappedTypeInference.symbols | 489 +++++ .../isomorphicMappedTypeInference.types | 587 ++++++ .../jsxFactoryQualifiedNameWithEs5.js | 27 + .../jsxFactoryQualifiedNameWithEs5.symbols | 23 + .../jsxFactoryQualifiedNameWithEs5.types | 27 + tests/baselines/reference/keyofAndForIn.js | 81 + .../baselines/reference/keyofAndForIn.symbols | 125 ++ tests/baselines/reference/keyofAndForIn.types | 134 ++ .../reference/keyofAndIndexedAccess.js | 394 +++- .../reference/keyofAndIndexedAccess.symbols | 1598 ++++++++++++----- .../reference/keyofAndIndexedAccess.types | 937 +++++++++- .../keyofAndIndexedAccessErrors.errors.txt | 26 +- .../reference/keyofAndIndexedAccessErrors.js | 21 + .../keyofIsLiteralContexualType.errors.txt | 28 + .../reference/keyofIsLiteralContexualType.js | 23 + .../reference/mappedTypeErrors.errors.txt | 109 +- tests/baselines/reference/mappedTypeErrors.js | 116 +- .../mappedTypeInferenceCircularity.js | 12 + .../mappedTypeInferenceCircularity.symbols | 26 + .../mappedTypeInferenceCircularity.types | 27 + .../reference/mappedTypeModifiers.js | 133 ++ .../reference/mappedTypeModifiers.symbols | 355 ++++ .../reference/mappedTypeModifiers.types | 355 ++++ tests/baselines/reference/mappedTypes1.js | 35 +- .../baselines/reference/mappedTypes1.symbols | 17 +- tests/baselines/reference/mappedTypes1.types | 20 +- tests/baselines/reference/mappedTypes2.js | 41 +- .../baselines/reference/mappedTypes2.symbols | 191 +- tests/baselines/reference/mappedTypes2.types | 75 +- tests/baselines/reference/mappedTypes4.js | 129 ++ .../baselines/reference/mappedTypes4.symbols | 198 ++ tests/baselines/reference/mappedTypes4.types | 213 +++ .../reference/nestedFreshLiteral.errors.txt | 31 + .../baselines/reference/nestedFreshLiteral.js | 19 + .../newLexicalEnvironmentForConvertedLoop.js | 31 + ...LexicalEnvironmentForConvertedLoop.symbols | 30 + ...ewLexicalEnvironmentForConvertedLoop.types | 45 + .../reference/objectFreeze.errors.txt | 22 + tests/baselines/reference/objectFreeze.js | 29 + tests/baselines/reference/objectRest.js | 8 +- tests/baselines/reference/objectRest.symbols | 7 + tests/baselines/reference/objectRest.types | 12 + .../reference/objectRestAssignment.js | 2 +- tests/baselines/reference/objectRestForOf.js | 2 +- .../reference/objectRestNegative.errors.txt | 13 +- .../baselines/reference/objectRestNegative.js | 8 +- .../reference/objectRestParameter.js | 2 +- .../baselines/reference/objectSpread.symbols | 1 - .../reference/objectSpreadNegative.errors.txt | 30 +- .../reference/objectSpreadNegative.js | 8 +- .../parserExportAssignment9.errors.txt | 8 +- tests/baselines/reference/restIntersection.js | 20 + .../reference/restIntersection.symbols | 19 + .../reference/restIntersection.types | 19 + .../restInvalidArgumentType.errors.txt | 104 ++ .../reference/restInvalidArgumentType.js | 115 ++ tests/baselines/reference/restUnion.js | 36 + tests/baselines/reference/restUnion.symbols | 44 + tests/baselines/reference/restUnion.types | 45 + tests/baselines/reference/restUnion2.js | 38 + tests/baselines/reference/restUnion2.symbols | 52 + tests/baselines/reference/restUnion2.types | 55 + .../selfReferencingSpreadInLoop.errors.txt | 14 + .../reference/selfReferencingSpreadInLoop.js | 13 + .../baselines/reference/spreadIntersection.js | 23 + .../reference/spreadIntersection.symbols | 26 + .../reference/spreadIntersection.types | 29 + .../spreadInvalidArgumentType.errors.txt | 104 ++ .../reference/spreadInvalidArgumentType.js | 114 ++ tests/baselines/reference/spreadUnion.js | 28 + tests/baselines/reference/spreadUnion.symbols | 38 + tests/baselines/reference/spreadUnion.types | 42 + tests/baselines/reference/spreadUnion2.js | 49 + .../baselines/reference/spreadUnion2.symbols | 74 + tests/baselines/reference/spreadUnion2.types | 84 + ...eReservedWordInClassDeclaration.errors.txt | 8 +- ...ubSubClassCanAccessProtectedConstructor.js | 51 + ...ClassCanAccessProtectedConstructor.symbols | 40 + ...ubClassCanAccessProtectedConstructor.types | 46 + .../reference/superAccess2.errors.txt | 11 +- .../superInConstructorParam1.errors.txt | 5 +- .../reference/superNewCall1.errors.txt | 5 +- 186 files changed, 11685 insertions(+), 1584 deletions(-) create mode 100644 src/harness/unittests/textStorage.ts create mode 100644 tests/baselines/reference/awaitInheritedPromise_es2017.js create mode 100644 tests/baselines/reference/awaitInheritedPromise_es2017.symbols create mode 100644 tests/baselines/reference/awaitInheritedPromise_es2017.types create mode 100644 tests/baselines/reference/circularIndexedAccessErrors.errors.txt create mode 100644 tests/baselines/reference/circularIndexedAccessErrors.js create mode 100644 tests/baselines/reference/circularReferenceInImport.js create mode 100644 tests/baselines/reference/circularReferenceInImport.symbols create mode 100644 tests/baselines/reference/circularReferenceInImport.types create mode 100644 tests/baselines/reference/classAbstractAccessor.errors.txt create mode 100644 tests/baselines/reference/classAbstractAccessor.js create mode 100644 tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt create mode 100644 tests/baselines/reference/declarationEmitIndexTypeNotFound.js create mode 100644 tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js create mode 100644 tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols create mode 100644 tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types create mode 100644 tests/baselines/reference/decoratorOnClassAccessor7.errors.txt create mode 100644 tests/baselines/reference/decoratorOnClassAccessor7.js create mode 100644 tests/baselines/reference/decoratorOnClassAccessor8.js create mode 100644 tests/baselines/reference/decoratorOnClassAccessor8.symbols create mode 100644 tests/baselines/reference/decoratorOnClassAccessor8.types create mode 100644 tests/baselines/reference/decoratorOnClassConstructor4.js create mode 100644 tests/baselines/reference/decoratorOnClassConstructor4.symbols create mode 100644 tests/baselines/reference/decoratorOnClassConstructor4.types create mode 100644 tests/baselines/reference/decoratorWithUnderscoreMethod.js create mode 100644 tests/baselines/reference/decoratorWithUnderscoreMethod.symbols create mode 100644 tests/baselines/reference/decoratorWithUnderscoreMethod.types create mode 100644 tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.js create mode 100644 tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.symbols create mode 100644 tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.types create mode 100644 tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js create mode 100644 tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols create mode 100644 tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types create mode 100644 tests/baselines/reference/importHelpersDeclarations.symbols create mode 100644 tests/baselines/reference/importHelpersDeclarations.types create mode 100644 tests/baselines/reference/intersectionTypeWithLeadingOperator.js create mode 100644 tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols create mode 100644 tests/baselines/reference/intersectionTypeWithLeadingOperator.types create mode 100644 tests/baselines/reference/invalidUseOfTypeAsNamespace.errors.txt create mode 100644 tests/baselines/reference/invalidUseOfTypeAsNamespace.js create mode 100644 tests/baselines/reference/isomorphicMappedTypeInference.js create mode 100644 tests/baselines/reference/isomorphicMappedTypeInference.symbols create mode 100644 tests/baselines/reference/isomorphicMappedTypeInference.types create mode 100644 tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.js create mode 100644 tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.symbols create mode 100644 tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types create mode 100644 tests/baselines/reference/keyofAndForIn.js create mode 100644 tests/baselines/reference/keyofAndForIn.symbols create mode 100644 tests/baselines/reference/keyofAndForIn.types create mode 100644 tests/baselines/reference/keyofIsLiteralContexualType.errors.txt create mode 100644 tests/baselines/reference/keyofIsLiteralContexualType.js create mode 100644 tests/baselines/reference/mappedTypeInferenceCircularity.js create mode 100644 tests/baselines/reference/mappedTypeInferenceCircularity.symbols create mode 100644 tests/baselines/reference/mappedTypeInferenceCircularity.types create mode 100644 tests/baselines/reference/mappedTypeModifiers.js create mode 100644 tests/baselines/reference/mappedTypeModifiers.symbols create mode 100644 tests/baselines/reference/mappedTypeModifiers.types create mode 100644 tests/baselines/reference/mappedTypes4.js create mode 100644 tests/baselines/reference/mappedTypes4.symbols create mode 100644 tests/baselines/reference/mappedTypes4.types create mode 100644 tests/baselines/reference/nestedFreshLiteral.errors.txt create mode 100644 tests/baselines/reference/nestedFreshLiteral.js create mode 100644 tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js create mode 100644 tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols create mode 100644 tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types create mode 100644 tests/baselines/reference/objectFreeze.errors.txt create mode 100644 tests/baselines/reference/objectFreeze.js create mode 100644 tests/baselines/reference/restIntersection.js create mode 100644 tests/baselines/reference/restIntersection.symbols create mode 100644 tests/baselines/reference/restIntersection.types create mode 100644 tests/baselines/reference/restInvalidArgumentType.errors.txt create mode 100644 tests/baselines/reference/restInvalidArgumentType.js create mode 100644 tests/baselines/reference/restUnion.js create mode 100644 tests/baselines/reference/restUnion.symbols create mode 100644 tests/baselines/reference/restUnion.types create mode 100644 tests/baselines/reference/restUnion2.js create mode 100644 tests/baselines/reference/restUnion2.symbols create mode 100644 tests/baselines/reference/restUnion2.types create mode 100644 tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt create mode 100644 tests/baselines/reference/selfReferencingSpreadInLoop.js create mode 100644 tests/baselines/reference/spreadIntersection.js create mode 100644 tests/baselines/reference/spreadIntersection.symbols create mode 100644 tests/baselines/reference/spreadIntersection.types create mode 100644 tests/baselines/reference/spreadInvalidArgumentType.errors.txt create mode 100644 tests/baselines/reference/spreadInvalidArgumentType.js create mode 100644 tests/baselines/reference/spreadUnion.js create mode 100644 tests/baselines/reference/spreadUnion.symbols create mode 100644 tests/baselines/reference/spreadUnion.types create mode 100644 tests/baselines/reference/spreadUnion2.js create mode 100644 tests/baselines/reference/spreadUnion2.symbols create mode 100644 tests/baselines/reference/spreadUnion2.types create mode 100644 tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js create mode 100644 tests/baselines/reference/subSubClassCanAccessProtectedConstructor.symbols create mode 100644 tests/baselines/reference/subSubClassCanAccessProtectedConstructor.types diff --git a/.mailmap b/.mailmap index cc101c0517e..ede478c8a18 100644 --- a/.mailmap +++ b/.mailmap @@ -172,4 +172,45 @@ zhongsp # Patrick Zhong T18970237136 # @T18970237136 JBerger bootstraponline # @bootstraponline -yortus # @yortus \ No newline at end of file +yortus # @yortus +András Parditka +Anton Khlynovskiy +Charly POLY +Cotton Hou +Ethan Resnick +Marius Schulz +Mattias Buelens +Myles Megyesi +Tim Lancina +Aaron Holmes Aaron Holmes +Akshar Patel +Ali Sabzevari +Aliaksandr Radzivanovich +BuildTools # Franklin Tse +ChogyDan # Daniel Hollocher +Daniel Rosenwasser Daniel Rosenwasser +David Kmenta +E020873 # Nicolas Henry +Elisée Maurer +Emilio García-Pumarino dashaus +Guilherme Oenning +Herrington Darkholme +Ivo Gabe de Wolff +Joey Wilson +Jonathon Smith +Juan Luis Boya García +Kagami Sascha Rosylight +Lucien Greathouse +Martin Vseticka +Mattias Buelens +Michael Bromley +Paul Jolly +Perry Jiang +Peter Burns +Robert Coie +Thomas Loubiou +Tim Perry +Vidar Tonaas Fauske +Viktor Zozulyak +rix # Richard Sentino +rohitverma007 # Rohit Verma \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 2751337c708..08bd7817c79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: node_js node_js: - 'stable' + - '6' - '4' sudo: false diff --git a/AUTHORS.md b/AUTHORS.md index 50f1ea12c2b..ae7832176ea 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,17 +1,23 @@ TypeScript is authored by: +* Aaron Holmes * Abubaker Bashir * Adam Freidin * Adi Dahiya * Ahmad Farid +* Akshar Patel * Alex Eagle * Alexander Kuvaev * Alexander Rusakov +* Ali Sabzevari +* Aliaksandr Radzivanovich * Anatoly Ressin * Anders Hejlsberg * Andrej Baran * Andrew Z Allen +* András Parditka * Andy Hanson * Anil Anar +* Anton Khlynovskiy * Anton Tolmachev * Arnav Singh * Arthur Ozga @@ -27,16 +33,20 @@ TypeScript is authored by: * Brett Mayen * Bryan Forbes * Caitlin Potter +* Charly POLY * Chris Bubernak * Christophe Vidal * Chuck Jazdzewski * Colby Russell * Colin Snover +* Cotton Hou * Cyrus Najmabadi * Dafrok Zhang * Dan Corder * Dan Quirk +* Daniel Hollocher * Daniel Rosenwasser +* David Kmenta * David Li * David Souther * Denis Nedelyaev @@ -45,8 +55,11 @@ TypeScript is authored by: * Dirk Holtwick * Dom Chen * Doug Ilijev +* Elisée Maurer +* Emilio García-Pumarino * Eric Tsang * Erik Edrosa +* Ethan Resnick * Ethan Rubio * Evan Martin * Evan Sebastian @@ -54,12 +67,14 @@ TypeScript is authored by: * Fabian Cook * @falsandtru * Frank Wallis +* Franklin Tse * František Žiacik * Gabe Moothart * Gabriel Isenberg * Gilad Peleg * Godfrey Chan * Graeme Wicksted +* Guilherme Oenning * Guillaume Salles * Guy Bedford * Harald Niesche @@ -78,12 +93,14 @@ TypeScript is authored by: * Jeffrey Morlan * Jesse Schalken * Jiri Tobisek +* Joey Wilson * Johannes Rieken * John Vilk * Jonathan Bond-Caron * Jonathan Park * Jonathan Toland * Jonathan Turner +* Jonathon Smith * Josh Abernathy * Josh Kalderimis * Josh Soref @@ -102,15 +119,21 @@ TypeScript is authored by: * Lucien Greathouse * Lukas Elmer * Marin Marinov +* Marius Schulz * Martin Vseticka * Masahiro Wakame * Matt McCutchen +* Mattias Buelens +* Mattias Buelens * Max Deepfield * Micah Zoltu * Michael +* Michael Bromley * Mohamed Hegazy +* Myles Megyesi * Nathan Shively-Sanders * Nathan Yee +* Nicolas Henry * Nima Zahedi * Noah Chen * Noj Vek @@ -119,9 +142,12 @@ TypeScript is authored by: * Omer Sheikh * Oskar Segersva¨rd * Patrick Zhong +* Paul Jolly * Paul van Brenk * @pcbro * Pedro Maltez +* Perry Jiang +* Peter Burns * Philip Bulley * Piero Cangianiello * @piloopin @@ -130,6 +156,9 @@ TypeScript is authored by: * Punya Biswal * Rado Kirov * Richard Knoll +* Richard Sentino +* Robert Coie +* Rohit Verma * Ron Buckton * Rostislav Galimsky * Rowan Wyborn @@ -152,7 +181,9 @@ TypeScript is authored by: * @T18970237136 * Tarik Ozket * Tetsuharu Ohzeki +* Thomas Loubiou * Tien Hoanhtien +* Tim Lancina * Tim Perry * Tim Viiding-Spader * Tingan Ho @@ -161,6 +192,8 @@ TypeScript is authored by: * Tomas Grubliauskas * Torben Fitschen * TruongSinh Tran-Nguyen +* Vidar Tonaas Fauske +* Viktor Zozulyak * Vilic Vane * Vladimir Matveev * Wesley Wigham diff --git a/Jakefile.js b/Jakefile.js index d327b5bb47b..17346e8bc1f 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -250,6 +250,7 @@ var harnessSources = harnessCoreSources.concat([ "convertToBase64.ts", "transpile.ts", "reuseProgramStructure.ts", + "textStorage.ts", "cachingInServerLSHost.ts", "moduleResolution.ts", "tsconfigParsing.ts", diff --git a/netci.groovy b/netci.groovy index 9f2a96cdeef..bc512f6b245 100644 --- a/netci.groovy +++ b/netci.groovy @@ -5,7 +5,7 @@ import jobs.generation.Utilities; def project = GithubProject def branch = GithubBranchName -def nodeVersions = ['stable', '4'] +def nodeVersions = ['stable', '6', '4'] nodeVersions.each { nodeVer -> diff --git a/package.json b/package.json index 175c1675f2c..fdb85ea764b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "tsserver": "./bin/tsserver" }, "engines": { - "node": ">=0.8.0" + "node": ">=4.2.0" }, "devDependencies": { "@types/browserify": "latest", diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index c2bfce10e57..a6f5993f6c8 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -518,7 +518,6 @@ namespace ts { hasExplicitReturn = false; bindChildren(node); // Reset all reachability check related flags on node (for incremental scenarios) - // Reset all emit helper flags on node (for incremental scenarios) node.flags &= ~NodeFlags.ReachabilityAndEmitFlags; if (!(currentFlow.flags & FlowFlags.Unreachable) && containerFlags & ContainerFlags.IsFunctionLike && nodeIsPresent((node).body)) { node.flags |= NodeFlags.HasImplicitReturn; @@ -1950,9 +1949,6 @@ namespace ts { return bindParameter(node); case SyntaxKind.VariableDeclaration: case SyntaxKind.BindingElement: - if ((node as BindingElement).dotDotDotToken && node.parent.kind === SyntaxKind.ObjectBindingPattern) { - emitFlags |= NodeFlags.HasRestAttribute; - } return bindVariableDeclarationOrBindingElement(node); case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: @@ -1980,7 +1976,6 @@ namespace ts { } root = root.parent; } - emitFlags |= hasRest ? NodeFlags.HasRestAttribute : NodeFlags.HasSpreadAttribute; return; case SyntaxKind.CallSignature: @@ -2236,15 +2231,6 @@ namespace ts { } function bindClassLikeDeclaration(node: ClassLikeDeclaration) { - if (!isDeclarationFile(file) && !isInAmbientContext(node)) { - if (getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= NodeFlags.HasClassExtends; - } - if (nodeIsDecorated(node)) { - emitFlags |= NodeFlags.HasDecorators; - } - } - if (node.kind === SyntaxKind.ClassDeclaration) { bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes); } @@ -2314,12 +2300,6 @@ namespace ts { } function bindParameter(node: ParameterDeclaration) { - if (!isDeclarationFile(file) && - !isInAmbientContext(node) && - nodeIsDecorated(node)) { - emitFlags |= (NodeFlags.HasDecorators | NodeFlags.HasParamDecorators); - } - if (inStrictMode) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -2377,9 +2357,6 @@ namespace ts { if (isAsyncFunctionLike(node)) { emitFlags |= NodeFlags.HasAsyncFunctions; } - if (nodeIsDecorated(node)) { - emitFlags |= NodeFlags.HasDecorators; - } } if (currentFlow && isObjectLiteralOrClassExpressionMethod(node)) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 11085532794..f1b9f614fa7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -38,6 +38,8 @@ namespace ts { // is because diagnostics can be quite expensive, and we want to allow hosts to bail out if // they no longer need the information (for example, if the user started editing again). let cancellationToken: CancellationToken; + let requestedExternalEmitHelpers: ExternalEmitHelpers; + let externalHelpersModule: Symbol; const Symbol = objectAllocator.getSymbolConstructor(); const Type = objectAllocator.getTypeConstructor(); @@ -922,6 +924,7 @@ namespace ts { if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && + !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg)); } @@ -1032,6 +1035,18 @@ namespace ts { } } + function checkAndReportErrorForUsingTypeAsNamespace(errorLocation: Node, name: string, meaning: SymbolFlags): boolean { + if (meaning === SymbolFlags.Namespace) { + const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.Type & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined)); + if (symbol) { + error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name); + return true; + } + } + + return false; + } + function checkAndReportErrorForUsingTypeAsValue(errorLocation: Node, name: string, meaning: SymbolFlags): boolean { if (meaning & (SymbolFlags.Value & ~SymbolFlags.NamespaceModule)) { const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.Type & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined)); @@ -1424,9 +1439,8 @@ namespace ts { // May be an untyped module. If so, ignore resolutionDiagnostic. if (!isRelative && resolvedModule && !extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - Debug.assert(!!moduleNotFoundError); const diag = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } else if (compilerOptions.noImplicitAny && moduleNotFoundError) { error(errorNode, @@ -1727,7 +1741,19 @@ namespace ts { } function getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] { - function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable): Symbol[] { + function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + + function getAccessibleSymbolChainFromSymbolTableWorker(symbols: SymbolTable, visitedSymbolTables: SymbolTable[]): Symbol[] { + if (contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + const result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; + function canQualifySymbol(symbolFromSymbolTable: Symbol, meaning: SymbolFlags) { // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { @@ -1749,34 +1775,36 @@ namespace ts { } } - // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } + function trySymbolTable(symbols: SymbolTable) { + // If symbol is directly available by its name in the symbol table + if (isAccessible(symbols[symbol.name])) { + return [symbol]; + } - // Check if symbol is any of the alias - return forEachProperty(symbols, symbolFromSymbolTable => { - if (symbolFromSymbolTable.flags & SymbolFlags.Alias - && symbolFromSymbolTable.name !== "export=" - && !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) { - if (!useOnlyExternalAliasing || // We can use any type of alias to get the name - // Is this external alias, then use it to name - ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) { + // Check if symbol is any of the alias + return forEachProperty(symbols, symbolFromSymbolTable => { + if (symbolFromSymbolTable.flags & SymbolFlags.Alias + && symbolFromSymbolTable.name !== "export=" + && !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) { + if (!useOnlyExternalAliasing || // We can use any type of alias to get the name + // Is this external alias, then use it to name + ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) { - const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } + const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } - // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain - // but only if the symbolFromSymbolTable can be qualified - const accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain + // but only if the symbolFromSymbolTable can be qualified + const accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { @@ -2658,7 +2686,7 @@ namespace ts { } Debug.assert(bindingElement.kind === SyntaxKind.BindingElement); if (bindingElement.propertyName) { - writer.writeSymbol(getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, SyntaxKind.ColonToken); writeSpace(writer); } @@ -3041,7 +3069,15 @@ namespace ts { } function getRestType(source: Type, properties: PropertyName[], symbol: Symbol): Type { - Debug.assert(!!(source.flags & TypeFlags.Object), "Rest types only support object types right now."); + source = filterType(source, t => !(t.flags & TypeFlags.Nullable)); + if (source.flags & TypeFlags.Never) { + return emptyObjectType; + } + + if (source.flags & TypeFlags.Union) { + return mapType(source, t => getRestType(t, properties, symbol)); + } + const members = createMap(); const names = createMap(); for (const name of properties) { @@ -3082,7 +3118,7 @@ namespace ts { let type: Type; if (pattern.kind === SyntaxKind.ObjectBindingPattern) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & TypeFlags.Object)) { + if (!isValidSpreadType(parentType)) { error(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } @@ -3192,7 +3228,7 @@ namespace ts { // right hand expression is of a type parameter type. if (declaration.parent.parent.kind === SyntaxKind.ForInStatement) { const indexType = getIndexType(checkNonNullExpression((declaration.parent.parent).expression)); - return indexType.flags & TypeFlags.Index ? indexType : stringType; + return indexType.flags & (TypeFlags.TypeParameter | TypeFlags.Index) ? indexType : stringType; } if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement) { @@ -3296,14 +3332,19 @@ namespace ts { // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern: ObjectBindingPattern, includePatternInType: boolean, reportErrors: boolean): Type { const members = createMap(); + let stringIndexInfo: IndexInfo; let hasComputedProperties = false; forEach(pattern.elements, e => { const name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { - // do not include computed properties or rests in the implied type + if (isComputedNonLiteralName(name)) { + // do not include computed properties in the implied type hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); + return; + } const text = getTextOfPropertyName(name); const flags = SymbolFlags.Property | SymbolFlags.Transient | (e.initializer ? SymbolFlags.Optional : 0); @@ -3312,7 +3353,7 @@ namespace ts { symbol.bindingElement = e; members[symbol.name] = symbol; }); - const result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + const result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -3444,20 +3485,7 @@ namespace ts { } if (!popTypeResolution()) { - if ((symbol.valueDeclaration).type) { - // Variable has type annotation that circularly references the variable itself - type = unknownType; - error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, - symbolToString(symbol)); - } - else { - // Variable has initializer that circularly references the variable itself - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, - symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -3591,11 +3619,33 @@ namespace ts { function getTypeOfInstantiatedSymbol(symbol: Symbol): Type { const links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) { + return unknownType; + } + let type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; } return links.type; } + function reportCircularityError(symbol: Symbol) { + // Check if variable has type annotation that circularly references the variable itself + if ((symbol.valueDeclaration).type) { + error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, + symbolToString(symbol)); + return unknownType; + } + // Otherwise variable has initializer that circularly references the variable itself + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, + symbolToString(symbol)); + } + return anyType; + } + function getTypeOfSymbol(symbol: Symbol): Type { if (symbol.flags & SymbolFlags.Instantiated) { return getTypeOfInstantiatedSymbol(symbol); @@ -4481,7 +4531,6 @@ namespace ts { function resolveMappedTypeMembers(type: MappedType) { const members: SymbolTable = createMap(); let stringIndexInfo: IndexInfo; - let numberIndexInfo: IndexInfo; // Resolve upfront such that recursive references see an empty object type. setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); // In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type, @@ -4489,12 +4538,13 @@ namespace ts { const typeParameter = getTypeParameterFromMappedType(type); const constraintType = getConstraintTypeFromMappedType(type); const templateType = getTemplateTypeFromMappedType(type); - const isReadonly = !!type.declaration.readonlyToken; - const isOptional = !!type.declaration.questionToken; + const modifiersType = getModifiersTypeFromMappedType(type); + const templateReadonly = !!type.declaration.readonlyToken; + const templateOptional = !!type.declaration.questionToken; // First, if the constraint type is a type parameter, obtain the base constraint. Then, // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. // Finally, iterate over the constituents of the resulting iteration type. - const keyType = constraintType.flags & TypeFlags.TypeParameter ? getApparentType(constraintType) : constraintType; + const keyType = constraintType.flags & TypeFlags.TypeVariable ? getApparentType(constraintType) : constraintType; const iterationType = keyType.flags & TypeFlags.Index ? getIndexType(getApparentType((keyType).type)) : keyType; forEachType(iterationType, t => { // Create a mapper from T to the current iteration type constituent. Then, if the @@ -4503,29 +4553,22 @@ namespace ts { const iterationMapper = createUnaryTypeMapper(typeParameter, t); const templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; const propType = instantiateType(templateType, templateMapper); - // If the current iteration type constituent is a literal type, create a property. - // Otherwise, for type string create a string index signature and for type number - // create a numeric index signature. - if (t.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral | TypeFlags.EnumLiteral)) { + // If the current iteration type constituent is a string literal type, create a property. + // Otherwise, for type string create a string index signature. + if (t.flags & TypeFlags.StringLiteral) { const propName = (t).text; + const modifiersProp = getPropertyOfType(modifiersType, propName); + const isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & SymbolFlags.Optional); const prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | (isOptional ? SymbolFlags.Optional : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; + prop.type = propType; + prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); members[propName] = prop; } else if (t.flags & TypeFlags.String) { - stringIndexInfo = createIndexInfo(propType, isReadonly); - } - else if (t.flags & TypeFlags.Number) { - numberIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } }); - // If we created both a string and a numeric string index signature, and if the two index - // signatures have identical types, discard the redundant numeric index signature. - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; - } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); } function getTypeParameterFromMappedType(type: MappedType) { @@ -4541,10 +4584,32 @@ namespace ts { function getTemplateTypeFromMappedType(type: MappedType) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } + function getModifiersTypeFromMappedType(type: MappedType) { + if (!type.modifiersType) { + const constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === SyntaxKind.TypeOperator) { + // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check + // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves + // 'keyof T' to a literal union type and we can't recover T from that type. + type.modifiersType = instantiateType(getTypeFromTypeNode((constraintDeclaration).type), type.mapper || identityMapper); + } + else { + // Otherwise, get the declared constraint type, and if the constraint type is a type parameter, + // get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T', + // the modifiers type is T. Otherwise, the modifiers type is {}. + const declaredType = getTypeFromMappedTypeNode(type.declaration); + const constraint = getConstraintTypeFromMappedType(declaredType); + const extendedConstraint = constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint.flags & TypeFlags.Index ? instantiateType((extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; + } + function getErasedTemplateTypeFromMappedType(type: MappedType) { return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); } @@ -4552,7 +4617,7 @@ namespace ts { function isGenericMappedType(type: Type) { if (getObjectFlags(type) & ObjectFlags.Mapped) { const constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (TypeFlags.TypeParameter | TypeFlags.Index)); + return maybeTypeOfKind(constraintType, TypeFlags.TypeVariable | TypeFlags.Index); } return false; } @@ -4640,33 +4705,24 @@ namespace ts { * The apparent type of a type parameter is the base constraint instantiated with the type parameter * as the type argument for the 'this' type. */ - function getApparentTypeOfTypeParameter(type: TypeParameter) { + function getApparentTypeOfTypeVariable(type: TypeVariable) { if (!type.resolvedApparentType) { - let constraintType = getConstraintOfTypeParameter(type); + let constraintType = getConstraintOfTypeVariable(type); while (constraintType && constraintType.flags & TypeFlags.TypeParameter) { - constraintType = getConstraintOfTypeParameter(constraintType); + constraintType = getConstraintOfTypeVariable(constraintType); } type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); } return type.resolvedApparentType; } - /** - * The apparent type of an indexed access T[K] is the type of T's string index signature, if any. - */ - function getApparentTypeOfIndexedAccess(type: IndexedAccessType) { - return getIndexTypeOfType(getApparentType(type.objectType), IndexKind.String) || type; - } - /** * For a type parameter, return the base constraint of the type parameter. For the string, number, * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type: Type): Type { - const t = type.flags & TypeFlags.TypeParameter ? getApparentTypeOfTypeParameter(type) : - type.flags & TypeFlags.IndexedAccess ? getApparentTypeOfIndexedAccess(type) : - type; + const t = type.flags & TypeFlags.TypeVariable ? getApparentTypeOfTypeVariable(type) : type; return t.flags & TypeFlags.StringLike ? globalStringType : t.flags & TypeFlags.NumberLike ? globalNumberType : t.flags & TypeFlags.BooleanLike ? globalBooleanType : @@ -5252,6 +5308,12 @@ namespace ts { return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } + function getConstraintOfTypeVariable(type: TypeVariable): Type { + return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(type) : + type.flags & TypeFlags.IndexedAccess ? (type).constraint : + undefined; + } + function getParentSymbolOfTypeParameter(typeParameter: TypeParameter): Symbol { return getSymbolOfNode(getDeclarationOfKind(typeParameter.symbol, SyntaxKind.TypeParameter).parent); } @@ -5624,6 +5686,7 @@ namespace ts { containsString?: boolean; containsNumber?: boolean; containsStringOrNumberLiteral?: boolean; + unionIndex?: number; } function binarySearchTypes(types: Type[], type: Type): number { @@ -5818,6 +5881,9 @@ namespace ts { typeSet.containsAny = true; } else if (!(type.flags & TypeFlags.Never) && (strictNullChecks || !(type.flags & TypeFlags.Nullable)) && !contains(typeSet, type)) { + if (type.flags & TypeFlags.Union && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } typeSet.push(type); } } @@ -5844,15 +5910,6 @@ namespace ts { if (types.length === 0) { return emptyObjectType; } - for (let i = 0; i < types.length; i++) { - const type = types[i]; - if (type.flags & TypeFlags.Union) { - // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of - // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. - return getUnionType(map((type).types, t => getIntersectionType(replaceElement(types, i, t))), - /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); - } - } const typeSet = [] as TypeSet; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { @@ -5861,6 +5918,14 @@ namespace ts { if (typeSet.length === 1) { return typeSet[0]; } + const unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of + // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. + const unionType = typeSet[unionIndex]; + return getUnionType(map(unionType.types, t => getIntersectionType(replaceElement(typeSet, unionIndex, t))), + /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); + } const id = getTypeListId(typeSet); let type = intersectionTypes[id]; if (!type) { @@ -5882,7 +5947,7 @@ namespace ts { return links.resolvedType; } - function getIndexTypeForTypeParameter(type: TypeParameter) { + function getIndexTypeForGenericType(type: TypeVariable | UnionOrIntersectionType) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(TypeFlags.Index); type.resolvedIndexType.type = type; @@ -5901,12 +5966,17 @@ namespace ts { } function getIndexType(type: Type): Type { - return type.flags & TypeFlags.TypeParameter ? getIndexTypeForTypeParameter(type) : + return maybeTypeOfKind(type, TypeFlags.TypeVariable) ? getIndexTypeForGenericType(type) : getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(type) : type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType : getLiteralTypeFromPropertyNames(type); } + function getIndexTypeOrString(type: Type): Type { + const indexType = getIndexType(type); + return indexType !== neverType ? indexType : stringType; + } + function getTypeFromTypeOperatorNode(node: TypeOperatorNode) { const links = getNodeLinks(node); if (!links.resolvedType) { @@ -5919,6 +5989,24 @@ namespace ts { const type = createType(TypeFlags.IndexedAccess); type.objectType = objectType; type.indexType = indexType; + // We eagerly compute the constraint of the indexed access type such that circularity + // errors are immediately caught and reported. For example, class C { x: this["x"] } + // becomes an error only when the constraint is eagerly computed. + if (type.objectType.flags & TypeFlags.StructuredType) { + // The constraint of T[K], where T is an object, union, or intersection type, + // is the type of the string index signature of T, if any. + type.constraint = getIndexTypeOfType(type.objectType, IndexKind.String); + } + else if (type.objectType.flags & TypeFlags.TypeVariable) { + // The constraint of T[K], where T is a type variable, is A[K], where A is the + // apparent type of T. + const apparentType = getApparentTypeOfTypeVariable(type.objectType); + if (apparentType !== emptyObjectType) { + type.constraint = isTypeOfKind((type).indexType, TypeFlags.StringLike) ? + getIndexedAccessType(apparentType, (type).indexType) : + getIndexTypeOfType(apparentType, IndexKind.String); + } + } return type; } @@ -5993,20 +6081,25 @@ namespace ts { } const mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); const templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; - return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken); + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } function getIndexedAccessType(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode) { - if (indexType.flags & TypeFlags.TypeParameter || - objectType.flags & TypeFlags.TypeParameter && indexType.flags & TypeFlags.Index || + // If the index type is generic, if the object type is generic and doesn't originate in an expression, + // or if the object type is a mapped type with a generic constraint, we are performing a higher-order + // index access where we cannot meaningfully access the properties of the object type. Note that for a + // generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to + // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved + // eagerly using the constraint type of 'this' at the given location. + if (maybeTypeOfKind(indexType, TypeFlags.TypeVariable | TypeFlags.Index) || + maybeTypeOfKind(objectType, TypeFlags.TypeVariable) && !(accessNode && accessNode.kind === SyntaxKind.ElementAccessExpression) || isGenericMappedType(objectType)) { - // If either the object type or the index type are type parameters, or if the object type is a mapped - // type with a generic constraint, we are performing a higher-order index access where we cannot - // meaningfully access the properties of the object type. In those cases, we first check that the - // index type is assignable to 'keyof T' for the object type. + if (objectType.flags & TypeFlags.Any) { + return objectType; + } + // We first check that the index type is assignable to 'keyof T' for the object type. if (accessNode) { - const keyType = indexType.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(indexType) || emptyObjectType : indexType; - if (!isTypeAssignableTo(keyType, getIndexType(objectType))) { + if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { error(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); return unknownType; } @@ -6021,6 +6114,7 @@ namespace ts { const id = objectType.id + "," + indexType.id; return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); } + // In the following we resolve T[K] to the type of the property in T selected by K. const apparentObjectType = getApparentType(objectType); if (indexType.flags & TypeFlags.Union && !(indexType.flags & TypeFlags.Primitive)) { const propTypes: Type[] = []; @@ -6091,11 +6185,25 @@ namespace ts { * this function should be called in a left folding style, with left = previous result of getSpreadType * and right = the new element to be spread. */ - function getSpreadType(left: Type, right: Type, isFromObjectLiteral: boolean): ResolvedType | IntrinsicType { - Debug.assert(!!(left.flags & (TypeFlags.Object | TypeFlags.Any)) && !!(right.flags & (TypeFlags.Object | TypeFlags.Any)), "Only object types may be spread."); + function getSpreadType(left: Type, right: Type, isFromObjectLiteral: boolean): Type { if (left.flags & TypeFlags.Any || right.flags & TypeFlags.Any) { return anyType; } + left = filterType(left, t => !(t.flags & TypeFlags.Nullable)); + if (left.flags & TypeFlags.Never) { + return right; + } + right = filterType(right, t => !(t.flags & TypeFlags.Nullable)); + if (right.flags & TypeFlags.Never) { + return left; + } + if (left.flags & TypeFlags.Union) { + return mapType(left, t => getSpreadType(t, right, isFromObjectLiteral)); + } + if (right.flags & TypeFlags.Union) { + return mapType(right, t => getSpreadType(left, t, isFromObjectLiteral)); + } + const members = createMap(); const skippedPrivateMembers = createMap(); let stringIndexInfo: IndexInfo; @@ -6482,7 +6590,36 @@ namespace ts { return result; } - function instantiateMappedType(type: MappedType, mapper: TypeMapper): MappedType { + function instantiateMappedType(type: MappedType, mapper: TypeMapper): Type { + // Check if we have a homomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some + // type variable T. If so, the mapped type is distributive over a union type and when T is instantiated + // to a union type A | B, we produce { [P in keyof A]: X } | { [P in keyof B]: X }. Furthermore, for + // homomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a + // union type A | undefined, we produce { [P in keyof A]: X } | undefined. + const constraintType = getConstraintTypeFromMappedType(type); + if (constraintType.flags & TypeFlags.Index) { + const typeVariable = (constraintType).type; + const mappedTypeVariable = instantiateType(typeVariable, mapper); + if (typeVariable !== mappedTypeVariable) { + return mapType(mappedTypeVariable, t => { + if (isMappableType(t)) { + const replacementMapper = createUnaryTypeMapper(typeVariable, t); + const combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } + } + return instantiateMappedObjectType(type, mapper); + } + + function isMappableType(type: Type) { + return type.flags & (TypeFlags.TypeParameter | TypeFlags.Object | TypeFlags.Intersection | TypeFlags.IndexedAccess); + } + + function instantiateMappedObjectType(type: MappedType, mapper: TypeMapper): Type { const result = createObjectType(ObjectFlags.Mapped | ObjectFlags.Instantiated, type.symbol); result.declaration = type.declaration; result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; @@ -7084,6 +7221,25 @@ namespace ts { } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type: Type): boolean { + if (!(type.flags & TypeFlags.UnionOrIntersection)) { + return false; + } + // at this point we know that this is union or intersection type possibly with nullable constituents. + // check if we still will have compound type if we ignore nullable components. + let seenNonNullable = false; + for (const t of (type).types) { + if (t.flags & TypeFlags.Nullable) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } + // Compare two types and return // Ternary.True if they are related with no assumptions, // Ternary.Maybe if they are related with assumptions of other relationships, or @@ -7116,7 +7272,7 @@ namespace ts { // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - if (target.flags & TypeFlags.UnionOrIntersection) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -7165,8 +7321,7 @@ namespace ts { return result; } } - - if (target.flags & TypeFlags.TypeParameter) { + else if (target.flags & TypeFlags.TypeParameter) { // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P]. if (getObjectFlags(source) & ObjectFlags.Mapped && getConstraintTypeFromMappedType(source) === getIndexType(target)) { if (!(source).declaration.questionToken) { @@ -7195,12 +7350,14 @@ namespace ts { return result; } } - // Given a type parameter T with a constraint C, a type S is assignable to + // Given a type variable T with a constraint C, a type S is assignable to // keyof T if S is assignable to keyof C. - const constraint = getConstraintOfTypeParameter((target).type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; + if ((target).type.flags & TypeFlags.TypeVariable) { + const constraint = getConstraintOfTypeVariable((target).type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } } } } @@ -7212,6 +7369,14 @@ namespace ts { return result; } } + // A type S is related to a type T[K] if S is related to A[K], where K is string-like and + // A is the apparent type of S. + if ((target).constraint) { + if (result = isRelatedTo(source, (target).constraint, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } } if (source.flags & TypeFlags.TypeParameter) { @@ -7220,6 +7385,7 @@ namespace ts { const indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); const templateType = getTemplateTypeFromMappedType(target); if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; return result; } } @@ -7241,6 +7407,16 @@ namespace ts { } } } + else if (source.flags & TypeFlags.IndexedAccess) { + // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and + // A is the apparent type of S. + if ((source).constraint) { + if (result = isRelatedTo((source).constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } else { if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target) { // We have type references to same target type, see if relationship holds for all type arguments @@ -7524,25 +7700,30 @@ namespace ts { // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. function mappedTypeRelatedTo(source: Type, target: Type, reportErrors: boolean): Ternary { - if (isGenericMappedType(source) && isGenericMappedType(target)) { - let result: Ternary; - if (relation === identityRelation) { - const readonlyMatches = !(source).declaration.readonlyToken === !(target).declaration.readonlyToken; - const optionalMatches = !(source).declaration.questionToken === !(target).declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !(source).declaration.questionToken || (target).declaration.questionToken) { - if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + if (isGenericMappedType(target)) { + if (isGenericMappedType(source)) { + let result: Ternary; + if (relation === identityRelation) { + const readonlyMatches = !(source).declaration.readonlyToken === !(target).declaration.readonlyToken; + const optionalMatches = !(source).declaration.questionToken === !(target).declaration.questionToken; + if (readonlyMatches && optionalMatches) { + if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); + } + } + } + else { + if (relation === comparableRelation || !(source).declaration.questionToken || (target).declaration.questionToken) { + if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + } } } } } + else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { + return Ternary.True; + } return Ternary.False; } @@ -8376,28 +8557,78 @@ namespace ts { // Return true if the given type could possibly reference a type parameter for which // we perform type inference (i.e. a type parameter of a generic function). We cache // results for union and intersection types for performance reasons. - function couldContainTypeParameters(type: Type): boolean { + function couldContainTypeVariables(type: Type): boolean { const objectFlags = getObjectFlags(type); - return !!(type.flags & TypeFlags.TypeParameter || - objectFlags & ObjectFlags.Reference && forEach((type).typeArguments, couldContainTypeParameters) || + return !!(type.flags & TypeFlags.TypeVariable || + objectFlags & ObjectFlags.Reference && forEach((type).typeArguments, couldContainTypeVariables) || objectFlags & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral | SymbolFlags.Class) || objectFlags & ObjectFlags.Mapped || - type.flags & TypeFlags.UnionOrIntersection && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & TypeFlags.UnionOrIntersection && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type: UnionOrIntersectionType): boolean { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type: UnionOrIntersectionType): boolean { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type: Type, typeParameter: TypeParameter): boolean { return type === typeParameter || type.flags & TypeFlags.UnionOrIntersection && forEach((type).types, t => isTypeParameterAtTopLevel(t, typeParameter)); } - function inferTypes(context: InferenceContext, originalSource: Type, originalTarget: Type) { - const typeParameters = context.signature.typeParameters; + // Infer a suitable input type for a homomorphic mapped type { [P in keyof T]: X }. We construct + // an object type with the same set of properties as the source type, where the type of each + // property is computed by inferring from the source property type to X for the type + // variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for). + function inferTypeForHomomorphicMappedType(source: Type, target: MappedType): Type { + const properties = getPropertiesOfType(source); + let indexInfo = getIndexInfoOfType(source, IndexKind.String); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + const typeVariable = getIndexedAccessType((getConstraintTypeFromMappedType(target)).type, getTypeParameterFromMappedType(target)); + const typeVariableArray = [typeVariable]; + const typeInferences = createTypeInferencesObject(); + const typeInferencesArray = [typeInferences]; + const templateType = getTemplateTypeFromMappedType(target); + const readonlyMask = target.declaration.readonlyToken ? false : true; + const optionalMask = target.declaration.questionToken ? 0 : SymbolFlags.Optional; + const members = createSymbolTable(properties); + for (const prop of properties) { + const inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + const inferredProp = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | prop.flags & optionalMask, prop.name); + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); + members[prop.name] = inferredProp; + } + if (indexInfo) { + const inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + + function inferTargetType(sourceType: Type): Type { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + const inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, /*subtypeReduction*/ true); + } + } + + function inferTypesWithContext(context: InferenceContext, originalSource: Type, originalTarget: Type) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + + function inferTypes(typeVariables: TypeVariable[], typeInferences: TypeInferences[], originalSource: Type, originalTarget: Type) { let sourceStack: Type[]; let targetStack: Type[]; let depth = 0; @@ -8415,7 +8646,7 @@ namespace ts { } function inferFromTypes(source: Type, target: Type) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -8465,7 +8696,7 @@ namespace ts { target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & TypeFlags.TypeParameter) { + if (target.flags & TypeFlags.TypeVariable) { // If target is a type parameter, make an inference, unless the source type contains // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). // Because the anyFunctionType is internal, it should not be exposed to the user by adding @@ -8475,9 +8706,9 @@ namespace ts { if (source.flags & TypeFlags.ContainsAnyFunctionType) { return; } - for (let i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - const inferences = context.inferences[i]; + for (let i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + const inferences = typeInferences[i]; if (!inferences.isFixed) { // Any inferences that are made to a type parameter in a union type are inferior // to inferences made to a flat (non-union) type. This is because if we infer to @@ -8491,7 +8722,7 @@ namespace ts { if (!contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & TypeFlags.TypeParameter && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -8510,24 +8741,24 @@ namespace ts { } else if (target.flags & TypeFlags.UnionOrIntersection) { const targetTypes = (target).types; - let typeParameterCount = 0; - let typeParameter: TypeParameter; - // First infer to each type in union or intersection that isn't a type parameter + let typeVariableCount = 0; + let typeVariable: TypeVariable; + // First infer to each type in union or intersection that isn't a type variable for (const t of targetTypes) { - if (t.flags & TypeFlags.TypeParameter && contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + if (t.flags & TypeFlags.TypeVariable && contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - // Next, if target containings a single naked type parameter, make a secondary inference to that type - // parameter. This gives meaningful results for union types in co-variant positions and intersection + // Next, if target containings a single naked type variable, make a secondary inference to that type + // variable. This gives meaningful results for union types in co-variant positions and intersection // types in contra-variant positions (such as callback parameters). - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -8539,19 +8770,6 @@ namespace ts { } } else { - if (getObjectFlags(target) & ObjectFlags.Mapped) { - const constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & ObjectFlags.Mapped) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); - return; - } - if (constraintType.flags & TypeFlags.TypeParameter) { - inferFromTypes(getIndexType(source), constraintType); - inferFromTypes(getUnionType(map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); - return; - } - } source = getApparentType(source); if (source.flags & TypeFlags.Object) { if (isInProcess(source, target)) { @@ -8572,15 +8790,45 @@ namespace ts { sourceStack[depth] = source; targetStack[depth] = target; depth++; - inferFromProperties(source, target); - inferFromSignatures(source, target, SignatureKind.Call); - inferFromSignatures(source, target, SignatureKind.Construct); - inferFromIndexTypes(source, target); + inferFromObjectTypes(source, target); depth--; } } } + function inferFromObjectTypes(source: Type, target: Type) { + if (getObjectFlags(target) & ObjectFlags.Mapped) { + const constraintType = getConstraintTypeFromMappedType(target); + if (constraintType.flags & TypeFlags.Index) { + // We're inferring from some source type S to a homomorphic mapped type { [P in keyof T]: X }, + // where T is a type variable. Use inferTypeForHomomorphicMappedType to infer a suitable source + // type and then make a secondary inference from that type to T. We make a secondary inference + // such that direct inferences to T get priority over inferences to Partial, for example. + const index = indexOf(typeVariables, (constraintType).type); + if (index >= 0 && !typeInferences[index].isFixed) { + const inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } + return; + } + if (constraintType.flags & TypeFlags.TypeParameter) { + // We're inferring from some source type S to a mapped type { [P in T]: X }, where T is a type + // parameter. Infer from 'keyof S' to T and infer from a union of each property type in S to X. + inferFromTypes(getIndexType(source), constraintType); + inferFromTypes(getUnionType(map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); + return; + } + } + inferFromProperties(source, target); + inferFromSignatures(source, target, SignatureKind.Call); + inferFromSignatures(source, target, SignatureKind.Construct); + inferFromIndexTypes(source, target); + } + function inferFromProperties(source: Type, target: Type) { const properties = getPropertiesOfObjectType(target); for (const targetProp of properties) { @@ -10253,6 +10501,29 @@ namespace ts { return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node: Node, container: Node, diagnosticMessage: DiagnosticMessage) { + const containingClassDecl = container.parent; + const baseTypeNode = getClassExtendsHeritageClauseElement(containingClassDecl); + + // If a containing class does not have extends clause or the class extends null + // skip checking whether super statement is called before "this" accessing. + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + const superCall = getSuperCallInConstructor(container); + + // We should give an error in the following cases: + // - No super-call + // - "this" is accessing before super-call. + // i.e super(this) + // this.x; super(); + // We want to make sure that super-call is done before accessing "this" so that + // "this" is not accessed as a parameter of the super-call. + if (!superCall || superCall.end > node.pos) { + // In ES6, super inside constructor of class-declaration has to precede "this" accessing + error(node, diagnosticMessage); + } + } + } + function checkThisExpression(node: Node): Type { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. @@ -10260,26 +10531,7 @@ namespace ts { let needToCaptureLexicalThis = false; if (container.kind === SyntaxKind.Constructor) { - const containingClassDecl = container.parent; - const baseTypeNode = getClassExtendsHeritageClauseElement(containingClassDecl); - - // If a containing class does not have extends clause or the class extends null - // skip checking whether super statement is called before "this" accessing. - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - const superCall = getSuperCallInConstructor(container); - - // We should give an error in the following cases: - // - No super-call - // - "this" is accessing before super-call. - // i.e super(this) - // this.x; super(); - // We want to make sure that super-call is done before accessing "this" so that - // "this" is not accessed as a parameter of the super-call. - if (!superCall || superCall.end > node.pos) { - // In ES6, super inside constructor of class-declaration has to precede "this" accessing - error(node, Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. @@ -10427,6 +10679,10 @@ namespace ts { return unknownType; } + if (!isCallExpression && container.kind === SyntaxKind.Constructor) { + checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } + if ((getModifierFlags(container) & ModifierFlags.Static) || isCallExpression) { nodeCheckFlag = NodeCheckFlags.SuperStatic; } @@ -11092,13 +11348,7 @@ namespace ts { } function checkSpreadExpression(node: SpreadElement, contextualMapper?: TypeMapper): Type { - // It is usually not safe to call checkExpressionCached if we can be contextually typing. - // You can tell that we are contextually typing because of the contextualMapper parameter. - // While it is true that a spread element can have a contextual type, it does not do anything - // with this type. It is neither affected by it, nor does it propagate it to its operand. - // So the fact that contextualMapper is passed is not important, because the operand of a spread - // element is not contextually typed. - const arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); + const arrayOrIterableType = checkExpression(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } @@ -11308,7 +11558,8 @@ namespace ts { if (impliedProp) { prop.flags |= impliedProp.flags & SymbolFlags.Optional; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, IndexKind.String)) { error(memberDecl.name, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } @@ -11324,6 +11575,9 @@ namespace ts { member = prop; } else if (memberDecl.kind === SyntaxKind.SpreadAssignment) { + if (languageVersion < ScriptTarget.ESNext) { + checkExternalEmitHelpers(memberDecl, ExternalEmitHelpers.Assign); + } if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); propertiesArray = []; @@ -11333,7 +11587,7 @@ namespace ts { typeFlags = 0; } const type = checkExpression((memberDecl as SpreadAssignment).expression); - if (!(type.flags & (TypeFlags.Object | TypeFlags.Any))) { + if (!isValidSpreadType(type)) { error(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } @@ -11384,8 +11638,11 @@ namespace ts { if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; + if (spread.flags & TypeFlags.Object) { + // only set the symbol and flags if this is a (fresh) object type + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; + } return spread; } @@ -11411,6 +11668,12 @@ namespace ts { } } + function isValidSpreadType(type: Type): boolean { + return !!(type.flags & (TypeFlags.Any | TypeFlags.Null | TypeFlags.Undefined) || + type.flags & TypeFlags.Object && !isGenericMappedType(type) || + type.flags & TypeFlags.UnionOrIntersection && !forEach((type).types, t => !isValidSpreadType(t))); + } + function checkJsxSelfClosingElement(node: JsxSelfClosingElement) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; @@ -11511,6 +11774,9 @@ namespace ts { } function checkJsxSpreadAttribute(node: JsxSpreadAttribute, elementAttributesType: Type, nameTable: Map) { + if (compilerOptions.jsx === JsxEmit.React) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Assign); + } const type = checkExpression(node.expression); const props = getPropertiesOfType(type); for (const prop of props) { @@ -12411,7 +12677,7 @@ namespace ts { const context = createInferenceContext(signature, /*inferUnionTypes*/ true); forEachMatchingParameterType(contextualSignature, signature, (source, target) => { // Type parameters from outer context referenced by source type are fixed by instantiation of the source type - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -12446,7 +12712,7 @@ namespace ts { if (thisType) { const thisArgumentNode = getThisArgumentOfCall(node); const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } // We perform two passes over the arguments. In the first pass we infer from all arguments, but use @@ -12468,7 +12734,7 @@ namespace ts { argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } @@ -12483,7 +12749,7 @@ namespace ts { if (excludeArgument[i] === false) { const arg = args[i]; const paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -13302,13 +13568,14 @@ namespace ts { const containingClass = getContainingClass(node); if (containingClass) { const containingType = getTypeOfNode(containingClass); - const baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + let baseTypes = getBaseTypes(containingType as InterfaceType); + while (baseTypes.length) { const baseType = baseTypes[0]; if (modifiers & ModifierFlags.Protected && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType as InterfaceType); } } if (modifiers & ModifierFlags.Private) { @@ -13570,7 +13837,7 @@ namespace ts { for (let i = 0; i < len; i++) { const declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -13656,7 +13923,7 @@ namespace ts { // T in the second overload so that we do not infer Base as a candidate for T // (inferring Base would make type argument inference inconsistent between the two // overloads). - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } @@ -13792,7 +14059,7 @@ namespace ts { if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func: FunctionLikeDeclaration) { @@ -14228,10 +14495,10 @@ namespace ts { // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. - if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { + if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, TypeFlags.NumberLike | TypeFlags.ESSymbol))) { error(left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeParameter | TypeFlags.IndexedAccess)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeVariable)) { error(right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -14276,6 +14543,9 @@ namespace ts { } } else if (property.kind === SyntaxKind.SpreadAssignment) { + if (languageVersion < ScriptTarget.ESNext) { + checkExternalEmitHelpers(property, ExternalEmitHelpers.Rest); + } const nonRestNames: PropertyName[] = []; if (allProperties) { for (let i = 0; i < allProperties.length - 1; i++) { @@ -14813,8 +15083,8 @@ namespace ts { function isLiteralContextualType(contextualType: Type) { if (contextualType) { - if (contextualType.flags & TypeFlags.TypeParameter) { - const apparentType = getApparentTypeOfTypeParameter(contextualType); + if (contextualType.flags & TypeFlags.TypeVariable) { + const apparentType = getApparentTypeOfTypeVariable(contextualType); // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. @@ -14823,7 +15093,7 @@ namespace ts { } contextualType = apparentType; } - return maybeTypeOfKind(contextualType, TypeFlags.Literal); + return maybeTypeOfKind(contextualType, (TypeFlags.Literal | TypeFlags.Index)); } return false; } @@ -15188,6 +15458,13 @@ namespace ts { checkGrammarFunctionLikeDeclaration(node); } + if (isAsyncFunctionLike(node) && languageVersion < ScriptTarget.ES2017) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Awaiter); + if (languageVersion < ScriptTarget.ES2015) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Generator); + } + } + checkTypeParameters(node.typeParameters); forEach(node.parameters, checkParameter); @@ -15642,7 +15919,7 @@ namespace ts { checkSourceElement(node.type); const type = getTypeFromMappedTypeNode(node); const constraintType = getConstraintTypeFromMappedType(type); - const keyType = constraintType.flags & TypeFlags.TypeParameter ? getApparentTypeOfTypeParameter(constraintType) : constraintType; + const keyType = constraintType.flags & TypeFlags.TypeVariable ? getApparentTypeOfTypeVariable(constraintType) : constraintType; checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); } @@ -16024,7 +16301,7 @@ namespace ts { return undefined; } - const onfulfilledParameterType = getTypeWithFacts(getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)), TypeFacts.NEUndefined); + const onfulfilledParameterType = getTypeWithFacts(getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)), TypeFacts.NEUndefinedOrNull); if (isTypeAny(onfulfilledParameterType)) { return undefined; } @@ -16307,6 +16584,10 @@ namespace ts { } } + function getParameterTypeNodeForDecoratorCheck(node: ParameterDeclaration): TypeNode { + return node.dotDotDotToken ? getRestParameterElementType(node.type) : node.type; + } + /** Check the decorators of a node */ function checkDecorators(node: Node): void { if (!node.decorators) { @@ -16323,14 +16604,22 @@ namespace ts { error(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + const firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.Decorate); + if (node.kind === SyntaxKind.Parameter) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.Param); + } + if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.Metadata); + // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { case SyntaxKind.ClassDeclaration: const constructor = getFirstConstructorWithBody(node); if (constructor) { for (const parameter of constructor.parameters) { - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; @@ -16339,15 +16628,17 @@ namespace ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: for (const parameter of (node).parameters) { - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced((node).type); break; case SyntaxKind.PropertyDeclaration: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; case SyntaxKind.Parameter: - markTypeNodeAsReferenced((node).type); + markTypeNodeAsReferenced((node).type); break; } } @@ -16510,6 +16801,14 @@ namespace ts { } } + function isRemovedPropertyFromObjectSpread(node: Node) { + if (isBindingElement(node) && isObjectBindingPattern(node.parent)) { + const lastElement = lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } + function errorUnusedLocal(node: Node, name: string) { if (isIdentifierThatStartsWithUnderScore(node)) { const declaration = getRootDeclaration(node.parent); @@ -16519,7 +16818,10 @@ namespace ts { return; } } - error(node, Diagnostics._0_is_declared_but_never_used, name); + + if (!isRemovedPropertyFromObjectSpread(node.kind === SyntaxKind.Identifier ? node.parent : node)) { + error(node, Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName: DeclarationName) { @@ -16710,7 +17012,7 @@ namespace ts { } function checkCollisionWithGlobalPromiseInGeneratedCode(node: Node, name: Identifier): void { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= ScriptTarget.ES2017 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } @@ -16887,6 +17189,9 @@ namespace ts { } if (node.kind === SyntaxKind.BindingElement) { + if (node.parent.kind === SyntaxKind.ObjectBindingPattern && languageVersion < ScriptTarget.ESNext) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Rest); + } // check computed properties inside property names of binding elements if (node.propertyName && node.propertyName.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.propertyName); @@ -17119,6 +17424,7 @@ namespace ts { // Grammar checking checkGrammarForInOrForOfStatement(node); + const rightType = checkNonNullExpression(node.expression); // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form // for (let VarDecl in Expr) Statement @@ -17129,7 +17435,6 @@ namespace ts { if (variable && isBindingPattern(variable.name)) { error(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } - checkForInOrForOfVariableDeclaration(node); } else { @@ -17142,7 +17447,7 @@ namespace ts { if (varExpr.kind === SyntaxKind.ArrayLiteralExpression || varExpr.kind === SyntaxKind.ObjectLiteralExpression) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } - else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, TypeFlags.StringLike)) { + else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -17151,10 +17456,9 @@ namespace ts { } } - const rightType = checkNonNullExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeParameter | TypeFlags.IndexedAccess)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeVariable)) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } @@ -17805,6 +18109,10 @@ namespace ts { const baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < ScriptTarget.ES2015 && !isInAmbientContext(node)) { + checkExternalEmitHelpers(baseTypeNode.parent, ExternalEmitHelpers.Extends); + } + const baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { const baseType = baseTypes[0]; @@ -20251,8 +20559,6 @@ namespace ts { // Initialize global symbol table let augmentations: LiteralExpression[][]; - let requestedExternalEmitHelpers: NodeFlags = 0; - let firstFileRequestingExternalHelpers: SourceFile; for (const file of host.getSourceFiles()) { if (!isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); @@ -20272,15 +20578,6 @@ namespace ts { } } } - if ((compilerOptions.isolatedModules || isExternalModule(file)) && !file.isDeclarationFile) { - const fileRequestedExternalEmitHelpers = file.flags & NodeFlags.EmitHelperFlags; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; - } - } - } } if (augmentations) { @@ -20346,57 +20643,51 @@ namespace ts { const symbol = getGlobalSymbol("ReadonlyArray", SymbolFlags.Type, /*diagnostic*/ undefined); globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; + } - // If we have specified that we are importing helpers, we should report global - // errors if we cannot resolve the helpers external module, or if it does not have - // the necessary helpers exported. - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - // Find the first reference to the helpers module. - const helpersModule = resolveExternalModule( - firstFileRequestingExternalHelpers, - externalHelpersModuleNameText, - Diagnostics.Cannot_find_module_0, - /*errorNode*/ undefined); - - // If we found the module, report errors if it does not have the necessary exports. - if (helpersModule) { - const exports = helpersModule.exports; - if (requestedExternalEmitHelpers & NodeFlags.HasClassExtends && languageVersion < ScriptTarget.ES2015) { - verifyHelperSymbol(exports, "__extends", SymbolFlags.Value); - } - if (requestedExternalEmitHelpers & NodeFlags.HasSpreadAttribute && - (languageVersion < ScriptTarget.ESNext || compilerOptions.jsx === JsxEmit.React)) { - verifyHelperSymbol(exports, "__assign", SymbolFlags.Value); - } - if (languageVersion < ScriptTarget.ESNext && requestedExternalEmitHelpers & NodeFlags.HasRestAttribute) { - verifyHelperSymbol(exports, "__rest", SymbolFlags.Value); - } - if (requestedExternalEmitHelpers & NodeFlags.HasDecorators) { - verifyHelperSymbol(exports, "__decorate", SymbolFlags.Value); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports, "__metadata", SymbolFlags.Value); - } - } - if (requestedExternalEmitHelpers & NodeFlags.HasParamDecorators) { - verifyHelperSymbol(exports, "__param", SymbolFlags.Value); - } - if (requestedExternalEmitHelpers & NodeFlags.HasAsyncFunctions) { - verifyHelperSymbol(exports, "__awaiter", SymbolFlags.Value); - if (languageVersion < ScriptTarget.ES2015) { - verifyHelperSymbol(exports, "__generator", SymbolFlags.Value); + function checkExternalEmitHelpers(location: Node, helpers: ExternalEmitHelpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + const sourceFile = getSourceFileOfNode(location); + if (isEffectiveExternalModule(sourceFile, compilerOptions)) { + const helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + const uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (let helper = ExternalEmitHelpers.FirstEmitHelper; helper <= ExternalEmitHelpers.LastEmitHelper; helper <<= 1) { + if (uncheckedHelpers & helper) { + const name = getHelperName(helper); + const symbol = getSymbol(helpersModule.exports, escapeIdentifier(name), SymbolFlags.Value); + if (!symbol) { + error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, externalHelpersModuleNameText, name); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags) { - const symbol = getSymbol(symbols, escapeIdentifier(name), meaning); - if (!symbol) { - error(/*location*/ undefined, Diagnostics.Module_0_has_no_exported_member_1, externalHelpersModuleNameText, name); + function getHelperName(helper: ExternalEmitHelpers) { + switch (helper) { + case ExternalEmitHelpers.Extends: return "__extends"; + case ExternalEmitHelpers.Assign: return "__assign"; + case ExternalEmitHelpers.Rest: return "__rest"; + case ExternalEmitHelpers.Decorate: return "__decorate"; + case ExternalEmitHelpers.Metadata: return "__metadata"; + case ExternalEmitHelpers.Param: return "__param"; + case ExternalEmitHelpers.Awaiter: return "__awaiter"; + case ExternalEmitHelpers.Generator: return "__generator"; } } + function resolveHelpersModule(node: SourceFile, errorNode: Node) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; + } + return externalHelpersModule; + } + + function createInstantiatedPromiseLikeType(): ObjectType { const promiseLikeType = getGlobalPromiseLikeType(); if (promiseLikeType !== emptyGenericType) { @@ -21141,6 +21432,9 @@ namespace ts { else if (accessor.body === undefined && !(getModifierFlags(accessor) & ModifierFlags.Abstract)) { return grammarErrorAtPos(getSourceFileOfNode(accessor), accessor.end - 1, ";".length, Diagnostics._0_expected, "{"); } + else if (accessor.body && getModifierFlags(accessor) & ModifierFlags.Abstract) { + return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, Diagnostics.An_accessor_cannot_have_type_parameters); } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 3c6a86134ea..251eeb58b15 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -272,7 +272,7 @@ namespace ts { "es2017": ScriptTarget.ES2017, "esnext": ScriptTarget.ESNext, }), - description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, paramType: Diagnostics.VERSION, }, { @@ -549,14 +549,7 @@ namespace ts { /* @internal */ export function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]) { - const key = trimString((value || "")).toLowerCase(); - const map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } /* @internal */ @@ -848,7 +841,7 @@ namespace ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string, resolutionStack: Path[] = []): ParsedCommandLine { + export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string, resolutionStack: Path[] = [], extraFileExtensions: FileExtensionInfo[] = []): ParsedCommandLine { const errors: Diagnostic[] = []; const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames); const resolvedPath = toPath(configFileName || "", basePath, getCanonicalFileName); @@ -988,7 +981,7 @@ namespace ts { includeSpecs = ["**/*"]; } - const result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + const result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !hasProperty(json, "files") && resolutionStack.length === 0) { errors.push( @@ -1192,7 +1185,7 @@ namespace ts { * @param host The host used to resolve files and directories. * @param errors An array for diagnostic reporting. */ - function matchFileNames(fileNames: string[], include: string[], exclude: string[], basePath: string, options: CompilerOptions, host: ParseConfigHost, errors: Diagnostic[]): ExpandResult { + function matchFileNames(fileNames: string[], include: string[], exclude: string[], basePath: string, options: CompilerOptions, host: ParseConfigHost, errors: Diagnostic[], extraFileExtensions: FileExtensionInfo[]): ExpandResult { basePath = normalizePath(basePath); // The exclude spec list is converted into a regular expression, which allows us to quickly @@ -1226,7 +1219,7 @@ namespace ts { // Rather than requery this for each file and filespec, we query the supported extensions // once and store it on the expansion context. - const supportedExtensions = getSupportedExtensions(options); + const supportedExtensions = getSupportedExtensions(options, extraFileExtensions); // Literal files are always included verbatim. An "include" or "exclude" specification cannot // remove a literal file. diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index cd96981c093..bd9190dbec7 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -156,6 +156,9 @@ namespace ts { if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 89057dd2939..ceff1359579 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -863,24 +863,6 @@ namespace ts { return result; } - /** - * Reduce the properties defined on a map-like (but not from its prototype chain). - * - * NOTE: This is intended for use with MapLike objects. For Map objects, use - * reduceProperties instead as it offers better performance. - * - * @param map The map-like to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - export function reduceOwnProperties(map: MapLike, callback: (aggregate: U, value: T, key: string) => U, initial: U): U { - let result = initial; - for (const key in map) if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - /** * Performs a shallow equality comparison of the contents of two map-likes. * @@ -1942,8 +1924,18 @@ namespace ts { export const supportedJavascriptExtensions = [".js", ".jsx"]; const allSupportedExtensions = supportedTypeScriptExtensions.concat(supportedJavascriptExtensions); - export function getSupportedExtensions(options?: CompilerOptions): string[] { - return options && options.allowJs ? allSupportedExtensions : supportedTypeScriptExtensions; + export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]): string[] { + const needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0) { + return needAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions; + } + const extensions = (needAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions).slice(0); + for (const extInfo of extraFileExtensions) { + if (needAllExtensions || extInfo.scriptKind === ScriptKind.TS) { + extensions.push(extInfo.extension); + } + } + return extensions; } export function hasJavaScriptFileExtension(fileName: string) { @@ -1954,10 +1946,10 @@ namespace ts { return forEach(supportedTypeScriptExtensions, extension => fileExtensionIs(fileName, extension)); } - export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions) { + export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]) { if (!fileName) { return false; } - for (const extension of getSupportedExtensions(compilerOptions)) { + for (const extension of getSupportedExtensions(compilerOptions, extraFileExtensions)) { if (fileExtensionIs(fileName, extension)) { return true; } diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index fd2740f20c2..cd98622e080 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -194,6 +194,7 @@ namespace ts { writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -1625,6 +1626,12 @@ namespace ts { Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case SyntaxKind.IndexSignature: + // Interfaces cannot have parameter types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: if (hasModifier(node.parent, ModifierFlags.Static)) { diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 63333dbe0b2..ebcea221f9e 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1677,16 +1677,10 @@ namespace ts { function createJsxFactoryExpressionFromEntityName(jsxFactory: EntityName, parent: JsxOpeningLikeElement): Expression { if (isQualifiedName(jsxFactory)) { - return createPropertyAccess( - createJsxFactoryExpressionFromEntityName( - jsxFactory.left, - parent - ), - setEmitFlags( - getMutableClone(jsxFactory.right), - EmitFlags.NoSourceMap - ) - ); + const left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); + const right = createSynthesizedNode(SyntaxKind.Identifier); + right.text = jsxFactory.right.text; + return createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 0ce21b2d9fe..2f0d6a4d975 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2558,6 +2558,8 @@ namespace ts { case SyntaxKind.OpenBraceToken: case SyntaxKind.OpenBracketToken: case SyntaxKind.LessThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: case SyntaxKind.NewKeyword: case SyntaxKind.StringLiteral: case SyntaxKind.NumericLiteral: @@ -2617,6 +2619,7 @@ namespace ts { } function parseUnionOrIntersectionType(kind: SyntaxKind, parseConstituentType: () => TypeNode, operator: SyntaxKind): TypeNode { + parseOptional(operator); let type = parseConstituentType(); if (token() === operator) { const types = createNodeArray([type], type.pos); @@ -6334,7 +6337,7 @@ namespace ts { break; case SyntaxKind.AsteriskToken: const asterisk = scanner.getTokenText(); - if (state === JSDocState.SawAsterisk) { + if (state === JSDocState.SawAsterisk || state === JSDocState.SavingComments) { // If we've already seen an asterisk, then we can no longer parse a tag on this line state = JSDocState.SavingComments; pushComment(asterisk); @@ -6355,7 +6358,10 @@ namespace ts { case SyntaxKind.WhitespaceTrivia: // only collect whitespace if we're already saving comments or have just crossed the comment indent margin const whitespace = scanner.getTokenText(); - if (state === JSDocState.SavingComments || margin !== undefined && indent + whitespace.length > margin) { + if (state === JSDocState.SavingComments) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -6363,6 +6369,8 @@ namespace ts { case SyntaxKind.EndOfFileToken: break; default: + // anything other than whitespace or asterisk at the beginning of the line starts the comment text + state = JSDocState.SavingComments; pushComment(scanner.getTokenText()); break; } diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 46db5188e33..650b9b0ef02 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -427,7 +427,7 @@ namespace ts { encodeLastRecordedSourceMapSpan(); - return stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index 43590791c83..8e32259ff0f 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -459,7 +459,7 @@ namespace ts { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index bc9341a4b4f..ad016972d0d 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -2286,14 +2286,19 @@ namespace ts { } } + startLexicalEnvironment(); let loopBody = visitNode(node.statement, visitor, isStatement); + const lexicalEnvironment = endLexicalEnvironment(); const currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { + if (loopOutParameters.length || lexicalEnvironment) { const statements = isBlock(loopBody) ? (loopBody).statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements); + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements); + } + addRange(statements, lexicalEnvironment) loopBody = createBlock(statements, /*location*/ undefined, /*multiline*/ true); } @@ -2837,7 +2842,6 @@ namespace ts { // _super.call(this, a) // _super.m.call(this, a) // _super.prototype.m.call(this, a) - resultingCall = createFunctionCall( visitNode(target, visitor, isExpression), visitNode(thisArg, visitor, isExpression), diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index 91e29e09886..0e3a42da0d2 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -101,20 +101,21 @@ namespace ts { // So the helper will be emit at the correct position instead of at the top of the source-file const moduleName = tryGetModuleNameFromFile(node, host, compilerOptions); const dependencies = createArrayLiteral(map(dependencyGroups, dependencyGroup => dependencyGroup.name)); - const updated = updateSourceFileNode( - node, - createNodeArray([ - createStatement( - createCall( - createPropertyAccess(createIdentifier("System"), "register"), + const updated = setEmitFlags( + updateSourceFileNode( + node, + createNodeArray([ + createStatement( + createCall( + createPropertyAccess(createIdentifier("System"), "register"), /*typeArguments*/ undefined, - moduleName - ? [moduleName, dependencies, moduleBodyFunction] - : [dependencies, moduleBodyFunction] + moduleName + ? [moduleName, dependencies, moduleBodyFunction] + : [dependencies, moduleBodyFunction] + ) ) - ) - ], node.statements) - ); + ], node.statements) + ), EmitFlags.NoTrailingComments); if (!(compilerOptions.outFile || compilerOptions.out)) { moveEmitHelpers(updated, moduleBodyBlock, helper => !helper.scoped); diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 62b2022b7df..877131b369c 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -345,6 +345,7 @@ namespace ts { case SyntaxKind.PropertyDeclaration: // TypeScript property declarations are elided. + return undefined; case SyntaxKind.Constructor: return visitConstructor(node); @@ -1222,11 +1223,12 @@ namespace ts { } const { firstAccessor, secondAccessor, setAccessor } = getAllAccessorDeclarations(node.members, accessor); - if (accessor !== firstAccessor) { + const firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - const decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + const decorators = firstAccessorWithDecorators.decorators; const parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -1275,7 +1277,7 @@ namespace ts { * @param node The declaration node. * @param allDecorators An object containing all of the decorators for the declaration. */ - function transformAllDecoratorsOfDeclaration(node: Declaration, allDecorators: AllDecorators) { + function transformAllDecoratorsOfDeclaration(node: Declaration, container: ClassLikeDeclaration, allDecorators: AllDecorators) { if (!allDecorators) { return undefined; } @@ -1283,7 +1285,7 @@ namespace ts { const decoratorExpressions: Expression[] = []; addRange(decoratorExpressions, map(allDecorators.decorators, transformDecorator)); addRange(decoratorExpressions, flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } @@ -1332,7 +1334,7 @@ namespace ts { */ function generateClassElementDecorationExpression(node: ClassExpression | ClassDeclaration, member: ClassElement) { const allDecorators = getAllDecoratorsOfClassElement(node, member); - const decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + const decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -1353,13 +1355,13 @@ namespace ts { // __metadata("design:type", Function), // __metadata("design:paramtypes", [Object]), // __metadata("design:returntype", void 0) - // ], C.prototype, "method", undefined); + // ], C.prototype, "method", null); // // The emit for an accessor is: // // __decorate([ // dec - // ], C.prototype, "accessor", undefined); + // ], C.prototype, "accessor", null); // // The emit for a property is: // @@ -1413,7 +1415,7 @@ namespace ts { */ function generateConstructorDecorationExpression(node: ClassExpression | ClassDeclaration) { const allDecorators = getAllDecoratorsOfConstructor(node); - const decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + const decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -1466,22 +1468,22 @@ namespace ts { * @param node The declaration node. * @param decoratorExpressions The destination array to which to add new decorator expressions. */ - function addTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) { + function addTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) { + function addOldTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); @@ -1489,14 +1491,14 @@ namespace ts { } } - function addNewTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) { + function addNewTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) { if (compilerOptions.emitDecoratorMetadata) { let properties: ObjectLiteralElementLike[]; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(createPropertyAssignment("type", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(createPropertyAssignment("paramTypes", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(createPropertyAssignment("paramTypes", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(createPropertyAssignment("returnType", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeReturnTypeOfNode(node)))); @@ -1541,12 +1543,16 @@ namespace ts { * @param node The node to test. */ function shouldAddParamTypesMetadata(node: Declaration): boolean { - const kind = node.kind; - return kind === SyntaxKind.ClassDeclaration - || kind === SyntaxKind.ClassExpression - || kind === SyntaxKind.MethodDeclaration - || kind === SyntaxKind.GetAccessor - || kind === SyntaxKind.SetAccessor; + switch (node.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: + return getFirstConstructorWithBody(node) !== undefined; + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return true; + } + return false; } /** @@ -1571,30 +1577,12 @@ namespace ts { } } - /** - * Gets the most likely element type for a TypeNode. This is not an exhaustive test - * as it assumes a rest argument can only be an array type (either T[], or Array). - * - * @param node The type node. - */ - function getRestParameterElementType(node: TypeNode) { - if (node && node.kind === SyntaxKind.ArrayType) { - return (node).elementType; - } - else if (node && node.kind === SyntaxKind.TypeReference) { - return singleOrUndefined((node).typeArguments); - } - else { - return undefined; - } - } - /** * Serializes the types of the parameters of a node for use with decorator type metadata. * * @param node The node that should have its parameter types serialized. */ - function serializeParameterTypesOfNode(node: Node): Expression { + function serializeParameterTypesOfNode(node: Node, container: ClassLikeDeclaration): Expression { const valueDeclaration = isClassLike(node) ? getFirstConstructorWithBody(node) @@ -1604,7 +1592,7 @@ namespace ts { const expressions: Expression[] = []; if (valueDeclaration) { - const parameters = valueDeclaration.parameters; + const parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); const numParameters = parameters.length; for (let i = 0; i < numParameters; i++) { const parameter = parameters[i]; @@ -1623,6 +1611,16 @@ namespace ts { return createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node: FunctionLikeDeclaration, container: ClassLikeDeclaration) { + if (container && node.kind === SyntaxKind.GetAccessor) { + const { setAccessor } = getAllAccessorDeclarations(container.members, node); + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } + /** * Serializes the return type of a node for use with decorator type metadata. * @@ -1905,7 +1903,7 @@ namespace ts { : (name).expression; } else if (isIdentifier(name)) { - return createLiteral(name.text); + return createLiteral(unescapeIdentifier(name.text)); } else { return getSynthesizedClone(name); diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index bd70a0afb10..cbbdbb04d50 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -11,7 +11,8 @@ "stripInternal": true, "target": "es5", "noUnusedLocals": true, - "noUnusedParameters": true + "noUnusedParameters": true, + "types": [ ] }, "files": [ "core.ts", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 219e7efa90a..1ee59149b2c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -418,26 +418,20 @@ namespace ts { HasImplicitReturn = 1 << 7, // If function implicitly returns on one of codepaths (initialized by binding) HasExplicitReturn = 1 << 8, // If function has explicit reachable return on one of codepaths (initialized by binding) GlobalAugmentation = 1 << 9, // Set if module declaration is an augmentation for the global scope - HasClassExtends = 1 << 10, // If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding) - HasDecorators = 1 << 11, // If the file has decorators (initialized by binding) - HasParamDecorators = 1 << 12, // If the file has parameter decorators (initialized by binding) - HasAsyncFunctions = 1 << 13, // If the file has async functions (initialized by binding) - HasSpreadAttribute = 1 << 14, // If the file as JSX spread attributes (initialized by binding) - HasRestAttribute = 1 << 15, // If the file has object destructure elements - DisallowInContext = 1 << 16, // If node was parsed in a context where 'in-expressions' are not allowed - YieldContext = 1 << 17, // If node was parsed in the 'yield' context created when parsing a generator - DecoratorContext = 1 << 18, // If node was parsed as part of a decorator - AwaitContext = 1 << 19, // If node was parsed in the 'await' context created when parsing an async function - ThisNodeHasError = 1 << 20, // If the parser encountered an error when parsing the code that created this node - JavaScriptFile = 1 << 21, // If node was parsed in a JavaScript - ThisNodeOrAnySubNodesHasError = 1 << 22, // If this node or any of its children had an error - HasAggregatedChildData = 1 << 23, // If we've computed data from children and cached it in this node + HasAsyncFunctions = 1 << 10, // If the file has async functions (initialized by binding) + DisallowInContext = 1 << 11, // If node was parsed in a context where 'in-expressions' are not allowed + YieldContext = 1 << 12, // If node was parsed in the 'yield' context created when parsing a generator + DecoratorContext = 1 << 13, // If node was parsed as part of a decorator + AwaitContext = 1 << 14, // If node was parsed in the 'await' context created when parsing an async function + ThisNodeHasError = 1 << 15, // If the parser encountered an error when parsing the code that created this node + JavaScriptFile = 1 << 16, // If node was parsed in a JavaScript + ThisNodeOrAnySubNodesHasError = 1 << 17, // If this node or any of its children had an error + HasAggregatedChildData = 1 << 18, // If we've computed data from children and cached it in this node BlockScoped = Let | Const, ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn, - EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions | HasSpreadAttribute | HasRestAttribute, - ReachabilityAndEmitFlags = ReachabilityCheckFlags | EmitHelperFlags, + ReachabilityAndEmitFlags = ReachabilityCheckFlags | HasAsyncFunctions, // Parsing context flags ContextFlags = DisallowInContext | YieldContext | DecoratorContext | AwaitContext | JavaScriptFile, @@ -2413,6 +2407,7 @@ namespace ts { writeSpace(text: string): void; writeStringLiteral(text: string): void; writeParameter(text: string): void; + writeProperty(text: string): void; writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; @@ -2803,6 +2798,7 @@ namespace ts { UnionOrIntersection = Union | Intersection, StructuredType = Object | Union | Intersection, StructuredOrTypeParameter = StructuredType | TypeParameter | Index, + TypeVariable = TypeParameter | IndexedAccess, // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never @@ -2913,7 +2909,9 @@ namespace ts { /* @internal */ resolvedProperties: SymbolTable; // Cache of resolved properties /* @internal */ - couldContainTypeParameters: boolean; + resolvedIndexType: IndexType; + /* @internal */ + couldContainTypeVariables: boolean; } export interface UnionType extends UnionOrIntersectionType { } @@ -2935,6 +2933,7 @@ namespace ts { typeParameter?: TypeParameter; constraintType?: Type; templateType?: Type; + modifiersType?: Type; mapper?: TypeMapper; // Instantiation mapper } @@ -2969,28 +2968,35 @@ namespace ts { iteratorElementType?: Type; } + export interface TypeVariable extends Type { + /* @internal */ + resolvedApparentType: Type; + /* @internal */ + resolvedIndexType: IndexType; + } + // Type parameters (TypeFlags.TypeParameter) - export interface TypeParameter extends Type { + export interface TypeParameter extends TypeVariable { constraint: Type; // Constraint /* @internal */ target?: TypeParameter; // Instantiation target /* @internal */ mapper?: TypeMapper; // Instantiation mapper /* @internal */ - resolvedApparentType: Type; - /* @internal */ - resolvedIndexType: IndexType; - /* @internal */ isThisType?: boolean; } - export interface IndexType extends Type { - type: TypeParameter; - } - - export interface IndexedAccessType extends Type { + // Indexed access types (TypeFlags.IndexedAccess) + // Possible forms are T[xxx], xxx[T], or xxx[keyof T], where T is a type variable + export interface IndexedAccessType extends TypeVariable { objectType: Type; indexType: Type; + constraint?: Type; + } + + // keyof T types (TypeFlags.Index) + export interface IndexType extends Type { + type: TypeVariable | UnionOrIntersectionType; } export const enum SignatureKind { @@ -3082,6 +3088,12 @@ namespace ts { ThisProperty } + export interface FileExtensionInfo { + extension: string; + scriptKind: ScriptKind; + isMixedContent: boolean; + } + export interface DiagnosticMessage { key: string; category: DiagnosticCategory; @@ -3698,6 +3710,25 @@ namespace ts { readonly priority?: number; // Helpers with a higher priority are emitted earlier than other helpers on the node. } + /** + * Used by the checker, this enum keeps track of external emit helpers that should be type + * checked. + */ + /* @internal */ + export const enum ExternalEmitHelpers { + Extends = 1 << 0, // __extends (used by the ES2015 class transformation) + Assign = 1 << 1, // __assign (used by Jsx and ESNext object spread transformations) + Rest = 1 << 2, // __rest (used by ESNext object rest transformation) + Decorate = 1 << 3, // __decorate (used by TypeScript decorators transformation) + Metadata = 1 << 4, // __metadata (used by TypeScript decorators transformation) + Param = 1 << 5, // __param (used by TypeScript decorators transformation) + Awaiter = 1 << 6, // __awaiter (used by ES2017 async functions transformation) + Generator = 1 << 7, // __generator (used by ES2015 generator transformation) + + FirstEmitHelper = Extends, + LastEmitHelper = Generator + } + /* @internal */ export const enum EmitContext { SourceFile, // Emitting a SourceFile diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 363ddf0de80..6f491f6708f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -43,6 +43,7 @@ namespace ts { writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, // Completely ignore indentation for string writers. And map newlines to @@ -423,6 +424,10 @@ namespace ts { return false; } + export function isEffectiveExternalModule(node: SourceFile, compilerOptions: CompilerOptions) { + return isExternalModule(node) || compilerOptions.isolatedModules; + } + export function isBlockScope(node: Node, parentNode: Node) { switch (node.kind) { case SyntaxKind.SourceFile: @@ -798,6 +803,23 @@ namespace ts { } } + /** + * Gets the most likely element type for a TypeNode. This is not an exhaustive test + * as it assumes a rest argument can only be an array type (either T[], or Array). + * + * @param node The type node. + */ + export function getRestParameterElementType(node: TypeNode) { + if (node && node.kind === SyntaxKind.ArrayType) { + return (node).elementType; + } + else if (node && node.kind === SyntaxKind.TypeReference) { + return singleOrUndefined((node).typeArguments); + } + else { + return undefined; + } + } export function isVariableLike(node: Node): node is VariableLikeDeclaration { if (node) { @@ -3184,55 +3206,6 @@ namespace ts { return output; } - /** - * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph - * as the fallback implementation does not check for circular references by default. - */ - export const stringify: (value: any) => string = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - - /** - * Serialize an object graph into a JSON string. - */ - function stringifyFallback(value: any): string { - // JSON.stringify returns `undefined` here, instead of the string "undefined". - return value === undefined ? undefined : stringifyValue(value); - } - - function stringifyValue(value: any): string { - return typeof value === "string" ? `"${escapeString(value)}"` - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : /*fallback*/ "null"; - } - - function cycleCheck(cb: (value: any) => string, value: any) { - Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - const result = cb(value); - delete value.__cycle; - return result; - } - - function stringifyArray(value: any) { - return `[${reduceLeft(value, stringifyElement, "")}]`; - } - - function stringifyElement(memo: string, value: any) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - - function stringifyObject(value: any) { - return `{${reduceOwnProperties(value, stringifyProperty, "")}}`; - } - - function stringifyProperty(memo: string, value: any, key: string) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + `"${escapeString(key)}":${stringifyValue(value)}`; - } - const base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; /** diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 1486ea2253f..7c7a06db0b6 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -607,23 +607,13 @@ namespace FourSlash { }); } - public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) { - const members = this.getMemberListAtCaret(); - if (members) { - this.assertItemInCompletionList(members.entries, symbol, text, documentation, kind); - } - else { - this.raiseError("Expected a member list, but none was provided"); - } - } - - public verifyMemberListCount(expectedCount: number, negative: boolean) { + public verifyCompletionListCount(expectedCount: number, negative: boolean) { if (expectedCount === 0 && negative) { - this.verifyMemberListIsEmpty(/*negative*/ false); + this.verifyCompletionListIsEmpty(/*negative*/ false); return; } - const members = this.getMemberListAtCaret(); + const members = this.getCompletionListAtCaret(); if (members) { const match = members.entries.length === expectedCount; @@ -637,13 +627,6 @@ namespace FourSlash { } } - public verifyMemberListDoesNotContain(symbol: string) { - const members = this.getMemberListAtCaret(); - if (members && members.entries.filter(e => e.name === symbol).length !== 0) { - this.raiseError(`Member list did contain ${symbol}`); - } - } - public verifyCompletionListItemsCountIsGreaterThan(count: number, negative: boolean) { const completions = this.getCompletionListAtCaret(); const itemsCount = completions.entries.length; @@ -685,16 +668,6 @@ namespace FourSlash { } } - public verifyMemberListIsEmpty(negative: boolean) { - const members = this.getMemberListAtCaret(); - if ((!members || members.entries.length === 0) && negative) { - this.raiseError("Member list is empty at Caret"); - } - else if ((members && members.entries.length !== 0) && !negative) { - this.raiseError(`Member list is not empty at Caret:\nMember List contains: ${stringify(members.entries.map(e => e.name))}`); - } - } - public verifyCompletionListIsEmpty(negative: boolean) { const completions = this.getCompletionListAtCaret(); if ((!completions || completions.entries.length === 0) && negative) { @@ -892,10 +865,6 @@ namespace FourSlash { this.raiseError(`verifyReferencesAtPositionListContains failed - could not find the item: ${stringify(missingItem)} in the returned list: (${stringify(references)})`); } - private getMemberListAtCaret() { - return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition); - } - private getCompletionListAtCaret() { return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition); } @@ -1353,11 +1322,6 @@ namespace FourSlash { Harness.IO.log(stringify(sigHelp)); } - public printMemberListMembers() { - const members = this.getMemberListAtCaret(); - this.printMembersOrCompletions(members); - } - public printCompletionListMembers() { const completions = this.getCompletionListAtCaret(); this.printMembersOrCompletions(completions); @@ -3061,19 +3025,8 @@ namespace FourSlashInterface { } } - // Verifies the member list contains the specified symbol. The - // member list is brought up if necessary - public memberListContains(symbol: string, text?: string, documentation?: string, kind?: string) { - if (this.negative) { - this.state.verifyMemberListDoesNotContain(symbol); - } - else { - this.state.verifyMemberListContains(symbol, text, documentation, kind); - } - } - - public memberListCount(expectedCount: number) { - this.state.verifyMemberListCount(expectedCount, this.negative); + public completionListCount(expectedCount: number) { + this.state.verifyCompletionListCount(expectedCount, this.negative); } // Verifies the completion list contains the specified symbol. The @@ -3109,10 +3062,6 @@ namespace FourSlashInterface { this.state.verifyCompletionListAllowsNewIdentifier(this.negative); } - public memberListIsEmpty() { - this.state.verifyMemberListIsEmpty(this.negative); - } - public signatureHelpPresent() { this.state.verifySignatureHelpPresent(!this.negative); } @@ -3514,10 +3463,6 @@ namespace FourSlashInterface { this.state.printCurrentSignatureHelp(); } - public printMemberListMembers() { - this.state.printMemberListMembers(); - } - public printCompletionListMembers() { this.state.printCompletionListMembers(); } diff --git a/src/harness/unittests/textStorage.ts b/src/harness/unittests/textStorage.ts new file mode 100644 index 00000000000..b4287f2610c --- /dev/null +++ b/src/harness/unittests/textStorage.ts @@ -0,0 +1,70 @@ +/// +/// +/// + +namespace ts.textStorage { + describe("Text storage", () => { + const f = { + path: "/a/app.ts", + content: ` + let x = 1; + let y = 2; + function bar(a: number) { + return a + 1; + }` + }; + + it("text based storage should be have exactly the same as script version cache", () => { + + const host = ts.projectSystem.createServerHost([f]); + + const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path)); + const ts2 = new server.TextStorage(host, server.asNormalizedPath(f.path)); + + ts1.useScriptVersionCache(); + ts2.useText(); + + const lineMap = computeLineStarts(f.content); + + for (let line = 0; line < lineMap.length; line++) { + const start = lineMap[line]; + const end = line === lineMap.length - 1 ? f.path.length : lineMap[line + 1]; + + for (let offset = 0; offset < end - start; offset++) { + const pos1 = ts1.lineOffsetToPosition(line + 1, offset + 1); + const pos2 = ts2.lineOffsetToPosition(line + 1, offset + 1); + assert.isTrue(pos1 === pos2, `lineOffsetToPosition ${line + 1}-${offset + 1}: expected ${pos1} to equal ${pos2}`); + } + + const {start: start1, length: length1 } = ts1.lineToTextSpan(line); + const {start: start2, length: length2 } = ts2.lineToTextSpan(line); + assert.isTrue(start1 === start2, `lineToTextSpan ${line}::start:: expected ${start1} to equal ${start2}`); + assert.isTrue(length1 === length2, `lineToTextSpan ${line}::length:: expected ${length1} to equal ${length2}`); + } + + for (let pos = 0; pos < f.content.length; pos++) { + const { line: line1, offset: offset1 } = ts1.positionToLineOffset(pos); + const { line: line2, offset: offset2 } = ts2.positionToLineOffset(pos); + assert.isTrue(line1 === line2, `positionToLineOffset ${pos}::line:: expected ${line1} to equal ${line2}`); + assert.isTrue(offset1 === offset2, `positionToLineOffset ${pos}::offset:: expected ${offset1} to equal ${offset2}`); + } + }); + + it("should switch to script version cache if necessary", () => { + const host = ts.projectSystem.createServerHost([f]); + const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path)); + + ts1.getSnapshot(); + assert.isTrue(!ts1.hasScriptVersionCache(), "should not have script version cache - 1"); + + ts1.edit(0, 5, " "); + assert.isTrue(ts1.hasScriptVersionCache(), "have script version cache - 1"); + + ts1.useText(); + assert.isTrue(!ts1.hasScriptVersionCache(), "should not have script version cache - 2"); + + ts1.getLineInfo(0); + assert.isTrue(ts1.hasScriptVersionCache(), "have script version cache - 2"); + }) + }); +} \ No newline at end of file diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 43f125b0bed..783a6016f7a 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -51,9 +51,8 @@ namespace ts.projectSystem { throttleLimit: number, installTypingHost: server.ServerHost, readonly typesRegistry = createMap(), - telemetryEnabled?: boolean, log?: TI.Log) { - super(installTypingHost, globalTypingsCacheLocation, safeList.path, throttleLimit, telemetryEnabled, log); + super(installTypingHost, globalTypingsCacheLocation, safeList.path, throttleLimit, log); } safeFileList = safeList.path; @@ -141,7 +140,6 @@ namespace ts.projectSystem { export interface TestServerHostCreationParameters { useCaseSensitiveFileNames?: boolean; executingFilePath?: string; - libFile?: FileOrFolder; currentDirectory?: string; } @@ -578,6 +576,35 @@ namespace ts.projectSystem { checkWatchedDirectories(host, ["/a/b/c", "/a/b", "/a"]); }); + it("can handle tsconfig file name with difference casing", () => { + const f1 = { + path: "/a/b/app.ts", + content: "let x = 1" + }; + const config = { + path: "/a/b/tsconfig.json", + content: JSON.stringify({ + include: [] + }) + }; + + const host = createServerHost([f1, config], { useCaseSensitiveFileNames: false }); + const service = createProjectService(host); + service.openExternalProject({ + projectFileName: "/a/b/project.csproj", + rootFiles: toExternalFiles([f1.path, combinePaths(getDirectoryPath(config.path).toUpperCase(), getBaseFileName(config.path))]), + options: {} + }); + service.checkNumberOfProjects({ configuredProjects: 1 }); + checkProjectActualFiles(service.configuredProjects[0], []); + + service.openClientFile(f1.path); + service.checkNumberOfProjects({ configuredProjects: 1, inferredProjects: 1 }); + + checkProjectActualFiles(service.configuredProjects[0], []); + checkProjectActualFiles(service.inferredProjects[0], [f1.path]); + }) + it("create configured project without file list", () => { const configFile: FileOrFolder = { path: "/a/b/tsconfig.json", @@ -699,6 +726,66 @@ namespace ts.projectSystem { checkNumberOfInferredProjects(projectService, 1); }); + it("remove not-listed external projects", () => { + const f1 = { + path: "/a/app.ts", + content: "let x = 1" + }; + const f2 = { + path: "/b/app.ts", + content: "let x = 1" + }; + const f3 = { + path: "/c/app.ts", + content: "let x = 1" + }; + const makeProject = (f: FileOrFolder) => ({ projectFileName: f.path + ".csproj", rootFiles: [toExternalFile(f.path)], options: {} }); + const p1 = makeProject(f1); + const p2 = makeProject(f2); + const p3 = makeProject(f3); + + const host = createServerHost([f1, f2, f3]); + const session = createSession(host); + + session.executeCommand({ + seq: 1, + type: "request", + command: "openExternalProjects", + arguments: { projects: [p1, p2] } + }); + + const projectService = session.getProjectService(); + checkNumberOfProjects(projectService, { externalProjects: 2 }); + assert.equal(projectService.externalProjects[0].getProjectName(), p1.projectFileName); + assert.equal(projectService.externalProjects[1].getProjectName(), p2.projectFileName); + + session.executeCommand({ + seq: 2, + type: "request", + command: "openExternalProjects", + arguments: { projects: [p1, p3] } + }); + checkNumberOfProjects(projectService, { externalProjects: 2 }); + assert.equal(projectService.externalProjects[0].getProjectName(), p1.projectFileName); + assert.equal(projectService.externalProjects[1].getProjectName(), p3.projectFileName); + + session.executeCommand({ + seq: 3, + type: "request", + command: "openExternalProjects", + arguments: { projects: [] } + }); + checkNumberOfProjects(projectService, { externalProjects: 0 }); + + session.executeCommand({ + seq: 3, + type: "request", + command: "openExternalProjects", + arguments: { projects: [p2] } + }); + assert.equal(projectService.externalProjects[0].getProjectName(), p2.projectFileName); + }); + it("handle recreated files correctly", () => { const configFile: FileOrFolder = { path: "/a/b/tsconfig.json", @@ -1057,6 +1144,69 @@ namespace ts.projectSystem { checkNumberOfProjects(projectService, {}); }); + it("reload regular file after closing", () => { + const f1 = { + path: "/a/b/app.ts", + content: "x." + }; + const f2 = { + path: "/a/b/lib.ts", + content: "let x: number;" + }; + + const host = createServerHost([f1, f2, libFile]); + const service = createProjectService(host); + service.openExternalProject({ projectFileName: "/a/b/project", rootFiles: toExternalFiles([f1.path, f2.path]), options: {} }) + + service.openClientFile(f1.path); + service.openClientFile(f2.path, "let x: string"); + + service.checkNumberOfProjects({ externalProjects: 1 }); + checkProjectActualFiles(service.externalProjects[0], [f1.path, f2.path, libFile.path]); + + const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 2); + // should contain completions for string + assert.isTrue(completions1.entries.some(e => e.name === "charAt"), "should contain 'charAt'"); + assert.isFalse(completions1.entries.some(e => e.name === "toExponential"), "should not contain 'toExponential'"); + + service.closeClientFile(f2.path); + const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 2); + // should contain completions for string + assert.isFalse(completions2.entries.some(e => e.name === "charAt"), "should not contain 'charAt'"); + assert.isTrue(completions2.entries.some(e => e.name === "toExponential"), "should contain 'toExponential'"); + }); + + it("clear mixed content file after closing", () => { + const f1 = { + path: "/a/b/app.ts", + content: " " + }; + const f2 = { + path: "/a/b/lib.html", + content: "" + }; + + const host = createServerHost([f1, f2, libFile]); + const service = createProjectService(host); + service.openExternalProject({ projectFileName: "/a/b/project", rootFiles: [{ fileName: f1.path }, { fileName: f2.path, hasMixedContent: true }], options: {} }) + + service.openClientFile(f1.path); + service.openClientFile(f2.path, "let somelongname: string"); + + service.checkNumberOfProjects({ externalProjects: 1 }); + checkProjectActualFiles(service.externalProjects[0], [f1.path, f2.path, libFile.path]); + + const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0); + assert.isTrue(completions1.entries.some(e => e.name === "somelongname"), "should contain 'somelongname'"); + + service.closeClientFile(f2.path); + const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0); + assert.isFalse(completions2.entries.some(e => e.name === "somelongname"), "should not contain 'somelongname'"); + const sf2 = service.externalProjects[0].getLanguageService().getProgram().getSourceFile(f2.path); + assert.equal(sf2.text, ""); + }); + + it("external project with included config file opened after configured project", () => { const file1 = { path: "/a/b/f1.ts", @@ -1088,6 +1238,7 @@ namespace ts.projectSystem { projectService.closeExternalProject(externalProjectName); checkNumberOfProjects(projectService, { configuredProjects: 0 }); }); + it("external project with included config file opened after configured project and then closed", () => { const file1 = { path: "/a/b/f1.ts", @@ -1441,6 +1592,67 @@ namespace ts.projectSystem { checkProjectActualFiles(projectService.inferredProjects[1], [file2.path]); }); + it("tsconfig script block support", () => { + const file1 = { + path: "/a/b/f1.ts", + content: ` ` + }; + const file2 = { + path: "/a/b/f2.html", + content: `var hello = "hello";` + }; + const config = { + path: "/a/b/tsconfig.json", + content: JSON.stringify({ compilerOptions: { allowJs: true } }) + }; + const host = createServerHost([file1, file2, config]); + const session = createSession(host); + openFilesForSession([file1], session); + const projectService = session.getProjectService(); + + // HTML file will not be included in any projects yet + checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkProjectActualFiles(projectService.configuredProjects[0], [file1.path]); + + // Specify .html extension as mixed content + const extraFileExtensions = [{ extension: ".html", scriptKind: ScriptKind.JS, isMixedContent: true }]; + const configureHostRequest = makeSessionRequest(CommandNames.Configure, { extraFileExtensions }); + session.executeCommand(configureHostRequest).response; + + // HTML file still not included in the project as it is closed + checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkProjectActualFiles(projectService.configuredProjects[0], [file1.path]); + + // Open HTML file + projectService.applyChangesInOpenFiles( + /*openFiles*/[{ fileName: file2.path, hasMixedContent: true, scriptKind: ScriptKind.JS, content: `var hello = "hello";` }], + /*changedFiles*/undefined, + /*closedFiles*/undefined); + + // Now HTML file is included in the project + checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkProjectActualFiles(projectService.configuredProjects[0], [file1.path, file2.path]); + + // Check identifiers defined in HTML content are available in .ts file + const project = projectService.configuredProjects[0]; + let completions = project.getLanguageService().getCompletionsAtPosition(file1.path, 1); + assert(completions && completions.entries[0].name === "hello", `expected entry hello to be in completion list`); + + // Close HTML file + projectService.applyChangesInOpenFiles( + /*openFiles*/undefined, + /*changedFiles*/undefined, + /*closedFiles*/[file2.path]); + + // HTML file is still included in project + checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkProjectActualFiles(projectService.configuredProjects[0], [file1.path, file2.path]); + + // Check identifiers defined in HTML content are not available in .ts file + completions = project.getLanguageService().getCompletionsAtPosition(file1.path, 5); + assert(completions && completions.entries[0].name !== "hello", `unexpected hello entry in completion list`); + }); + it("project structure update is deferred if files are not added\removed", () => { const file1 = { path: "/a/b/f1.ts", @@ -1486,7 +1698,7 @@ namespace ts.projectSystem { const project = projectService.externalProjects[0]; const scriptInfo = project.getScriptInfo(file1.path); - const snap = scriptInfo.snap(); + const snap = scriptInfo.getSnapshot(); const actualText = snap.getText(0, snap.getLength()); assert.equal(actualText, "", `expected content to be empty string, got "${actualText}"`); @@ -1499,7 +1711,7 @@ namespace ts.projectSystem { projectService.closeClientFile(file1.path); const scriptInfo2 = project.getScriptInfo(file1.path); - const snap2 = scriptInfo2.snap(); + const snap2 = scriptInfo2.getSnapshot(); const actualText2 = snap2.getText(0, snap.getLength()); assert.equal(actualText2, "", `expected content to be empty string, got "${actualText2}"`); }); @@ -1586,6 +1798,49 @@ namespace ts.projectSystem { checkNumberOfProjects(projectService, { configuredProjects: 0 }); }); + it("language service disabled state is updated in external projects", () => { + debugger + const f1 = { + path: "/a/app.js", + content: "var x = 1" + }; + const f2 = { + path: "/a/largefile.js", + content: "" + }; + const host = createServerHost([f1, f2]); + const originalGetFileSize = host.getFileSize; + host.getFileSize = (filePath: string) => + filePath === f2.path ? server.maxProgramSizeForNonTsFiles + 1 : originalGetFileSize.call(host, filePath); + + const service = createProjectService(host); + const projectFileName = "/a/proj.csproj"; + + service.openExternalProject({ + projectFileName, + rootFiles: toExternalFiles([f1.path, f2.path]), + options: {} + }); + service.checkNumberOfProjects({ externalProjects: 1 }); + assert.isFalse(service.externalProjects[0].languageServiceEnabled, "language service should be disabled - 1"); + + service.openExternalProject({ + projectFileName, + rootFiles: toExternalFiles([f1.path]), + options: {} + }); + service.checkNumberOfProjects({ externalProjects: 1 }); + assert.isTrue(service.externalProjects[0].languageServiceEnabled, "language service should be enabled"); + + service.openExternalProject({ + projectFileName, + rootFiles: toExternalFiles([f1.path, f2.path]), + options: {} + }); + service.checkNumberOfProjects({ externalProjects: 1 }); + assert.isFalse(service.externalProjects[0].languageServiceEnabled, "language service should be disabled - 2"); + }); + it("language service disabled events are triggered", () => { const f1 = { path: "/a/app.js", @@ -2197,13 +2452,13 @@ namespace ts.projectSystem { p.updateGraph(); const scriptInfo = p.getScriptInfo(f.path); - checkSnapLength(scriptInfo.snap(), f.content.length); + checkSnapLength(scriptInfo.getSnapshot(), f.content.length); // open project and replace its content with empty string projectService.openClientFile(f.path, ""); - checkSnapLength(scriptInfo.snap(), 0); + checkSnapLength(scriptInfo.getSnapshot(), 0); }); - function checkSnapLength(snap: server.LineIndexSnapshot, expectedLength: number) { + function checkSnapLength(snap: IScriptSnapshot, expectedLength: number) { assert.equal(snap.getLength(), expectedLength, "Incorrect snapshot size"); } }); @@ -2356,7 +2611,6 @@ namespace ts.projectSystem { const cwd = { path: "/a/c" }; - debugger; const host = createServerHost([f1, config, node, cwd], { currentDirectory: cwd.path }); const projectService = createProjectService(host); projectService.openClientFile(f1.path); @@ -2627,7 +2881,7 @@ namespace ts.projectSystem { // verify content const projectServiice = session.getProjectService(); - const snap1 = projectServiice.getScriptInfo(f1.path).snap(); + const snap1 = projectServiice.getScriptInfo(f1.path).getSnapshot(); assert.equal(snap1.getText(0, snap1.getLength()), tmp.content, "content should be equal to the content of temp file"); // reload from original file file @@ -2639,7 +2893,7 @@ namespace ts.projectSystem { }); // verify content - const snap2 = projectServiice.getScriptInfo(f1.path).snap(); + const snap2 = projectServiice.getScriptInfo(f1.path).getSnapshot(); assert.equal(snap2.getText(0, snap2.getLength()), f1.content, "content should be equal to the content of original file"); }); @@ -2700,6 +2954,65 @@ namespace ts.projectSystem { arguments: { projectFileName: projectName } }).response; assert.isTrue(diags.length === 0); + + session.executeCommand({ + type: "request", + command: server.CommandNames.CompilerOptionsForInferredProjects, + seq: 3, + arguments: { options: { module: ModuleKind.CommonJS } } + }); + const diagsAfterUpdate = session.executeCommand({ + type: "request", + command: server.CommandNames.CompilerOptionsDiagnosticsFull, + seq: 4, + arguments: { projectFileName: projectName } + }).response; + assert.isTrue(diagsAfterUpdate.length === 0); + }); + + it("for external project", () => { + const f1 = { + path: "/a/b/f1.js", + content: "function test1() { }" + }; + const host = createServerHost([f1, libFile]); + const session = createSession(host); + const projectService = session.getProjectService(); + const projectFileName = "/a/b/project.csproj"; + const externalFiles = toExternalFiles([f1.path]); + projectService.openExternalProject({ + projectFileName, + rootFiles: externalFiles, + options: {} + }); + + checkNumberOfProjects(projectService, { externalProjects: 1 }); + + const diags = session.executeCommand({ + type: "request", + command: server.CommandNames.CompilerOptionsDiagnosticsFull, + seq: 2, + arguments: { projectFileName } + }).response; + assert.isTrue(diags.length === 0); + + session.executeCommand({ + type: "request", + command: server.CommandNames.OpenExternalProject, + seq: 3, + arguments: { + projectFileName, + rootFiles: externalFiles, + options: { module: ModuleKind.CommonJS } + } + }); + const diagsAfterUpdate = session.executeCommand({ + type: "request", + command: server.CommandNames.CompilerOptionsDiagnosticsFull, + seq: 4, + arguments: { projectFileName } + }).response; + assert.isTrue(diagsAfterUpdate.length === 0); }); }); diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index aea9f4eb9ed..62d2f7ac801 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -20,13 +20,12 @@ namespace ts.projectSystem { } class Installer extends TestTypingsInstaller { - constructor(host: server.ServerHost, p?: InstallerParams, telemetryEnabled?: boolean, log?: TI.Log) { + constructor(host: server.ServerHost, p?: InstallerParams, log?: TI.Log) { super( (p && p.globalTypingsCacheLocation) || "/a/data", (p && p.throttleLimit) || 5, host, (p && p.typesRegistry), - telemetryEnabled, log); } @@ -36,7 +35,7 @@ namespace ts.projectSystem { } } - function executeCommand(self: Installer, host: TestServerHost, installedTypings: string[], typingFiles: FileOrFolder[], cb: TI.RequestCompletedAction): void { + function executeCommand(self: Installer, host: TestServerHost, installedTypings: string[] | string, typingFiles: FileOrFolder[], cb: TI.RequestCompletedAction): void { self.addPostExecAction(installedTypings, success => { for (const file of typingFiles) { host.createFileOrFolder(file, /*createParentDirectory*/ true); @@ -907,7 +906,7 @@ namespace ts.projectSystem { const host = createServerHost([f1, packageJson]); const installer = new (class extends Installer { constructor() { - super(host, { globalTypingsCacheLocation: "/tmp" }, /*telemetryEnabled*/ false, { isEnabled: () => true, writeLine: msg => messages.push(msg) }); + super(host, { globalTypingsCacheLocation: "/tmp" }, { isEnabled: () => true, writeLine: msg => messages.push(msg) }); } installWorker(_requestId: number, _args: string[], _cwd: string, _cb: server.typingsInstaller.RequestCompletedAction) { assert(false, "runCommand should not be invoked"); @@ -971,15 +970,18 @@ namespace ts.projectSystem { let seenTelemetryEvent = false; const installer = new (class extends Installer { constructor() { - super(host, { globalTypingsCacheLocation: cachePath, typesRegistry: createTypesRegistry("commander") }, /*telemetryEnabled*/ true); + super(host, { globalTypingsCacheLocation: cachePath, typesRegistry: createTypesRegistry("commander") }); } installWorker(_requestId: number, _args: string[], _cwd: string, cb: server.typingsInstaller.RequestCompletedAction) { const installedTypings = ["@types/commander"]; const typingFiles = [commander]; executeCommand(this, host, installedTypings, typingFiles, cb); } - sendResponse(response: server.SetTypings | server.InvalidateCachedTypings | server.TypingsInstallEvent) { - if (response.kind === server.EventInstall) { + sendResponse(response: server.SetTypings | server.InvalidateCachedTypings | server.BeginInstallTypes | server.EndInstallTypes) { + if (response.kind === server.EventBeginInstallTypes) { + return; + } + if (response.kind === server.EventEndInstallTypes) { assert.deepEqual(response.packagesToInstall, ["@types/commander"]); seenTelemetryEvent = true; return; @@ -997,4 +999,102 @@ namespace ts.projectSystem { checkProjectActualFiles(projectService.inferredProjects[0], [f1.path, commander.path]); }); }); + + describe("progress notifications", () => { + it ("should be sent for success", () => { + const f1 = { + path: "/a/app.js", + content: "" + }; + const package = { + path: "/a/package.json", + content: JSON.stringify({ dependencies: { "commander": "1.0.0" } }) + }; + const cachePath = "/a/cache/"; + const commander = { + path: cachePath + "node_modules/@types/commander/index.d.ts", + content: "export let x: number" + }; + const host = createServerHost([f1, package]); + let beginEvent: server.BeginInstallTypes; + let endEvent: server.EndInstallTypes; + const installer = new (class extends Installer { + constructor() { + super(host, { globalTypingsCacheLocation: cachePath, typesRegistry: createTypesRegistry("commander") }); + } + installWorker(_requestId: number, _args: string[], _cwd: string, cb: server.typingsInstaller.RequestCompletedAction) { + const installedTypings = ["@types/commander"]; + const typingFiles = [commander]; + executeCommand(this, host, installedTypings, typingFiles, cb); + } + sendResponse(response: server.SetTypings | server.InvalidateCachedTypings | server.BeginInstallTypes | server.EndInstallTypes) { + if (response.kind === server.EventBeginInstallTypes) { + beginEvent = response; + return; + } + if (response.kind === server.EventEndInstallTypes) { + endEvent = response; + return; + } + super.sendResponse(response); + } + })(); + const projectService = createProjectService(host, { typingsInstaller: installer }); + projectService.openClientFile(f1.path); + + installer.installAll(/*expectedCount*/ 1); + + assert.isTrue(!!beginEvent); + assert.isTrue(!!endEvent); + assert.isTrue(beginEvent.eventId === endEvent.eventId); + assert.isTrue(endEvent.installSuccess); + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + checkProjectActualFiles(projectService.inferredProjects[0], [f1.path, commander.path]); + }); + + it ("should be sent for error", () => { + const f1 = { + path: "/a/app.js", + content: "" + }; + const package = { + path: "/a/package.json", + content: JSON.stringify({ dependencies: { "commander": "1.0.0" } }) + }; + const cachePath = "/a/cache/"; + const host = createServerHost([f1, package]); + let beginEvent: server.BeginInstallTypes; + let endEvent: server.EndInstallTypes; + const installer = new (class extends Installer { + constructor() { + super(host, { globalTypingsCacheLocation: cachePath, typesRegistry: createTypesRegistry("commander") }); + } + installWorker(_requestId: number, _args: string[], _cwd: string, cb: server.typingsInstaller.RequestCompletedAction) { + executeCommand(this, host, "", [], cb); + } + sendResponse(response: server.SetTypings | server.InvalidateCachedTypings | server.BeginInstallTypes | server.EndInstallTypes) { + if (response.kind === server.EventBeginInstallTypes) { + beginEvent = response; + return; + } + if (response.kind === server.EventEndInstallTypes) { + endEvent = response; + return; + } + super.sendResponse(response); + } + })(); + const projectService = createProjectService(host, { typingsInstaller: installer }); + projectService.openClientFile(f1.path); + + installer.installAll(/*expectedCount*/ 1); + + assert.isTrue(!!beginEvent); + assert.isTrue(!!endEvent); + assert.isTrue(beginEvent.eventId === endEvent.eventId); + assert.isFalse(endEvent.installSuccess); + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + checkProjectActualFiles(projectService.inferredProjects[0], [f1.path]); + }); + }); } \ No newline at end of file diff --git a/src/lib/es2016.array.include.d.ts b/src/lib/es2016.array.include.d.ts index 17b3eaac1d3..fdd9ed4639f 100644 --- a/src/lib/es2016.array.include.d.ts +++ b/src/lib/es2016.array.include.d.ts @@ -7,6 +7,15 @@ interface Array { includes(searchElement: T, fromIndex?: number): boolean; } +interface ReadonlyArray { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: T, fromIndex?: number): boolean; +} + interface Int8Array { /** * Determines whether an array includes a certain element, returning true or false as appropriate. diff --git a/src/lib/es2017.object.d.ts b/src/lib/es2017.object.d.ts index c219f467ac9..80c2161506a 100644 --- a/src/lib/es2017.object.d.ts +++ b/src/lib/es2017.object.d.ts @@ -4,11 +4,22 @@ interface ObjectConstructor { * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ values(o: { [s: string]: T }): T[]; + + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ values(o: any): any[]; + + /** + * Returns an array of key/values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + entries(o: { [s: string]: T }): [string, T][]; + /** * Returns an array of key/values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - entries(o: T): [keyof T, T[K]][]; entries(o: any): [string, any][]; } diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 7ee47817802..1e6b44788b3 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -176,6 +176,18 @@ interface ObjectConstructor { */ seal(o: T): T; + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(a: T[]): ReadonlyArray; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(f: T): T; + /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. diff --git a/src/server/builder.ts b/src/server/builder.ts index 5354e7ed508..60f56dc3241 100644 --- a/src/server/builder.ts +++ b/src/server/builder.ts @@ -75,17 +75,32 @@ namespace ts.server { getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; onProjectUpdateGraph(): void; emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean; + clear(): void; } abstract class AbstractBuilder implements Builder { - private fileInfos = createFileMap(); + /** + * stores set of files from the project. + * NOTE: this field is created on demand and should not be accessed directly. + * Use 'getFileInfos' instead. + */ + private fileInfos_doNotAccessDirectly: FileMap; constructor(public readonly project: Project, private ctor: { new (scriptInfo: ScriptInfo, project: Project): T }) { } + private getFileInfos() { + return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = createFileMap()); + } + + public clear() { + // drop the existing list - it will be re-created as necessary + this.fileInfos_doNotAccessDirectly = undefined; + } + protected getFileInfo(path: Path): T { - return this.fileInfos.get(path); + return this.getFileInfos().get(path); } protected getOrCreateFileInfo(path: Path): T { @@ -99,19 +114,19 @@ namespace ts.server { } protected getFileInfoPaths(): Path[] { - return this.fileInfos.getKeys(); + return this.getFileInfos().getKeys(); } protected setFileInfo(path: Path, info: T) { - this.fileInfos.set(path, info); + this.getFileInfos().set(path, info); } protected removeFileInfo(path: Path) { - this.fileInfos.remove(path); + this.getFileInfos().remove(path); } protected forEachFileInfo(action: (fileInfo: T) => any) { - this.fileInfos.forEachValue((_path, value) => action(value)); + this.getFileInfos().forEachValue((_path, value) => action(value)); } abstract getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; @@ -231,6 +246,11 @@ namespace ts.server { private projectVersionForDependencyGraph: string; + public clear() { + this.projectVersionForDependencyGraph = undefined; + super.clear(); + } + private getReferencedFileInfos(fileInfo: ModuleBuilderFileInfo): ModuleBuilderFileInfo[] { if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { return []; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 881d188307d..00df53e1e35 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -108,6 +108,7 @@ namespace ts.server { export interface HostConfiguration { formatCodeOptions: FormatCodeSettings; hostInfo: string; + extraFileExtensions?: FileExtensionInfo[]; } interface ConfigFileConversionResult { @@ -125,20 +126,23 @@ namespace ts.server { } export interface OpenConfiguredProjectResult { - configFileName?: string; + configFileName?: NormalizedPath; configFileErrors?: Diagnostic[]; } interface FilePropertyReader { getFileName(f: T): string; getScriptKind(f: T): ScriptKind; - hasMixedContent(f: T): boolean; + hasMixedContent(f: T, extraFileExtensions: FileExtensionInfo[]): boolean; } const fileNamePropertyReader: FilePropertyReader = { getFileName: x => x, getScriptKind: _ => undefined, - hasMixedContent: _ => false + hasMixedContent: (fileName, extraFileExtensions) => { + const mixedContentExtensions = ts.map(ts.filter(extraFileExtensions, item => item.isMixedContent), item => item.extension); + return forEach(mixedContentExtensions, extension => fileExtensionIs(fileName, extension)) + } }; const externalFilePropertyReader: FilePropertyReader = { @@ -257,7 +261,7 @@ namespace ts.server { private changedFiles: ScriptInfo[]; - private toCanonicalFileName: (f: string) => string; + readonly toCanonicalFileName: (f: string) => string; public lastDeletedFile: ScriptInfo; @@ -282,7 +286,8 @@ namespace ts.server { this.hostConfiguration = { formatCodeOptions: getDefaultFormatCodeSettings(this.host), - hostInfo: "Unknown host" + hostInfo: "Unknown host", + extraFileExtensions: [] }; this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory()); @@ -424,7 +429,7 @@ namespace ts.server { this.handleDeletedFile(info); } else { - if (info && (!info.isOpen)) { + if (info && (!info.isScriptOpen())) { // file has been changed which might affect the set of referenced files in projects that include // this file and set of inferred projects info.reloadFromFile(); @@ -440,7 +445,7 @@ namespace ts.server { // TODO: handle isOpen = true case - if (!info.isOpen) { + if (!info.isScriptOpen()) { this.filenameToScriptInfo.remove(info.path); this.lastDeletedFile = info; @@ -486,7 +491,7 @@ namespace ts.server { // If a change was made inside "folder/file", node will trigger the callback twice: // one with the fileName being "folder/file", and the other one with "folder". // We don't respond to the second one. - if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions())) { + if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions(), this.hostConfiguration.extraFileExtensions)) { return; } @@ -634,15 +639,17 @@ namespace ts.server { // Closing file should trigger re-reading the file content from disk. This is // because the user may chose to discard the buffer content before saving // to the disk, and the server's version of the file can be out of sync. - info.reloadFromFile(); + info.close(); removeItemFromSet(this.openFiles, info); - info.isOpen = false; // collect all projects that should be removed let projectsToRemove: Project[]; for (const p of info.containingProjects) { if (p.projectKind === ProjectKind.Configured) { + if (info.hasMixedContent) { + info.registerFileUpdate(); + } // last open file in configured project - close it if ((p).deleteOpenRef() === 0) { (projectsToRemove || (projectsToRemove = [])).push(p); @@ -652,6 +659,13 @@ namespace ts.server { // open file in inferred project (projectsToRemove || (projectsToRemove = [])).push(p); } + + if (!p.languageServiceEnabled) { + // if project language service is disabled then we create a program only for open files. + // this means that project should be marked as dirty to force rebuilding of the program + // on the next request + p.markAsDirty(); + } } if (projectsToRemove) { for (const project of projectsToRemove) { @@ -777,7 +791,13 @@ namespace ts.server { } private findConfiguredProjectByProjectName(configFileName: NormalizedPath) { - return findProjectByName(configFileName, this.configuredProjects); + // make sure that casing of config file name is consistent + configFileName = asNormalizedPath(this.toCanonicalFileName(configFileName)); + for (const proj of this.configuredProjects) { + if (proj.canonicalConfigFilePath === configFileName) { + return proj; + } + } } private findExternalProjectByProjectName(projectFileName: string) { @@ -805,7 +825,9 @@ namespace ts.server { this.host, getDirectoryPath(configFilename), /*existingOptions*/ {}, - configFilename); + configFilename, + /*resolutionStack*/ [], + this.hostConfiguration.extraFileExtensions); if (parsedCommandLine.errors.length) { errors = concatenate(errors, parsedCommandLine.errors); @@ -909,7 +931,7 @@ namespace ts.server { for (const f of files) { const rootFilename = propertyReader.getFileName(f); const scriptKind = propertyReader.getScriptKind(f); - const hasMixedContent = propertyReader.hasMixedContent(f); + const hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); if (this.host.fileExists(rootFilename)) { const info = this.getOrCreateScriptInfoForNormalizedPath(toNormalizedPath(rootFilename), /*openedByClient*/ clientFileName == rootFilename, /*fileContent*/ undefined, scriptKind, hasMixedContent); project.addRoot(info); @@ -955,7 +977,7 @@ namespace ts.server { rootFilesChanged = true; if (!scriptInfo) { const scriptKind = propertyReader.getScriptKind(f); - const hasMixedContent = propertyReader.hasMixedContent(f); + const hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, /*openedByClient*/ false, /*fileContent*/ undefined, scriptKind, hasMixedContent); } } @@ -983,7 +1005,7 @@ namespace ts.server { } if (toAdd) { for (const f of toAdd) { - if (f.isOpen && isRootFileInInferredProject(f)) { + if (f.isScriptOpen() && isRootFileInInferredProject(f)) { // if file is already root in some inferred project // - remove the file from that project and delete the project if necessary const inferredProject = f.containingProjects[0]; @@ -1037,9 +1059,7 @@ namespace ts.server { project.stopWatchingDirectory(); } else { - if (!project.languageServiceEnabled) { - project.enableLanguageService(); - } + project.enableLanguageService(); this.watchConfigDirectoryForProject(project, projectOptions); this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors); } @@ -1083,32 +1103,34 @@ namespace ts.server { getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean) { let info = this.getScriptInfoForNormalizedPath(fileName); if (!info) { - let content: string; - if (this.host.fileExists(fileName)) { - // by default pick whatever content was supplied as the argument - // if argument was not given - then for mixed content files assume that its content is empty string - content = fileContent || (hasMixedContent ? "" : this.host.readFile(fileName)); - } - if (!content) { - if (openedByClient) { - content = ""; - } - } - if (content !== undefined) { - info = new ScriptInfo(this.host, fileName, content, scriptKind, openedByClient, hasMixedContent); - // do not watch files with mixed content - server doesn't know how to interpret it + if (openedByClient || this.host.fileExists(fileName)) { + info = new ScriptInfo(this.host, fileName, scriptKind, hasMixedContent); + this.filenameToScriptInfo.set(info.path, info); - if (!info.isOpen && !hasMixedContent) { - info.setWatcher(this.host.watchFile(fileName, _ => this.onSourceFileChanged(fileName))); + + if (openedByClient) { + if (fileContent === undefined) { + // if file is opened by client and its content is not specified - use file text + fileContent = this.host.readFile(fileName) || ""; + } + } + else { + // do not watch files with mixed content - server doesn't know how to interpret it + if (!hasMixedContent) { + info.setWatcher(this.host.watchFile(fileName, _ => this.onSourceFileChanged(fileName))); + } } } } if (info) { - if (fileContent !== undefined) { - info.reload(fileContent); + if (openedByClient && !info.isScriptOpen()) { + info.open(fileContent); + if (hasMixedContent) { + info.registerFileUpdate(); + } } - if (openedByClient) { - info.isOpen = true; + else if (fileContent !== undefined) { + info.reload(fileContent); } } return info; @@ -1140,6 +1162,10 @@ namespace ts.server { mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); this.logger.info("Format host information updated"); } + if (args.extraFileExtensions) { + this.hostConfiguration.extraFileExtensions = args.extraFileExtensions; + this.logger.info("Host file extension mappings updated"); + } } } @@ -1205,9 +1231,22 @@ namespace ts.server { } openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): OpenConfiguredProjectResult { - const { configFileName = undefined, configFileErrors = undefined }: OpenConfiguredProjectResult = this.findContainingExternalProject(fileName) - ? {} - : this.openOrUpdateConfiguredProjectForFile(fileName); + let configFileName: NormalizedPath; + let configFileErrors: Diagnostic[]; + + let project: ConfiguredProject | ExternalProject = this.findContainingExternalProject(fileName); + if (!project) { + ({ configFileName, configFileErrors } = this.openOrUpdateConfiguredProjectForFile(fileName)); + if (configFileName) { + project = this.findConfiguredProjectByProjectName(configFileName); + } + } + if (project && !project.languageServiceEnabled) { + // if project language service is disabled then we create a program only for open files. + // this means that project should be marked as dirty to force rebuilding of the program + // on the next request + project.markAsDirty(); + } // at this point if file is the part of some configured/external project then this project should be created const info = this.getOrCreateScriptInfoForNormalizedPath(fileName, /*openedByClient*/ true, fileContent, scriptKind, hasMixedContent); @@ -1224,7 +1263,6 @@ namespace ts.server { const info = this.getScriptInfoForNormalizedPath(toNormalizedPath(uncheckedFileName)); if (info) { this.closeOpenFile(info); - info.isOpen = false; } this.printProjects(); } @@ -1249,7 +1287,7 @@ namespace ts.server { if (openFiles) { for (const file of openFiles) { const scriptInfo = this.getScriptInfo(file.fileName); - Debug.assert(!scriptInfo || !scriptInfo.isOpen); + Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen()); const normalizedPath = scriptInfo ? scriptInfo.fileName : toNormalizedPath(file.fileName); this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent); } @@ -1321,7 +1359,28 @@ namespace ts.server { } } - openExternalProject(proj: protocol.ExternalProject): void { + openExternalProjects(projects: protocol.ExternalProject[]): void { + // record project list before the update + const projectsToClose = arrayToMap(this.externalProjects, p => p.getProjectName(), _ => true); + for (const externalProjectName in this.externalProjectToConfiguredProjectMap) { + projectsToClose[externalProjectName] = true; + } + + for (const externalProject of projects) { + this.openExternalProject(externalProject, /*suppressRefreshOfInferredProjects*/ true); + // delete project that is present in input list + delete projectsToClose[externalProject.projectFileName]; + } + + // close projects that were missing in the input list + for (const externalProjectName in projectsToClose) { + this.closeExternalProject(externalProjectName, /*suppressRefresh*/ true) + } + + this.refreshInferredProjects(); + } + + openExternalProject(proj: protocol.ExternalProject, suppressRefreshOfInferredProjects = false): void { // typingOptions has been deprecated and is only supported for backward compatibility // purposes. It should be removed in future releases - use typeAcquisition instead. if (proj.typingOptions && !proj.typeAcquisition) { @@ -1351,8 +1410,15 @@ namespace ts.server { let exisingConfigFiles: string[]; if (externalProject) { if (!tsConfigFiles) { + const compilerOptions = convertCompilerOptions(proj.options); + if (this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, proj.rootFiles, externalFilePropertyReader)) { + externalProject.disableLanguageService(); + } + else { + externalProject.enableLanguageService(); + } // external project already exists and not config files were added - update the project and return; - this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typeAcquisition, proj.options.compileOnSave, /*configFileErrors*/ undefined); + this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, /*configFileErrors*/ undefined); return; } // some config files were added to external project (that previously were not there) @@ -1414,7 +1480,9 @@ namespace ts.server { delete this.externalProjectToConfiguredProjectMap[proj.projectFileName]; this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); } - this.refreshInferredProjects(); + if (!suppressRefreshOfInferredProjects) { + this.refreshInferredProjects(); + } } } } diff --git a/src/server/lsHost.ts b/src/server/lsHost.ts index aa37008ff66..d73a31933f4 100644 --- a/src/server/lsHost.ts +++ b/src/server/lsHost.ts @@ -169,7 +169,7 @@ namespace ts.server { getScriptSnapshot(filename: string): ts.IScriptSnapshot { const scriptInfo = this.project.getScriptInfoLSHost(filename); if (scriptInfo) { - return scriptInfo.snap(); + return scriptInfo.getSnapshot(); } } diff --git a/src/server/project.ts b/src/server/project.ts index c37dd6e135a..0037a470a49 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// @@ -90,87 +90,6 @@ namespace ts.server { } } - const emptyResult: any[] = []; - const getEmptyResult = () => emptyResult; - const getUndefined = () => undefined; - const emptyEncodedSemanticClassifications = { spans: emptyResult, endOfLineState: EndOfLineState.None }; - - export function createNoSemanticFeaturesWrapper(realLanguageService: LanguageService): LanguageService { - return { - cleanupSemanticCache: noop, - getSyntacticDiagnostics: (fileName) => - fileName ? realLanguageService.getSyntacticDiagnostics(fileName) : emptyResult, - getSemanticDiagnostics: getEmptyResult, - getCompilerOptionsDiagnostics: () => - realLanguageService.getCompilerOptionsDiagnostics(), - getSyntacticClassifications: (fileName, span) => - realLanguageService.getSyntacticClassifications(fileName, span), - getEncodedSyntacticClassifications: (fileName, span) => - realLanguageService.getEncodedSyntacticClassifications(fileName, span), - getSemanticClassifications: getEmptyResult, - getEncodedSemanticClassifications: () => - emptyEncodedSemanticClassifications, - getCompletionsAtPosition: getUndefined, - findReferences: getEmptyResult, - getCompletionEntryDetails: getUndefined, - getQuickInfoAtPosition: getUndefined, - findRenameLocations: getEmptyResult, - getNameOrDottedNameSpan: (fileName, startPos, endPos) => - realLanguageService.getNameOrDottedNameSpan(fileName, startPos, endPos), - getBreakpointStatementAtPosition: (fileName, position) => - realLanguageService.getBreakpointStatementAtPosition(fileName, position), - getBraceMatchingAtPosition: (fileName, position) => - realLanguageService.getBraceMatchingAtPosition(fileName, position), - getSignatureHelpItems: getUndefined, - getDefinitionAtPosition: getEmptyResult, - getRenameInfo: () => ({ - canRename: false, - localizedErrorMessage: getLocaleSpecificMessage(Diagnostics.Language_service_is_disabled), - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }), - getTypeDefinitionAtPosition: getUndefined, - getReferencesAtPosition: getEmptyResult, - getDocumentHighlights: getEmptyResult, - getOccurrencesAtPosition: getEmptyResult, - getNavigateToItems: getEmptyResult, - getNavigationBarItems: fileName => - realLanguageService.getNavigationBarItems(fileName), - getNavigationTree: fileName => - realLanguageService.getNavigationTree(fileName), - getOutliningSpans: fileName => - realLanguageService.getOutliningSpans(fileName), - getTodoComments: getEmptyResult, - getIndentationAtPosition: (fileName, position, options) => - realLanguageService.getIndentationAtPosition(fileName, position, options), - getFormattingEditsForRange: (fileName, start, end, options) => - realLanguageService.getFormattingEditsForRange(fileName, start, end, options), - getFormattingEditsForDocument: (fileName, options) => - realLanguageService.getFormattingEditsForDocument(fileName, options), - getFormattingEditsAfterKeystroke: (fileName, position, key, options) => - realLanguageService.getFormattingEditsAfterKeystroke(fileName, position, key, options), - getDocCommentTemplateAtPosition: (fileName, position) => - realLanguageService.getDocCommentTemplateAtPosition(fileName, position), - isValidBraceCompletionAtPosition: (fileName, position, openingBrace) => - realLanguageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace), - getEmitOutput: getUndefined, - getProgram: () => - realLanguageService.getProgram(), - getNonBoundSourceFile: fileName => - realLanguageService.getNonBoundSourceFile(fileName), - dispose: () => - realLanguageService.dispose(), - getCompletionEntrySymbol: getUndefined, - getImplementationAtPosition: getEmptyResult, - getSourceFile: fileName => - realLanguageService.getSourceFile(fileName), - getCodeFixesAtPosition: getEmptyResult - }; - } - export abstract class Project { private rootFiles: ScriptInfo[] = []; private rootFilesMap: FileMap = createFileMap(); @@ -181,12 +100,14 @@ namespace ts.server { private lastCachedUnresolvedImportsList: SortedReadonlyArray; private readonly languageService: LanguageService; - // wrapper over the real language service that will suppress all semantic operations - private readonly noSemanticFeaturesLanguageService: LanguageService; public languageServiceEnabled = true; builder: Builder; + /** + * Set of files names that were updated since the last call to getChangesSinceVersion. + */ + private updatedFileNames: Map; /** * Set of files that was returned from the last call to getChangesSinceVersion. */ @@ -248,15 +169,12 @@ namespace ts.server { this.compilerOptions.allowNonTsExtensions = true; } - if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { - this.compilerOptions.noEmitForJsFiles = true; - } + this.setInternalCompilerOptionsForEmittingJsFiles(); this.lsHost = new LSHost(this.projectService.host, this, this.projectService.cancellationToken); this.lsHost.setCompilationSettings(this.compilerOptions); this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry); - this.noSemanticFeaturesLanguageService = createNoSemanticFeaturesWrapper(this.languageService); if (!languageServiceEnabled) { this.disableLanguageService(); @@ -266,6 +184,12 @@ namespace ts.server { this.markAsDirty(); } + private setInternalCompilerOptionsForEmittingJsFiles() { + if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { + this.compilerOptions.noEmitForJsFiles = true; + } + } + getProjectErrors() { return this.projectErrors; } @@ -274,9 +198,7 @@ namespace ts.server { if (ensureSynchronized) { this.updateGraph(); } - return this.languageServiceEnabled - ? this.languageService - : this.noSemanticFeaturesLanguageService; + return this.languageService; } getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[] { @@ -365,7 +287,10 @@ namespace ts.server { const result: string[] = []; if (this.rootFiles) { for (const f of this.rootFiles) { - result.push(f.fileName); + if (this.languageServiceEnabled || f.isScriptOpen()) { + // if language service is disabled - process only files that are open + result.push(f.fileName); + } } if (this.typingFiles) { for (const f of this.typingFiles) { @@ -381,6 +306,10 @@ namespace ts.server { } getScriptInfos() { + if (!this.languageServiceEnabled) { + // if language service is not enabled - return just root files + return this.rootFiles; + } return map(this.program.getSourceFiles(), sourceFile => { const scriptInfo = this.projectService.getScriptInfoForPath(sourceFile.path); if (!scriptInfo) { @@ -444,7 +373,7 @@ namespace ts.server { containsFile(filename: NormalizedPath, requireOpen?: boolean) { const info = this.projectService.getScriptInfoForNormalizedPath(filename); - if (info && (info.isOpen || !requireOpen)) { + if (info && (info.isScriptOpen() || !requireOpen)) { return this.containsScriptInfo(info); } } @@ -476,6 +405,10 @@ namespace ts.server { this.markAsDirty(); } + registerFileUpdate(fileName: string) { + (this.updatedFileNames || (this.updatedFileNames = createMap()))[fileName] = fileName; + } + markAsDirty() { this.projectStateVersion++; } @@ -517,10 +450,6 @@ namespace ts.server { * @returns: true if set of files in the project stays the same and false - otherwise. */ updateGraph(): boolean { - if (!this.languageServiceEnabled) { - return true; - } - this.lsHost.startRecordingFilesWithChangedResolutions(); let hasChanges = this.updateGraphWorker(); @@ -552,6 +481,16 @@ namespace ts.server { if (this.setTypings(cachedTypings)) { hasChanges = this.updateGraphWorker() || hasChanges; } + + // update builder only if language service is enabled + // otherwise tell it to drop its internal state + if (this.languageServiceEnabled) { + this.builder.onProjectUpdateGraph(); + } + else { + this.builder.clear(); + } + if (hasChanges) { this.projectStructureVersion++; } @@ -590,7 +529,6 @@ namespace ts.server { } } } - this.builder.onProjectUpdateGraph(); return hasChanges; } @@ -637,6 +575,7 @@ namespace ts.server { this.lastCachedUnresolvedImportsList = undefined; } this.compilerOptions = compilerOptions; + this.setInternalCompilerOptionsForEmittingJsFiles(); this.lsHost.setCompilationSettings(compilerOptions); this.markAsDirty(); @@ -660,12 +599,15 @@ namespace ts.server { projectName: this.getProjectName(), version: this.projectStructureVersion, isInferred: this.projectKind === ProjectKind.Inferred, - options: this.getCompilerOptions() + options: this.getCompilerOptions(), + languageServiceDisabled: !this.languageServiceEnabled }; + const updatedFileNames = this.updatedFileNames; + this.updatedFileNames = undefined; // check if requested version is the same that we have reported last time if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) { - // if current structure version is the same - return info witout any changes - if (this.projectStructureVersion == this.lastReportedVersion) { + // if current structure version is the same - return info without any changes + if (this.projectStructureVersion == this.lastReportedVersion && !updatedFileNames) { return { info, projectErrors: this.projectErrors }; } // compute and return the difference @@ -674,6 +616,7 @@ namespace ts.server { const added: string[] = []; const removed: string[] = []; + const updated: string[] = getOwnKeys(updatedFileNames); for (const id in currentFiles) { if (!hasProperty(lastReportedFileNames, id)) { added.push(id); @@ -686,7 +629,7 @@ namespace ts.server { } this.lastReportedFileNames = currentFiles; this.lastReportedVersion = this.projectStructureVersion; - return { info, changes: { added, removed }, projectErrors: this.projectErrors }; + return { info, changes: { added, removed, updated }, projectErrors: this.projectErrors }; } else { // unknown version - return everything @@ -817,6 +760,7 @@ namespace ts.server { private directoryWatcher: FileWatcher; private directoriesWatchedForWildcards: Map; private typeRootsWatchers: FileWatcher[]; + readonly canonicalConfigFilePath: NormalizedPath; /** Used for configured projects which may have multiple open roots */ openRefCount = 0; @@ -830,6 +774,7 @@ namespace ts.server { languageServiceEnabled: boolean, public compileOnSaveEnabled: boolean) { super(configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled); + this.canonicalConfigFilePath = asNormalizedPath(projectService.toCanonicalFileName(configFileName)); } getConfigFilePath() { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index e1735f768e4..39012e49fcd 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1,4 +1,4 @@ -/** +/** * Declaration module describing the TypeScript Server protocol */ namespace ts.server.protocol { @@ -904,6 +904,11 @@ namespace ts.server.protocol { * Current set of compiler options for project */ options: ts.CompilerOptions; + + /** + * true if project language service is disabled + */ + languageServiceDisabled: boolean; } /** @@ -918,6 +923,10 @@ namespace ts.server.protocol { * List of removed files */ removed: string[]; + /** + * List of updated files + */ + updated: string[]; } /** @@ -990,6 +999,11 @@ namespace ts.server.protocol { * The format options to use during formatting and other code editing features. */ formatOptions?: FormatCodeSettings; + + /** + * The host's additional supported file extensions + */ + extraFileExtensions?: FileExtensionInfo[]; } /** @@ -2117,6 +2131,40 @@ namespace ts.server.protocol { typingsInstallerVersion: string; } + export type BeginInstallTypesEventName = "beginInstallTypes"; + export type EndInstallTypesEventName = "endInstallTypes"; + + export interface BeginInstallTypesEvent extends Event { + event: BeginInstallTypesEventName; + body: BeginInstallTypesEventBody; + } + + export interface EndInstallTypesEvent extends Event { + event: EndInstallTypesEventName; + body: EndInstallTypesEventBody; + } + + export interface InstallTypesEventBody { + /** + * correlation id to match begin and end events + */ + eventId: number; + /** + * list of packages to install + */ + packages: ReadonlyArray; + } + + export interface BeginInstallTypesEventBody extends InstallTypesEventBody { + } + + export interface EndInstallTypesEventBody extends InstallTypesEventBody { + /** + * true if installation succeeded, otherwise false + */ + success: boolean; + } + export interface NavBarResponse extends Response { body?: NavigationBarItem[]; } diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 84649863a7b..0acd45d0287 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -2,6 +2,161 @@ namespace ts.server { + /* @internal */ + export class TextStorage { + private svc: ScriptVersionCache | undefined; + private svcVersion = 0; + + private text: string; + private lineMap: number[]; + private textVersion = 0; + + constructor(private readonly host: ServerHost, private readonly fileName: NormalizedPath) { + } + + public getVersion() { + return this.svc + ? `SVC-${this.svcVersion}-${this.svc.getSnapshot().version}` + : `Text-${this.textVersion}`; + } + + public hasScriptVersionCache() { + return this.svc !== undefined; + } + + public useScriptVersionCache(newText?: string) { + this.switchToScriptVersionCache(newText); + } + + public useText(newText?: string) { + this.svc = undefined; + this.setText(newText); + } + + public edit(start: number, end: number, newText: string) { + this.switchToScriptVersionCache().edit(start, end - start, newText); + } + + public reload(text: string) { + if (this.svc) { + this.svc.reload(text); + } + else { + this.setText(text); + } + } + + public reloadFromFile(tempFileName?: string) { + if (this.svc || (tempFileName !== this.fileName)) { + this.reload(this.getFileText(tempFileName)) + } + else { + this.setText(undefined); + } + } + + public getSnapshot(): IScriptSnapshot { + return this.svc + ? this.svc.getSnapshot() + : ScriptSnapshot.fromString(this.getOrLoadText()); + } + + public getLineInfo(line: number) { + return this.switchToScriptVersionCache().getSnapshot().index.lineNumberToInfo(line); + } + /** + * @param line 0 based index + */ + lineToTextSpan(line: number) { + if (!this.svc) { + const lineMap = this.getLineMap(); + const start = lineMap[line]; // -1 since line is 1-based + const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length; + return ts.createTextSpanFromBounds(start, end); + } + const index = this.svc.getSnapshot().index; + const lineInfo = index.lineNumberToInfo(line + 1); + let len: number; + if (lineInfo.leaf) { + len = lineInfo.leaf.text.length; + } + else { + const nextLineInfo = index.lineNumberToInfo(line + 2); + len = nextLineInfo.offset - lineInfo.offset; + } + return ts.createTextSpan(lineInfo.offset, len); + } + + /** + * @param line 1 based index + * @param offset 1 based index + */ + lineOffsetToPosition(line: number, offset: number): number { + if (!this.svc) { + return computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1); + } + const index = this.svc.getSnapshot().index; + + const lineInfo = index.lineNumberToInfo(line); + // TODO: assert this offset is actually on the line + return (lineInfo.offset + offset - 1); + } + + /** + * @param line 1-based index + * @param offset 1-based index + */ + positionToLineOffset(position: number): ILineInfo { + if (!this.svc) { + const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position); + return { line: line + 1, offset: character + 1 }; + } + const index = this.svc.getSnapshot().index; + const lineOffset = index.charOffsetToLineNumberAndPos(position); + return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + } + + private getFileText(tempFileName?: string) { + return this.host.readFile(tempFileName || this.fileName) || ""; + } + + private ensureNoScriptVersionCache() { + Debug.assert(!this.svc, "ScriptVersionCache should not be set"); + } + + private switchToScriptVersionCache(newText?: string): ScriptVersionCache { + if (!this.svc) { + this.svc = ScriptVersionCache.fromString(this.host, newText !== undefined ? newText : this.getOrLoadText()); + this.svcVersion++; + this.text = undefined; + } + return this.svc; + } + + private getOrLoadText() { + this.ensureNoScriptVersionCache(); + if (this.text === undefined) { + this.setText(this.getFileText()); + } + return this.text; + } + + private getLineMap() { + this.ensureNoScriptVersionCache(); + return this.lineMap || (this.lineMap = computeLineStarts(this.getOrLoadText())); + } + + private setText(newText: string) { + this.ensureNoScriptVersionCache(); + if (newText === undefined || this.text !== newText) { + this.text = newText; + this.lineMap = undefined; + this.textVersion++; + } + } + } + + export class ScriptInfo { /** * All projects that include this file @@ -11,24 +166,46 @@ namespace ts.server { readonly path: Path; private fileWatcher: FileWatcher; - private svc: ScriptVersionCache; + private textStorage: TextStorage; + + private isOpen: boolean; - // TODO: allow to update hasMixedContent from the outside constructor( private readonly host: ServerHost, readonly fileName: NormalizedPath, - content: string, readonly scriptKind: ScriptKind, - public isOpen = false, public hasMixedContent = false) { this.path = toPath(fileName, host.getCurrentDirectory(), createGetCanonicalFileName(host.useCaseSensitiveFileNames)); - this.svc = ScriptVersionCache.fromString(host, content); + this.textStorage = new TextStorage(host, fileName); + if (hasMixedContent) { + this.textStorage.reload(""); + } this.scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName); } + public isScriptOpen() { + return this.isOpen; + } + + public open(newText: string) { + this.isOpen = true; + this.textStorage.useScriptVersionCache(newText); + this.markContainingProjectsAsDirty(); + } + + public close() { + this.isOpen = false; + this.textStorage.useText(this.hasMixedContent ? "" : undefined); + this.markContainingProjectsAsDirty(); + } + + public getSnapshot() { + return this.textStorage.getSnapshot(); + } + getFormatCodeSettings() { return this.formatCodeSettings; } @@ -90,6 +267,12 @@ namespace ts.server { return this.containingProjects[0]; } + registerFileUpdate(): void { + for (const p of this.containingProjects) { + p.registerFileUpdate(this.path); + } + } + setFormatOptions(formatSettings: FormatCodeSettings): void { if (formatSettings) { if (!this.formatCodeSettings) { @@ -112,16 +295,16 @@ namespace ts.server { } getLatestVersion() { - return this.svc.latestVersion().toString(); + return this.textStorage.getVersion(); } reload(script: string) { - this.svc.reload(script); + this.textStorage.reload(script); this.markContainingProjectsAsDirty(); } saveTo(fileName: string) { - const snap = this.snap(); + const snap = this.textStorage.getSnapshot(); this.host.writeFile(fileName, snap.getText(0, snap.getLength())); } @@ -130,22 +313,17 @@ namespace ts.server { this.reload(""); } else { - this.svc.reloadFromFile(tempFileName || this.fileName); + this.textStorage.reloadFromFile(tempFileName); this.markContainingProjectsAsDirty(); } } - snap() { - return this.svc.getSnapshot(); - } - getLineInfo(line: number) { - const snap = this.snap(); - return snap.index.lineNumberToInfo(line); + return this.textStorage.getLineInfo(line); } editContent(start: number, end: number, newText: string): void { - this.svc.edit(start, end - start, newText); + this.textStorage.edit(start, end, newText); this.markContainingProjectsAsDirty(); } @@ -159,17 +337,7 @@ namespace ts.server { * @param line 1 based index */ lineToTextSpan(line: number) { - const index = this.snap().index; - const lineInfo = index.lineNumberToInfo(line + 1); - let len: number; - if (lineInfo.leaf) { - len = lineInfo.leaf.text.length; - } - else { - const nextLineInfo = index.lineNumberToInfo(line + 2); - len = nextLineInfo.offset - lineInfo.offset; - } - return ts.createTextSpan(lineInfo.offset, len); + return this.textStorage.lineToTextSpan(line); } /** @@ -177,11 +345,7 @@ namespace ts.server { * @param offset 1 based index */ lineOffsetToPosition(line: number, offset: number): number { - const index = this.snap().index; - - const lineInfo = index.lineNumberToInfo(line); - // TODO: assert this offset is actually on the line - return (lineInfo.offset + offset - 1); + return this.textStorage.lineOffsetToPosition(line, offset); } /** @@ -189,9 +353,7 @@ namespace ts.server { * @param offset 1-based index */ positionToLineOffset(position: number): ILineInfo { - const index = this.snap().index; - const lineOffset = index.charOffsetToLineNumberAndPos(position); - return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + return this.textStorage.positionToLineOffset(position); } } } \ No newline at end of file diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index f094a183610..aaf04d39a1f 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -438,8 +438,9 @@ namespace ts.server { } } getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange { - const oldSnap = oldSnapshot; - return this.getTextChangeRangeSinceVersion(oldSnap.version); + if (oldSnapshot instanceof LineIndexSnapshot) { + return this.getTextChangeRangeSinceVersion(oldSnapshot.version); + } } } diff --git a/src/server/server.ts b/src/server/server.ts index d5ccea4cd32..a020ef210fe 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -20,34 +20,41 @@ namespace ts.server { } = require("os"); function getGlobalTypingsCacheLocation() { - let basePath: string; switch (process.platform) { - case "win32": - basePath = process.env.LOCALAPPDATA || + case "win32": { + const basePath = process.env.LOCALAPPDATA || process.env.APPDATA || (os.homedir && os.homedir()) || process.env.USERPROFILE || (process.env.HOMEDRIVE && process.env.HOMEPATH && normalizeSlashes(process.env.HOMEDRIVE + process.env.HOMEPATH)) || os.tmpdir(); - break; - case "linux": - case "android": - basePath = (os.homedir && os.homedir()) || - process.env.HOME || - ((process.env.LOGNAME || process.env.USER) && `/home/${process.env.LOGNAME || process.env.USER}`) || - os.tmpdir(); - break; + return combinePaths(normalizeSlashes(basePath), "Microsoft/TypeScript"); + } case "darwin": - const homeDir = (os.homedir && os.homedir()) || - process.env.HOME || - ((process.env.LOGNAME || process.env.USER) && `/Users/${process.env.LOGNAME || process.env.USER}`) || - os.tmpdir(); - basePath = combinePaths(homeDir, "Library/Application Support/"); - break; + case "linux": + case "android": { + const cacheLocation = getNonWindowsCacheLocation(process.platform === "darwin"); + return combinePaths(cacheLocation, "typescript"); + } + default: + Debug.fail(`unsupported platform '${process.platform}'`); + return; } + } - Debug.assert(basePath !== undefined); - return combinePaths(normalizeSlashes(basePath), "Microsoft/TypeScript"); + function getNonWindowsCacheLocation(platformIsDarwin: boolean) { + if (process.env.XDG_CACHE_HOME) { + return process.env.XDG_CACHE_HOME; + } + const usersDir = platformIsDarwin ? "Users" : "home" + const homePath = (os.homedir && os.homedir()) || + process.env.HOME || + ((process.env.LOGNAME || process.env.USER) && `/${usersDir}/${process.env.LOGNAME || process.env.USER}`) || + os.tmpdir(); + const cacheFolder = platformIsDarwin + ? "Library/Caches" + : ".cache" + return combinePaths(normalizeSlashes(homePath), cacheFolder); } interface NodeChildProcess { @@ -198,7 +205,7 @@ namespace ts.server { private socket: NodeSocket; private projectService: ProjectService; private throttledOperations: ThrottledOperations; - private telemetrySender: EventSender; + private eventSender: EventSender; constructor( private readonly telemetryEnabled: boolean, @@ -231,7 +238,7 @@ namespace ts.server { } setTelemetrySender(telemetrySender: EventSender) { - this.telemetrySender = telemetrySender; + this.eventSender = telemetrySender; } attach(projectService: ProjectService) { @@ -291,12 +298,30 @@ namespace ts.server { }); } - private handleMessage(response: SetTypings | InvalidateCachedTypings | TypingsInstallEvent) { + private handleMessage(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes) { if (this.logger.hasLevel(LogLevel.verbose)) { this.logger.info(`Received response: ${JSON.stringify(response)}`); } - if (response.kind === EventInstall) { - if (this.telemetrySender) { + + if (response.kind === EventBeginInstallTypes) { + if (!this.eventSender) { + return; + } + const body: protocol.BeginInstallTypesEventBody = { + eventId: response.eventId, + packages: response.packagesToInstall, + }; + const eventName: protocol.BeginInstallTypesEventName = "beginInstallTypes"; + this.eventSender.event(body, eventName); + + return; + } + + if (response.kind === EventEndInstallTypes) { + if (!this.eventSender) { + return; + } + if (this.telemetryEnabled) { const body: protocol.TypingsInstalledTelemetryEventBody = { telemetryEventName: "typingsInstalled", payload: { @@ -306,10 +331,19 @@ namespace ts.server { } }; const eventName: protocol.TelemetryEventName = "telemetry"; - this.telemetrySender.event(body, eventName); + this.eventSender.event(body, eventName); } + + const body: protocol.EndInstallTypesEventBody = { + eventId: response.eventId, + packages: response.packagesToInstall, + success: response.installSuccess, + }; + const eventName: protocol.EndInstallTypesEventName = "endInstallTypes"; + this.eventSender.event(body, eventName); return; } + this.projectService.updateTypingsForProject(response); if (response.kind == ActionSet && this.socket) { this.sendEvent(0, "setTypings", response); diff --git a/src/server/session.ts b/src/server/session.ts index 36144b3212d..5c382aae7d3 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -709,7 +709,7 @@ namespace ts.server { const displayString = ts.displayPartsToString(nameInfo.displayParts); const nameSpan = nameInfo.textSpan; const nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset; - const nameText = scriptInfo.snap().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + const nameText = scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); const refs = combineProjectOutput( projects, (project: Project) => { @@ -722,7 +722,7 @@ namespace ts.server { const refScriptInfo = project.getScriptInfo(ref.fileName); const start = refScriptInfo.positionToLineOffset(ref.textSpan.start); const refLineSpan = refScriptInfo.lineToTextSpan(start.line - 1); - const lineText = refScriptInfo.snap().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + const lineText = refScriptInfo.getSnapshot().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); return { file: ref.fileName, start: start, @@ -1026,6 +1026,9 @@ namespace ts.server { if (!project) { Errors.ThrowNoProject(); } + if (!project.languageServiceEnabled) { + return false; + } const scriptInfo = project.getScriptInfo(file); return project.builder.emitFile(scriptInfo, (path, data, writeByteOrderMark) => this.host.writeFile(path, data, writeByteOrderMark)); } @@ -1326,7 +1329,7 @@ namespace ts.server { highPriorityFiles.push(fileNameInProject); else { const info = this.projectService.getScriptInfo(fileNameInProject); - if (!info.isOpen) { + if (!info.isScriptOpen()) { if (fileNameInProject.indexOf(".d.ts") > 0) veryLowPriorityFiles.push(fileNameInProject); else @@ -1365,14 +1368,12 @@ namespace ts.server { private handlers = createMap<(request: protocol.Request) => { response?: any, responseRequired?: boolean }>({ [CommandNames.OpenExternalProject]: (request: protocol.OpenExternalProjectRequest) => { - this.projectService.openExternalProject(request.arguments); + this.projectService.openExternalProject(request.arguments, /*suppressRefreshOfInferredProjects*/ false); // TODO: report errors return this.requiredResponse(true); }, [CommandNames.OpenExternalProjects]: (request: protocol.OpenExternalProjectsRequest) => { - for (const proj of request.arguments.projects) { - this.projectService.openExternalProject(proj); - } + this.projectService.openExternalProjects(request.arguments.projects); // TODO: report errors return this.requiredResponse(true); }, diff --git a/src/server/shared.ts b/src/server/shared.ts index 81a1f7fb55b..c56d4098e75 100644 --- a/src/server/shared.ts +++ b/src/server/shared.ts @@ -3,7 +3,8 @@ namespace ts.server { export const ActionSet: ActionSet = "action::set"; export const ActionInvalidate: ActionInvalidate = "action::invalidate"; - export const EventInstall: EventInstall = "event::install"; + export const EventBeginInstallTypes: EventBeginInstallTypes = "event::beginInstallTypes"; + export const EventEndInstallTypes: EventEndInstallTypes = "event::endInstallTypes"; export namespace Arguments { export const GlobalCacheLocation = "--globalTypingsCacheLocation"; diff --git a/src/server/types.d.ts b/src/server/types.d.ts index 77e9e762b59..9f53fa8def1 100644 --- a/src/server/types.d.ts +++ b/src/server/types.d.ts @@ -43,10 +43,11 @@ declare namespace ts.server { export type ActionSet = "action::set"; export type ActionInvalidate = "action::invalidate"; - export type EventInstall = "event::install"; + export type EventBeginInstallTypes = "event::beginInstallTypes"; + export type EventEndInstallTypes = "event::endInstallTypes"; export interface TypingInstallerResponse { - readonly kind: ActionSet | ActionInvalidate | EventInstall; + readonly kind: ActionSet | ActionInvalidate | EventBeginInstallTypes | EventEndInstallTypes; } export interface ProjectResponse extends TypingInstallerResponse { @@ -65,11 +66,20 @@ declare namespace ts.server { readonly kind: ActionInvalidate; } - export interface TypingsInstallEvent extends TypingInstallerResponse { - readonly packagesToInstall: ReadonlyArray; - readonly kind: EventInstall; - readonly installSuccess: boolean; + export interface InstallTypes extends ProjectResponse { + readonly kind: EventBeginInstallTypes | EventEndInstallTypes; + readonly eventId: number; readonly typingsInstallerVersion: string; + readonly packagesToInstall: ReadonlyArray; + } + + export interface BeginInstallTypes extends InstallTypes { + readonly kind: EventBeginInstallTypes; + } + + export interface EndInstallTypes extends InstallTypes { + readonly kind: EventEndInstallTypes; + readonly installSuccess: boolean; } export interface InstallTypingHost extends JsTyping.TypingResolutionHost { diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts index 235c2f16dad..19f794ad57c 100644 --- a/src/server/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts @@ -70,13 +70,12 @@ namespace ts.server.typingsInstaller { private readonly npmPath: string; readonly typesRegistry: Map; - constructor(globalTypingsCacheLocation: string, throttleLimit: number, telemetryEnabled: boolean, log: Log) { + constructor(globalTypingsCacheLocation: string, throttleLimit: number, log: Log) { super( sys, globalTypingsCacheLocation, toPath("typingSafeList.json", __dirname, createGetCanonicalFileName(sys.useCaseSensitiveFileNames)), throttleLimit, - telemetryEnabled, log); if (this.log.isEnabled()) { this.log.writeLine(`Process id: ${process.pid}`); @@ -113,7 +112,7 @@ namespace ts.server.typingsInstaller { }); } - protected sendResponse(response: SetTypings | InvalidateCachedTypings) { + protected sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes) { if (this.log.isEnabled()) { this.log.writeLine(`Sending response: ${JSON.stringify(response)}`); } @@ -149,7 +148,6 @@ namespace ts.server.typingsInstaller { const logFilePath = findArgument(server.Arguments.LogFile); const globalTypingsCacheLocation = findArgument(server.Arguments.GlobalCacheLocation); - const telemetryEnabled = hasArgument(server.Arguments.EnableTelemetry); const log = new FileLog(logFilePath); if (log.isEnabled()) { @@ -163,6 +161,6 @@ namespace ts.server.typingsInstaller { } process.exit(0); }); - const installer = new NodeTypingsInstaller(globalTypingsCacheLocation, /*throttleLimit*/5, telemetryEnabled, log); + const installer = new NodeTypingsInstaller(globalTypingsCacheLocation, /*throttleLimit*/5, log); installer.listen(); } \ No newline at end of file diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts index 25d53e14e75..7a09c1f6c21 100644 --- a/src/server/typingsInstaller/typingsInstaller.ts +++ b/src/server/typingsInstaller/typingsInstaller.ts @@ -97,7 +97,6 @@ namespace ts.server.typingsInstaller { readonly globalCachePath: string, readonly safeListPath: Path, readonly throttleLimit: number, - readonly telemetryEnabled: boolean, protected readonly log = nullLog) { if (this.log.isEnabled()) { this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}'`); @@ -309,47 +308,58 @@ namespace ts.server.typingsInstaller { const requestId = this.installRunCount; this.installRunCount++; + // send progress event + this.sendResponse({ + kind: EventBeginInstallTypes, + eventId: requestId, + typingsInstallerVersion: ts.version, // qualified explicitly to prevent occasional shadowing + projectName: req.projectName + }); + this.installTypingsAsync(requestId, scopedTypings, cachePath, ok => { - if (this.telemetryEnabled) { - this.sendResponse({ - kind: EventInstall, + try { + if (!ok) { + if (this.log.isEnabled()) { + this.log.writeLine(`install request failed, marking packages as missing to prevent repeated requests: ${JSON.stringify(filteredTypings)}`); + } + for (const typing of filteredTypings) { + this.missingTypingsSet[typing] = true; + } + return; + } + + // TODO: watch project directory + if (this.log.isEnabled()) { + this.log.writeLine(`Installed typings ${JSON.stringify(scopedTypings)}`); + } + const installedTypingFiles: string[] = []; + for (const packageName of filteredTypings) { + const typingFile = typingToFileName(cachePath, packageName, this.installTypingHost, this.log); + if (!typingFile) { + this.missingTypingsSet[packageName] = true; + continue; + } + if (!this.packageNameToTypingLocation[packageName]) { + this.packageNameToTypingLocation[packageName] = typingFile; + } + installedTypingFiles.push(typingFile); + } + if (this.log.isEnabled()) { + this.log.writeLine(`Installed typing files ${JSON.stringify(installedTypingFiles)}`); + } + + this.sendResponse(this.createSetTypings(req, currentlyCachedTypings.concat(installedTypingFiles))); + } + finally { + this.sendResponse({ + kind: EventEndInstallTypes, + eventId: requestId, + projectName: req.projectName, packagesToInstall: scopedTypings, installSuccess: ok, typingsInstallerVersion: ts.version // qualified explicitly to prevent occasional shadowing }); } - - if (!ok) { - if (this.log.isEnabled()) { - this.log.writeLine(`install request failed, marking packages as missing to prevent repeated requests: ${JSON.stringify(filteredTypings)}`); - } - for (const typing of filteredTypings) { - this.missingTypingsSet[typing] = true; - } - return; - } - - // TODO: watch project directory - if (this.log.isEnabled()) { - this.log.writeLine(`Installed typings ${JSON.stringify(scopedTypings)}`); - } - const installedTypingFiles: string[] = []; - for (const packageName of filteredTypings) { - const typingFile = typingToFileName(cachePath, packageName, this.installTypingHost, this.log); - if (!typingFile) { - this.missingTypingsSet[packageName] = true; - continue; - } - if (!this.packageNameToTypingLocation[packageName]) { - this.packageNameToTypingLocation[packageName] = typingFile; - } - installedTypingFiles.push(typingFile); - } - if (this.log.isEnabled()) { - this.log.writeLine(`Installed typing files ${JSON.stringify(installedTypingFiles)}`); - } - - this.sendResponse(this.createSetTypings(req, currentlyCachedTypings.concat(installedTypingFiles))); }); } @@ -417,6 +427,6 @@ namespace ts.server.typingsInstaller { } protected abstract installWorker(requestId: number, args: string[], cwd: string, onRequestCompleted: RequestCompletedAction): void; - protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | TypingsInstallEvent): void; + protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes): void; } } \ No newline at end of file diff --git a/src/server/utilities.ts b/src/server/utilities.ts index fd370da7fa1..839e79268fa 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -1,4 +1,4 @@ -/// +/// /// namespace ts.server { diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 3369ac23223..0e65d3b264e 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -1,4 +1,4 @@ -/* @internal */ +/* @internal */ namespace ts.JsDoc { const jsDocTagNames = [ "augments", @@ -23,6 +23,7 @@ namespace ts.JsDoc { "lends", "link", "memberOf", + "method", "name", "namespace", "param", @@ -166,6 +167,7 @@ namespace ts.JsDoc { const lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + const isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName); let docParams = ""; for (let i = 0, numParams = parameters.length; i < numParams; i++) { @@ -173,8 +175,12 @@ namespace ts.JsDoc { const paramName = currentName.kind === SyntaxKind.Identifier ? (currentName).text : "param" + i; - - docParams += `${indentationStr} * @param ${paramName}${newLine}`; + if (isJavaScriptFile) { + docParams += `${indentationStr} * @param {any} ${paramName}${newLine}`; + } + else { + docParams += `${indentationStr} * @param ${paramName}${newLine}`; + } } // A doc comment consists of the following diff --git a/src/services/services.ts b/src/services/services.ts index d28dd871105..7ad02de56e5 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1725,7 +1725,7 @@ namespace ts { const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Check if in a context where we don't want to perform any insertion - if (isInString(sourceFile, position) || isInComment(sourceFile, position)) { + if (isInString(sourceFile, position)) { return false; } diff --git a/src/services/types.ts b/src/services/types.ts index 6a0e6e886b5..3865fe7fac9 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -91,7 +91,9 @@ namespace ts { } public getText(start: number, end: number): string { - return this.text.substring(start, end); + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); } public getLength(): number { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index e19fdc0a84a..2f52d747e23 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1137,6 +1137,7 @@ namespace ts { writeSpace: text => writeKind(text, SymbolDisplayPartKind.space), writeStringLiteral: text => writeKind(text, SymbolDisplayPartKind.stringLiteral), writeParameter: text => writeKind(text, SymbolDisplayPartKind.parameterName), + writeProperty: text => writeKind(text, SymbolDisplayPartKind.propertyName), writeSymbol, writeLine, increaseIndent: () => { indent++; }, diff --git a/tests/baselines/reference/awaitInheritedPromise_es2017.js b/tests/baselines/reference/awaitInheritedPromise_es2017.js new file mode 100644 index 00000000000..e973d0b166a --- /dev/null +++ b/tests/baselines/reference/awaitInheritedPromise_es2017.js @@ -0,0 +1,11 @@ +//// [awaitInheritedPromise_es2017.ts] +interface A extends Promise {} +declare var a: A; +async function f() { + await a; +} + +//// [awaitInheritedPromise_es2017.js] +async function f() { + await a; +} diff --git a/tests/baselines/reference/awaitInheritedPromise_es2017.symbols b/tests/baselines/reference/awaitInheritedPromise_es2017.symbols new file mode 100644 index 00000000000..ef68d16b678 --- /dev/null +++ b/tests/baselines/reference/awaitInheritedPromise_es2017.symbols @@ -0,0 +1,15 @@ +=== tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts === +interface A extends Promise {} +>A : Symbol(A, Decl(awaitInheritedPromise_es2017.ts, 0, 0)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) + +declare var a: A; +>a : Symbol(a, Decl(awaitInheritedPromise_es2017.ts, 1, 11)) +>A : Symbol(A, Decl(awaitInheritedPromise_es2017.ts, 0, 0)) + +async function f() { +>f : Symbol(f, Decl(awaitInheritedPromise_es2017.ts, 1, 17)) + + await a; +>a : Symbol(a, Decl(awaitInheritedPromise_es2017.ts, 1, 11)) +} diff --git a/tests/baselines/reference/awaitInheritedPromise_es2017.types b/tests/baselines/reference/awaitInheritedPromise_es2017.types new file mode 100644 index 00000000000..bed681181b0 --- /dev/null +++ b/tests/baselines/reference/awaitInheritedPromise_es2017.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts === +interface A extends Promise {} +>A : A +>Promise : Promise + +declare var a: A; +>a : A +>A : A + +async function f() { +>f : () => Promise + + await a; +>await a : string +>a : A +} diff --git a/tests/baselines/reference/capturedLetConstInLoop9.js b/tests/baselines/reference/capturedLetConstInLoop9.js index 84f9a021054..8f88855a9ad 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.js +++ b/tests/baselines/reference/capturedLetConstInLoop9.js @@ -208,6 +208,7 @@ function foo() { } (function () { return b; }); return { value: 100 }; + var _a; }; for (var _c = 0, _d = []; _c < _d.length; _c++) { var b = _d[_c]; @@ -221,6 +222,7 @@ function foo() { } } (function () { return a; }); + var _b; }; var arguments_1 = arguments, x, z, x1, z1; l0: for (var _i = 0, _a = []; _i < _a.length; _i++) { @@ -238,7 +240,6 @@ function foo() { use(z); use(x1); use(z1); - var _b, _a; } function foo2() { for (var _i = 0, _a = []; _i < _a.length; _i++) { diff --git a/tests/baselines/reference/circularIndexedAccessErrors.errors.txt b/tests/baselines/reference/circularIndexedAccessErrors.errors.txt new file mode 100644 index 00000000000..e3076e08b7e --- /dev/null +++ b/tests/baselines/reference/circularIndexedAccessErrors.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(3,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(7,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(15,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(19,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(23,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(27,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(28,5): error TS2502: 'y' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(29,5): error TS2502: 'z' is referenced directly or indirectly in its own type annotation. + + +==== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts (8 errors) ==== + + type T1 = { + x: T1["x"]; // Error + ~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + }; + + type T2 = { + x: T2[K]; // Error + ~~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + y: number; + } + + declare let x2: T2<"x">; + let x2x = x2.x; + + interface T3> { + x: T["x"]; // Error + ~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + } + + interface T4> { + x: T4["x"]; // Error + ~~~~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + } + + class C1 { + x: C1["x"]; // Error + ~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + } + + class C2 { + x: this["y"]; // Error + ~~~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + y: this["z"]; // Error + ~~~~~~~~~~~~~ +!!! error TS2502: 'y' is referenced directly or indirectly in its own type annotation. + z: this["x"]; // Error + ~~~~~~~~~~~~~ +!!! error TS2502: 'z' is referenced directly or indirectly in its own type annotation. + } \ No newline at end of file diff --git a/tests/baselines/reference/circularIndexedAccessErrors.js b/tests/baselines/reference/circularIndexedAccessErrors.js new file mode 100644 index 00000000000..46784ae8d18 --- /dev/null +++ b/tests/baselines/reference/circularIndexedAccessErrors.js @@ -0,0 +1,70 @@ +//// [circularIndexedAccessErrors.ts] + +type T1 = { + x: T1["x"]; // Error +}; + +type T2 = { + x: T2[K]; // Error + y: number; +} + +declare let x2: T2<"x">; +let x2x = x2.x; + +interface T3> { + x: T["x"]; // Error +} + +interface T4> { + x: T4["x"]; // Error +} + +class C1 { + x: C1["x"]; // Error +} + +class C2 { + x: this["y"]; // Error + y: this["z"]; // Error + z: this["x"]; // Error +} + +//// [circularIndexedAccessErrors.js] +var x2x = x2.x; +var C1 = (function () { + function C1() { + } + return C1; +}()); +var C2 = (function () { + function C2() { + } + return C2; +}()); + + +//// [circularIndexedAccessErrors.d.ts] +declare type T1 = { + x: T1["x"]; +}; +declare type T2 = { + x: T2[K]; + y: number; +}; +declare let x2: T2<"x">; +declare let x2x: any; +interface T3> { + x: T["x"]; +} +interface T4> { + x: T4["x"]; +} +declare class C1 { + x: C1["x"]; +} +declare class C2 { + x: this["y"]; + y: this["z"]; + z: this["x"]; +} diff --git a/tests/baselines/reference/circularReferenceInImport.js b/tests/baselines/reference/circularReferenceInImport.js new file mode 100644 index 00000000000..a9cf0925c34 --- /dev/null +++ b/tests/baselines/reference/circularReferenceInImport.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/circularReferenceInImport.ts] //// + +//// [db.d.ts] + +declare namespace Db { + export import Types = Db; +} + +export = Db; + +//// [app.ts] +import * as Db from "./db" + +export function foo() { + return new Object() +} + +//// [app.js] +"use strict"; +function foo() { + return new Object(); +} +exports.foo = foo; + + +//// [app.d.ts] +export declare function foo(): Object; diff --git a/tests/baselines/reference/circularReferenceInImport.symbols b/tests/baselines/reference/circularReferenceInImport.symbols new file mode 100644 index 00000000000..b74ac14b5ab --- /dev/null +++ b/tests/baselines/reference/circularReferenceInImport.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/db.d.ts === + +declare namespace Db { +>Db : Symbol(Types, Decl(db.d.ts, 0, 0)) + + export import Types = Db; +>Types : Symbol(Types, Decl(db.d.ts, 1, 22)) +>Db : Symbol(Types, Decl(db.d.ts, 0, 0)) +} + +export = Db; +>Db : Symbol(Db, Decl(db.d.ts, 0, 0)) + +=== tests/cases/compiler/app.ts === +import * as Db from "./db" +>Db : Symbol(Db, Decl(app.ts, 0, 6)) + +export function foo() { +>foo : Symbol(foo, Decl(app.ts, 0, 26)) + + return new Object() +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +} diff --git a/tests/baselines/reference/circularReferenceInImport.types b/tests/baselines/reference/circularReferenceInImport.types new file mode 100644 index 00000000000..d8db7f56231 --- /dev/null +++ b/tests/baselines/reference/circularReferenceInImport.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/db.d.ts === + +declare namespace Db { +>Db : typeof Types + + export import Types = Db; +>Types : typeof Types +>Db : typeof Types +} + +export = Db; +>Db : typeof Db + +=== tests/cases/compiler/app.ts === +import * as Db from "./db" +>Db : typeof Db + +export function foo() { +>foo : () => Object + + return new Object() +>new Object() : Object +>Object : ObjectConstructor +} diff --git a/tests/baselines/reference/classAbstractAccessor.errors.txt b/tests/baselines/reference/classAbstractAccessor.errors.txt new file mode 100644 index 00000000000..b43cfa9d7f1 --- /dev/null +++ b/tests/baselines/reference/classAbstractAccessor.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts(4,17): error TS1318: An abstract accessor cannot have an implementation. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts(6,17): error TS1318: An abstract accessor cannot have an implementation. + + +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts (2 errors) ==== + + abstract class A { + abstract get a(); + abstract get aa() { return 1; } // error + ~~ +!!! error TS1318: An abstract accessor cannot have an implementation. + abstract set b(x: string); + abstract set bb(x: string) {} // error + ~~ +!!! error TS1318: An abstract accessor cannot have an implementation. + } + \ No newline at end of file diff --git a/tests/baselines/reference/classAbstractAccessor.js b/tests/baselines/reference/classAbstractAccessor.js new file mode 100644 index 00000000000..a1edf0cb88d --- /dev/null +++ b/tests/baselines/reference/classAbstractAccessor.js @@ -0,0 +1,28 @@ +//// [classAbstractAccessor.ts] + +abstract class A { + abstract get a(); + abstract get aa() { return 1; } // error + abstract set b(x: string); + abstract set bb(x: string) {} // error +} + + +//// [classAbstractAccessor.js] +var A = (function () { + function A() { + } + Object.defineProperty(A.prototype, "aa", { + get: function () { return 1; } // error + , + enumerable: true, + configurable: true + }); + Object.defineProperty(A.prototype, "bb", { + set: function (x) { } // error + , + enumerable: true, + configurable: true + }); + return A; +}()); diff --git a/tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt b/tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt new file mode 100644 index 00000000000..ffbfd25fa94 --- /dev/null +++ b/tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(3,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(3,13): error TS2304: Cannot find name 'TypeNotFound'. +tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(3,13): error TS4092: Parameter 'index' of index signature from exported interface has or is using private name 'TypeNotFound'. + + +==== tests/cases/compiler/declarationEmitIndexTypeNotFound.ts (3 errors) ==== + + export interface Test { + [index: TypeNotFound]: any; + ~~~~~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + ~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'TypeNotFound'. + ~~~~~~~~~~~~ +!!! error TS4092: Parameter 'index' of index signature from exported interface has or is using private name 'TypeNotFound'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitIndexTypeNotFound.js b/tests/baselines/reference/declarationEmitIndexTypeNotFound.js new file mode 100644 index 00000000000..22100e5cb72 --- /dev/null +++ b/tests/baselines/reference/declarationEmitIndexTypeNotFound.js @@ -0,0 +1,9 @@ +//// [declarationEmitIndexTypeNotFound.ts] + +export interface Test { + [index: TypeNotFound]: any; +} + + +//// [declarationEmitIndexTypeNotFound.js] +"use strict"; diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS1.js b/tests/baselines/reference/decoratedClassExportsCommonJS1.js index 2b20c7ec168..7ef4369f975 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS1.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS1.js @@ -14,15 +14,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; let Testing123 = Testing123_1 = class Testing123 { }; Testing123.prop1 = Testing123_1.prop0; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports.Testing123 = Testing123; var Testing123_1; diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS2.js b/tests/baselines/reference/decoratedClassExportsCommonJS2.js index 9e8b8693109..994178cbb79 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS2.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS2.js @@ -13,14 +13,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; let Testing123 = Testing123_1 = class Testing123 { }; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports.Testing123 = Testing123; var Testing123_1; diff --git a/tests/baselines/reference/decoratedClassExportsSystem1.js b/tests/baselines/reference/decoratedClassExportsSystem1.js index 6f7fcbd144a..2f33feb28fb 100644 --- a/tests/baselines/reference/decoratedClassExportsSystem1.js +++ b/tests/baselines/reference/decoratedClassExportsSystem1.js @@ -17,9 +17,6 @@ System.register([], function (exports_1, context_1) { else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; - var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); - }; var __moduleName = context_1 && context_1.id; var Testing123, Testing123_1; return { @@ -29,8 +26,7 @@ System.register([], function (exports_1, context_1) { }; Testing123.prop1 = Testing123_1.prop0; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports_1("Testing123", Testing123); } diff --git a/tests/baselines/reference/decoratedClassExportsSystem2.js b/tests/baselines/reference/decoratedClassExportsSystem2.js index 2a1a394a1f3..2c9c62cadb2 100644 --- a/tests/baselines/reference/decoratedClassExportsSystem2.js +++ b/tests/baselines/reference/decoratedClassExportsSystem2.js @@ -14,9 +14,6 @@ System.register([], function (exports_1, context_1) { else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; - var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); - }; var __moduleName = context_1 && context_1.id; var Testing123, Testing123_1; return { @@ -25,8 +22,7 @@ System.register([], function (exports_1, context_1) { Testing123 = Testing123_1 = class Testing123 { }; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports_1("Testing123", Testing123); } diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js new file mode 100644 index 00000000000..be249800d57 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js @@ -0,0 +1,112 @@ +//// [tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts] //// + +//// [aux.ts] + +export class SomeClass { + field: string; +} + +//// [aux1.ts] +export class SomeClass1 { + field: string; +} + +//// [aux2.ts] +export class SomeClass2 { + field: string; +} +//// [main.ts] +import { SomeClass } from './aux'; +import { SomeClass1 } from './aux1'; + +function annotation(): ClassDecorator { + return (target: any): void => { }; +} + +function annotation1(): MethodDecorator { + return (target: any): void => { }; +} + +@annotation() +export class ClassA { + array: SomeClass[]; + + constructor(...init: SomeClass[]) { + this.array = init; + } + + @annotation1() + foo(... args: SomeClass1[]) { + } +} + +//// [aux.js] +"use strict"; +var SomeClass = (function () { + function SomeClass() { + } + return SomeClass; +}()); +exports.SomeClass = SomeClass; +//// [aux1.js] +"use strict"; +var SomeClass1 = (function () { + function SomeClass1() { + } + return SomeClass1; +}()); +exports.SomeClass1 = SomeClass1; +//// [aux2.js] +"use strict"; +var SomeClass2 = (function () { + function SomeClass2() { + } + return SomeClass2; +}()); +exports.SomeClass2 = SomeClass2; +//// [main.js] +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var aux_1 = require("./aux"); +var aux1_1 = require("./aux1"); +function annotation() { + return function (target) { }; +} +function annotation1() { + return function (target) { }; +} +var ClassA = (function () { + function ClassA() { + var init = []; + for (var _i = 0; _i < arguments.length; _i++) { + init[_i] = arguments[_i]; + } + this.array = init; + } + ClassA.prototype.foo = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + }; + return ClassA; +}()); +__decorate([ + annotation1(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [aux1_1.SomeClass1]), + __metadata("design:returntype", void 0) +], ClassA.prototype, "foo", null); +ClassA = __decorate([ + annotation(), + __metadata("design:paramtypes", [aux_1.SomeClass]) +], ClassA); +exports.ClassA = ClassA; diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols new file mode 100644 index 00000000000..9bd293cdfcb --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols @@ -0,0 +1,77 @@ +=== tests/cases/compiler/aux.ts === + +export class SomeClass { +>SomeClass : Symbol(SomeClass, Decl(aux.ts, 0, 0)) + + field: string; +>field : Symbol(SomeClass.field, Decl(aux.ts, 1, 24)) +} + +=== tests/cases/compiler/aux1.ts === +export class SomeClass1 { +>SomeClass1 : Symbol(SomeClass1, Decl(aux1.ts, 0, 0)) + + field: string; +>field : Symbol(SomeClass1.field, Decl(aux1.ts, 0, 25)) +} + +=== tests/cases/compiler/aux2.ts === +export class SomeClass2 { +>SomeClass2 : Symbol(SomeClass2, Decl(aux2.ts, 0, 0)) + + field: string; +>field : Symbol(SomeClass2.field, Decl(aux2.ts, 0, 25)) +} +=== tests/cases/compiler/main.ts === +import { SomeClass } from './aux'; +>SomeClass : Symbol(SomeClass, Decl(main.ts, 0, 8)) + +import { SomeClass1 } from './aux1'; +>SomeClass1 : Symbol(SomeClass1, Decl(main.ts, 1, 8)) + +function annotation(): ClassDecorator { +>annotation : Symbol(annotation, Decl(main.ts, 1, 36)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) + + return (target: any): void => { }; +>target : Symbol(target, Decl(main.ts, 4, 12)) +} + +function annotation1(): MethodDecorator { +>annotation1 : Symbol(annotation1, Decl(main.ts, 5, 1)) +>MethodDecorator : Symbol(MethodDecorator, Decl(lib.d.ts, --, --)) + + return (target: any): void => { }; +>target : Symbol(target, Decl(main.ts, 8, 12)) +} + +@annotation() +>annotation : Symbol(annotation, Decl(main.ts, 1, 36)) + +export class ClassA { +>ClassA : Symbol(ClassA, Decl(main.ts, 9, 1)) + + array: SomeClass[]; +>array : Symbol(ClassA.array, Decl(main.ts, 12, 21)) +>SomeClass : Symbol(SomeClass, Decl(main.ts, 0, 8)) + + constructor(...init: SomeClass[]) { +>init : Symbol(init, Decl(main.ts, 15, 16)) +>SomeClass : Symbol(SomeClass, Decl(main.ts, 0, 8)) + + this.array = init; +>this.array : Symbol(ClassA.array, Decl(main.ts, 12, 21)) +>this : Symbol(ClassA, Decl(main.ts, 9, 1)) +>array : Symbol(ClassA.array, Decl(main.ts, 12, 21)) +>init : Symbol(init, Decl(main.ts, 15, 16)) + } + + @annotation1() +>annotation1 : Symbol(annotation1, Decl(main.ts, 5, 1)) + + foo(... args: SomeClass1[]) { +>foo : Symbol(ClassA.foo, Decl(main.ts, 17, 5)) +>args : Symbol(args, Decl(main.ts, 20, 8)) +>SomeClass1 : Symbol(SomeClass1, Decl(main.ts, 1, 8)) + } +} diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types new file mode 100644 index 00000000000..6c27aa2c942 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types @@ -0,0 +1,82 @@ +=== tests/cases/compiler/aux.ts === + +export class SomeClass { +>SomeClass : SomeClass + + field: string; +>field : string +} + +=== tests/cases/compiler/aux1.ts === +export class SomeClass1 { +>SomeClass1 : SomeClass1 + + field: string; +>field : string +} + +=== tests/cases/compiler/aux2.ts === +export class SomeClass2 { +>SomeClass2 : SomeClass2 + + field: string; +>field : string +} +=== tests/cases/compiler/main.ts === +import { SomeClass } from './aux'; +>SomeClass : typeof SomeClass + +import { SomeClass1 } from './aux1'; +>SomeClass1 : typeof SomeClass1 + +function annotation(): ClassDecorator { +>annotation : () => ClassDecorator +>ClassDecorator : ClassDecorator + + return (target: any): void => { }; +>(target: any): void => { } : (target: any) => void +>target : any +} + +function annotation1(): MethodDecorator { +>annotation1 : () => MethodDecorator +>MethodDecorator : MethodDecorator + + return (target: any): void => { }; +>(target: any): void => { } : (target: any) => void +>target : any +} + +@annotation() +>annotation() : ClassDecorator +>annotation : () => ClassDecorator + +export class ClassA { +>ClassA : ClassA + + array: SomeClass[]; +>array : SomeClass[] +>SomeClass : SomeClass + + constructor(...init: SomeClass[]) { +>init : SomeClass[] +>SomeClass : SomeClass + + this.array = init; +>this.array = init : SomeClass[] +>this.array : SomeClass[] +>this : this +>array : SomeClass[] +>init : SomeClass[] + } + + @annotation1() +>annotation1() : MethodDecorator +>annotation1 : () => MethodDecorator + + foo(... args: SomeClass1[]) { +>foo : (...args: SomeClass1[]) => void +>args : SomeClass1[] +>SomeClass1 : SomeClass1 + } +} diff --git a/tests/baselines/reference/decoratorOnClassAccessor7.errors.txt b/tests/baselines/reference/decoratorOnClassAccessor7.errors.txt new file mode 100644 index 00000000000..d776297fcf4 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor7.errors.txt @@ -0,0 +1,41 @@ +tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts(26,5): error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name. +tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts(31,5): error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name. + + +==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts (2 errors) ==== + declare function dec1(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + declare function dec2(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + + class A { + @dec1 get x() { return 0; } + set x(value: number) { } + } + + class B { + get x() { return 0; } + @dec2 set x(value: number) { } + } + + class C { + @dec1 set x(value: number) { } + get x() { return 0; } + } + + class D { + set x(value: number) { } + @dec2 get x() { return 0; } + } + + class E { + @dec1 get x() { return 0; } + @dec2 set x(value: number) { } + ~ +!!! error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name. + } + + class F { + @dec1 set x(value: number) { } + @dec2 get x() { return 0; } + ~ +!!! error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name. + } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassAccessor7.js b/tests/baselines/reference/decoratorOnClassAccessor7.js new file mode 100644 index 00000000000..5ae0c29c14b --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor7.js @@ -0,0 +1,125 @@ +//// [decoratorOnClassAccessor7.ts] +declare function dec1(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; +declare function dec2(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + +class A { + @dec1 get x() { return 0; } + set x(value: number) { } +} + +class B { + get x() { return 0; } + @dec2 set x(value: number) { } +} + +class C { + @dec1 set x(value: number) { } + get x() { return 0; } +} + +class D { + set x(value: number) { } + @dec2 get x() { return 0; } +} + +class E { + @dec1 get x() { return 0; } + @dec2 set x(value: number) { } +} + +class F { + @dec1 set x(value: number) { } + @dec2 get x() { return 0; } +} + +//// [decoratorOnClassAccessor7.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var A = (function () { + function A() { + } + Object.defineProperty(A.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return A; +}()); +__decorate([ + dec1 +], A.prototype, "x", null); +var B = (function () { + function B() { + } + Object.defineProperty(B.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return B; +}()); +__decorate([ + dec2 +], B.prototype, "x", null); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return C; +}()); +__decorate([ + dec1 +], C.prototype, "x", null); +var D = (function () { + function D() { + } + Object.defineProperty(D.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return D; +}()); +__decorate([ + dec2 +], D.prototype, "x", null); +var E = (function () { + function E() { + } + Object.defineProperty(E.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return E; +}()); +__decorate([ + dec1 +], E.prototype, "x", null); +var F = (function () { + function F() { + } + Object.defineProperty(F.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return F; +}()); +__decorate([ + dec1 +], F.prototype, "x", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor8.js b/tests/baselines/reference/decoratorOnClassAccessor8.js new file mode 100644 index 00000000000..7347e630eab --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor8.js @@ -0,0 +1,135 @@ +//// [decoratorOnClassAccessor8.ts] +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + +class A { + @dec get x() { return 0; } + set x(value: number) { } +} + +class B { + get x() { return 0; } + @dec set x(value: number) { } +} + +class C { + @dec set x(value: number) { } + get x() { return 0; } +} + +class D { + set x(value: number) { } + @dec get x() { return 0; } +} + +class E { + @dec get x() { return 0; } +} + +class F { + @dec set x(value: number) { } +} + +//// [decoratorOnClassAccessor8.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var A = (function () { + function A() { + } + Object.defineProperty(A.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return A; +}()); +__decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", [Number]) +], A.prototype, "x", null); +var B = (function () { + function B() { + } + Object.defineProperty(B.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return B; +}()); +__decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) +], B.prototype, "x", null); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return C; +}()); +__decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) +], C.prototype, "x", null); +var D = (function () { + function D() { + } + Object.defineProperty(D.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return D; +}()); +__decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", [Number]) +], D.prototype, "x", null); +var E = (function () { + function E() { + } + Object.defineProperty(E.prototype, "x", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + return E; +}()); +__decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", []) +], E.prototype, "x", null); +var F = (function () { + function F() { + } + Object.defineProperty(F.prototype, "x", { + set: function (value) { }, + enumerable: true, + configurable: true + }); + return F; +}()); +__decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) +], F.prototype, "x", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor8.symbols b/tests/baselines/reference/decoratorOnClassAccessor8.symbols new file mode 100644 index 00000000000..d1e22d586fc --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor8.symbols @@ -0,0 +1,76 @@ +=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts === +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClassAccessor8.ts, 0, 24)) +>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassAccessor8.ts, 0, 36)) +>descriptor : Symbol(descriptor, Decl(decoratorOnClassAccessor8.ts, 0, 57)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21)) + +class A { +>A : Symbol(A, Decl(decoratorOnClassAccessor8.ts, 0, 126)) + + @dec get x() { return 0; } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(A.x, Decl(decoratorOnClassAccessor8.ts, 2, 9), Decl(decoratorOnClassAccessor8.ts, 3, 30)) + + set x(value: number) { } +>x : Symbol(A.x, Decl(decoratorOnClassAccessor8.ts, 2, 9), Decl(decoratorOnClassAccessor8.ts, 3, 30)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 4, 10)) +} + +class B { +>B : Symbol(B, Decl(decoratorOnClassAccessor8.ts, 5, 1)) + + get x() { return 0; } +>x : Symbol(B.x, Decl(decoratorOnClassAccessor8.ts, 7, 9), Decl(decoratorOnClassAccessor8.ts, 8, 25)) + + @dec set x(value: number) { } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(B.x, Decl(decoratorOnClassAccessor8.ts, 7, 9), Decl(decoratorOnClassAccessor8.ts, 8, 25)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 9, 15)) +} + +class C { +>C : Symbol(C, Decl(decoratorOnClassAccessor8.ts, 10, 1)) + + @dec set x(value: number) { } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(C.x, Decl(decoratorOnClassAccessor8.ts, 12, 9), Decl(decoratorOnClassAccessor8.ts, 13, 33)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 13, 15)) + + get x() { return 0; } +>x : Symbol(C.x, Decl(decoratorOnClassAccessor8.ts, 12, 9), Decl(decoratorOnClassAccessor8.ts, 13, 33)) +} + +class D { +>D : Symbol(D, Decl(decoratorOnClassAccessor8.ts, 15, 1)) + + set x(value: number) { } +>x : Symbol(D.x, Decl(decoratorOnClassAccessor8.ts, 17, 9), Decl(decoratorOnClassAccessor8.ts, 18, 28)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 18, 10)) + + @dec get x() { return 0; } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(D.x, Decl(decoratorOnClassAccessor8.ts, 17, 9), Decl(decoratorOnClassAccessor8.ts, 18, 28)) +} + +class E { +>E : Symbol(E, Decl(decoratorOnClassAccessor8.ts, 20, 1)) + + @dec get x() { return 0; } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(E.x, Decl(decoratorOnClassAccessor8.ts, 22, 9)) +} + +class F { +>F : Symbol(F, Decl(decoratorOnClassAccessor8.ts, 24, 1)) + + @dec set x(value: number) { } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(F.x, Decl(decoratorOnClassAccessor8.ts, 26, 9)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 27, 15)) +} diff --git a/tests/baselines/reference/decoratorOnClassAccessor8.types b/tests/baselines/reference/decoratorOnClassAccessor8.types new file mode 100644 index 00000000000..e8f46ee460d --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor8.types @@ -0,0 +1,81 @@ +=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts === +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>T : T +>target : any +>propertyKey : string +>descriptor : TypedPropertyDescriptor +>TypedPropertyDescriptor : TypedPropertyDescriptor +>T : T +>TypedPropertyDescriptor : TypedPropertyDescriptor +>T : T + +class A { +>A : A + + @dec get x() { return 0; } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>0 : 0 + + set x(value: number) { } +>x : number +>value : number +} + +class B { +>B : B + + get x() { return 0; } +>x : number +>0 : 0 + + @dec set x(value: number) { } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>value : number +} + +class C { +>C : C + + @dec set x(value: number) { } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>value : number + + get x() { return 0; } +>x : number +>0 : 0 +} + +class D { +>D : D + + set x(value: number) { } +>x : number +>value : number + + @dec get x() { return 0; } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>0 : 0 +} + +class E { +>E : E + + @dec get x() { return 0; } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>0 : 0 +} + +class F { +>F : F + + @dec set x(value: number) { } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>value : number +} diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.js b/tests/baselines/reference/decoratorOnClassConstructor4.js new file mode 100644 index 00000000000..22414e89e43 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor4.js @@ -0,0 +1,58 @@ +//// [decoratorOnClassConstructor4.ts] +declare var dec: any; + +@dec +class A { +} + +@dec +class B { + constructor(x: number) {} +} + +@dec +class C extends A { +} + +//// [decoratorOnClassConstructor4.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var A = (function () { + function A() { + } + return A; +}()); +A = __decorate([ + dec +], A); +var B = (function () { + function B(x) { + } + return B; +}()); +B = __decorate([ + dec, + __metadata("design:paramtypes", [Number]) +], B); +var C = (function (_super) { + __extends(C, _super); + function C() { + return _super.apply(this, arguments) || this; + } + return C; +}(A)); +C = __decorate([ + dec +], C); diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.symbols b/tests/baselines/reference/decoratorOnClassConstructor4.symbols new file mode 100644 index 00000000000..8a414abd7b1 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor4.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts === +declare var dec: any; +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +class A { +>A : Symbol(A, Decl(decoratorOnClassConstructor4.ts, 0, 21)) +} + +@dec +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +class B { +>B : Symbol(B, Decl(decoratorOnClassConstructor4.ts, 4, 1)) + + constructor(x: number) {} +>x : Symbol(x, Decl(decoratorOnClassConstructor4.ts, 8, 16)) +} + +@dec +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +class C extends A { +>C : Symbol(C, Decl(decoratorOnClassConstructor4.ts, 9, 1)) +>A : Symbol(A, Decl(decoratorOnClassConstructor4.ts, 0, 21)) +} diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.types b/tests/baselines/reference/decoratorOnClassConstructor4.types new file mode 100644 index 00000000000..f4203bd5d7d --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor4.types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts === +declare var dec: any; +>dec : any + +@dec +>dec : any + +class A { +>A : A +} + +@dec +>dec : any + +class B { +>B : B + + constructor(x: number) {} +>x : number +} + +@dec +>dec : any + +class C extends A { +>C : C +>A : A +} diff --git a/tests/baselines/reference/decoratorWithUnderscoreMethod.js b/tests/baselines/reference/decoratorWithUnderscoreMethod.js new file mode 100644 index 00000000000..bf79890263b --- /dev/null +++ b/tests/baselines/reference/decoratorWithUnderscoreMethod.js @@ -0,0 +1,37 @@ +//// [decoratorWithUnderscoreMethod.ts] + +declare var console : { log(arg: string): void }; +function dec(): Function { + return function (target: any, propKey: string, descr: PropertyDescriptor): void { + console.log(target[propKey]); + //logs undefined + //propKey has three underscores as prefix, but the method has only two underscores + }; +} + +class A { + @dec() + private __foo(bar: string): void { + // do something with bar + } +} + +//// [decoratorWithUnderscoreMethod.js] +function dec() { + return function (target, propKey, descr) { + console.log(target[propKey]); + //logs undefined + //propKey has three underscores as prefix, but the method has only two underscores + }; +} +var A = (function () { + function A() { + } + A.prototype.__foo = function (bar) { + // do something with bar + }; + return A; +}()); +__decorate([ + dec() +], A.prototype, "__foo"); diff --git a/tests/baselines/reference/decoratorWithUnderscoreMethod.symbols b/tests/baselines/reference/decoratorWithUnderscoreMethod.symbols new file mode 100644 index 00000000000..a512bde71f6 --- /dev/null +++ b/tests/baselines/reference/decoratorWithUnderscoreMethod.symbols @@ -0,0 +1,42 @@ +=== tests/cases/compiler/decoratorWithUnderscoreMethod.ts === + +declare var console : { log(arg: string): void }; +>console : Symbol(console, Decl(decoratorWithUnderscoreMethod.ts, 1, 11)) +>log : Symbol(log, Decl(decoratorWithUnderscoreMethod.ts, 1, 23)) +>arg : Symbol(arg, Decl(decoratorWithUnderscoreMethod.ts, 1, 28)) + +function dec(): Function { +>dec : Symbol(dec, Decl(decoratorWithUnderscoreMethod.ts, 1, 49)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + return function (target: any, propKey: string, descr: PropertyDescriptor): void { +>target : Symbol(target, Decl(decoratorWithUnderscoreMethod.ts, 3, 21)) +>propKey : Symbol(propKey, Decl(decoratorWithUnderscoreMethod.ts, 3, 33)) +>descr : Symbol(descr, Decl(decoratorWithUnderscoreMethod.ts, 3, 50)) +>PropertyDescriptor : Symbol(PropertyDescriptor, Decl(lib.d.ts, --, --)) + + console.log(target[propKey]); +>console.log : Symbol(log, Decl(decoratorWithUnderscoreMethod.ts, 1, 23)) +>console : Symbol(console, Decl(decoratorWithUnderscoreMethod.ts, 1, 11)) +>log : Symbol(log, Decl(decoratorWithUnderscoreMethod.ts, 1, 23)) +>target : Symbol(target, Decl(decoratorWithUnderscoreMethod.ts, 3, 21)) +>propKey : Symbol(propKey, Decl(decoratorWithUnderscoreMethod.ts, 3, 33)) + + //logs undefined + //propKey has three underscores as prefix, but the method has only two underscores + }; +} + +class A { +>A : Symbol(A, Decl(decoratorWithUnderscoreMethod.ts, 8, 1)) + + @dec() +>dec : Symbol(dec, Decl(decoratorWithUnderscoreMethod.ts, 1, 49)) + + private __foo(bar: string): void { +>__foo : Symbol(A.__foo, Decl(decoratorWithUnderscoreMethod.ts, 10, 9)) +>bar : Symbol(bar, Decl(decoratorWithUnderscoreMethod.ts, 12, 18)) + + // do something with bar + } +} diff --git a/tests/baselines/reference/decoratorWithUnderscoreMethod.types b/tests/baselines/reference/decoratorWithUnderscoreMethod.types new file mode 100644 index 00000000000..1ce08dc8a9e --- /dev/null +++ b/tests/baselines/reference/decoratorWithUnderscoreMethod.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/decoratorWithUnderscoreMethod.ts === + +declare var console : { log(arg: string): void }; +>console : { log(arg: string): void; } +>log : (arg: string) => void +>arg : string + +function dec(): Function { +>dec : () => Function +>Function : Function + + return function (target: any, propKey: string, descr: PropertyDescriptor): void { +>function (target: any, propKey: string, descr: PropertyDescriptor): void { console.log(target[propKey]); //logs undefined //propKey has three underscores as prefix, but the method has only two underscores } : (target: any, propKey: string, descr: PropertyDescriptor) => void +>target : any +>propKey : string +>descr : PropertyDescriptor +>PropertyDescriptor : PropertyDescriptor + + console.log(target[propKey]); +>console.log(target[propKey]) : void +>console.log : (arg: string) => void +>console : { log(arg: string): void; } +>log : (arg: string) => void +>target[propKey] : any +>target : any +>propKey : string + + //logs undefined + //propKey has three underscores as prefix, but the method has only two underscores + }; +} + +class A { +>A : A + + @dec() +>dec() : Function +>dec : () => Function + + private __foo(bar: string): void { +>__foo : (bar: string) => void +>bar : string + + // do something with bar + } +} diff --git a/tests/baselines/reference/errorSuperCalls.errors.txt b/tests/baselines/reference/errorSuperCalls.errors.txt index 49bcb4b4d45..036367fd44b 100644 --- a/tests/baselines/reference/errorSuperCalls.errors.txt +++ b/tests/baselines/reference/errorSuperCalls.errors.txt @@ -7,6 +7,7 @@ tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(26,9): error T tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(30,16): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(34,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(38,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(46,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(46,14): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(58,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(62,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. @@ -14,7 +15,7 @@ tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(67,9): error T tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(71,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. -==== tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts (14 errors) ==== +==== tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts (15 errors) ==== //super call in class constructor with no base type class NoBase { constructor() { @@ -79,6 +80,8 @@ tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(71,9): error T //super call with type arguments constructor() { super(); + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. super(); diff --git a/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.js b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.js new file mode 100644 index 00000000000..218d760d6c5 --- /dev/null +++ b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.js @@ -0,0 +1,39 @@ +//// [exhaustiveSwitchWithWideningLiteralTypes.ts] + +// Repro from #12529 + +class A { + readonly kind = "A"; // (property) A.kind: "A" +} + +class B { + readonly kind = "B"; // (property) B.kind: "B" +} + +function f(value: A | B): number { + switch(value.kind) { + case "A": return 0; + case "B": return 1; + } +} + +//// [exhaustiveSwitchWithWideningLiteralTypes.js] +// Repro from #12529 +var A = (function () { + function A() { + this.kind = "A"; // (property) A.kind: "A" + } + return A; +}()); +var B = (function () { + function B() { + this.kind = "B"; // (property) B.kind: "B" + } + return B; +}()); +function f(value) { + switch (value.kind) { + case "A": return 0; + case "B": return 1; + } +} diff --git a/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.symbols b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.symbols new file mode 100644 index 00000000000..929a394dc7b --- /dev/null +++ b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.symbols @@ -0,0 +1,33 @@ +=== tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts === + +// Repro from #12529 + +class A { +>A : Symbol(A, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 0, 0)) + + readonly kind = "A"; // (property) A.kind: "A" +>kind : Symbol(A.kind, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 3, 9)) +} + +class B { +>B : Symbol(B, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 5, 1)) + + readonly kind = "B"; // (property) B.kind: "B" +>kind : Symbol(B.kind, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 7, 9)) +} + +function f(value: A | B): number { +>f : Symbol(f, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 9, 1)) +>value : Symbol(value, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 11, 11)) +>A : Symbol(A, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 0, 0)) +>B : Symbol(B, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 5, 1)) + + switch(value.kind) { +>value.kind : Symbol(kind, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 3, 9), Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 7, 9)) +>value : Symbol(value, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 11, 11)) +>kind : Symbol(kind, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 3, 9), Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 7, 9)) + + case "A": return 0; + case "B": return 1; + } +} diff --git a/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.types b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.types new file mode 100644 index 00000000000..3955c80ff1e --- /dev/null +++ b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts === + +// Repro from #12529 + +class A { +>A : A + + readonly kind = "A"; // (property) A.kind: "A" +>kind : "A" +>"A" : "A" +} + +class B { +>B : B + + readonly kind = "B"; // (property) B.kind: "B" +>kind : "B" +>"B" : "B" +} + +function f(value: A | B): number { +>f : (value: A | B) => number +>value : A | B +>A : A +>B : B + + switch(value.kind) { +>value.kind : "A" | "B" +>value : A | B +>kind : "A" | "B" + + case "A": return 0; +>"A" : "A" +>0 : 0 + + case "B": return 1; +>"B" : "B" +>1 : 1 + } +} diff --git a/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js new file mode 100644 index 00000000000..8715fd9eaca --- /dev/null +++ b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js @@ -0,0 +1,16 @@ +//// [explicitAnyAfterSpreadNoImplicitAnyError.ts] +({ a: [], ...(null as any) }); +let x: any; + + +//// [explicitAnyAfterSpreadNoImplicitAnyError.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +(__assign({ a: [] }, null)); +var x; diff --git a/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols new file mode 100644 index 00000000000..c53845d99aa --- /dev/null +++ b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols @@ -0,0 +1,7 @@ +=== tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts === +({ a: [], ...(null as any) }); +>a : Symbol(a, Decl(explicitAnyAfterSpreadNoImplicitAnyError.ts, 0, 2)) + +let x: any; +>x : Symbol(x, Decl(explicitAnyAfterSpreadNoImplicitAnyError.ts, 1, 3)) + diff --git a/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types new file mode 100644 index 00000000000..5e463e77bbb --- /dev/null +++ b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts === +({ a: [], ...(null as any) }); +>({ a: [], ...(null as any) }) : any +>{ a: [], ...(null as any) } : any +>a : undefined[] +>[] : undefined[] +>(null as any) : any +>null as any : any +>null : null + +let x: any; +>x : any + diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index ae4d3127010..762f0778945 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -64,8 +64,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { @@ -111,6 +110,5 @@ __decorate([ __metadata("design:returntype", void 0) ], C.prototype, "method", null); C = __decorate([ - dec, - __metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/importHelpersDeclarations.symbols b/tests/baselines/reference/importHelpersDeclarations.symbols new file mode 100644 index 00000000000..f578850cc4e --- /dev/null +++ b/tests/baselines/reference/importHelpersDeclarations.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/declaration.d.ts === +export declare class D { +>D : Symbol(D, Decl(declaration.d.ts, 0, 0)) +} +export declare class E extends D { +>E : Symbol(E, Decl(declaration.d.ts, 1, 1)) +>D : Symbol(D, Decl(declaration.d.ts, 0, 0)) +} diff --git a/tests/baselines/reference/importHelpersDeclarations.types b/tests/baselines/reference/importHelpersDeclarations.types new file mode 100644 index 00000000000..4b8c56d7869 --- /dev/null +++ b/tests/baselines/reference/importHelpersDeclarations.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/declaration.d.ts === +export declare class D { +>D : D +} +export declare class E extends D { +>E : E +>D : D +} diff --git a/tests/baselines/reference/importHelpersInIsolatedModules.js b/tests/baselines/reference/importHelpersInIsolatedModules.js index 28c00f97554..5c395ea0b9f 100644 --- a/tests/baselines/reference/importHelpersInIsolatedModules.js +++ b/tests/baselines/reference/importHelpersInIsolatedModules.js @@ -64,8 +64,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); //// [script.js] "use strict"; @@ -96,6 +95,5 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/importHelpersNoHelpers.errors.txt b/tests/baselines/reference/importHelpersNoHelpers.errors.txt index fa9a935c8d8..a0c089a9ddc 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.errors.txt +++ b/tests/baselines/reference/importHelpersNoHelpers.errors.txt @@ -1,32 +1,38 @@ -error TS2305: Module 'tslib' has no exported member '__assign'. -error TS2305: Module 'tslib' has no exported member '__decorate'. -error TS2305: Module 'tslib' has no exported member '__extends'. -error TS2305: Module 'tslib' has no exported member '__metadata'. -error TS2305: Module 'tslib' has no exported member '__param'. -error TS2305: Module 'tslib' has no exported member '__rest'. +tests/cases/compiler/external.ts(2,16): error TS2343: This syntax requires an imported helper named '__extends', but module 'tslib' has no exported member '__extends'. +tests/cases/compiler/external.ts(6,1): error TS2343: This syntax requires an imported helper named '__decorate', but module 'tslib' has no exported member '__decorate'. +tests/cases/compiler/external.ts(6,1): error TS2343: This syntax requires an imported helper named '__metadata', but module 'tslib' has no exported member '__metadata'. +tests/cases/compiler/external.ts(8,12): error TS2343: This syntax requires an imported helper named '__param', but module 'tslib' has no exported member '__param'. +tests/cases/compiler/external.ts(13,13): error TS2343: This syntax requires an imported helper named '__assign', but module 'tslib' has no exported member '__assign'. +tests/cases/compiler/external.ts(14,12): error TS2343: This syntax requires an imported helper named '__rest', but module 'tslib' has no exported member '__rest'. -!!! error TS2305: Module 'tslib' has no exported member '__assign'. -!!! error TS2305: Module 'tslib' has no exported member '__decorate'. -!!! error TS2305: Module 'tslib' has no exported member '__extends'. -!!! error TS2305: Module 'tslib' has no exported member '__metadata'. -!!! error TS2305: Module 'tslib' has no exported member '__param'. -!!! error TS2305: Module 'tslib' has no exported member '__rest'. -==== tests/cases/compiler/external.ts (0 errors) ==== +==== tests/cases/compiler/external.ts (6 errors) ==== export class A { } export class B extends A { } + ~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__extends', but module 'tslib' has no exported member '__extends'. declare var dec: any; @dec + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__decorate', but module 'tslib' has no exported member '__decorate'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__metadata', but module 'tslib' has no exported member '__metadata'. class C { method(@dec x: number) { + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__param', but module 'tslib' has no exported member '__param'. } } const o = { a: 1 }; const y = { ...o }; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__assign', but module 'tslib' has no exported member '__assign'. const { ...x } = y; + ~ +!!! error TS2343: This syntax requires an imported helper named '__rest', but module 'tslib' has no exported member '__rest'. ==== tests/cases/compiler/script.ts (0 errors) ==== class A { } diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index a9c2deb76b6..560e16d1cca 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -63,8 +63,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); var o = { a: 1 }; var y = tslib_1.__assign({}, o); @@ -113,6 +112,5 @@ __decorate([ __metadata("design:returntype", void 0) ], C.prototype, "method", null); C = __decorate([ - dec, - __metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/importHelpersNoModule.errors.txt b/tests/baselines/reference/importHelpersNoModule.errors.txt index d59fd0537ca..b6786ec3635 100644 --- a/tests/baselines/reference/importHelpersNoModule.errors.txt +++ b/tests/baselines/reference/importHelpersNoModule.errors.txt @@ -1,10 +1,11 @@ -error TS2307: Cannot find module 'tslib'. +tests/cases/compiler/external.ts(2,16): error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found. -!!! error TS2307: Cannot find module 'tslib'. -==== tests/cases/compiler/external.ts (0 errors) ==== +==== tests/cases/compiler/external.ts (1 errors) ==== export class A { } export class B extends A { } + ~~~~~~~~~ +!!! error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found. declare var dec: any; diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index 41df9710f33..65a004eb66c 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -56,8 +56,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { @@ -103,6 +102,5 @@ __decorate([ __metadata("design:returntype", void 0) ], C.prototype, "method", null); C = __decorate([ - dec, - __metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt index 0985157e0da..5aeae5f160e 100644 --- a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt @@ -1,8 +1,6 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -19,7 +17,7 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (19 errors) ==== +==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (17 errors) ==== enum E { a } var x: any; @@ -42,11 +40,7 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv !!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra4 = a4 in x; var ra5 = null in x; - ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra6 = undefined in x; - ~~~~~~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra7 = E.a in x; var ra8 = false in x; ~~~~~ diff --git a/tests/baselines/reference/intersectionTypeNormalization.js b/tests/baselines/reference/intersectionTypeNormalization.js index 8309b17f198..f6eea23e98e 100644 --- a/tests/baselines/reference/intersectionTypeNormalization.js +++ b/tests/baselines/reference/intersectionTypeNormalization.js @@ -58,6 +58,51 @@ function getValueAsString(value: IntersectionFail): string { return '' + value.num; } return value.str; +} + +// Repro from #12535 + +namespace enums { + export const enum A { + a1, + a2, + a3, + // ... elements omitted for the sake of clarity + a75, + a76, + a77, + } + export const enum B { + b1, + b2, + // ... elements omitted for the sake of clarity + b86, + b87, + } + export const enum C { + c1, + c2, + // ... elements omitted for the sake of clarity + c210, + c211, + } + export type Genre = A | B | C; +} + +type Foo = { + genreId: enums.Genre; +}; + +type Bar = { + genreId: enums.Genre; +}; + +type FooBar = Foo & Bar; + +function foo(so: any) { + const val = so as FooBar; + const isGenre = val.genreId; + return isGenre; } //// [intersectionTypeNormalization.js] @@ -77,3 +122,8 @@ function getValueAsString(value) { } return value.str; } +function foo(so) { + var val = so; + var isGenre = val.genreId; + return isGenre; +} diff --git a/tests/baselines/reference/intersectionTypeNormalization.symbols b/tests/baselines/reference/intersectionTypeNormalization.symbols index a5a00c70407..fd81eac6d18 100644 --- a/tests/baselines/reference/intersectionTypeNormalization.symbols +++ b/tests/baselines/reference/intersectionTypeNormalization.symbols @@ -240,3 +240,113 @@ function getValueAsString(value: IntersectionFail): string { >value : Symbol(value, Decl(intersectionTypeNormalization.ts, 54, 26)) >str : Symbol(str, Decl(intersectionTypeNormalization.ts, 47, 35)) } + +// Repro from #12535 + +namespace enums { +>enums : Symbol(enums, Decl(intersectionTypeNormalization.ts, 59, 1)) + + export const enum A { +>A : Symbol(A, Decl(intersectionTypeNormalization.ts, 63, 17)) + + a1, +>a1 : Symbol(A.a1, Decl(intersectionTypeNormalization.ts, 64, 25)) + + a2, +>a2 : Symbol(A.a2, Decl(intersectionTypeNormalization.ts, 65, 11)) + + a3, +>a3 : Symbol(A.a3, Decl(intersectionTypeNormalization.ts, 66, 11)) + + // ... elements omitted for the sake of clarity + a75, +>a75 : Symbol(A.a75, Decl(intersectionTypeNormalization.ts, 67, 11)) + + a76, +>a76 : Symbol(A.a76, Decl(intersectionTypeNormalization.ts, 69, 12)) + + a77, +>a77 : Symbol(A.a77, Decl(intersectionTypeNormalization.ts, 70, 12)) + } + export const enum B { +>B : Symbol(B, Decl(intersectionTypeNormalization.ts, 72, 5)) + + b1, +>b1 : Symbol(B.b1, Decl(intersectionTypeNormalization.ts, 73, 25)) + + b2, +>b2 : Symbol(B.b2, Decl(intersectionTypeNormalization.ts, 74, 11)) + + // ... elements omitted for the sake of clarity + b86, +>b86 : Symbol(B.b86, Decl(intersectionTypeNormalization.ts, 75, 11)) + + b87, +>b87 : Symbol(B.b87, Decl(intersectionTypeNormalization.ts, 77, 12)) + } + export const enum C { +>C : Symbol(C, Decl(intersectionTypeNormalization.ts, 79, 5)) + + c1, +>c1 : Symbol(C.c1, Decl(intersectionTypeNormalization.ts, 80, 25)) + + c2, +>c2 : Symbol(C.c2, Decl(intersectionTypeNormalization.ts, 81, 11)) + + // ... elements omitted for the sake of clarity + c210, +>c210 : Symbol(C.c210, Decl(intersectionTypeNormalization.ts, 82, 11)) + + c211, +>c211 : Symbol(C.c211, Decl(intersectionTypeNormalization.ts, 84, 13)) + } + export type Genre = A | B | C; +>Genre : Symbol(Genre, Decl(intersectionTypeNormalization.ts, 86, 5)) +>A : Symbol(A, Decl(intersectionTypeNormalization.ts, 63, 17)) +>B : Symbol(B, Decl(intersectionTypeNormalization.ts, 72, 5)) +>C : Symbol(C, Decl(intersectionTypeNormalization.ts, 79, 5)) +} + +type Foo = { +>Foo : Symbol(Foo, Decl(intersectionTypeNormalization.ts, 88, 1)) + + genreId: enums.Genre; +>genreId : Symbol(genreId, Decl(intersectionTypeNormalization.ts, 90, 12)) +>enums : Symbol(enums, Decl(intersectionTypeNormalization.ts, 59, 1)) +>Genre : Symbol(enums.Genre, Decl(intersectionTypeNormalization.ts, 86, 5)) + +}; + +type Bar = { +>Bar : Symbol(Bar, Decl(intersectionTypeNormalization.ts, 92, 2)) + + genreId: enums.Genre; +>genreId : Symbol(genreId, Decl(intersectionTypeNormalization.ts, 94, 12)) +>enums : Symbol(enums, Decl(intersectionTypeNormalization.ts, 59, 1)) +>Genre : Symbol(enums.Genre, Decl(intersectionTypeNormalization.ts, 86, 5)) + +}; + +type FooBar = Foo & Bar; +>FooBar : Symbol(FooBar, Decl(intersectionTypeNormalization.ts, 96, 2)) +>Foo : Symbol(Foo, Decl(intersectionTypeNormalization.ts, 88, 1)) +>Bar : Symbol(Bar, Decl(intersectionTypeNormalization.ts, 92, 2)) + +function foo(so: any) { +>foo : Symbol(foo, Decl(intersectionTypeNormalization.ts, 98, 24)) +>so : Symbol(so, Decl(intersectionTypeNormalization.ts, 100, 13)) + + const val = so as FooBar; +>val : Symbol(val, Decl(intersectionTypeNormalization.ts, 101, 9)) +>so : Symbol(so, Decl(intersectionTypeNormalization.ts, 100, 13)) +>FooBar : Symbol(FooBar, Decl(intersectionTypeNormalization.ts, 96, 2)) + + const isGenre = val.genreId; +>isGenre : Symbol(isGenre, Decl(intersectionTypeNormalization.ts, 102, 9)) +>val.genreId : Symbol(genreId, Decl(intersectionTypeNormalization.ts, 90, 12), Decl(intersectionTypeNormalization.ts, 94, 12)) +>val : Symbol(val, Decl(intersectionTypeNormalization.ts, 101, 9)) +>genreId : Symbol(genreId, Decl(intersectionTypeNormalization.ts, 90, 12), Decl(intersectionTypeNormalization.ts, 94, 12)) + + return isGenre; +>isGenre : Symbol(isGenre, Decl(intersectionTypeNormalization.ts, 102, 9)) +} diff --git a/tests/baselines/reference/intersectionTypeNormalization.types b/tests/baselines/reference/intersectionTypeNormalization.types index 99d0ecb1f3a..3ffe7484afe 100644 --- a/tests/baselines/reference/intersectionTypeNormalization.types +++ b/tests/baselines/reference/intersectionTypeNormalization.types @@ -244,3 +244,114 @@ function getValueAsString(value: IntersectionFail): string { >value : { kind: "string"; str: string; } & ToString >str : string } + +// Repro from #12535 + +namespace enums { +>enums : typeof enums + + export const enum A { +>A : A + + a1, +>a1 : A.a1 + + a2, +>a2 : A.a2 + + a3, +>a3 : A.a3 + + // ... elements omitted for the sake of clarity + a75, +>a75 : A.a75 + + a76, +>a76 : A.a76 + + a77, +>a77 : A.a77 + } + export const enum B { +>B : B + + b1, +>b1 : B.b1 + + b2, +>b2 : B.b2 + + // ... elements omitted for the sake of clarity + b86, +>b86 : B.b86 + + b87, +>b87 : B.b87 + } + export const enum C { +>C : C + + c1, +>c1 : C.c1 + + c2, +>c2 : C.c2 + + // ... elements omitted for the sake of clarity + c210, +>c210 : C.c210 + + c211, +>c211 : C.c211 + } + export type Genre = A | B | C; +>Genre : Genre +>A : A +>B : B +>C : C +} + +type Foo = { +>Foo : Foo + + genreId: enums.Genre; +>genreId : enums.Genre +>enums : any +>Genre : enums.Genre + +}; + +type Bar = { +>Bar : Bar + + genreId: enums.Genre; +>genreId : enums.Genre +>enums : any +>Genre : enums.Genre + +}; + +type FooBar = Foo & Bar; +>FooBar : FooBar +>Foo : Foo +>Bar : Bar + +function foo(so: any) { +>foo : (so: any) => enums.Genre +>so : any + + const val = so as FooBar; +>val : FooBar +>so as FooBar : FooBar +>so : any +>FooBar : FooBar + + const isGenre = val.genreId; +>isGenre : enums.Genre +>val.genreId : enums.Genre +>val : FooBar +>genreId : enums.Genre + + return isGenre; +>isGenre : enums.Genre +} diff --git a/tests/baselines/reference/intersectionTypeWithLeadingOperator.js b/tests/baselines/reference/intersectionTypeWithLeadingOperator.js new file mode 100644 index 00000000000..61b034f1e03 --- /dev/null +++ b/tests/baselines/reference/intersectionTypeWithLeadingOperator.js @@ -0,0 +1,10 @@ +//// [intersectionTypeWithLeadingOperator.ts] +type A = & string; +type B = + & { foo: string } + & { bar: number }; + +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; + + +//// [intersectionTypeWithLeadingOperator.js] diff --git a/tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols b/tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols new file mode 100644 index 00000000000..f6648183bb6 --- /dev/null +++ b/tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols @@ -0,0 +1,20 @@ +=== tests/cases/compiler/intersectionTypeWithLeadingOperator.ts === +type A = & string; +>A : Symbol(A, Decl(intersectionTypeWithLeadingOperator.ts, 0, 0)) + +type B = +>B : Symbol(B, Decl(intersectionTypeWithLeadingOperator.ts, 0, 18)) + + & { foo: string } +>foo : Symbol(foo, Decl(intersectionTypeWithLeadingOperator.ts, 2, 5)) + + & { bar: number }; +>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 3, 5)) + +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; +>C : Symbol(C, Decl(intersectionTypeWithLeadingOperator.ts, 3, 20)) +>foo : Symbol(foo, Decl(intersectionTypeWithLeadingOperator.ts, 5, 13)) +>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 5, 26)) +>foo : Symbol(foo, Decl(intersectionTypeWithLeadingOperator.ts, 5, 40)) +>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 5, 53)) + diff --git a/tests/baselines/reference/intersectionTypeWithLeadingOperator.types b/tests/baselines/reference/intersectionTypeWithLeadingOperator.types new file mode 100644 index 00000000000..9961f051f7f --- /dev/null +++ b/tests/baselines/reference/intersectionTypeWithLeadingOperator.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/intersectionTypeWithLeadingOperator.ts === +type A = & string; +>A : string + +type B = +>B : B + + & { foo: string } +>foo : string + + & { bar: number }; +>bar : number + +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; +>C : [{ foo: 1; } & { bar: 2; }, { foo: 3; } & { bar: 4; }] +>foo : 1 +>bar : 2 +>foo : 3 +>bar : 4 + diff --git a/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt b/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt index bf5cf5c0f12..c69cc85ad9d 100644 --- a/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt +++ b/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(5,12): error TS2503: Cannot find namespace 'V'. tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(11,12): error TS2503: Cannot find namespace 'C'. -tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2693: 'I' only refers to a type, but is being used as a value here. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2702: 'I' only refers to a type, but is being used as a namespace here. ==== tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts (3 errors) ==== @@ -32,5 +32,5 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde import i = I; ~ -!!! error TS2693: 'I' only refers to a type, but is being used as a value here. +!!! error TS2702: 'I' only refers to a type, but is being used as a namespace here. \ No newline at end of file diff --git a/tests/baselines/reference/invalidUseOfTypeAsNamespace.errors.txt b/tests/baselines/reference/invalidUseOfTypeAsNamespace.errors.txt new file mode 100644 index 00000000000..0353d46d632 --- /dev/null +++ b/tests/baselines/reference/invalidUseOfTypeAsNamespace.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/invalidUseOfTypeAsNamespace.ts(4,16): error TS2702: 'OhNo' only refers to a type, but is being used as a namespace here. + + +==== tests/cases/compiler/invalidUseOfTypeAsNamespace.ts (1 errors) ==== + interface OhNo { + } + + declare let y: OhNo.hello; + ~~~~ +!!! error TS2702: 'OhNo' only refers to a type, but is being used as a namespace here. + \ No newline at end of file diff --git a/tests/baselines/reference/invalidUseOfTypeAsNamespace.js b/tests/baselines/reference/invalidUseOfTypeAsNamespace.js new file mode 100644 index 00000000000..3b598fdea9c --- /dev/null +++ b/tests/baselines/reference/invalidUseOfTypeAsNamespace.js @@ -0,0 +1,8 @@ +//// [invalidUseOfTypeAsNamespace.ts] +interface OhNo { +} + +declare let y: OhNo.hello; + + +//// [invalidUseOfTypeAsNamespace.js] diff --git a/tests/baselines/reference/isomorphicMappedTypeInference.js b/tests/baselines/reference/isomorphicMappedTypeInference.js new file mode 100644 index 00000000000..560c926877a --- /dev/null +++ b/tests/baselines/reference/isomorphicMappedTypeInference.js @@ -0,0 +1,330 @@ +//// [isomorphicMappedTypeInference.ts] + +type Box = { + value: T; +} + +type Boxified = { + [P in keyof T]: Box; +} + +function box(x: T): Box { + return { value: x }; +} + +function unbox(x: Box): T { + return x.value; +} + +function boxify(obj: T): Boxified { + let result = {} as Boxified; + for (let k in obj) { + result[k] = box(obj[k]); + } + return result; +} + +function unboxify(obj: Boxified): T { + let result = {} as T; + for (let k in obj) { + result[k] = unbox(obj[k]); + } + return result; +} + +function assignBoxified(obj: Boxified, values: T) { + for (let k in values) { + obj[k].value = values[k]; + } +} + +function f1() { + let v = { + a: 42, + b: "hello", + c: true + }; + let b = boxify(v); + let x: number = b.a.value; +} + +function f2() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + let v = unboxify(b); + let x: number = v.a; +} + +function f3() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + assignBoxified(b, { c: false }); +} + +function f4() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + b = boxify(unboxify(b)); + b = unboxify(boxify(b)); +} + +function makeRecord(obj: { [P in K]: T }) { + return obj; +} + +function f5(s: string) { + let b = makeRecord({ + a: box(42), + b: box("hello"), + c: box(true) + }); + let v = unboxify(b); + let x: string | number | boolean = v.a; +} + +function makeDictionary(obj: { [x: string]: T }) { + return obj; +} + +function f6(s: string) { + let b = makeDictionary({ + a: box(42), + b: box("hello"), + c: box(true) + }); + let v = unboxify(b); + let x: string | number | boolean = v[s]; +} + +declare function validate(obj: { [P in keyof T]?: T[P] }): T; +declare function clone(obj: { readonly [P in keyof T]: T[P] }): T; +declare function validateAndClone(obj: { readonly [P in keyof T]?: T[P] }): T; + +type Foo = { + a?: number; + readonly b: string; +} + +function f10(foo: Foo) { + let x = validate(foo); // { a: number, readonly b: string } + let y = clone(foo); // { a?: number, b: string } + let z = validateAndClone(foo); // { a: number, b: string } +} + +// Repro from #12606 + +type Func = (...args: any[]) => T; +type Spec = { + [P in keyof T]: Func | Spec ; +}; + +/** + * Given a spec object recursively mapping properties to functions, creates a function + * producing an object of the same structure, by mapping each property to the result + * of calling its associated function with the supplied arguments. + */ +declare function applySpec(obj: Spec): (...args: any[]) => T; + +// Infers g1: (...args: any[]) => { sum: number, nested: { mul: string } } +var g1 = applySpec({ + sum: (a: any) => 3, + nested: { + mul: (b: any) => "n" + } +}); + +// Infers g2: (...args: any[]) => { foo: { bar: { baz: boolean } } } +var g2 = applySpec({ foo: { bar: { baz: (x: any) => true } } }); + +// Repro from #12633 + +const foo = (object: T, partial: Partial) => object; +let o = {a: 5, b: 7}; +foo(o, {b: 9}); +o = foo(o, {b: 9}); + +//// [isomorphicMappedTypeInference.js] +function box(x) { + return { value: x }; +} +function unbox(x) { + return x.value; +} +function boxify(obj) { + var result = {}; + for (var k in obj) { + result[k] = box(obj[k]); + } + return result; +} +function unboxify(obj) { + var result = {}; + for (var k in obj) { + result[k] = unbox(obj[k]); + } + return result; +} +function assignBoxified(obj, values) { + for (var k in values) { + obj[k].value = values[k]; + } +} +function f1() { + var v = { + a: 42, + b: "hello", + c: true + }; + var b = boxify(v); + var x = b.a.value; +} +function f2() { + var b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + var v = unboxify(b); + var x = v.a; +} +function f3() { + var b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + assignBoxified(b, { c: false }); +} +function f4() { + var b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + b = boxify(unboxify(b)); + b = unboxify(boxify(b)); +} +function makeRecord(obj) { + return obj; +} +function f5(s) { + var b = makeRecord({ + a: box(42), + b: box("hello"), + c: box(true) + }); + var v = unboxify(b); + var x = v.a; +} +function makeDictionary(obj) { + return obj; +} +function f6(s) { + var b = makeDictionary({ + a: box(42), + b: box("hello"), + c: box(true) + }); + var v = unboxify(b); + var x = v[s]; +} +function f10(foo) { + var x = validate(foo); // { a: number, readonly b: string } + var y = clone(foo); // { a?: number, b: string } + var z = validateAndClone(foo); // { a: number, b: string } +} +// Infers g1: (...args: any[]) => { sum: number, nested: { mul: string } } +var g1 = applySpec({ + sum: function (a) { return 3; }, + nested: { + mul: function (b) { return "n"; } + } +}); +// Infers g2: (...args: any[]) => { foo: { bar: { baz: boolean } } } +var g2 = applySpec({ foo: { bar: { baz: function (x) { return true; } } } }); +// Repro from #12633 +var foo = function (object, partial) { return object; }; +var o = { a: 5, b: 7 }; +foo(o, { b: 9 }); +o = foo(o, { b: 9 }); + + +//// [isomorphicMappedTypeInference.d.ts] +declare type Box = { + value: T; +}; +declare type Boxified = { + [P in keyof T]: Box; +}; +declare function box(x: T): Box; +declare function unbox(x: Box): T; +declare function boxify(obj: T): Boxified; +declare function unboxify(obj: Boxified): T; +declare function assignBoxified(obj: Boxified, values: T): void; +declare function f1(): void; +declare function f2(): void; +declare function f3(): void; +declare function f4(): void; +declare function makeRecord(obj: { + [P in K]: T; +}): { + [P in K]: T; +}; +declare function f5(s: string): void; +declare function makeDictionary(obj: { + [x: string]: T; +}): { + [x: string]: T; +}; +declare function f6(s: string): void; +declare function validate(obj: { + [P in keyof T]?: T[P]; +}): T; +declare function clone(obj: { + readonly [P in keyof T]: T[P]; +}): T; +declare function validateAndClone(obj: { + readonly [P in keyof T]?: T[P]; +}): T; +declare type Foo = { + a?: number; + readonly b: string; +}; +declare function f10(foo: Foo): void; +declare type Func = (...args: any[]) => T; +declare type Spec = { + [P in keyof T]: Func | Spec; +}; +/** + * Given a spec object recursively mapping properties to functions, creates a function + * producing an object of the same structure, by mapping each property to the result + * of calling its associated function with the supplied arguments. + */ +declare function applySpec(obj: Spec): (...args: any[]) => T; +declare var g1: (...args: any[]) => { + sum: number; + nested: { + mul: string; + }; +}; +declare var g2: (...args: any[]) => { + foo: { + bar: { + baz: boolean; + }; + }; +}; +declare const foo: (object: T, partial: Partial) => T; +declare let o: { + a: number; + b: number; +}; diff --git a/tests/baselines/reference/isomorphicMappedTypeInference.symbols b/tests/baselines/reference/isomorphicMappedTypeInference.symbols new file mode 100644 index 00000000000..93ce825c35d --- /dev/null +++ b/tests/baselines/reference/isomorphicMappedTypeInference.symbols @@ -0,0 +1,489 @@ +=== tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts === + +type Box = { +>Box : Symbol(Box, Decl(isomorphicMappedTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 1, 9)) + + value: T; +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 1, 9)) +} + +type Boxified = { +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 3, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 5, 14)) + + [P in keyof T]: Box; +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 6, 5)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 5, 14)) +>Box : Symbol(Box, Decl(isomorphicMappedTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 5, 14)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 6, 5)) +} + +function box(x: T): Box { +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 9, 13)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 9, 16)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 9, 13)) +>Box : Symbol(Box, Decl(isomorphicMappedTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 9, 13)) + + return { value: x }; +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 10, 12)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 9, 16)) +} + +function unbox(x: Box): T { +>unbox : Symbol(unbox, Decl(isomorphicMappedTypeInference.ts, 11, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 13, 15)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 13, 18)) +>Box : Symbol(Box, Decl(isomorphicMappedTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 13, 15)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 13, 15)) + + return x.value; +>x.value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 13, 18)) +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +} + +function boxify(obj: T): Boxified { +>boxify : Symbol(boxify, Decl(isomorphicMappedTypeInference.ts, 15, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 17, 16)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 17, 19)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 17, 16)) +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 3, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 17, 16)) + + let result = {} as Boxified; +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 18, 7)) +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 3, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 17, 16)) + + for (let k in obj) { +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 19, 12)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 17, 19)) + + result[k] = box(obj[k]); +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 18, 7)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 19, 12)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 17, 19)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 19, 12)) + } + return result; +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 18, 7)) +} + +function unboxify(obj: Boxified): T { +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 25, 18)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 25, 21)) +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 3, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 25, 18)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 25, 18)) + + let result = {} as T; +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 26, 7)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 25, 18)) + + for (let k in obj) { +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 27, 12)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 25, 21)) + + result[k] = unbox(obj[k]); +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 26, 7)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 27, 12)) +>unbox : Symbol(unbox, Decl(isomorphicMappedTypeInference.ts, 11, 1)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 25, 21)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 27, 12)) + } + return result; +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 26, 7)) +} + +function assignBoxified(obj: Boxified, values: T) { +>assignBoxified : Symbol(assignBoxified, Decl(isomorphicMappedTypeInference.ts, 31, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 33, 24)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 33, 27)) +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 3, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 33, 24)) +>values : Symbol(values, Decl(isomorphicMappedTypeInference.ts, 33, 44)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 33, 24)) + + for (let k in values) { +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 34, 12)) +>values : Symbol(values, Decl(isomorphicMappedTypeInference.ts, 33, 44)) + + obj[k].value = values[k]; +>obj[k].value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 33, 27)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 34, 12)) +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +>values : Symbol(values, Decl(isomorphicMappedTypeInference.ts, 33, 44)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 34, 12)) + } +} + +function f1() { +>f1 : Symbol(f1, Decl(isomorphicMappedTypeInference.ts, 37, 1)) + + let v = { +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 40, 7)) + + a: 42, +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 40, 13)) + + b: "hello", +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 41, 14)) + + c: true +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 42, 19)) + + }; + let b = boxify(v); +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 45, 7)) +>boxify : Symbol(boxify, Decl(isomorphicMappedTypeInference.ts, 15, 1)) +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 40, 7)) + + let x: number = b.a.value; +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 46, 7)) +>b.a.value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +>b.a : Symbol(a) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 45, 7)) +>a : Symbol(a) +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +} + +function f2() { +>f2 : Symbol(f2, Decl(isomorphicMappedTypeInference.ts, 47, 1)) + + let b = { +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 50, 7)) + + a: box(42), +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 50, 13)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + b: box("hello"), +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 51, 19)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + c: box(true) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 52, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + }; + let v = unboxify(b); +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 55, 7)) +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 50, 7)) + + let x: number = v.a; +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 56, 7)) +>v.a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 50, 13)) +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 55, 7)) +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 50, 13)) +} + +function f3() { +>f3 : Symbol(f3, Decl(isomorphicMappedTypeInference.ts, 57, 1)) + + let b = { +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 60, 7)) + + a: box(42), +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 60, 13)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + b: box("hello"), +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 61, 19)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + c: box(true) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 62, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + }; + assignBoxified(b, { c: false }); +>assignBoxified : Symbol(assignBoxified, Decl(isomorphicMappedTypeInference.ts, 31, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 60, 7)) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 65, 23)) +} + +function f4() { +>f4 : Symbol(f4, Decl(isomorphicMappedTypeInference.ts, 66, 1)) + + let b = { +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 69, 7)) + + a: box(42), +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 69, 13)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + b: box("hello"), +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 70, 19)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + c: box(true) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 71, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + }; + b = boxify(unboxify(b)); +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 69, 7)) +>boxify : Symbol(boxify, Decl(isomorphicMappedTypeInference.ts, 15, 1)) +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 69, 7)) + + b = unboxify(boxify(b)); +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 69, 7)) +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>boxify : Symbol(boxify, Decl(isomorphicMappedTypeInference.ts, 15, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 69, 7)) +} + +function makeRecord(obj: { [P in K]: T }) { +>makeRecord : Symbol(makeRecord, Decl(isomorphicMappedTypeInference.ts, 76, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 78, 20)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 78, 22)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 78, 41)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 78, 49)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 78, 22)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 78, 20)) + + return obj; +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 78, 41)) +} + +function f5(s: string) { +>f5 : Symbol(f5, Decl(isomorphicMappedTypeInference.ts, 80, 1)) +>s : Symbol(s, Decl(isomorphicMappedTypeInference.ts, 82, 12)) + + let b = makeRecord({ +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 83, 7)) +>makeRecord : Symbol(makeRecord, Decl(isomorphicMappedTypeInference.ts, 76, 1)) + + a: box(42), +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 83, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + b: box("hello"), +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 84, 19)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + c: box(true) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 85, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + }); + let v = unboxify(b); +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 88, 7)) +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 83, 7)) + + let x: string | number | boolean = v.a; +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 89, 7)) +>v.a : Symbol(a) +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 88, 7)) +>a : Symbol(a) +} + +function makeDictionary(obj: { [x: string]: T }) { +>makeDictionary : Symbol(makeDictionary, Decl(isomorphicMappedTypeInference.ts, 90, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 92, 24)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 92, 27)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 92, 35)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 92, 24)) + + return obj; +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 92, 27)) +} + +function f6(s: string) { +>f6 : Symbol(f6, Decl(isomorphicMappedTypeInference.ts, 94, 1)) +>s : Symbol(s, Decl(isomorphicMappedTypeInference.ts, 96, 12)) + + let b = makeDictionary({ +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 97, 7)) +>makeDictionary : Symbol(makeDictionary, Decl(isomorphicMappedTypeInference.ts, 90, 1)) + + a: box(42), +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 97, 28)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + b: box("hello"), +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 98, 19)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + c: box(true) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 99, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + }); + let v = unboxify(b); +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 102, 7)) +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 97, 7)) + + let x: string | number | boolean = v[s]; +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 103, 7)) +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 102, 7)) +>s : Symbol(s, Decl(isomorphicMappedTypeInference.ts, 96, 12)) +} + +declare function validate(obj: { [P in keyof T]?: T[P] }): T; +>validate : Symbol(validate, Decl(isomorphicMappedTypeInference.ts, 104, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 106, 26)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 106, 29)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 106, 37)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 106, 26)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 106, 26)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 106, 37)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 106, 26)) + +declare function clone(obj: { readonly [P in keyof T]: T[P] }): T; +>clone : Symbol(clone, Decl(isomorphicMappedTypeInference.ts, 106, 64)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 107, 23)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 107, 26)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 107, 43)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 107, 23)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 107, 23)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 107, 43)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 107, 23)) + +declare function validateAndClone(obj: { readonly [P in keyof T]?: T[P] }): T; +>validateAndClone : Symbol(validateAndClone, Decl(isomorphicMappedTypeInference.ts, 107, 69)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 108, 34)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 108, 37)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 108, 54)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 108, 34)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 108, 34)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 108, 54)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 108, 34)) + +type Foo = { +>Foo : Symbol(Foo, Decl(isomorphicMappedTypeInference.ts, 108, 81)) + + a?: number; +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 110, 12)) + + readonly b: string; +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 111, 15)) +} + +function f10(foo: Foo) { +>f10 : Symbol(f10, Decl(isomorphicMappedTypeInference.ts, 113, 1)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 115, 13)) +>Foo : Symbol(Foo, Decl(isomorphicMappedTypeInference.ts, 108, 81)) + + let x = validate(foo); // { a: number, readonly b: string } +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 116, 7)) +>validate : Symbol(validate, Decl(isomorphicMappedTypeInference.ts, 104, 1)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 115, 13)) + + let y = clone(foo); // { a?: number, b: string } +>y : Symbol(y, Decl(isomorphicMappedTypeInference.ts, 117, 7)) +>clone : Symbol(clone, Decl(isomorphicMappedTypeInference.ts, 106, 64)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 115, 13)) + + let z = validateAndClone(foo); // { a: number, b: string } +>z : Symbol(z, Decl(isomorphicMappedTypeInference.ts, 118, 7)) +>validateAndClone : Symbol(validateAndClone, Decl(isomorphicMappedTypeInference.ts, 107, 69)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 115, 13)) +} + +// Repro from #12606 + +type Func = (...args: any[]) => T; +>Func : Symbol(Func, Decl(isomorphicMappedTypeInference.ts, 119, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 123, 10)) +>args : Symbol(args, Decl(isomorphicMappedTypeInference.ts, 123, 16)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 123, 10)) + +type Spec = { +>Spec : Symbol(Spec, Decl(isomorphicMappedTypeInference.ts, 123, 37)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 124, 10)) + + [P in keyof T]: Func | Spec ; +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 125, 5)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 124, 10)) +>Func : Symbol(Func, Decl(isomorphicMappedTypeInference.ts, 119, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 124, 10)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 125, 5)) +>Spec : Symbol(Spec, Decl(isomorphicMappedTypeInference.ts, 123, 37)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 124, 10)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 125, 5)) + +}; + +/** + * Given a spec object recursively mapping properties to functions, creates a function + * producing an object of the same structure, by mapping each property to the result + * of calling its associated function with the supplied arguments. + */ +declare function applySpec(obj: Spec): (...args: any[]) => T; +>applySpec : Symbol(applySpec, Decl(isomorphicMappedTypeInference.ts, 126, 2)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 133, 27)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 133, 30)) +>Spec : Symbol(Spec, Decl(isomorphicMappedTypeInference.ts, 123, 37)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 133, 27)) +>args : Symbol(args, Decl(isomorphicMappedTypeInference.ts, 133, 46)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 133, 27)) + +// Infers g1: (...args: any[]) => { sum: number, nested: { mul: string } } +var g1 = applySpec({ +>g1 : Symbol(g1, Decl(isomorphicMappedTypeInference.ts, 136, 3)) +>applySpec : Symbol(applySpec, Decl(isomorphicMappedTypeInference.ts, 126, 2)) + + sum: (a: any) => 3, +>sum : Symbol(sum, Decl(isomorphicMappedTypeInference.ts, 136, 20)) +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 137, 10)) + + nested: { +>nested : Symbol(nested, Decl(isomorphicMappedTypeInference.ts, 137, 23)) + + mul: (b: any) => "n" +>mul : Symbol(mul, Decl(isomorphicMappedTypeInference.ts, 138, 13)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 139, 14)) + } +}); + +// Infers g2: (...args: any[]) => { foo: { bar: { baz: boolean } } } +var g2 = applySpec({ foo: { bar: { baz: (x: any) => true } } }); +>g2 : Symbol(g2, Decl(isomorphicMappedTypeInference.ts, 144, 3)) +>applySpec : Symbol(applySpec, Decl(isomorphicMappedTypeInference.ts, 126, 2)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 144, 20)) +>bar : Symbol(bar, Decl(isomorphicMappedTypeInference.ts, 144, 27)) +>baz : Symbol(baz, Decl(isomorphicMappedTypeInference.ts, 144, 34)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 144, 41)) + +// Repro from #12633 + +const foo = (object: T, partial: Partial) => object; +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 148, 5)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 148, 13)) +>object : Symbol(object, Decl(isomorphicMappedTypeInference.ts, 148, 16)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 148, 13)) +>partial : Symbol(partial, Decl(isomorphicMappedTypeInference.ts, 148, 26)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 148, 13)) +>object : Symbol(object, Decl(isomorphicMappedTypeInference.ts, 148, 16)) + +let o = {a: 5, b: 7}; +>o : Symbol(o, Decl(isomorphicMappedTypeInference.ts, 149, 3)) +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 149, 9)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 149, 14)) + +foo(o, {b: 9}); +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 148, 5)) +>o : Symbol(o, Decl(isomorphicMappedTypeInference.ts, 149, 3)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 150, 8)) + +o = foo(o, {b: 9}); +>o : Symbol(o, Decl(isomorphicMappedTypeInference.ts, 149, 3)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 148, 5)) +>o : Symbol(o, Decl(isomorphicMappedTypeInference.ts, 149, 3)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 151, 12)) + diff --git a/tests/baselines/reference/isomorphicMappedTypeInference.types b/tests/baselines/reference/isomorphicMappedTypeInference.types new file mode 100644 index 00000000000..ca20e06e113 --- /dev/null +++ b/tests/baselines/reference/isomorphicMappedTypeInference.types @@ -0,0 +1,587 @@ +=== tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts === + +type Box = { +>Box : Box +>T : T + + value: T; +>value : T +>T : T +} + +type Boxified = { +>Boxified : Boxified +>T : T + + [P in keyof T]: Box; +>P : P +>T : T +>Box : Box +>T : T +>P : P +} + +function box(x: T): Box { +>box : (x: T) => Box +>T : T +>x : T +>T : T +>Box : Box +>T : T + + return { value: x }; +>{ value: x } : { value: T; } +>value : T +>x : T +} + +function unbox(x: Box): T { +>unbox : (x: Box) => T +>T : T +>x : Box +>Box : Box +>T : T +>T : T + + return x.value; +>x.value : T +>x : Box +>value : T +} + +function boxify(obj: T): Boxified { +>boxify : (obj: T) => Boxified +>T : T +>obj : T +>T : T +>Boxified : Boxified +>T : T + + let result = {} as Boxified; +>result : Boxified +>{} as Boxified : Boxified +>{} : {} +>Boxified : Boxified +>T : T + + for (let k in obj) { +>k : keyof T +>obj : T + + result[k] = box(obj[k]); +>result[k] = box(obj[k]) : Box +>result[k] : Box +>result : Boxified +>k : keyof T +>box(obj[k]) : Box +>box : (x: T) => Box +>obj[k] : T[keyof T] +>obj : T +>k : keyof T + } + return result; +>result : Boxified +} + +function unboxify(obj: Boxified): T { +>unboxify : (obj: Boxified) => T +>T : T +>obj : Boxified +>Boxified : Boxified +>T : T +>T : T + + let result = {} as T; +>result : T +>{} as T : T +>{} : {} +>T : T + + for (let k in obj) { +>k : keyof T +>obj : Boxified + + result[k] = unbox(obj[k]); +>result[k] = unbox(obj[k]) : T[keyof T] +>result[k] : T[keyof T] +>result : T +>k : keyof T +>unbox(obj[k]) : T[keyof T] +>unbox : (x: Box) => T +>obj[k] : Box +>obj : Boxified +>k : keyof T + } + return result; +>result : T +} + +function assignBoxified(obj: Boxified, values: T) { +>assignBoxified : (obj: Boxified, values: T) => void +>T : T +>obj : Boxified +>Boxified : Boxified +>T : T +>values : T +>T : T + + for (let k in values) { +>k : keyof T +>values : T + + obj[k].value = values[k]; +>obj[k].value = values[k] : T[keyof T] +>obj[k].value : T[keyof T] +>obj[k] : Box +>obj : Boxified +>k : keyof T +>value : T[keyof T] +>values[k] : T[keyof T] +>values : T +>k : keyof T + } +} + +function f1() { +>f1 : () => void + + let v = { +>v : { a: number; b: string; c: boolean; } +>{ a: 42, b: "hello", c: true } : { a: number; b: string; c: boolean; } + + a: 42, +>a : number +>42 : 42 + + b: "hello", +>b : string +>"hello" : "hello" + + c: true +>c : boolean +>true : true + + }; + let b = boxify(v); +>b : Boxified<{ a: number; b: string; c: boolean; }> +>boxify(v) : Boxified<{ a: number; b: string; c: boolean; }> +>boxify : (obj: T) => Boxified +>v : { a: number; b: string; c: boolean; } + + let x: number = b.a.value; +>x : number +>b.a.value : number +>b.a : Box +>b : Boxified<{ a: number; b: string; c: boolean; }> +>a : Box +>value : number +} + +function f2() { +>f2 : () => void + + let b = { +>b : { a: Box; b: Box; c: Box; } +>{ a: box(42), b: box("hello"), c: box(true) } : { a: Box; b: Box; c: Box; } + + a: box(42), +>a : Box +>box(42) : Box +>box : (x: T) => Box +>42 : 42 + + b: box("hello"), +>b : Box +>box("hello") : Box +>box : (x: T) => Box +>"hello" : "hello" + + c: box(true) +>c : Box +>box(true) : Box +>box : (x: T) => Box +>true : true + + }; + let v = unboxify(b); +>v : { a: number; b: string; c: boolean; } +>unboxify(b) : { a: number; b: string; c: boolean; } +>unboxify : (obj: Boxified) => T +>b : { a: Box; b: Box; c: Box; } + + let x: number = v.a; +>x : number +>v.a : number +>v : { a: number; b: string; c: boolean; } +>a : number +} + +function f3() { +>f3 : () => void + + let b = { +>b : { a: Box; b: Box; c: Box; } +>{ a: box(42), b: box("hello"), c: box(true) } : { a: Box; b: Box; c: Box; } + + a: box(42), +>a : Box +>box(42) : Box +>box : (x: T) => Box +>42 : 42 + + b: box("hello"), +>b : Box +>box("hello") : Box +>box : (x: T) => Box +>"hello" : "hello" + + c: box(true) +>c : Box +>box(true) : Box +>box : (x: T) => Box +>true : true + + }; + assignBoxified(b, { c: false }); +>assignBoxified(b, { c: false }) : void +>assignBoxified : (obj: Boxified, values: T) => void +>b : { a: Box; b: Box; c: Box; } +>{ c: false } : { c: false; } +>c : boolean +>false : false +} + +function f4() { +>f4 : () => void + + let b = { +>b : { a: Box; b: Box; c: Box; } +>{ a: box(42), b: box("hello"), c: box(true) } : { a: Box; b: Box; c: Box; } + + a: box(42), +>a : Box +>box(42) : Box +>box : (x: T) => Box +>42 : 42 + + b: box("hello"), +>b : Box +>box("hello") : Box +>box : (x: T) => Box +>"hello" : "hello" + + c: box(true) +>c : Box +>box(true) : Box +>box : (x: T) => Box +>true : true + + }; + b = boxify(unboxify(b)); +>b = boxify(unboxify(b)) : Boxified<{ a: number; b: string; c: boolean; }> +>b : { a: Box; b: Box; c: Box; } +>boxify(unboxify(b)) : Boxified<{ a: number; b: string; c: boolean; }> +>boxify : (obj: T) => Boxified +>unboxify(b) : { a: number; b: string; c: boolean; } +>unboxify : (obj: Boxified) => T +>b : { a: Box; b: Box; c: Box; } + + b = unboxify(boxify(b)); +>b = unboxify(boxify(b)) : { a: Box; b: Box; c: Box; } +>b : { a: Box; b: Box; c: Box; } +>unboxify(boxify(b)) : { a: Box; b: Box; c: Box; } +>unboxify : (obj: Boxified) => T +>boxify(b) : Boxified<{ a: Box; b: Box; c: Box; }> +>boxify : (obj: T) => Boxified +>b : { a: Box; b: Box; c: Box; } +} + +function makeRecord(obj: { [P in K]: T }) { +>makeRecord : (obj: { [P in K]: T; }) => { [P in K]: T; } +>T : T +>K : K +>obj : { [P in K]: T; } +>P : P +>K : K +>T : T + + return obj; +>obj : { [P in K]: T; } +} + +function f5(s: string) { +>f5 : (s: string) => void +>s : string + + let b = makeRecord({ +>b : { a: Box | Box | Box; b: Box | Box | Box; c: Box | Box | Box; } +>makeRecord({ a: box(42), b: box("hello"), c: box(true) }) : { a: Box | Box | Box; b: Box | Box | Box; c: Box | Box | Box; } +>makeRecord : (obj: { [P in K]: T; }) => { [P in K]: T; } +>{ a: box(42), b: box("hello"), c: box(true) } : { a: Box; b: Box; c: Box; } + + a: box(42), +>a : Box +>box(42) : Box +>box : (x: T) => Box +>42 : 42 + + b: box("hello"), +>b : Box +>box("hello") : Box +>box : (x: T) => Box +>"hello" : "hello" + + c: box(true) +>c : Box +>box(true) : Box +>box : (x: T) => Box +>true : true + + }); + let v = unboxify(b); +>v : { a: string | number | boolean; b: string | number | boolean; c: string | number | boolean; } +>unboxify(b) : { a: string | number | boolean; b: string | number | boolean; c: string | number | boolean; } +>unboxify : (obj: Boxified) => T +>b : { a: Box | Box | Box; b: Box | Box | Box; c: Box | Box | Box; } + + let x: string | number | boolean = v.a; +>x : string | number | boolean +>v.a : string | number | boolean +>v : { a: string | number | boolean; b: string | number | boolean; c: string | number | boolean; } +>a : string | number | boolean +} + +function makeDictionary(obj: { [x: string]: T }) { +>makeDictionary : (obj: { [x: string]: T; }) => { [x: string]: T; } +>T : T +>obj : { [x: string]: T; } +>x : string +>T : T + + return obj; +>obj : { [x: string]: T; } +} + +function f6(s: string) { +>f6 : (s: string) => void +>s : string + + let b = makeDictionary({ +>b : { [x: string]: Box | Box | Box; } +>makeDictionary({ a: box(42), b: box("hello"), c: box(true) }) : { [x: string]: Box | Box | Box; } +>makeDictionary : (obj: { [x: string]: T; }) => { [x: string]: T; } +>{ a: box(42), b: box("hello"), c: box(true) } : { a: Box; b: Box; c: Box; } + + a: box(42), +>a : Box +>box(42) : Box +>box : (x: T) => Box +>42 : 42 + + b: box("hello"), +>b : Box +>box("hello") : Box +>box : (x: T) => Box +>"hello" : "hello" + + c: box(true) +>c : Box +>box(true) : Box +>box : (x: T) => Box +>true : true + + }); + let v = unboxify(b); +>v : { [x: string]: string | number | boolean; } +>unboxify(b) : { [x: string]: string | number | boolean; } +>unboxify : (obj: Boxified) => T +>b : { [x: string]: Box | Box | Box; } + + let x: string | number | boolean = v[s]; +>x : string | number | boolean +>v[s] : string | number | boolean +>v : { [x: string]: string | number | boolean; } +>s : string +} + +declare function validate(obj: { [P in keyof T]?: T[P] }): T; +>validate : (obj: { [P in keyof T]?: T[P] | undefined; }) => T +>T : T +>obj : { [P in keyof T]?: T[P] | undefined; } +>P : P +>T : T +>T : T +>P : P +>T : T + +declare function clone(obj: { readonly [P in keyof T]: T[P] }): T; +>clone : (obj: { readonly [P in keyof T]: T[P]; }) => T +>T : T +>obj : { readonly [P in keyof T]: T[P]; } +>P : P +>T : T +>T : T +>P : P +>T : T + +declare function validateAndClone(obj: { readonly [P in keyof T]?: T[P] }): T; +>validateAndClone : (obj: { readonly [P in keyof T]?: T[P] | undefined; }) => T +>T : T +>obj : { readonly [P in keyof T]?: T[P] | undefined; } +>P : P +>T : T +>T : T +>P : P +>T : T + +type Foo = { +>Foo : Foo + + a?: number; +>a : number | undefined + + readonly b: string; +>b : string +} + +function f10(foo: Foo) { +>f10 : (foo: Foo) => void +>foo : Foo +>Foo : Foo + + let x = validate(foo); // { a: number, readonly b: string } +>x : { a: number; readonly b: string; } +>validate(foo) : { a: number; readonly b: string; } +>validate : (obj: { [P in keyof T]?: T[P] | undefined; }) => T +>foo : Foo + + let y = clone(foo); // { a?: number, b: string } +>y : { a?: number | undefined; b: string; } +>clone(foo) : { a?: number | undefined; b: string; } +>clone : (obj: { readonly [P in keyof T]: T[P]; }) => T +>foo : Foo + + let z = validateAndClone(foo); // { a: number, b: string } +>z : { a: number; b: string; } +>validateAndClone(foo) : { a: number; b: string; } +>validateAndClone : (obj: { readonly [P in keyof T]?: T[P] | undefined; }) => T +>foo : Foo +} + +// Repro from #12606 + +type Func = (...args: any[]) => T; +>Func : Func +>T : T +>args : any[] +>T : T + +type Spec = { +>Spec : Spec +>T : T + + [P in keyof T]: Func | Spec ; +>P : P +>T : T +>Func : Func +>T : T +>P : P +>Spec : Spec +>T : T +>P : P + +}; + +/** + * Given a spec object recursively mapping properties to functions, creates a function + * producing an object of the same structure, by mapping each property to the result + * of calling its associated function with the supplied arguments. + */ +declare function applySpec(obj: Spec): (...args: any[]) => T; +>applySpec : (obj: Spec) => (...args: any[]) => T +>T : T +>obj : Spec +>Spec : Spec +>T : T +>args : any[] +>T : T + +// Infers g1: (...args: any[]) => { sum: number, nested: { mul: string } } +var g1 = applySpec({ +>g1 : (...args: any[]) => { sum: number; nested: { mul: string; }; } +>applySpec({ sum: (a: any) => 3, nested: { mul: (b: any) => "n" }}) : (...args: any[]) => { sum: number; nested: { mul: string; }; } +>applySpec : (obj: Spec) => (...args: any[]) => T +>{ sum: (a: any) => 3, nested: { mul: (b: any) => "n" }} : { sum: (a: any) => number; nested: { mul: (b: any) => string; }; } + + sum: (a: any) => 3, +>sum : (a: any) => number +>(a: any) => 3 : (a: any) => number +>a : any +>3 : 3 + + nested: { +>nested : { mul: (b: any) => string; } +>{ mul: (b: any) => "n" } : { mul: (b: any) => string; } + + mul: (b: any) => "n" +>mul : (b: any) => string +>(b: any) => "n" : (b: any) => string +>b : any +>"n" : "n" + } +}); + +// Infers g2: (...args: any[]) => { foo: { bar: { baz: boolean } } } +var g2 = applySpec({ foo: { bar: { baz: (x: any) => true } } }); +>g2 : (...args: any[]) => { foo: { bar: { baz: boolean; }; }; } +>applySpec({ foo: { bar: { baz: (x: any) => true } } }) : (...args: any[]) => { foo: { bar: { baz: boolean; }; }; } +>applySpec : (obj: Spec) => (...args: any[]) => T +>{ foo: { bar: { baz: (x: any) => true } } } : { foo: { bar: { baz: (x: any) => boolean; }; }; } +>foo : { bar: { baz: (x: any) => boolean; }; } +>{ bar: { baz: (x: any) => true } } : { bar: { baz: (x: any) => boolean; }; } +>bar : { baz: (x: any) => boolean; } +>{ baz: (x: any) => true } : { baz: (x: any) => boolean; } +>baz : (x: any) => boolean +>(x: any) => true : (x: any) => boolean +>x : any +>true : true + +// Repro from #12633 + +const foo = (object: T, partial: Partial) => object; +>foo : (object: T, partial: Partial) => T +>(object: T, partial: Partial) => object : (object: T, partial: Partial) => T +>T : T +>object : T +>T : T +>partial : Partial +>Partial : Partial +>T : T +>object : T + +let o = {a: 5, b: 7}; +>o : { a: number; b: number; } +>{a: 5, b: 7} : { a: number; b: number; } +>a : number +>5 : 5 +>b : number +>7 : 7 + +foo(o, {b: 9}); +>foo(o, {b: 9}) : { a: number; b: number; } +>foo : (object: T, partial: Partial) => T +>o : { a: number; b: number; } +>{b: 9} : { b: number; } +>b : number +>9 : 9 + +o = foo(o, {b: 9}); +>o = foo(o, {b: 9}) : { a: number; b: number; } +>o : { a: number; b: number; } +>foo(o, {b: 9}) : { a: number; b: number; } +>foo : (object: T, partial: Partial) => T +>o : { a: number; b: number; } +>{b: 9} : { b: number; } +>b : number +>9 : 9 + diff --git a/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.js b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.js new file mode 100644 index 00000000000..ecf7d13d89d --- /dev/null +++ b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.js @@ -0,0 +1,27 @@ +//// [index.tsx] + +import "./jsx"; + +var skate: any; +const React = { createElement: skate.h }; + +class Component { + renderCallback() { + return
test
; + } +}; + +//// [index.js] +"use strict"; +require("./jsx"); +var skate; +var React = { createElement: skate.h }; +var Component = (function () { + function Component() { + } + Component.prototype.renderCallback = function () { + return skate.h("div", null, "test"); + }; + return Component; +}()); +; diff --git a/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.symbols b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.symbols new file mode 100644 index 00000000000..35879c81ca6 --- /dev/null +++ b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/index.tsx === + +import "./jsx"; + +var skate: any; +>skate : Symbol(skate, Decl(index.tsx, 3, 3)) + +const React = { createElement: skate.h }; +>React : Symbol(React, Decl(index.tsx, 4, 5)) +>createElement : Symbol(createElement, Decl(index.tsx, 4, 15)) +>skate : Symbol(skate, Decl(index.tsx, 3, 3)) + +class Component { +>Component : Symbol(Component, Decl(index.tsx, 4, 41)) + + renderCallback() { +>renderCallback : Symbol(Component.renderCallback, Decl(index.tsx, 6, 17)) + + return
test
; +>div : Symbol(unknown) +>div : Symbol(unknown) + } +}; diff --git a/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types new file mode 100644 index 00000000000..21fd4bae84b --- /dev/null +++ b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/index.tsx === + +import "./jsx"; + +var skate: any; +>skate : any + +const React = { createElement: skate.h }; +>React : { createElement: any; } +>{ createElement: skate.h } : { createElement: any; } +>createElement : any +>skate.h : any +>skate : any +>h : any + +class Component { +>Component : Component + + renderCallback() { +>renderCallback : () => any + + return
test
; +>
test
: any +>div : any +>div : any + } +}; diff --git a/tests/baselines/reference/keyofAndForIn.js b/tests/baselines/reference/keyofAndForIn.js new file mode 100644 index 00000000000..0debf28b75e --- /dev/null +++ b/tests/baselines/reference/keyofAndForIn.js @@ -0,0 +1,81 @@ +//// [keyofAndForIn.ts] + +// Repro from #12513 + +function f1(obj: { [P in K]: T }, k: K) { + const b = k in obj; + let k1: K; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} + +function f2(obj: { [P in keyof T]: T[P] }, k: keyof T) { + const b = k in obj; + let k1: keyof T; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} + +function f3(obj: { [P in K]: T[P] }, k: K) { + const b = k in obj; + let k1: K; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} + +//// [keyofAndForIn.js] +// Repro from #12513 +function f1(obj, k) { + var b = k in obj; + var k1; + for (k1 in obj) { + var x1 = obj[k1]; + } + for (var k2 in obj) { + var x2 = obj[k2]; + } +} +function f2(obj, k) { + var b = k in obj; + var k1; + for (k1 in obj) { + var x1 = obj[k1]; + } + for (var k2 in obj) { + var x2 = obj[k2]; + } +} +function f3(obj, k) { + var b = k in obj; + var k1; + for (k1 in obj) { + var x1 = obj[k1]; + } + for (var k2 in obj) { + var x2 = obj[k2]; + } +} + + +//// [keyofAndForIn.d.ts] +declare function f1(obj: { + [P in K]: T; +}, k: K): void; +declare function f2(obj: { + [P in keyof T]: T[P]; +}, k: keyof T): void; +declare function f3(obj: { + [P in K]: T[P]; +}, k: K): void; diff --git a/tests/baselines/reference/keyofAndForIn.symbols b/tests/baselines/reference/keyofAndForIn.symbols new file mode 100644 index 00000000000..36b5d3e2d72 --- /dev/null +++ b/tests/baselines/reference/keyofAndForIn.symbols @@ -0,0 +1,125 @@ +=== tests/cases/conformance/types/keyof/keyofAndForIn.ts === + +// Repro from #12513 + +function f1(obj: { [P in K]: T }, k: K) { +>f1 : Symbol(f1, Decl(keyofAndForIn.ts, 0, 0)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 3, 12)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 3, 29)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) +>P : Symbol(P, Decl(keyofAndForIn.ts, 3, 41)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 3, 12)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 3, 29)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 3, 54)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 3, 12)) + + const b = k in obj; +>b : Symbol(b, Decl(keyofAndForIn.ts, 4, 9)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 3, 54)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) + + let k1: K; +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 5, 7)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 3, 12)) + + for (k1 in obj) { +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 5, 7)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) + + let x1 = obj[k1]; +>x1 : Symbol(x1, Decl(keyofAndForIn.ts, 7, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 5, 7)) + } + for (let k2 in obj) { +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 9, 12)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) + + let x2 = obj[k2]; +>x2 : Symbol(x2, Decl(keyofAndForIn.ts, 10, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 9, 12)) + } +} + +function f2(obj: { [P in keyof T]: T[P] }, k: keyof T) { +>f2 : Symbol(f2, Decl(keyofAndForIn.ts, 12, 1)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 14, 12)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) +>P : Symbol(P, Decl(keyofAndForIn.ts, 14, 23)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 14, 12)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 14, 12)) +>P : Symbol(P, Decl(keyofAndForIn.ts, 14, 23)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 14, 45)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 14, 12)) + + const b = k in obj; +>b : Symbol(b, Decl(keyofAndForIn.ts, 15, 9)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 14, 45)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) + + let k1: keyof T; +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 16, 7)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 14, 12)) + + for (k1 in obj) { +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 16, 7)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) + + let x1 = obj[k1]; +>x1 : Symbol(x1, Decl(keyofAndForIn.ts, 18, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 16, 7)) + } + for (let k2 in obj) { +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 20, 12)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) + + let x2 = obj[k2]; +>x2 : Symbol(x2, Decl(keyofAndForIn.ts, 21, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 20, 12)) + } +} + +function f3(obj: { [P in K]: T[P] }, k: K) { +>f3 : Symbol(f3, Decl(keyofAndForIn.ts, 23, 1)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 25, 12)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 25, 14)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 25, 12)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) +>P : Symbol(P, Decl(keyofAndForIn.ts, 25, 42)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 25, 14)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 25, 12)) +>P : Symbol(P, Decl(keyofAndForIn.ts, 25, 42)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 25, 58)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 25, 14)) + + const b = k in obj; +>b : Symbol(b, Decl(keyofAndForIn.ts, 26, 9)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 25, 58)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) + + let k1: K; +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 27, 7)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 25, 14)) + + for (k1 in obj) { +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 27, 7)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) + + let x1 = obj[k1]; +>x1 : Symbol(x1, Decl(keyofAndForIn.ts, 29, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 27, 7)) + } + for (let k2 in obj) { +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 31, 12)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) + + let x2 = obj[k2]; +>x2 : Symbol(x2, Decl(keyofAndForIn.ts, 32, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 31, 12)) + } +} diff --git a/tests/baselines/reference/keyofAndForIn.types b/tests/baselines/reference/keyofAndForIn.types new file mode 100644 index 00000000000..5e992e5d261 --- /dev/null +++ b/tests/baselines/reference/keyofAndForIn.types @@ -0,0 +1,134 @@ +=== tests/cases/conformance/types/keyof/keyofAndForIn.ts === + +// Repro from #12513 + +function f1(obj: { [P in K]: T }, k: K) { +>f1 : (obj: { [P in K]: T; }, k: K) => void +>K : K +>T : T +>obj : { [P in K]: T; } +>P : P +>K : K +>T : T +>k : K +>K : K + + const b = k in obj; +>b : boolean +>k in obj : boolean +>k : K +>obj : { [P in K]: T; } + + let k1: K; +>k1 : K +>K : K + + for (k1 in obj) { +>k1 : K +>obj : { [P in K]: T; } + + let x1 = obj[k1]; +>x1 : T +>obj[k1] : T +>obj : { [P in K]: T; } +>k1 : K + } + for (let k2 in obj) { +>k2 : K +>obj : { [P in K]: T; } + + let x2 = obj[k2]; +>x2 : T +>obj[k2] : T +>obj : { [P in K]: T; } +>k2 : K + } +} + +function f2(obj: { [P in keyof T]: T[P] }, k: keyof T) { +>f2 : (obj: { [P in keyof T]: T[P]; }, k: keyof T) => void +>T : T +>obj : { [P in keyof T]: T[P]; } +>P : P +>T : T +>T : T +>P : P +>k : keyof T +>T : T + + const b = k in obj; +>b : boolean +>k in obj : boolean +>k : keyof T +>obj : { [P in keyof T]: T[P]; } + + let k1: keyof T; +>k1 : keyof T +>T : T + + for (k1 in obj) { +>k1 : keyof T +>obj : { [P in keyof T]: T[P]; } + + let x1 = obj[k1]; +>x1 : T[keyof T] +>obj[k1] : T[keyof T] +>obj : { [P in keyof T]: T[P]; } +>k1 : keyof T + } + for (let k2 in obj) { +>k2 : keyof T +>obj : { [P in keyof T]: T[P]; } + + let x2 = obj[k2]; +>x2 : T[keyof T] +>obj[k2] : T[keyof T] +>obj : { [P in keyof T]: T[P]; } +>k2 : keyof T + } +} + +function f3(obj: { [P in K]: T[P] }, k: K) { +>f3 : (obj: { [P in K]: T[P]; }, k: K) => void +>T : T +>K : K +>T : T +>obj : { [P in K]: T[P]; } +>P : P +>K : K +>T : T +>P : P +>k : K +>K : K + + const b = k in obj; +>b : boolean +>k in obj : boolean +>k : K +>obj : { [P in K]: T[P]; } + + let k1: K; +>k1 : K +>K : K + + for (k1 in obj) { +>k1 : K +>obj : { [P in K]: T[P]; } + + let x1 = obj[k1]; +>x1 : T[K] +>obj[k1] : T[K] +>obj : { [P in K]: T[P]; } +>k1 : K + } + for (let k2 in obj) { +>k2 : K +>obj : { [P in K]: T[P]; } + + let x2 = obj[k2]; +>x2 : T[K] +>obj[k2] : T[K] +>obj : { [P in K]: T[P]; } +>k2 : K + } +} diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index 1cc8846bbbd..4b93897fdc4 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -21,11 +21,12 @@ class Options { } type Dictionary = { [x: string]: T }; +type NumericallyIndexed = { [x: number]: T }; const enum E { A, B, C } -type K00 = keyof any; // string | number -type K01 = keyof string; // number | "toString" | "charAt" | ... +type K00 = keyof any; // string +type K01 = keyof string; // "toString" | "charAt" | ... type K02 = keyof number; // "toString" | "toFixed" | "toExponential" | ... type K03 = keyof boolean; // "valueOf" type K04 = keyof void; // never @@ -34,19 +35,20 @@ type K06 = keyof null; // never type K07 = keyof never; // never type K10 = keyof Shape; // "name" | "width" | "height" | "visible" -type K11 = keyof Shape[]; // number | "length" | "toString" | ... -type K12 = keyof Dictionary; // string | number +type K11 = keyof Shape[]; // "length" | "toString" | ... +type K12 = keyof Dictionary; // string type K13 = keyof {}; // never type K14 = keyof Object; // "constructor" | "toString" | ... type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ... -type K16 = keyof [string, number]; // number | "0" | "1" | "length" | "toString" | ... +type K16 = keyof [string, number]; // "0" | "1" | "length" | "toString" | ... type K17 = keyof (Shape | Item); // "name" type K18 = keyof (Shape & Item); // "name" | "width" | "height" | "visible" | "price" +type K19 = keyof NumericallyIndexed // never type KeyOf = keyof T; type K20 = KeyOf; // "name" | "width" | "height" | "visible" -type K21 = KeyOf>; // string | number +type K21 = KeyOf>; // string type NAME = "name"; type WIDTH_OR_HEIGHT = "width" | "height"; @@ -217,6 +219,83 @@ function f60(source: T, target: T) { } } +function f70(func: (k1: keyof (T | U), k2: keyof (T & U)) => void) { + func<{ a: any, b: any }, { a: any, c: any }>('a', 'a'); + func<{ a: any, b: any }, { a: any, c: any }>('a', 'b'); + func<{ a: any, b: any }, { a: any, c: any }>('a', 'c'); +} + +function f71(func: (x: T, y: U) => Partial) { + let x = func({ a: 1, b: "hello" }, { c: true }); + x.a; // number | undefined + x.b; // string | undefined + x.c; // boolean | undefined +} + +function f72(func: (x: T, y: U, k: K) => (T & U)[K]) { + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} + +function f73(func: (x: T, y: U, k: K) => (T & U)[K]) { + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} + +function f74(func: (x: T, y: U, k: K) => (T | U)[K]) { + let a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean +} + +function f80(obj: T) { + let a1 = obj.a; // { x: any } + let a2 = obj['a']; // { x: any } + let a3 = obj['a'] as T['a']; // T["a"] + let x1 = obj.a.x; // any + let x2 = obj['a']['x']; // any + let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"] +} + +function f81(obj: T) { + return obj['a']['x'] as T['a']['x']; +} + +function f82() { + let x1 = f81({ a: { x: "hello" } }); // string + let x2 = f81({ a: { x: 42 } }); // number +} + +function f83(obj: T, key: K) { + return obj[key]['x'] as T[K]['x']; +} + +function f84() { + let x1 = f83({ foo: { x: "hello" } }, "foo"); // string + let x2 = f83({ bar: { x: 42 } }, "bar"); // number +} + +class C1 { + x: number; + get(key: K) { + return this[key]; + } + set(key: K, value: this[K]) { + this[key] = value; + } + foo() { + let x1 = this.x; // number + let x2 = this["x"]; // number + let x3 = this.get("x"); // this["x"] + let x4 = getProperty(this, "x"); // this["x"] + this.x = 42; + this["x"] = 42; + this.set("x", 42); + setProperty(this, "x", 42); + } +} + // Repros from #12011 class Base { @@ -247,7 +326,110 @@ class OtherPerson { getParts() { return getProperty(this, "parts") } -} +} + +// Modified repro from #12544 + +function path(obj: T, key1: K1): T[K1]; +function path(obj: T, key1: K1, key2: K2): T[K1][K2]; +function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; +function path(obj: any, ...keys: (string | number)[]): any; +function path(obj: any, ...keys: (string | number)[]): any { + let result = obj; + for (let k of keys) { + result = result[k]; + } + return result; +} + +type Thing = { + a: { x: number, y: string }, + b: boolean +}; + + +function f1(thing: Thing) { + let x1 = path(thing, 'a'); // { x: number, y: string } + let x2 = path(thing, 'a', 'y'); // string + let x3 = path(thing, 'b'); // boolean + let x4 = path(thing, ...['a', 'x']); // any +} + +// Repro from comment in #12114 + +const assignTo2 = (object: T, key1: K1, key2: K2) => + (value: T[K1][K2]) => object[key1][key2] = value; + +// Modified repro from #12573 + +declare function one(handler: (t: T) => void): T +var empty = one(() => {}) // inferred as {}, expected + +type Handlers = { [K in keyof T]: (t: T[K]) => void } +declare function on(handlerHash: Handlers): T +var hashOfEmpty1 = on({ test: () => {} }); // {} +var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } + +// Repro from #12624 + +interface Options1 { + data?: Data + computed?: Computed; +} + +declare class Component1 { + constructor(options: Options1); + get(key: K): (Data & Computed)[K]; +} + +let c1 = new Component1({ + data: { + hello: "" + } +}); + +c1.get("hello"); + +// Repro from #12625 + +interface Options2 { + data?: Data + computed?: Computed; +} + +declare class Component2 { + constructor(options: Options2); + get(key: K): (Data & Computed)[K]; +} + +// Repro from #12641 + +interface R { + p: number; +} + +function f(p: K) { + let a: any; + a[p].add; // any +} + +// Repro from #12651 + +type MethodDescriptor = { + name: string; + args: any[]; + returnValue: any; +} + +declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; + +type SomeMethodDescriptor = { + name: "someMethod"; + args: [string, number]; + returnValue: string[]; +} + +let result = dispatchMethod("someMethod", ["hello", 35]); //// [keyofAndIndexedAccess.js] var __extends = (this && this.__extends) || function (d, b) { @@ -394,6 +576,74 @@ function f60(source, target) { target[k] = source[k]; } } +function f70(func) { + func('a', 'a'); + func('a', 'b'); + func('a', 'c'); +} +function f71(func) { + var x = func({ a: 1, b: "hello" }, { c: true }); + x.a; // number | undefined + x.b; // string | undefined + x.c; // boolean | undefined +} +function f72(func) { + var a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + var b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + var c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} +function f73(func) { + var a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + var b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + var c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} +function f74(func) { + var a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number + var b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean +} +function f80(obj) { + var a1 = obj.a; // { x: any } + var a2 = obj['a']; // { x: any } + var a3 = obj['a']; // T["a"] + var x1 = obj.a.x; // any + var x2 = obj['a']['x']; // any + var x3 = obj['a']['x']; // T["a"]["x"] +} +function f81(obj) { + return obj['a']['x']; +} +function f82() { + var x1 = f81({ a: { x: "hello" } }); // string + var x2 = f81({ a: { x: 42 } }); // number +} +function f83(obj, key) { + return obj[key]['x']; +} +function f84() { + var x1 = f83({ foo: { x: "hello" } }, "foo"); // string + var x2 = f83({ bar: { x: 42 } }, "bar"); // number +} +var C1 = (function () { + function C1() { + } + C1.prototype.get = function (key) { + return this[key]; + }; + C1.prototype.set = function (key, value) { + this[key] = value; + }; + C1.prototype.foo = function () { + var x1 = this.x; // number + var x2 = this["x"]; // number + var x3 = this.get("x"); // this["x"] + var x4 = getProperty(this, "x"); // this["x"] + this.x = 42; + this["x"] = 42; + this.set("x", 42); + setProperty(this, "x", 42); + }; + return C1; +}()); // Repros from #12011 var Base = (function () { function Base() { @@ -427,6 +677,42 @@ var OtherPerson = (function () { }; return OtherPerson; }()); +function path(obj) { + var keys = []; + for (var _i = 1; _i < arguments.length; _i++) { + keys[_i - 1] = arguments[_i]; + } + var result = obj; + for (var _a = 0, keys_1 = keys; _a < keys_1.length; _a++) { + var k = keys_1[_a]; + result = result[k]; + } + return result; +} +function f1(thing) { + var x1 = path(thing, 'a'); // { x: number, y: string } + var x2 = path(thing, 'a', 'y'); // string + var x3 = path(thing, 'b'); // boolean + var x4 = path.apply(void 0, [thing].concat(['a', 'x'])); // any +} +// Repro from comment in #12114 +var assignTo2 = function (object, key1, key2) { + return function (value) { return object[key1][key2] = value; }; +}; +var empty = one(function () { }); // inferred as {}, expected +var hashOfEmpty1 = on({ test: function () { } }); // {} +var hashOfEmpty2 = on({ test: function (x) { } }); // { test: boolean } +var c1 = new Component1({ + data: { + hello: "" + } +}); +c1.get("hello"); +function f(p) { + var a; + a[p].add; // any +} +var result = dispatchMethod("someMethod", ["hello", 35]); //// [keyofAndIndexedAccess.d.ts] @@ -449,6 +735,9 @@ declare class Options { declare type Dictionary = { [x: string]: T; }; +declare type NumericallyIndexed = { + [x: number]: T; +}; declare const enum E { A = 0, B = 1, @@ -471,6 +760,7 @@ declare type K15 = keyof E; declare type K16 = keyof [string, number]; declare type K17 = keyof (Shape | Item); declare type K18 = keyof (Shape & Item); +declare type K19 = keyof NumericallyIndexed; declare type KeyOf = keyof T; declare type K20 = KeyOf; declare type K21 = KeyOf>; @@ -530,6 +820,34 @@ declare function f53(obj: { declare function f54(obj: T, key: keyof T): void; declare function f55(obj: T, key: K): void; declare function f60(source: T, target: T): void; +declare function f70(func: (k1: keyof (T | U), k2: keyof (T & U)) => void): void; +declare function f71(func: (x: T, y: U) => Partial): void; +declare function f72(func: (x: T, y: U, k: K) => (T & U)[K]): void; +declare function f73(func: (x: T, y: U, k: K) => (T & U)[K]): void; +declare function f74(func: (x: T, y: U, k: K) => (T | U)[K]): void; +declare function f80(obj: T): void; +declare function f81(obj: T): T["a"]["x"]; +declare function f82(): void; +declare function f83(obj: T, key: K): T[K]["x"]; +declare function f84(): void; +declare class C1 { + x: number; + get(key: K): this[K]; + set(key: K, value: this[K]): void; + foo(): void; +} declare class Base { get(prop: K): this[K]; set(prop: K, value: this[K]): void; @@ -537,10 +855,68 @@ declare class Base { declare class Person extends Base { parts: number; constructor(parts: number); - getParts(): number; + getParts(): this["parts"]; } declare class OtherPerson { parts: number; constructor(parts: number); - getParts(): number; + getParts(): this["parts"]; } +declare function path(obj: T, key1: K1): T[K1]; +declare function path(obj: T, key1: K1, key2: K2): T[K1][K2]; +declare function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; +declare function path(obj: any, ...keys: (string | number)[]): any; +declare type Thing = { + a: { + x: number; + y: string; + }; + b: boolean; +}; +declare function f1(thing: Thing): void; +declare const assignTo2: (object: T, key1: K1, key2: K2) => (value: T[K1][K2]) => T[K1][K2]; +declare function one(handler: (t: T) => void): T; +declare var empty: {}; +declare type Handlers = { + [K in keyof T]: (t: T[K]) => void; +}; +declare function on(handlerHash: Handlers): T; +declare var hashOfEmpty1: {}; +declare var hashOfEmpty2: { + test: boolean; +}; +interface Options1 { + data?: Data; + computed?: Computed; +} +declare class Component1 { + constructor(options: Options1); + get(key: K): (Data & Computed)[K]; +} +declare let c1: Component1<{ + hello: string; +}, {}>; +interface Options2 { + data?: Data; + computed?: Computed; +} +declare class Component2 { + constructor(options: Options2); + get(key: K): (Data & Computed)[K]; +} +interface R { + p: number; +} +declare function f(p: K): void; +declare type MethodDescriptor = { + name: string; + args: any[]; + returnValue: any; +}; +declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; +declare type SomeMethodDescriptor = { + name: "someMethod"; + args: [string, number]; + returnValue: string[]; +}; +declare let result: string[]; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.symbols b/tests/baselines/reference/keyofAndIndexedAccess.symbols index 634dfe09da9..1c69d4959d8 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess.symbols @@ -47,792 +47,1532 @@ type Dictionary = { [x: string]: T }; >x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 21, 24)) >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 21, 16)) +type NumericallyIndexed = { [x: number]: T }; +>NumericallyIndexed : Symbol(NumericallyIndexed, Decl(keyofAndIndexedAccess.ts, 21, 40)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 22, 24)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 22, 32)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 22, 24)) + const enum E { A, B, C } ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) ->A : Symbol(E.A, Decl(keyofAndIndexedAccess.ts, 23, 14)) ->B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 23, 17)) ->C : Symbol(E.C, Decl(keyofAndIndexedAccess.ts, 23, 20)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) +>A : Symbol(E.A, Decl(keyofAndIndexedAccess.ts, 24, 14)) +>B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 24, 17)) +>C : Symbol(E.C, Decl(keyofAndIndexedAccess.ts, 24, 20)) -type K00 = keyof any; // string | number ->K00 : Symbol(K00, Decl(keyofAndIndexedAccess.ts, 23, 24)) +type K00 = keyof any; // string +>K00 : Symbol(K00, Decl(keyofAndIndexedAccess.ts, 24, 24)) -type K01 = keyof string; // number | "toString" | "charAt" | ... ->K01 : Symbol(K01, Decl(keyofAndIndexedAccess.ts, 25, 21)) +type K01 = keyof string; // "toString" | "charAt" | ... +>K01 : Symbol(K01, Decl(keyofAndIndexedAccess.ts, 26, 21)) type K02 = keyof number; // "toString" | "toFixed" | "toExponential" | ... ->K02 : Symbol(K02, Decl(keyofAndIndexedAccess.ts, 26, 24)) +>K02 : Symbol(K02, Decl(keyofAndIndexedAccess.ts, 27, 24)) type K03 = keyof boolean; // "valueOf" ->K03 : Symbol(K03, Decl(keyofAndIndexedAccess.ts, 27, 24)) +>K03 : Symbol(K03, Decl(keyofAndIndexedAccess.ts, 28, 24)) type K04 = keyof void; // never ->K04 : Symbol(K04, Decl(keyofAndIndexedAccess.ts, 28, 25)) +>K04 : Symbol(K04, Decl(keyofAndIndexedAccess.ts, 29, 25)) type K05 = keyof undefined; // never ->K05 : Symbol(K05, Decl(keyofAndIndexedAccess.ts, 29, 22)) +>K05 : Symbol(K05, Decl(keyofAndIndexedAccess.ts, 30, 22)) type K06 = keyof null; // never ->K06 : Symbol(K06, Decl(keyofAndIndexedAccess.ts, 30, 27)) +>K06 : Symbol(K06, Decl(keyofAndIndexedAccess.ts, 31, 27)) type K07 = keyof never; // never ->K07 : Symbol(K07, Decl(keyofAndIndexedAccess.ts, 31, 22)) +>K07 : Symbol(K07, Decl(keyofAndIndexedAccess.ts, 32, 22)) type K10 = keyof Shape; // "name" | "width" | "height" | "visible" ->K10 : Symbol(K10, Decl(keyofAndIndexedAccess.ts, 32, 23)) +>K10 : Symbol(K10, Decl(keyofAndIndexedAccess.ts, 33, 23)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) -type K11 = keyof Shape[]; // number | "length" | "toString" | ... ->K11 : Symbol(K11, Decl(keyofAndIndexedAccess.ts, 34, 23)) +type K11 = keyof Shape[]; // "length" | "toString" | ... +>K11 : Symbol(K11, Decl(keyofAndIndexedAccess.ts, 35, 23)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) -type K12 = keyof Dictionary; // string | number ->K12 : Symbol(K12, Decl(keyofAndIndexedAccess.ts, 35, 25)) +type K12 = keyof Dictionary; // string +>K12 : Symbol(K12, Decl(keyofAndIndexedAccess.ts, 36, 25)) >Dictionary : Symbol(Dictionary, Decl(keyofAndIndexedAccess.ts, 19, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type K13 = keyof {}; // never ->K13 : Symbol(K13, Decl(keyofAndIndexedAccess.ts, 36, 35)) +>K13 : Symbol(K13, Decl(keyofAndIndexedAccess.ts, 37, 35)) type K14 = keyof Object; // "constructor" | "toString" | ... ->K14 : Symbol(K14, Decl(keyofAndIndexedAccess.ts, 37, 20)) +>K14 : Symbol(K14, Decl(keyofAndIndexedAccess.ts, 38, 20)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ... ->K15 : Symbol(K15, Decl(keyofAndIndexedAccess.ts, 38, 24)) ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) +>K15 : Symbol(K15, Decl(keyofAndIndexedAccess.ts, 39, 24)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) -type K16 = keyof [string, number]; // number | "0" | "1" | "length" | "toString" | ... ->K16 : Symbol(K16, Decl(keyofAndIndexedAccess.ts, 39, 19)) +type K16 = keyof [string, number]; // "0" | "1" | "length" | "toString" | ... +>K16 : Symbol(K16, Decl(keyofAndIndexedAccess.ts, 40, 19)) type K17 = keyof (Shape | Item); // "name" ->K17 : Symbol(K17, Decl(keyofAndIndexedAccess.ts, 40, 34)) +>K17 : Symbol(K17, Decl(keyofAndIndexedAccess.ts, 41, 34)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) >Item : Symbol(Item, Decl(keyofAndIndexedAccess.ts, 10, 1)) type K18 = keyof (Shape & Item); // "name" | "width" | "height" | "visible" | "price" ->K18 : Symbol(K18, Decl(keyofAndIndexedAccess.ts, 41, 32)) +>K18 : Symbol(K18, Decl(keyofAndIndexedAccess.ts, 42, 32)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) >Item : Symbol(Item, Decl(keyofAndIndexedAccess.ts, 10, 1)) -type KeyOf = keyof T; ->KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 42, 32)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 44, 11)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 44, 11)) - -type K20 = KeyOf; // "name" | "width" | "height" | "visible" ->K20 : Symbol(K20, Decl(keyofAndIndexedAccess.ts, 44, 24)) ->KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 42, 32)) +type K19 = keyof NumericallyIndexed // never +>K19 : Symbol(K19, Decl(keyofAndIndexedAccess.ts, 43, 32)) +>NumericallyIndexed : Symbol(NumericallyIndexed, Decl(keyofAndIndexedAccess.ts, 21, 40)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) -type K21 = KeyOf>; // string | number ->K21 : Symbol(K21, Decl(keyofAndIndexedAccess.ts, 46, 24)) ->KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 42, 32)) +type KeyOf = keyof T; +>KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 44, 42)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 46, 11)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 46, 11)) + +type K20 = KeyOf; // "name" | "width" | "height" | "visible" +>K20 : Symbol(K20, Decl(keyofAndIndexedAccess.ts, 46, 24)) +>KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 44, 42)) +>Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) + +type K21 = KeyOf>; // string +>K21 : Symbol(K21, Decl(keyofAndIndexedAccess.ts, 48, 24)) +>KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 44, 42)) >Dictionary : Symbol(Dictionary, Decl(keyofAndIndexedAccess.ts, 19, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type NAME = "name"; ->NAME : Symbol(NAME, Decl(keyofAndIndexedAccess.ts, 47, 36)) +>NAME : Symbol(NAME, Decl(keyofAndIndexedAccess.ts, 49, 36)) type WIDTH_OR_HEIGHT = "width" | "height"; ->WIDTH_OR_HEIGHT : Symbol(WIDTH_OR_HEIGHT, Decl(keyofAndIndexedAccess.ts, 49, 19)) +>WIDTH_OR_HEIGHT : Symbol(WIDTH_OR_HEIGHT, Decl(keyofAndIndexedAccess.ts, 51, 19)) type Q10 = Shape["name"]; // string ->Q10 : Symbol(Q10, Decl(keyofAndIndexedAccess.ts, 50, 42)) +>Q10 : Symbol(Q10, Decl(keyofAndIndexedAccess.ts, 52, 42)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type Q11 = Shape["width" | "height"]; // number ->Q11 : Symbol(Q11, Decl(keyofAndIndexedAccess.ts, 52, 25)) +>Q11 : Symbol(Q11, Decl(keyofAndIndexedAccess.ts, 54, 25)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type Q12 = Shape["name" | "visible"]; // string | boolean ->Q12 : Symbol(Q12, Decl(keyofAndIndexedAccess.ts, 53, 37)) +>Q12 : Symbol(Q12, Decl(keyofAndIndexedAccess.ts, 55, 37)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type Q20 = Shape[NAME]; // string ->Q20 : Symbol(Q20, Decl(keyofAndIndexedAccess.ts, 54, 37)) +>Q20 : Symbol(Q20, Decl(keyofAndIndexedAccess.ts, 56, 37)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->NAME : Symbol(NAME, Decl(keyofAndIndexedAccess.ts, 47, 36)) +>NAME : Symbol(NAME, Decl(keyofAndIndexedAccess.ts, 49, 36)) type Q21 = Shape[WIDTH_OR_HEIGHT]; // number ->Q21 : Symbol(Q21, Decl(keyofAndIndexedAccess.ts, 56, 23)) +>Q21 : Symbol(Q21, Decl(keyofAndIndexedAccess.ts, 58, 23)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->WIDTH_OR_HEIGHT : Symbol(WIDTH_OR_HEIGHT, Decl(keyofAndIndexedAccess.ts, 49, 19)) +>WIDTH_OR_HEIGHT : Symbol(WIDTH_OR_HEIGHT, Decl(keyofAndIndexedAccess.ts, 51, 19)) type Q30 = [string, number][0]; // string ->Q30 : Symbol(Q30, Decl(keyofAndIndexedAccess.ts, 57, 34)) +>Q30 : Symbol(Q30, Decl(keyofAndIndexedAccess.ts, 59, 34)) type Q31 = [string, number][1]; // number ->Q31 : Symbol(Q31, Decl(keyofAndIndexedAccess.ts, 59, 31)) +>Q31 : Symbol(Q31, Decl(keyofAndIndexedAccess.ts, 61, 31)) type Q32 = [string, number][2]; // string | number ->Q32 : Symbol(Q32, Decl(keyofAndIndexedAccess.ts, 60, 31)) +>Q32 : Symbol(Q32, Decl(keyofAndIndexedAccess.ts, 62, 31)) type Q33 = [string, number][E.A]; // string ->Q33 : Symbol(Q33, Decl(keyofAndIndexedAccess.ts, 61, 31)) ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) ->A : Symbol(E.A, Decl(keyofAndIndexedAccess.ts, 23, 14)) +>Q33 : Symbol(Q33, Decl(keyofAndIndexedAccess.ts, 63, 31)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) +>A : Symbol(E.A, Decl(keyofAndIndexedAccess.ts, 24, 14)) type Q34 = [string, number][E.B]; // number ->Q34 : Symbol(Q34, Decl(keyofAndIndexedAccess.ts, 62, 33)) ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) ->B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 23, 17)) +>Q34 : Symbol(Q34, Decl(keyofAndIndexedAccess.ts, 64, 33)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) +>B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 24, 17)) type Q35 = [string, number][E.C]; // string | number ->Q35 : Symbol(Q35, Decl(keyofAndIndexedAccess.ts, 63, 33)) ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) ->C : Symbol(E.C, Decl(keyofAndIndexedAccess.ts, 23, 20)) +>Q35 : Symbol(Q35, Decl(keyofAndIndexedAccess.ts, 65, 33)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) +>C : Symbol(E.C, Decl(keyofAndIndexedAccess.ts, 24, 20)) type Q36 = [string, number]["0"]; // string ->Q36 : Symbol(Q36, Decl(keyofAndIndexedAccess.ts, 64, 33)) +>Q36 : Symbol(Q36, Decl(keyofAndIndexedAccess.ts, 66, 33)) type Q37 = [string, number]["1"]; // string ->Q37 : Symbol(Q37, Decl(keyofAndIndexedAccess.ts, 65, 33)) +>Q37 : Symbol(Q37, Decl(keyofAndIndexedAccess.ts, 67, 33)) type Q40 = (Shape | Options)["visible"]; // boolean | "yes" | "no" ->Q40 : Symbol(Q40, Decl(keyofAndIndexedAccess.ts, 66, 33)) +>Q40 : Symbol(Q40, Decl(keyofAndIndexedAccess.ts, 68, 33)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) >Options : Symbol(Options, Decl(keyofAndIndexedAccess.ts, 15, 1)) type Q41 = (Shape & Options)["visible"]; // true & "yes" | true & "no" | false & "yes" | false & "no" ->Q41 : Symbol(Q41, Decl(keyofAndIndexedAccess.ts, 68, 40)) +>Q41 : Symbol(Q41, Decl(keyofAndIndexedAccess.ts, 70, 40)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) >Options : Symbol(Options, Decl(keyofAndIndexedAccess.ts, 15, 1)) type Q50 = Dictionary["howdy"]; // Shape ->Q50 : Symbol(Q50, Decl(keyofAndIndexedAccess.ts, 69, 40)) +>Q50 : Symbol(Q50, Decl(keyofAndIndexedAccess.ts, 71, 40)) >Dictionary : Symbol(Dictionary, Decl(keyofAndIndexedAccess.ts, 19, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type Q51 = Dictionary[123]; // Shape ->Q51 : Symbol(Q51, Decl(keyofAndIndexedAccess.ts, 71, 38)) +>Q51 : Symbol(Q51, Decl(keyofAndIndexedAccess.ts, 73, 38)) >Dictionary : Symbol(Dictionary, Decl(keyofAndIndexedAccess.ts, 19, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type Q52 = Dictionary[E.B]; // Shape ->Q52 : Symbol(Q52, Decl(keyofAndIndexedAccess.ts, 72, 34)) +>Q52 : Symbol(Q52, Decl(keyofAndIndexedAccess.ts, 74, 34)) >Dictionary : Symbol(Dictionary, Decl(keyofAndIndexedAccess.ts, 19, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) ->B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 23, 17)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) +>B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 24, 17)) declare let cond: boolean; ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) function getProperty(obj: T, key: K) { ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 77, 21)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 77, 23)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 77, 21)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 77, 43)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 77, 21)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 77, 50)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 77, 23)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 79, 21)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 79, 23)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 79, 21)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 79, 43)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 79, 21)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 79, 50)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 79, 23)) return obj[key]; ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 77, 43)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 77, 50)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 79, 43)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 79, 50)) } function setProperty(obj: T, key: K, value: T[K]) { ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 81, 21)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 81, 23)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 81, 21)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 81, 43)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 81, 21)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 81, 50)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 81, 23)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 81, 58)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 81, 21)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 81, 23)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 83, 21)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 83, 23)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 83, 21)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 83, 43)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 83, 21)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 83, 50)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 83, 23)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 83, 58)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 83, 21)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 83, 23)) obj[key] = value; ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 81, 43)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 81, 50)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 81, 58)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 83, 43)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 83, 50)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 83, 58)) } function f10(shape: Shape) { ->f10 : Symbol(f10, Decl(keyofAndIndexedAccess.ts, 83, 1)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) +>f10 : Symbol(f10, Decl(keyofAndIndexedAccess.ts, 85, 1)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let name = getProperty(shape, "name"); // string ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 86, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 88, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) let widthOrHeight = getProperty(shape, cond ? "width" : "height"); // number ->widthOrHeight : Symbol(widthOrHeight, Decl(keyofAndIndexedAccess.ts, 87, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>widthOrHeight : Symbol(widthOrHeight, Decl(keyofAndIndexedAccess.ts, 89, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) let nameOrVisible = getProperty(shape, cond ? "name" : "visible"); // string | boolean ->nameOrVisible : Symbol(nameOrVisible, Decl(keyofAndIndexedAccess.ts, 88, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>nameOrVisible : Symbol(nameOrVisible, Decl(keyofAndIndexedAccess.ts, 90, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) setProperty(shape, "name", "rectangle"); ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) setProperty(shape, cond ? "width" : "height", 10); ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) setProperty(shape, cond ? "name" : "visible", true); // Technically not safe ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) } function f11(a: Shape[]) { ->f11 : Symbol(f11, Decl(keyofAndIndexedAccess.ts, 92, 1)) ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 94, 13)) +>f11 : Symbol(f11, Decl(keyofAndIndexedAccess.ts, 94, 1)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 96, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let len = getProperty(a, "length"); // number ->len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 95, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 94, 13)) +>len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 97, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 96, 13)) setProperty(a, "length", len); ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 94, 13)) ->len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 95, 7)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 96, 13)) +>len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 97, 7)) } function f12(t: [Shape, boolean]) { ->f12 : Symbol(f12, Decl(keyofAndIndexedAccess.ts, 97, 1)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) +>f12 : Symbol(f12, Decl(keyofAndIndexedAccess.ts, 99, 1)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 101, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let len = getProperty(t, "length"); ->len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 100, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) +>len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 102, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 101, 13)) let s2 = getProperty(t, "0"); // Shape ->s2 : Symbol(s2, Decl(keyofAndIndexedAccess.ts, 101, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) +>s2 : Symbol(s2, Decl(keyofAndIndexedAccess.ts, 103, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 101, 13)) let b2 = getProperty(t, "1"); // boolean ->b2 : Symbol(b2, Decl(keyofAndIndexedAccess.ts, 102, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) +>b2 : Symbol(b2, Decl(keyofAndIndexedAccess.ts, 104, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 101, 13)) } function f13(foo: any, bar: any) { ->f13 : Symbol(f13, Decl(keyofAndIndexedAccess.ts, 103, 1)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) ->bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 105, 22)) +>f13 : Symbol(f13, Decl(keyofAndIndexedAccess.ts, 105, 1)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 107, 13)) +>bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 107, 22)) let x = getProperty(foo, "x"); // any ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 106, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 108, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 107, 13)) let y = getProperty(foo, "100"); // any ->y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 107, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 109, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 107, 13)) let z = getProperty(foo, bar); // any ->z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 108, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) ->bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 105, 22)) +>z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 110, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 107, 13)) +>bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 107, 22)) } class Component { ->Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 109, 1)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) +>Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 111, 1)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 113, 16)) props: PropType; ->props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) +>props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 113, 27)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 113, 16)) getProperty(key: K) { ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 113, 16)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 113, 42)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 113, 16)) +>getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 115, 16)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 113, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 115, 42)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 115, 16)) return this.props[key]; ->this.props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) ->this : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 109, 1)) ->props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 113, 42)) +>this.props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 113, 27)) +>this : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 111, 1)) +>props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 113, 27)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 115, 42)) } setProperty(key: K, value: PropType[K]) { ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 116, 16)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 116, 42)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 116, 16)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 116, 49)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 116, 16)) +>setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 118, 16)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 113, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 118, 42)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 118, 16)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 118, 49)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 113, 16)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 118, 16)) this.props[key] = value; ->this.props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) ->this : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 109, 1)) ->props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 116, 42)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 116, 49)) +>this.props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 113, 27)) +>this : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 111, 1)) +>props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 113, 27)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 118, 42)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 118, 49)) } } function f20(component: Component) { ->f20 : Symbol(f20, Decl(keyofAndIndexedAccess.ts, 119, 1)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 109, 1)) +>f20 : Symbol(f20, Decl(keyofAndIndexedAccess.ts, 121, 1)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 111, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let name = component.getProperty("name"); // string ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 122, 7)) ->component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 124, 7)) +>component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) let widthOrHeight = component.getProperty(cond ? "width" : "height"); // number ->widthOrHeight : Symbol(widthOrHeight, Decl(keyofAndIndexedAccess.ts, 123, 7)) ->component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>widthOrHeight : Symbol(widthOrHeight, Decl(keyofAndIndexedAccess.ts, 125, 7)) +>component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) let nameOrVisible = component.getProperty(cond ? "name" : "visible"); // string | boolean ->nameOrVisible : Symbol(nameOrVisible, Decl(keyofAndIndexedAccess.ts, 124, 7)) ->component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>nameOrVisible : Symbol(nameOrVisible, Decl(keyofAndIndexedAccess.ts, 126, 7)) +>component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) component.setProperty("name", "rectangle"); ->component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) +>component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) component.setProperty(cond ? "width" : "height", 10) ->component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) component.setProperty(cond ? "name" : "visible", true); // Technically not safe ->component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) } function pluck(array: T[], key: K) { ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 128, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 130, 15)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 130, 17)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 130, 15)) ->array : Symbol(array, Decl(keyofAndIndexedAccess.ts, 130, 37)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 130, 15)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 130, 48)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 130, 17)) +>pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 130, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 132, 15)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 132, 17)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 132, 15)) +>array : Symbol(array, Decl(keyofAndIndexedAccess.ts, 132, 37)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 132, 15)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 132, 48)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 132, 17)) return array.map(x => x[key]); >array.map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->array : Symbol(array, Decl(keyofAndIndexedAccess.ts, 130, 37)) +>array : Symbol(array, Decl(keyofAndIndexedAccess.ts, 132, 37)) >map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 131, 21)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 131, 21)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 130, 48)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 133, 21)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 133, 21)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 132, 48)) } function f30(shapes: Shape[]) { ->f30 : Symbol(f30, Decl(keyofAndIndexedAccess.ts, 132, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) +>f30 : Symbol(f30, Decl(keyofAndIndexedAccess.ts, 134, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 136, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let names = pluck(shapes, "name"); // string[] ->names : Symbol(names, Decl(keyofAndIndexedAccess.ts, 135, 7)) ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 128, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) +>names : Symbol(names, Decl(keyofAndIndexedAccess.ts, 137, 7)) +>pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 130, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 136, 13)) let widths = pluck(shapes, "width"); // number[] ->widths : Symbol(widths, Decl(keyofAndIndexedAccess.ts, 136, 7)) ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 128, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) +>widths : Symbol(widths, Decl(keyofAndIndexedAccess.ts, 138, 7)) +>pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 130, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 136, 13)) let nameOrVisibles = pluck(shapes, cond ? "name" : "visible"); // (string | boolean)[] ->nameOrVisibles : Symbol(nameOrVisibles, Decl(keyofAndIndexedAccess.ts, 137, 7)) ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 128, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>nameOrVisibles : Symbol(nameOrVisibles, Decl(keyofAndIndexedAccess.ts, 139, 7)) +>pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 130, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 136, 13)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) } function f31(key: K) { ->f31 : Symbol(f31, Decl(keyofAndIndexedAccess.ts, 138, 1)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 140, 13)) +>f31 : Symbol(f31, Decl(keyofAndIndexedAccess.ts, 140, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 142, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 140, 36)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 140, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 142, 36)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 142, 13)) const shape: Shape = { name: "foo", width: 5, height: 10, visible: true }; ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 141, 9)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 143, 9)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 141, 26)) ->width : Symbol(width, Decl(keyofAndIndexedAccess.ts, 141, 39)) ->height : Symbol(height, Decl(keyofAndIndexedAccess.ts, 141, 49)) ->visible : Symbol(visible, Decl(keyofAndIndexedAccess.ts, 141, 61)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 143, 26)) +>width : Symbol(width, Decl(keyofAndIndexedAccess.ts, 143, 39)) +>height : Symbol(height, Decl(keyofAndIndexedAccess.ts, 143, 49)) +>visible : Symbol(visible, Decl(keyofAndIndexedAccess.ts, 143, 61)) return shape[key]; // Shape[K] ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 141, 9)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 140, 36)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 143, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 142, 36)) } function f32(key: K) { ->f32 : Symbol(f32, Decl(keyofAndIndexedAccess.ts, 143, 1)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 145, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 145, 43)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 145, 13)) +>f32 : Symbol(f32, Decl(keyofAndIndexedAccess.ts, 145, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 147, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 147, 43)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 147, 13)) const shape: Shape = { name: "foo", width: 5, height: 10, visible: true }; ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 146, 9)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 148, 9)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 146, 26)) ->width : Symbol(width, Decl(keyofAndIndexedAccess.ts, 146, 39)) ->height : Symbol(height, Decl(keyofAndIndexedAccess.ts, 146, 49)) ->visible : Symbol(visible, Decl(keyofAndIndexedAccess.ts, 146, 61)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 148, 26)) +>width : Symbol(width, Decl(keyofAndIndexedAccess.ts, 148, 39)) +>height : Symbol(height, Decl(keyofAndIndexedAccess.ts, 148, 49)) +>visible : Symbol(visible, Decl(keyofAndIndexedAccess.ts, 148, 61)) return shape[key]; // Shape[K] ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 146, 9)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 145, 43)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 148, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 147, 43)) } function f33(shape: S, key: K) { ->f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 148, 1)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 150, 13)) +>f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 150, 1)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 152, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 150, 29)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 150, 13)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 150, 49)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 150, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 150, 58)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 150, 29)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 152, 29)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 152, 13)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 152, 49)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 152, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 152, 58)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 152, 29)) let name = getProperty(shape, "name"); ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 151, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 150, 49)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 153, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 152, 49)) let prop = getProperty(shape, key); ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 152, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 150, 49)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 150, 58)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 154, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 152, 49)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 152, 58)) return prop; ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 152, 7)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 154, 7)) } function f34(ts: TaggedShape) { ->f34 : Symbol(f34, Decl(keyofAndIndexedAccess.ts, 154, 1)) ->ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 156, 13)) +>f34 : Symbol(f34, Decl(keyofAndIndexedAccess.ts, 156, 1)) +>ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 158, 13)) >TaggedShape : Symbol(TaggedShape, Decl(keyofAndIndexedAccess.ts, 6, 1)) let tag1 = f33(ts, "tag"); ->tag1 : Symbol(tag1, Decl(keyofAndIndexedAccess.ts, 157, 7)) ->f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 148, 1)) ->ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 156, 13)) +>tag1 : Symbol(tag1, Decl(keyofAndIndexedAccess.ts, 159, 7)) +>f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 150, 1)) +>ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 158, 13)) let tag2 = getProperty(ts, "tag"); ->tag2 : Symbol(tag2, Decl(keyofAndIndexedAccess.ts, 158, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 156, 13)) +>tag2 : Symbol(tag2, Decl(keyofAndIndexedAccess.ts, 160, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 158, 13)) } class C { ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 161, 1)) public x: string; ->x : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 161, 9)) +>x : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 163, 9)) protected y: string; ->y : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 162, 21)) +>y : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 164, 21)) private z: string; ->z : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 163, 24)) +>z : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 165, 24)) } // Indexed access expressions have always permitted access to private and protected members. // For consistency we also permit such access in indexed access types. function f40(c: C) { ->f40 : Symbol(f40, Decl(keyofAndIndexedAccess.ts, 165, 1)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 169, 13)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) +>f40 : Symbol(f40, Decl(keyofAndIndexedAccess.ts, 167, 1)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 171, 13)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 161, 1)) type X = C["x"]; ->X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 169, 20)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) +>X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 171, 20)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 161, 1)) type Y = C["y"]; ->Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 170, 20)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) +>Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 172, 20)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 161, 1)) type Z = C["z"]; ->Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 171, 20)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) +>Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 173, 20)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 161, 1)) let x: X = c["x"]; ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 173, 7)) ->X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 169, 20)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 169, 13)) ->"x" : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 161, 9)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 175, 7)) +>X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 171, 20)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 171, 13)) +>"x" : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 163, 9)) let y: Y = c["y"]; ->y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 174, 7)) ->Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 170, 20)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 169, 13)) ->"y" : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 162, 21)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 176, 7)) +>Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 172, 20)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 171, 13)) +>"y" : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 164, 21)) let z: Z = c["z"]; ->z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 175, 7)) ->Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 171, 20)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 169, 13)) ->"z" : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 163, 24)) +>z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 177, 7)) +>Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 173, 20)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 171, 13)) +>"z" : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 165, 24)) } function f50(k: keyof T, s: string) { ->f50 : Symbol(f50, Decl(keyofAndIndexedAccess.ts, 176, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 178, 13)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 178, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 178, 13)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 178, 27)) +>f50 : Symbol(f50, Decl(keyofAndIndexedAccess.ts, 178, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 180, 13)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 180, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 180, 13)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 180, 27)) const x1 = s as keyof T; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 179, 9)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 178, 27)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 178, 13)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 181, 9)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 180, 27)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 180, 13)) const x2 = k as string; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 180, 9)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 178, 16)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 182, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 180, 16)) } function f51(k: K, s: string) { ->f51 : Symbol(f51, Decl(keyofAndIndexedAccess.ts, 181, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 183, 13)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 183, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 183, 13)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 183, 35)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 183, 15)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 183, 40)) +>f51 : Symbol(f51, Decl(keyofAndIndexedAccess.ts, 183, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 185, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 185, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 185, 13)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 185, 35)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 185, 15)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 185, 40)) const x1 = s as keyof T; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 184, 9)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 183, 40)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 183, 13)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 186, 9)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 185, 40)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 185, 13)) const x2 = k as string; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 185, 9)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 183, 35)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 187, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 185, 35)) } function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) { ->f52 : Symbol(f52, Decl(keyofAndIndexedAccess.ts, 186, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 188, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 188, 24)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 188, 46)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 188, 13)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 188, 58)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 188, 69)) +>f52 : Symbol(f52, Decl(keyofAndIndexedAccess.ts, 188, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 190, 16)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 190, 24)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 46)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 190, 58)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 190, 69)) const x1 = obj[s]; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 189, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 188, 58)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 191, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 190, 16)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 190, 58)) const x2 = obj[n]; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 190, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 188, 69)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 192, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 190, 16)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 190, 69)) const x3 = obj[k]; ->x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 191, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 188, 46)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 193, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 190, 16)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 46)) } function f53(obj: { [x: string]: boolean }, k: K, s: string, n: number) { ->f53 : Symbol(f53, Decl(keyofAndIndexedAccess.ts, 192, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 194, 13)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 194, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 194, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 194, 43)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 194, 65)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 194, 15)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 194, 71)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 194, 82)) +>f53 : Symbol(f53, Decl(keyofAndIndexedAccess.ts, 194, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 196, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 196, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 196, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 196, 35)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 196, 43)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 196, 65)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 196, 15)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 196, 71)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 196, 82)) const x1 = obj[s]; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 195, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 194, 71)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 197, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 196, 35)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 196, 71)) const x2 = obj[n]; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 196, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 194, 82)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 198, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 196, 35)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 196, 82)) const x3 = obj[k]; ->x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 197, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 194, 65)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 199, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 196, 35)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 196, 65)) } function f54(obj: T, key: keyof T) { ->f54 : Symbol(f54, Decl(keyofAndIndexedAccess.ts, 198, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 200, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 200, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 200, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 200, 23)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 200, 13)) +>f54 : Symbol(f54, Decl(keyofAndIndexedAccess.ts, 200, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 202, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 202, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 202, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 202, 23)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 202, 13)) for (let s in obj[key]) { ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 201, 12)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 200, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 200, 23)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 203, 12)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 202, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 202, 23)) } const b = "foo" in obj[key]; ->b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 203, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 200, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 200, 23)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 205, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 202, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 202, 23)) } function f55(obj: T, key: K) { ->f55 : Symbol(f55, Decl(keyofAndIndexedAccess.ts, 204, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 206, 13)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 206, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 206, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 206, 35)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 206, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 206, 42)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 206, 15)) +>f55 : Symbol(f55, Decl(keyofAndIndexedAccess.ts, 206, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 208, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 208, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 208, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 208, 35)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 208, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 208, 42)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 208, 15)) for (let s in obj[key]) { ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 207, 12)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 206, 35)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 206, 42)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 209, 12)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 208, 35)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 208, 42)) } const b = "foo" in obj[key]; ->b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 209, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 206, 35)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 206, 42)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 211, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 208, 35)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 208, 42)) } function f60(source: T, target: T) { ->f60 : Symbol(f60, Decl(keyofAndIndexedAccess.ts, 210, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 212, 13)) ->source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 212, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 212, 13)) ->target : Symbol(target, Decl(keyofAndIndexedAccess.ts, 212, 26)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 212, 13)) +>f60 : Symbol(f60, Decl(keyofAndIndexedAccess.ts, 212, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 214, 13)) +>source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 214, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 214, 13)) +>target : Symbol(target, Decl(keyofAndIndexedAccess.ts, 214, 26)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 214, 13)) for (let k in source) { ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 213, 12)) ->source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 212, 16)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 215, 12)) +>source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 214, 16)) target[k] = source[k]; ->target : Symbol(target, Decl(keyofAndIndexedAccess.ts, 212, 26)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 213, 12)) ->source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 212, 16)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 213, 12)) +>target : Symbol(target, Decl(keyofAndIndexedAccess.ts, 214, 26)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 215, 12)) +>source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 214, 16)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 215, 12)) + } +} + +function f70(func: (k1: keyof (T | U), k2: keyof (T & U)) => void) { +>f70 : Symbol(f70, Decl(keyofAndIndexedAccess.ts, 218, 1)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 220, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 220, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 220, 22)) +>k1 : Symbol(k1, Decl(keyofAndIndexedAccess.ts, 220, 26)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 220, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 220, 22)) +>k2 : Symbol(k2, Decl(keyofAndIndexedAccess.ts, 220, 44)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 220, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 220, 22)) + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'a'); +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 220, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 221, 10)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 221, 18)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 221, 30)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 221, 38)) + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'b'); +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 220, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 222, 10)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 222, 18)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 222, 30)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 222, 38)) + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'c'); +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 220, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 223, 10)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 223, 18)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 223, 30)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 223, 38)) +} + +function f71(func: (x: T, y: U) => Partial) { +>f71 : Symbol(f71, Decl(keyofAndIndexedAccess.ts, 224, 1)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 226, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 226, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 226, 22)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 226, 26)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 226, 20)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 226, 31)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 226, 22)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 226, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 226, 22)) + + let x = func({ a: 1, b: "hello" }, { c: true }); +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 227, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 226, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 227, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 227, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 227, 40)) + + x.a; // number | undefined +>x.a : Symbol(a) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 227, 7)) +>a : Symbol(a) + + x.b; // string | undefined +>x.b : Symbol(b) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 227, 7)) +>b : Symbol(b) + + x.c; // boolean | undefined +>x.c : Symbol(c) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 227, 7)) +>c : Symbol(c) +} + +function f72(func: (x: T, y: U, k: K) => (T & U)[K]) { +>f72 : Symbol(f72, Decl(keyofAndIndexedAccess.ts, 231, 1)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 233, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 233, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 233, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 233, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 233, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 233, 22)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 233, 55)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 233, 20)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 233, 60)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 233, 22)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 233, 66)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 233, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 233, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 233, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 233, 25)) + + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 234, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 233, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 234, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 234, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 234, 40)) + + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 235, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 233, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 235, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 235, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 235, 40)) + + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 236, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 233, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 236, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 236, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 236, 40)) +} + +function f73(func: (x: T, y: U, k: K) => (T & U)[K]) { +>f73 : Symbol(f73, Decl(keyofAndIndexedAccess.ts, 237, 1)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 239, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 239, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 239, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 239, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 239, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 239, 22)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 239, 51)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 239, 20)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 239, 56)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 239, 22)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 239, 62)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 239, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 239, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 239, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 239, 25)) + + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 240, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 239, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 240, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 240, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 240, 40)) + + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 241, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 239, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 241, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 241, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 241, 40)) + + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 242, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 239, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 242, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 242, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 242, 40)) +} + +function f74(func: (x: T, y: U, k: K) => (T | U)[K]) { +>f74 : Symbol(f74, Decl(keyofAndIndexedAccess.ts, 243, 1)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 245, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 245, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 245, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 245, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 245, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 245, 22)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 245, 51)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 245, 20)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 245, 56)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 245, 22)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 245, 62)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 245, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 245, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 245, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 245, 25)) + + let a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 246, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 245, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 246, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 246, 24)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 246, 40)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 246, 46)) + + let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 247, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 245, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 247, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 247, 24)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 247, 40)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 247, 46)) +} + +function f80(obj: T) { +>f80 : Symbol(f80, Decl(keyofAndIndexedAccess.ts, 248, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13)) + + let a1 = obj.a; // { x: any } +>a1 : Symbol(a1, Decl(keyofAndIndexedAccess.ts, 251, 7)) +>obj.a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) + + let a2 = obj['a']; // { x: any } +>a2 : Symbol(a2, Decl(keyofAndIndexedAccess.ts, 252, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) + + let a3 = obj['a'] as T['a']; // T["a"] +>a3 : Symbol(a3, Decl(keyofAndIndexedAccess.ts, 253, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13)) + + let x1 = obj.a.x; // any +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 254, 7)) +>obj.a.x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29)) +>obj.a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29)) + + let x2 = obj['a']['x']; // any +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 255, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29)) + + let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"] +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 256, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13)) +} + +function f81(obj: T) { +>f81 : Symbol(f81, Decl(keyofAndIndexedAccess.ts, 257, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 259, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 259, 24)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 259, 29)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 259, 42)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 259, 13)) + + return obj['a']['x'] as T['a']['x']; +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 259, 42)) +>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 259, 24)) +>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 259, 29)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 259, 13)) +} + +function f82() { +>f82 : Symbol(f82, Decl(keyofAndIndexedAccess.ts, 261, 1)) + + let x1 = f81({ a: { x: "hello" } }); // string +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 264, 7)) +>f81 : Symbol(f81, Decl(keyofAndIndexedAccess.ts, 257, 1)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 264, 18)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 264, 23)) + + let x2 = f81({ a: { x: 42 } }); // number +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 265, 7)) +>f81 : Symbol(f81, Decl(keyofAndIndexedAccess.ts, 257, 1)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 265, 18)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 265, 23)) +} + +function f83(obj: T, key: K) { +>f83 : Symbol(f83, Decl(keyofAndIndexedAccess.ts, 266, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 268, 26)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 268, 39)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 268, 51)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 268, 71)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 268, 78)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 268, 51)) + + return obj[key]['x'] as T[K]['x']; +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 268, 71)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 268, 78)) +>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 268, 39)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 268, 51)) +} + +function f84() { +>f84 : Symbol(f84, Decl(keyofAndIndexedAccess.ts, 270, 1)) + + let x1 = f83({ foo: { x: "hello" } }, "foo"); // string +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 273, 7)) +>f83 : Symbol(f83, Decl(keyofAndIndexedAccess.ts, 266, 1)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 273, 18)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 273, 25)) + + let x2 = f83({ bar: { x: 42 } }, "bar"); // number +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 274, 7)) +>f83 : Symbol(f83, Decl(keyofAndIndexedAccess.ts, 266, 1)) +>bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 274, 18)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 274, 25)) +} + +class C1 { +>C1 : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) + + x: number; +>x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) + + get(key: K) { +>get : Symbol(C1.get, Decl(keyofAndIndexedAccess.ts, 278, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 279, 8)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 279, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 279, 8)) + + return this[key]; +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 279, 30)) + } + set(key: K, value: this[K]) { +>set : Symbol(C1.set, Decl(keyofAndIndexedAccess.ts, 281, 5)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 282, 8)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 282, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 282, 8)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 282, 37)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 282, 8)) + + this[key] = value; +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 282, 30)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 282, 37)) + } + foo() { +>foo : Symbol(C1.foo, Decl(keyofAndIndexedAccess.ts, 284, 5)) + + let x1 = this.x; // number +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 286, 11)) +>this.x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) + + let x2 = this["x"]; // number +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 287, 11)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>"x" : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) + + let x3 = this.get("x"); // this["x"] +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 288, 11)) +>this.get : Symbol(C1.get, Decl(keyofAndIndexedAccess.ts, 278, 14)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>get : Symbol(C1.get, Decl(keyofAndIndexedAccess.ts, 278, 14)) + + let x4 = getProperty(this, "x"); // this["x"] +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 289, 11)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) + + this.x = 42; +>this.x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) + + this["x"] = 42; +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>"x" : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) + + this.set("x", 42); +>this.set : Symbol(C1.set, Decl(keyofAndIndexedAccess.ts, 281, 5)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>set : Symbol(C1.set, Decl(keyofAndIndexedAccess.ts, 281, 5)) + + setProperty(this, "x", 42); +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) } } // Repros from #12011 class Base { ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) get(prop: K) { ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 220, 12)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 221, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 221, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 221, 8)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 300, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 300, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 300, 8)) return this[prop]; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 221, 30)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 300, 30)) } set(prop: K, value: this[K]) { ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 223, 5)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 224, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 224, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 224, 8)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 224, 38)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 224, 8)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 303, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 303, 38)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8)) this[prop] = value; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 224, 30)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 224, 38)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 303, 30)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 303, 38)) } } class Person extends Base { ->Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 227, 1)) ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) +>Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) parts: number; ->parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 229, 27)) +>parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 308, 27)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 231, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 310, 16)) super(); ->super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) +>super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) this.set("parts", parts); ->this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 223, 5)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 227, 1)) ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 223, 5)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 231, 16)) +>this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 310, 16)) } getParts() { ->getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 234, 5)) +>getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 313, 5)) return this.get("parts") ->this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 220, 12)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 227, 1)) ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 220, 12)) +>this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12)) } } class OtherPerson { ->OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 238, 1)) +>OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1)) parts: number; ->parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 240, 19)) +>parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 319, 19)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 242, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 321, 16)) setProperty(this, "parts", parts); ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 238, 1)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 242, 16)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 321, 16)) } getParts() { ->getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 244, 5)) +>getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 323, 5)) return getProperty(this, "parts") ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 238, 1)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1)) } } + +// Modified repro from #12544 + +function path(obj: T, key1: K1): T[K1]; +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 331, 37)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 331, 44)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16)) + +function path(obj: T, key1: K1, key2: K2): T[K1][K2]; +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 332, 61)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 332, 68)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 332, 78)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36)) + +function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 333, 89)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 333, 96)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 333, 106)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) +>key3 : Symbol(key3, Decl(keyofAndIndexedAccess.ts, 333, 116)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60)) + +function path(obj: any, ...keys: (string | number)[]): any; +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 334, 14)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 334, 23)) + +function path(obj: any, ...keys: (string | number)[]): any { +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 335, 14)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 335, 23)) + + let result = obj; +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 335, 14)) + + for (let k of keys) { +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 337, 12)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 335, 23)) + + result = result[k]; +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 337, 12)) + } + return result; +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) +} + +type Thing = { +>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 341, 1)) + + a: { x: number, y: string }, +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 343, 14)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 344, 8)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 344, 19)) + + b: boolean +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 344, 32)) + +}; + + +function f1(thing: Thing) { +>f1 : Symbol(f1, Decl(keyofAndIndexedAccess.ts, 346, 2)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) +>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 341, 1)) + + let x1 = path(thing, 'a'); // { x: number, y: string } +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 350, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) + + let x2 = path(thing, 'a', 'y'); // string +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 351, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) + + let x3 = path(thing, 'b'); // boolean +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 352, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) + + let x4 = path(thing, ...['a', 'x']); // any +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 353, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) +} + +// Repro from comment in #12114 + +const assignTo2 = (object: T, key1: K1, key2: K2) => +>assignTo2 : Symbol(assignTo2, Decl(keyofAndIndexedAccess.ts, 358, 5)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) +>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 358, 66)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 358, 76)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 358, 86)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41)) + + (value: T[K1][K2]) => object[key1][key2] = value; +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 359, 5)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41)) +>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 358, 66)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 358, 76)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 358, 86)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 359, 5)) + +// Modified repro from #12573 + +declare function one(handler: (t: T) => void): T +>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 359, 53)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21)) +>handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 363, 24)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 363, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21)) + +var empty = one(() => {}) // inferred as {}, expected +>empty : Symbol(empty, Decl(keyofAndIndexedAccess.ts, 364, 3)) +>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 359, 53)) + +type Handlers = { [K in keyof T]: (t: T[K]) => void } +>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 364, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 366, 22)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 366, 38)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 366, 22)) + +declare function on(handlerHash: Handlers): T +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20)) +>handlerHash : Symbol(handlerHash, Decl(keyofAndIndexedAccess.ts, 367, 23)) +>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 364, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20)) + +var hashOfEmpty1 = on({ test: () => {} }); // {} +>hashOfEmpty1 : Symbol(hashOfEmpty1, Decl(keyofAndIndexedAccess.ts, 368, 3)) +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56)) +>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 368, 23)) + +var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } +>hashOfEmpty2 : Symbol(hashOfEmpty2, Decl(keyofAndIndexedAccess.ts, 369, 3)) +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56)) +>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 369, 23)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 369, 31)) + +// Repro from #12624 + +interface Options1 { +>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 369, 52)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 373, 19)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 373, 24)) + + data?: Data +>data : Symbol(Options1.data, Decl(keyofAndIndexedAccess.ts, 373, 36)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 373, 19)) + + computed?: Computed; +>computed : Symbol(Options1.computed, Decl(keyofAndIndexedAccess.ts, 374, 15)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 373, 24)) +} + +declare class Component1 { +>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 376, 1)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) + + constructor(options: Options1); +>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 379, 16)) +>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 369, 52)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) + + get(key: K): (Data & Computed)[K]; +>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 380, 43)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8)) +} + +let c1 = new Component1({ +>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 383, 3)) +>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 376, 1)) + + data: { +>data : Symbol(data, Decl(keyofAndIndexedAccess.ts, 383, 25)) + + hello: "" +>hello : Symbol(hello, Decl(keyofAndIndexedAccess.ts, 384, 11)) + } +}); + +c1.get("hello"); +>c1.get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51)) +>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 383, 3)) +>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51)) + +// Repro from #12625 + +interface Options2 { +>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 389, 16)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 393, 19)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 393, 24)) + + data?: Data +>data : Symbol(Options2.data, Decl(keyofAndIndexedAccess.ts, 393, 36)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 393, 19)) + + computed?: Computed; +>computed : Symbol(Options2.computed, Decl(keyofAndIndexedAccess.ts, 394, 15)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 393, 24)) +} + +declare class Component2 { +>Component2 : Symbol(Component2, Decl(keyofAndIndexedAccess.ts, 396, 1)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) + + constructor(options: Options2); +>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 399, 16)) +>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 389, 16)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) + + get(key: K): (Data & Computed)[K]; +>get : Symbol(Component2.get, Decl(keyofAndIndexedAccess.ts, 399, 51)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 400, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8)) +} + +// Repro from #12641 + +interface R { +>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 401, 1)) + + p: number; +>p : Symbol(R.p, Decl(keyofAndIndexedAccess.ts, 405, 13)) +} + +function f(p: K) { +>f : Symbol(f, Decl(keyofAndIndexedAccess.ts, 407, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 409, 11)) +>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 401, 1)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 409, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 409, 11)) + + let a: any; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 410, 7)) + + a[p].add; // any +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 410, 7)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 409, 30)) +} + +// Repro from #12651 + +type MethodDescriptor = { +>MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 412, 1)) + + name: string; +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 416, 25)) + + args: any[]; +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 417, 14)) + + returnValue: any; +>returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 418, 13)) +} + +declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; +>dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 420, 1)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) +>MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 412, 1)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 422, 60)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 422, 76)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) + +type SomeMethodDescriptor = { +>SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 422, 112)) + + name: "someMethod"; +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 424, 29)) + + args: [string, number]; +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 425, 20)) + + returnValue: string[]; +>returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 426, 24)) +} + +let result = dispatchMethod("someMethod", ["hello", 35]); +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 430, 3)) +>dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 420, 1)) +>SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 422, 112)) + diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index 916b82aaf40..f94249806f6 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -47,16 +47,22 @@ type Dictionary = { [x: string]: T }; >x : string >T : T +type NumericallyIndexed = { [x: number]: T }; +>NumericallyIndexed : NumericallyIndexed +>T : T +>x : number +>T : T + const enum E { A, B, C } >E : E >A : E.A >B : E.B >C : E.C -type K00 = keyof any; // string | number +type K00 = keyof any; // string >K00 : string -type K01 = keyof string; // number | "toString" | "charAt" | ... +type K01 = keyof string; // "toString" | "charAt" | ... >K01 : "length" | "toString" | "concat" | "slice" | "indexOf" | "lastIndexOf" | "charAt" | "charCodeAt" | "localeCompare" | "match" | "replace" | "search" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "substr" | "valueOf" type K02 = keyof number; // "toString" | "toFixed" | "toExponential" | ... @@ -82,11 +88,11 @@ type K10 = keyof Shape; // "name" | "width" | "height" | "visible" >K10 : "name" | "width" | "height" | "visible" >Shape : Shape -type K11 = keyof Shape[]; // number | "length" | "toString" | ... +type K11 = keyof Shape[]; // "length" | "toString" | ... >K11 : "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight" >Shape : Shape -type K12 = keyof Dictionary; // string | number +type K12 = keyof Dictionary; // string >K12 : string >Dictionary : Dictionary >Shape : Shape @@ -102,7 +108,7 @@ type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ... >K15 : "toString" | "toLocaleString" | "valueOf" | "toFixed" | "toExponential" | "toPrecision" >E : E -type K16 = keyof [string, number]; // number | "0" | "1" | "length" | "toString" | ... +type K16 = keyof [string, number]; // "0" | "1" | "length" | "toString" | ... >K16 : "0" | "1" | "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight" type K17 = keyof (Shape | Item); // "name" @@ -115,6 +121,11 @@ type K18 = keyof (Shape & Item); // "name" | "width" | "height" | "visible" | " >Shape : Shape >Item : Item +type K19 = keyof NumericallyIndexed // never +>K19 : never +>NumericallyIndexed : NumericallyIndexed +>Shape : Shape + type KeyOf = keyof T; >KeyOf : keyof T >T : T @@ -125,7 +136,7 @@ type K20 = KeyOf; // "name" | "width" | "height" | "visible" >KeyOf : keyof T >Shape : Shape -type K21 = KeyOf>; // string | number +type K21 = KeyOf>; // string >K21 : string >KeyOf : keyof T >Dictionary : Dictionary @@ -615,8 +626,8 @@ function f33(shape: S, key: K) { >K : K let name = getProperty(shape, "name"); ->name : string ->getProperty(shape, "name") : string +>name : S["name"] +>getProperty(shape, "name") : S["name"] >getProperty : (obj: T, key: K) => T[K] >shape : S >"name" : "name" @@ -769,8 +780,8 @@ function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) >n : number const x3 = obj[k]; ->x3 : boolean ->obj[k] : boolean +>x3 : { [x: string]: boolean; }[keyof T] +>obj[k] : { [x: string]: boolean; }[keyof T] >obj : { [x: string]: boolean; } >k : keyof T } @@ -815,7 +826,7 @@ function f54(obj: T, key: keyof T) { >T : T for (let s in obj[key]) { ->s : string +>s : keyof T[keyof T] >obj[key] : T[keyof T] >obj : T >key : keyof T @@ -840,7 +851,7 @@ function f55(obj: T, key: K) { >K : K for (let s in obj[key]) { ->s : string +>s : keyof T[K] >obj[key] : T[K] >obj : T >key : K @@ -877,6 +888,503 @@ function f60(source: T, target: T) { } } +function f70(func: (k1: keyof (T | U), k2: keyof (T & U)) => void) { +>f70 : (func: (k1: keyof (T | U), k2: keyof (T & U)) => void) => void +>func : (k1: keyof (T | U), k2: keyof (T & U)) => void +>T : T +>U : U +>k1 : keyof (T | U) +>T : T +>U : U +>k2 : keyof (T & U) +>T : T +>U : U + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'a'); +>func<{ a: any, b: any }, { a: any, c: any }>('a', 'a') : void +>func : (k1: keyof (T | U), k2: keyof (T & U)) => void +>a : any +>b : any +>a : any +>c : any +>'a' : "a" +>'a' : "a" + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'b'); +>func<{ a: any, b: any }, { a: any, c: any }>('a', 'b') : void +>func : (k1: keyof (T | U), k2: keyof (T & U)) => void +>a : any +>b : any +>a : any +>c : any +>'a' : "a" +>'b' : "b" + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'c'); +>func<{ a: any, b: any }, { a: any, c: any }>('a', 'c') : void +>func : (k1: keyof (T | U), k2: keyof (T & U)) => void +>a : any +>b : any +>a : any +>c : any +>'a' : "a" +>'c' : "c" +} + +function f71(func: (x: T, y: U) => Partial) { +>f71 : (func: (x: T, y: U) => Partial) => void +>func : (x: T, y: U) => Partial +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>Partial : Partial +>T : T +>U : U + + let x = func({ a: 1, b: "hello" }, { c: true }); +>x : Partial<{ a: number; b: string; } & { c: boolean; }> +>func({ a: 1, b: "hello" }, { c: true }) : Partial<{ a: number; b: string; } & { c: boolean; }> +>func : (x: T, y: U) => Partial +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true + + x.a; // number | undefined +>x.a : number | undefined +>x : Partial<{ a: number; b: string; } & { c: boolean; }> +>a : number | undefined + + x.b; // string | undefined +>x.b : string | undefined +>x : Partial<{ a: number; b: string; } & { c: boolean; }> +>b : string | undefined + + x.c; // boolean | undefined +>x.c : boolean | undefined +>x : Partial<{ a: number; b: string; } & { c: boolean; }> +>c : boolean | undefined +} + +function f72(func: (x: T, y: U, k: K) => (T & U)[K]) { +>f72 : (func: (x: T, y: U, k: K) => (T & U)[K]) => void +>func : (x: T, y: U, k: K) => (T & U)[K] +>T : T +>U : U +>K : K +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>k : K +>K : K +>T : T +>U : U +>K : K + + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number +>a : number +>func({ a: 1, b: "hello" }, { c: true }, 'a') : number +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'a' : "a" + + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string +>b : string +>func({ a: 1, b: "hello" }, { c: true }, 'b') : string +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'b' : "b" + + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +>c : boolean +>func({ a: 1, b: "hello" }, { c: true }, 'c') : boolean +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'c' : "c" +} + +function f73(func: (x: T, y: U, k: K) => (T & U)[K]) { +>f73 : (func: (x: T, y: U, k: K) => (T & U)[K]) => void +>func : (x: T, y: U, k: K) => (T & U)[K] +>T : T +>U : U +>K : K +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>k : K +>K : K +>T : T +>U : U +>K : K + + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number +>a : number +>func({ a: 1, b: "hello" }, { c: true }, 'a') : number +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'a' : "a" + + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string +>b : string +>func({ a: 1, b: "hello" }, { c: true }, 'b') : string +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'b' : "b" + + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +>c : boolean +>func({ a: 1, b: "hello" }, { c: true }, 'c') : boolean +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'c' : "c" +} + +function f74(func: (x: T, y: U, k: K) => (T | U)[K]) { +>f74 : (func: (x: T, y: U, k: K) => (T | U)[K]) => void +>func : (x: T, y: U, k: K) => (T | U)[K] +>T : T +>U : U +>K : K +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>k : K +>K : K +>T : T +>U : U +>K : K + + let a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number +>a : number +>func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a') : number +>func : (x: T, y: U, k: K) => (T | U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ a: 2, b: true } : { a: number; b: true; } +>a : number +>2 : 2 +>b : boolean +>true : true +>'a' : "a" + + let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean +>b : string | boolean +>func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b') : string | boolean +>func : (x: T, y: U, k: K) => (T | U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ a: 2, b: true } : { a: number; b: true; } +>a : number +>2 : 2 +>b : boolean +>true : true +>'b' : "b" +} + +function f80(obj: T) { +>f80 : (obj: T) => void +>T : T +>a : { x: any; } +>x : any +>obj : T +>T : T + + let a1 = obj.a; // { x: any } +>a1 : { x: any; } +>obj.a : { x: any; } +>obj : T +>a : { x: any; } + + let a2 = obj['a']; // { x: any } +>a2 : { x: any; } +>obj['a'] : { x: any; } +>obj : T +>'a' : "a" + + let a3 = obj['a'] as T['a']; // T["a"] +>a3 : T["a"] +>obj['a'] as T['a'] : T["a"] +>obj['a'] : { x: any; } +>obj : T +>'a' : "a" +>T : T + + let x1 = obj.a.x; // any +>x1 : any +>obj.a.x : any +>obj.a : { x: any; } +>obj : T +>a : { x: any; } +>x : any + + let x2 = obj['a']['x']; // any +>x2 : any +>obj['a']['x'] : any +>obj['a'] : { x: any; } +>obj : T +>'a' : "a" +>'x' : "x" + + let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"] +>x3 : T["a"]["x"] +>obj['a']['x'] as T['a']['x'] : T["a"]["x"] +>obj['a']['x'] : any +>obj['a'] : { x: any; } +>obj : T +>'a' : "a" +>'x' : "x" +>T : T +} + +function f81(obj: T) { +>f81 : (obj: T) => T["a"]["x"] +>T : T +>a : { x: any; } +>x : any +>obj : T +>T : T + + return obj['a']['x'] as T['a']['x']; +>obj['a']['x'] as T['a']['x'] : T["a"]["x"] +>obj['a']['x'] : any +>obj['a'] : { x: any; } +>obj : T +>'a' : "a" +>'x' : "x" +>T : T +} + +function f82() { +>f82 : () => void + + let x1 = f81({ a: { x: "hello" } }); // string +>x1 : string +>f81({ a: { x: "hello" } }) : string +>f81 : (obj: T) => T["a"]["x"] +>{ a: { x: "hello" } } : { a: { x: string; }; } +>a : { x: string; } +>{ x: "hello" } : { x: string; } +>x : string +>"hello" : "hello" + + let x2 = f81({ a: { x: 42 } }); // number +>x2 : number +>f81({ a: { x: 42 } }) : number +>f81 : (obj: T) => T["a"]["x"] +>{ a: { x: 42 } } : { a: { x: number; }; } +>a : { x: number; } +>{ x: 42 } : { x: number; } +>x : number +>42 : 42 +} + +function f83(obj: T, key: K) { +>f83 : (obj: T, key: K) => T[K]["x"] +>T : T +>x : string +>x : any +>K : K +>T : T +>obj : T +>T : T +>key : K +>K : K + + return obj[key]['x'] as T[K]['x']; +>obj[key]['x'] as T[K]['x'] : T[K]["x"] +>obj[key]['x'] : any +>obj[key] : T[K] +>obj : T +>key : K +>'x' : "x" +>T : T +>K : K +} + +function f84() { +>f84 : () => void + + let x1 = f83({ foo: { x: "hello" } }, "foo"); // string +>x1 : string +>f83({ foo: { x: "hello" } }, "foo") : string +>f83 : (obj: T, key: K) => T[K]["x"] +>{ foo: { x: "hello" } } : { foo: { x: string; }; } +>foo : { x: string; } +>{ x: "hello" } : { x: string; } +>x : string +>"hello" : "hello" +>"foo" : "foo" + + let x2 = f83({ bar: { x: 42 } }, "bar"); // number +>x2 : number +>f83({ bar: { x: 42 } }, "bar") : number +>f83 : (obj: T, key: K) => T[K]["x"] +>{ bar: { x: 42 } } : { bar: { x: number; }; } +>bar : { x: number; } +>{ x: 42 } : { x: number; } +>x : number +>42 : 42 +>"bar" : "bar" +} + +class C1 { +>C1 : C1 + + x: number; +>x : number + + get(key: K) { +>get : (key: K) => this[K] +>K : K +>key : K +>K : K + + return this[key]; +>this[key] : this[K] +>this : this +>key : K + } + set(key: K, value: this[K]) { +>set : (key: K, value: this[K]) => void +>K : K +>key : K +>K : K +>value : this[K] +>K : K + + this[key] = value; +>this[key] = value : this[K] +>this[key] : this[K] +>this : this +>key : K +>value : this[K] + } + foo() { +>foo : () => void + + let x1 = this.x; // number +>x1 : number +>this.x : number +>this : this +>x : number + + let x2 = this["x"]; // number +>x2 : number +>this["x"] : number +>this : this +>"x" : "x" + + let x3 = this.get("x"); // this["x"] +>x3 : this["x"] +>this.get("x") : this["x"] +>this.get : (key: K) => this[K] +>this : this +>get : (key: K) => this[K] +>"x" : "x" + + let x4 = getProperty(this, "x"); // this["x"] +>x4 : this["x"] +>getProperty(this, "x") : this["x"] +>getProperty : (obj: T, key: K) => T[K] +>this : this +>"x" : "x" + + this.x = 42; +>this.x = 42 : 42 +>this.x : number +>this : this +>x : number +>42 : 42 + + this["x"] = 42; +>this["x"] = 42 : 42 +>this["x"] : number +>this : this +>"x" : "x" +>42 : 42 + + this.set("x", 42); +>this.set("x", 42) : void +>this.set : (key: K, value: this[K]) => void +>this : this +>set : (key: K, value: this[K]) => void +>"x" : "x" +>42 : 42 + + setProperty(this, "x", 42); +>setProperty(this, "x", 42) : void +>setProperty : (obj: T, key: K, value: T[K]) => void +>this : this +>"x" : "x" +>42 : 42 + } +} + // Repros from #12011 class Base { @@ -933,10 +1441,10 @@ class Person extends Base { >parts : number } getParts() { ->getParts : () => number +>getParts : () => this["parts"] return this.get("parts") ->this.get("parts") : number +>this.get("parts") : this["parts"] >this.get : (prop: K) => this[K] >this : this >get : (prop: K) => this[K] @@ -961,12 +1469,409 @@ class OtherPerson { >parts : number } getParts() { ->getParts : () => number +>getParts : () => this["parts"] return getProperty(this, "parts") ->getProperty(this, "parts") : number +>getProperty(this, "parts") : this["parts"] >getProperty : (obj: T, key: K) => T[K] >this : this >"parts" : "parts" } } + +// Modified repro from #12544 + +function path(obj: T, key1: K1): T[K1]; +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>T : T +>K1 : K1 +>T : T +>obj : T +>T : T +>key1 : K1 +>K1 : K1 +>T : T +>K1 : K1 + +function path(obj: T, key1: K1, key2: K2): T[K1][K2]; +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>T : T +>K1 : K1 +>T : T +>K2 : K2 +>T : T +>K1 : K1 +>obj : T +>T : T +>key1 : K1 +>K1 : K1 +>key2 : K2 +>K2 : K2 +>T : T +>K1 : K1 +>K2 : K2 + +function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>T : T +>K1 : K1 +>T : T +>K2 : K2 +>T : T +>K1 : K1 +>K3 : K3 +>T : T +>K1 : K1 +>K2 : K2 +>obj : T +>T : T +>key1 : K1 +>K1 : K1 +>key2 : K2 +>K2 : K2 +>key3 : K3 +>K3 : K3 +>T : T +>K1 : K1 +>K2 : K2 +>K3 : K3 + +function path(obj: any, ...keys: (string | number)[]): any; +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>obj : any +>keys : (string | number)[] + +function path(obj: any, ...keys: (string | number)[]): any { +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>obj : any +>keys : (string | number)[] + + let result = obj; +>result : any +>obj : any + + for (let k of keys) { +>k : string | number +>keys : (string | number)[] + + result = result[k]; +>result = result[k] : any +>result : any +>result[k] : any +>result : any +>k : string | number + } + return result; +>result : any +} + +type Thing = { +>Thing : Thing + + a: { x: number, y: string }, +>a : { x: number; y: string; } +>x : number +>y : string + + b: boolean +>b : boolean + +}; + + +function f1(thing: Thing) { +>f1 : (thing: Thing) => void +>thing : Thing +>Thing : Thing + + let x1 = path(thing, 'a'); // { x: number, y: string } +>x1 : { x: number; y: string; } +>path(thing, 'a') : { x: number; y: string; } +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>thing : Thing +>'a' : "a" + + let x2 = path(thing, 'a', 'y'); // string +>x2 : string +>path(thing, 'a', 'y') : string +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>thing : Thing +>'a' : "a" +>'y' : "y" + + let x3 = path(thing, 'b'); // boolean +>x3 : boolean +>path(thing, 'b') : boolean +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>thing : Thing +>'b' : "b" + + let x4 = path(thing, ...['a', 'x']); // any +>x4 : any +>path(thing, ...['a', 'x']) : any +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>thing : Thing +>...['a', 'x'] : string +>['a', 'x'] : string[] +>'a' : "a" +>'x' : "x" +} + +// Repro from comment in #12114 + +const assignTo2 = (object: T, key1: K1, key2: K2) => +>assignTo2 : (object: T, key1: K1, key2: K2) => (value: T[K1][K2]) => T[K1][K2] +>(object: T, key1: K1, key2: K2) => (value: T[K1][K2]) => object[key1][key2] = value : (object: T, key1: K1, key2: K2) => (value: T[K1][K2]) => T[K1][K2] +>T : T +>K1 : K1 +>T : T +>K2 : K2 +>T : T +>K1 : K1 +>object : T +>T : T +>key1 : K1 +>K1 : K1 +>key2 : K2 +>K2 : K2 + + (value: T[K1][K2]) => object[key1][key2] = value; +>(value: T[K1][K2]) => object[key1][key2] = value : (value: T[K1][K2]) => T[K1][K2] +>value : T[K1][K2] +>T : T +>K1 : K1 +>K2 : K2 +>object[key1][key2] = value : T[K1][K2] +>object[key1][key2] : T[K1][K2] +>object[key1] : T[K1] +>object : T +>key1 : K1 +>key2 : K2 +>value : T[K1][K2] + +// Modified repro from #12573 + +declare function one(handler: (t: T) => void): T +>one : (handler: (t: T) => void) => T +>T : T +>handler : (t: T) => void +>t : T +>T : T +>T : T + +var empty = one(() => {}) // inferred as {}, expected +>empty : {} +>one(() => {}) : {} +>one : (handler: (t: T) => void) => T +>() => {} : () => void + +type Handlers = { [K in keyof T]: (t: T[K]) => void } +>Handlers : Handlers +>T : T +>K : K +>T : T +>t : T[K] +>T : T +>K : K + +declare function on(handlerHash: Handlers): T +>on : (handlerHash: Handlers) => T +>T : T +>handlerHash : Handlers +>Handlers : Handlers +>T : T +>T : T + +var hashOfEmpty1 = on({ test: () => {} }); // {} +>hashOfEmpty1 : {} +>on({ test: () => {} }) : {} +>on : (handlerHash: Handlers) => T +>{ test: () => {} } : { test: () => void; } +>test : () => void +>() => {} : () => void + +var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } +>hashOfEmpty2 : { test: boolean; } +>on({ test: (x: boolean) => {} }) : { test: boolean; } +>on : (handlerHash: Handlers) => T +>{ test: (x: boolean) => {} } : { test: (x: boolean) => void; } +>test : (x: boolean) => void +>(x: boolean) => {} : (x: boolean) => void +>x : boolean + +// Repro from #12624 + +interface Options1 { +>Options1 : Options1 +>Data : Data +>Computed : Computed + + data?: Data +>data : Data | undefined +>Data : Data + + computed?: Computed; +>computed : Computed | undefined +>Computed : Computed +} + +declare class Component1 { +>Component1 : Component1 +>Data : Data +>Computed : Computed + + constructor(options: Options1); +>options : Options1 +>Options1 : Options1 +>Data : Data +>Computed : Computed + + get(key: K): (Data & Computed)[K]; +>get : (key: K) => (Data & Computed)[K] +>K : K +>Data : Data +>Computed : Computed +>key : K +>K : K +>Data : Data +>Computed : Computed +>K : K +} + +let c1 = new Component1({ +>c1 : Component1<{ hello: string; }, {}> +>new Component1({ data: { hello: "" }}) : Component1<{ hello: string; }, {}> +>Component1 : typeof Component1 +>{ data: { hello: "" }} : { data: { hello: string; }; } + + data: { +>data : { hello: string; } +>{ hello: "" } : { hello: string; } + + hello: "" +>hello : string +>"" : "" + } +}); + +c1.get("hello"); +>c1.get("hello") : string +>c1.get : (key: K) => ({ hello: string; } & {})[K] +>c1 : Component1<{ hello: string; }, {}> +>get : (key: K) => ({ hello: string; } & {})[K] +>"hello" : "hello" + +// Repro from #12625 + +interface Options2 { +>Options2 : Options2 +>Data : Data +>Computed : Computed + + data?: Data +>data : Data | undefined +>Data : Data + + computed?: Computed; +>computed : Computed | undefined +>Computed : Computed +} + +declare class Component2 { +>Component2 : Component2 +>Data : Data +>Computed : Computed + + constructor(options: Options2); +>options : Options2 +>Options2 : Options2 +>Data : Data +>Computed : Computed + + get(key: K): (Data & Computed)[K]; +>get : (key: K) => (Data & Computed)[K] +>K : K +>Data : Data +>Computed : Computed +>key : K +>K : K +>Data : Data +>Computed : Computed +>K : K +} + +// Repro from #12641 + +interface R { +>R : R + + p: number; +>p : number +} + +function f(p: K) { +>f : (p: K) => void +>K : K +>R : R +>p : K +>K : K + + let a: any; +>a : any + + a[p].add; // any +>a[p].add : any +>a[p] : any +>a : any +>p : K +>add : any +} + +// Repro from #12651 + +type MethodDescriptor = { +>MethodDescriptor : MethodDescriptor + + name: string; +>name : string + + args: any[]; +>args : any[] + + returnValue: any; +>returnValue : any +} + +declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; +>dispatchMethod : (name: M["name"], args: M["args"]) => M["returnValue"] +>M : M +>MethodDescriptor : MethodDescriptor +>name : M["name"] +>M : M +>args : M["args"] +>M : M +>M : M + +type SomeMethodDescriptor = { +>SomeMethodDescriptor : SomeMethodDescriptor + + name: "someMethod"; +>name : "someMethod" + + args: [string, number]; +>args : [string, number] + + returnValue: string[]; +>returnValue : string[] +} + +let result = dispatchMethod("someMethod", ["hello", 35]); +>result : string[] +>dispatchMethod("someMethod", ["hello", 35]) : string[] +>dispatchMethod : (name: M["name"], args: M["args"]) => M["returnValue"] +>SomeMethodDescriptor : SomeMethodDescriptor +>"someMethod" : "someMethod" +>["hello", 35] : [string, number] +>"hello" : "hello" +>35 : 35 + diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index 23b79c16627..1e88e2abc43 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -21,9 +21,14 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(64,33): error tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(66,24): error TS2345: Argument of type '"size"' is not assignable to parameter of type '"name" | "width" | "height" | "visible"'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(67,24): error TS2345: Argument of type '"name" | "size"' is not assignable to parameter of type '"name" | "width" | "height" | "visible"'. Type '"size"' is not assignable to type '"name" | "width" | "height" | "visible"'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(72,5): error TS2536: Type 'keyof (T & U)' cannot be used to index type 'T | U'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(76,5): error TS2322: Type 'T | U' is not assignable to type 'T & U'. + Type 'T' is not assignable to type 'T & U'. + Type 'T' is not assignable to type 'U'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(77,5): error TS2322: Type 'keyof (T & U)' is not assignable to type 'keyof (T | U)'. -==== tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts (21 errors) ==== +==== tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts (24 errors) ==== class Shape { name: string; width: number; @@ -135,4 +140,23 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(67,24): error ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '"name" | "size"' is not assignable to parameter of type '"name" | "width" | "height" | "visible"'. !!! error TS2345: Type '"size"' is not assignable to type '"name" | "width" | "height" | "visible"'. + } + + function f20(k1: keyof (T | U), k2: keyof (T & U), o1: T | U, o2: T & U) { + o1[k1]; + o1[k2]; // Error + ~~~~~~ +!!! error TS2536: Type 'keyof (T & U)' cannot be used to index type 'T | U'. + o2[k1]; + o2[k2]; + o1 = o2; + o2 = o1; // Error + ~~ +!!! error TS2322: Type 'T | U' is not assignable to type 'T & U'. +!!! error TS2322: Type 'T' is not assignable to type 'T & U'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. + k1 = k2; // Error + ~~ +!!! error TS2322: Type 'keyof (T & U)' is not assignable to type 'keyof (T | U)'. + k2 = k1; } \ No newline at end of file diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.js b/tests/baselines/reference/keyofAndIndexedAccessErrors.js index 145d8e3f148..556aca12971 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.js +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.js @@ -66,6 +66,17 @@ function f10(shape: Shape) { setProperty(shape, "name", "rectangle"); setProperty(shape, "size", 10); // Error setProperty(shape, cond ? "name" : "size", 10); // Error +} + +function f20(k1: keyof (T | U), k2: keyof (T & U), o1: T | U, o2: T & U) { + o1[k1]; + o1[k2]; // Error + o2[k1]; + o2[k2]; + o1 = o2; + o2 = o1; // Error + k1 = k2; // Error + k2 = k1; } //// [keyofAndIndexedAccessErrors.js] @@ -88,3 +99,13 @@ function f10(shape) { setProperty(shape, "size", 10); // Error setProperty(shape, cond ? "name" : "size", 10); // Error } +function f20(k1, k2, o1, o2) { + o1[k1]; + o1[k2]; // Error + o2[k1]; + o2[k2]; + o1 = o2; + o2 = o1; // Error + k1 = k2; // Error + k2 = k1; +} diff --git a/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt b/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt new file mode 100644 index 00000000000..c19a13209c9 --- /dev/null +++ b/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/keyofIsLiteralContexualType.ts(5,9): error TS2322: Type '("a" | "b" | "c")[]' is not assignable to type 'keyof T[]'. + Type '"a" | "b" | "c"' is not assignable to type 'keyof T'. + Type '"c"' is not assignable to type 'keyof T'. + Type '"c"' is not assignable to type '"a" | "b"'. +tests/cases/compiler/keyofIsLiteralContexualType.ts(13,11): error TS2339: Property 'b' does not exist on type 'Pick<{ a: number; b: number; c: number; }, "a" | "c">'. + + +==== tests/cases/compiler/keyofIsLiteralContexualType.ts (2 errors) ==== + // keyof T is a literal contextual type + + function foo() { + let a: (keyof T)[] = ["a", "b"]; + let b: (keyof T)[] = ["a", "b", "c"]; + ~ +!!! error TS2322: Type '("a" | "b" | "c")[]' is not assignable to type 'keyof T[]'. +!!! error TS2322: Type '"a" | "b" | "c"' is not assignable to type 'keyof T'. +!!! error TS2322: Type '"c"' is not assignable to type 'keyof T'. +!!! error TS2322: Type '"c"' is not assignable to type '"a" | "b"'. + } + + // Repro from #12455 + + declare function pick(obj: T, propNames: K[]): Pick; + + let x = pick({ a: 10, b: 20, c: 30 }, ["a", "c"]); + let b = x.b; // Error + ~ +!!! error TS2339: Property 'b' does not exist on type 'Pick<{ a: number; b: number; c: number; }, "a" | "c">'. \ No newline at end of file diff --git a/tests/baselines/reference/keyofIsLiteralContexualType.js b/tests/baselines/reference/keyofIsLiteralContexualType.js new file mode 100644 index 00000000000..5325b976174 --- /dev/null +++ b/tests/baselines/reference/keyofIsLiteralContexualType.js @@ -0,0 +1,23 @@ +//// [keyofIsLiteralContexualType.ts] +// keyof T is a literal contextual type + +function foo() { + let a: (keyof T)[] = ["a", "b"]; + let b: (keyof T)[] = ["a", "b", "c"]; +} + +// Repro from #12455 + +declare function pick(obj: T, propNames: K[]): Pick; + +let x = pick({ a: 10, b: 20, c: 30 }, ["a", "c"]); +let b = x.b; // Error + +//// [keyofIsLiteralContexualType.js] +// keyof T is a literal contextual type +function foo() { + var a = ["a", "b"]; + var b = ["a", "b", "c"]; +} +var x = pick({ a: 10, b: 20, c: 30 }, ["a", "c"]); +var b = x.b; // Error diff --git a/tests/baselines/reference/mappedTypeErrors.errors.txt b/tests/baselines/reference/mappedTypeErrors.errors.txt index b3cba7eb54d..17c77fa50a0 100644 --- a/tests/baselines/reference/mappedTypeErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeErrors.errors.txt @@ -16,13 +16,29 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(38,24): error TS2344: T Type 'T' is not assignable to type '"visible"'. Type 'string | number' is not assignable to type '"visible"'. Type 'string' is not assignable to type '"visible"'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(60,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P]; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(60,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P] | undefined; }'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(61,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(62,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P]; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(62,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(67,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(76,45): error TS2345: Argument of type '{ x: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'. + Property 'y' is missing in type '{ x: number; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(78,59): error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'. + Object literal may only specify known properties, and 'z' does not exist in type 'Readonly<{ x: number; y: number; }>'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(84,58): error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Partial<{ x: number; y: number; }>'. + Object literal may only specify known properties, and 'z' does not exist in type 'Partial<{ x: number; y: number; }>'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(106,15): error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick'. + Types of property 'a' are incompatible. + Type 'undefined' is not assignable to type 'string'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(107,17): error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. + Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(124,12): error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick'. + Types of property 'a' are incompatible. + Type 'undefined' is not assignable to type 'string'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(125,14): error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. + Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. -==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (14 errors) ==== +==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (21 errors) ==== interface Shape { name: string; @@ -112,13 +128,13 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(67,9): error TS2403: Su var x: { [P in keyof T]: T[P] }; var x: { [P in keyof T]?: T[P] }; // Error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P]; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P] | undefined; }'. var x: { readonly [P in keyof T]: T[P] }; // Error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'. var x: { readonly [P in keyof T]?: T[P] }; // Error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P]; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'. } function f12() { @@ -126,4 +142,85 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(67,9): error TS2403: Su var x: { [P in keyof T]: T[P][] }; // Error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'. - } \ No newline at end of file + } + + // Check that inferences to mapped types are secondary + + declare function objAndReadonly(primary: T, secondary: Readonly): T; + declare function objAndPartial(primary: T, secondary: Partial): T; + + function f20() { + let x1 = objAndReadonly({ x: 0, y: 0 }, { x: 1 }); // Error + ~~~~~~~~ +!!! error TS2345: Argument of type '{ x: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'. +!!! error TS2345: Property 'y' is missing in type '{ x: number; }'. + let x2 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error + ~~~~ +!!! error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'. +!!! error TS2345: Object literal may only specify known properties, and 'z' does not exist in type 'Readonly<{ x: number; y: number; }>'. + } + + function f21() { + let x1 = objAndPartial({ x: 0, y: 0 }, { x: 1 }); + let x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error + ~~~~ +!!! error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Partial<{ x: number; y: number; }>'. +!!! error TS2345: Object literal may only specify known properties, and 'z' does not exist in type 'Partial<{ x: number; y: number; }>'. + } + + // Verify use of Pick for setState functions (#12793) + + interface Foo { + a: string; + b?: number; + } + + function setState(obj: T, props: Pick) { + for (let k in props) { + obj[k] = props[k]; + } + } + + let foo: Foo = { a: "hello", b: 42 }; + setState(foo, { a: "test", b: 43 }) + setState(foo, { a: "hi" }); + setState(foo, { b: undefined }); + setState(foo, { }); + setState(foo, foo); + setState(foo, { a: undefined }); // Error + ~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick'. +!!! error TS2345: Types of property 'a' are incompatible. +!!! error TS2345: Type 'undefined' is not assignable to type 'string'. + setState(foo, { c: true }); // Error + ~~~~~~~ +!!! error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. +!!! error TS2345: Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. + + class C { + state: T; + setState(props: Pick) { + for (let k in props) { + this.state[k] = props[k]; + } + } + } + + let c = new C(); + c.setState({ a: "test", b: 43 }); + c.setState({ a: "hi" }); + c.setState({ b: undefined }); + c.setState({ }); + c.setState(foo); + c.setState({ a: undefined }); // Error + ~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick'. +!!! error TS2345: Types of property 'a' are incompatible. +!!! error TS2345: Type 'undefined' is not assignable to type 'string'. + c.setState({ c: true }); // Error + ~~~~~~~ +!!! error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. +!!! error TS2345: Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. + \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeErrors.js b/tests/baselines/reference/mappedTypeErrors.js index cb840da32f7..e1b458565bb 100644 --- a/tests/baselines/reference/mappedTypeErrors.js +++ b/tests/baselines/reference/mappedTypeErrors.js @@ -66,7 +66,65 @@ function f11() { function f12() { var x: { [P in keyof T]: T[P] }; var x: { [P in keyof T]: T[P][] }; // Error -} +} + +// Check that inferences to mapped types are secondary + +declare function objAndReadonly(primary: T, secondary: Readonly): T; +declare function objAndPartial(primary: T, secondary: Partial): T; + +function f20() { + let x1 = objAndReadonly({ x: 0, y: 0 }, { x: 1 }); // Error + let x2 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} + +function f21() { + let x1 = objAndPartial({ x: 0, y: 0 }, { x: 1 }); + let x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} + +// Verify use of Pick for setState functions (#12793) + +interface Foo { + a: string; + b?: number; +} + +function setState(obj: T, props: Pick) { + for (let k in props) { + obj[k] = props[k]; + } +} + +let foo: Foo = { a: "hello", b: 42 }; +setState(foo, { a: "test", b: 43 }) +setState(foo, { a: "hi" }); +setState(foo, { b: undefined }); +setState(foo, { }); +setState(foo, foo); +setState(foo, { a: undefined }); // Error +setState(foo, { c: true }); // Error + +class C { + state: T; + setState(props: Pick) { + for (let k in props) { + this.state[k] = props[k]; + } + } +} + +let c = new C(); +c.setState({ a: "test", b: 43 }); +c.setState({ a: "hi" }); +c.setState({ b: undefined }); +c.setState({ }); +c.setState(foo); +c.setState({ a: undefined }); // Error +c.setState({ c: true }); // Error + //// [mappedTypeErrors.js] function f1(x) { @@ -97,6 +155,47 @@ function f12() { var x; var x; // Error } +function f20() { + var x1 = objAndReadonly({ x: 0, y: 0 }, { x: 1 }); // Error + var x2 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1 }); + var x3 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} +function f21() { + var x1 = objAndPartial({ x: 0, y: 0 }, { x: 1 }); + var x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 }); + var x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} +function setState(obj, props) { + for (var k in props) { + obj[k] = props[k]; + } +} +var foo = { a: "hello", b: 42 }; +setState(foo, { a: "test", b: 43 }); +setState(foo, { a: "hi" }); +setState(foo, { b: undefined }); +setState(foo, {}); +setState(foo, foo); +setState(foo, { a: undefined }); // Error +setState(foo, { c: true }); // Error +var C = (function () { + function C() { + } + C.prototype.setState = function (props) { + for (var k in props) { + this.state[k] = props[k]; + } + }; + return C; +}()); +var c = new C(); +c.setState({ a: "test", b: 43 }); +c.setState({ a: "hi" }); +c.setState({ b: undefined }); +c.setState({}); +c.setState(foo); +c.setState({ a: undefined }); // Error +c.setState({ c: true }); // Error //// [mappedTypeErrors.d.ts] @@ -137,3 +236,18 @@ declare function f4(x: T): void; declare function f10(): void; declare function f11(): void; declare function f12(): void; +declare function objAndReadonly(primary: T, secondary: Readonly): T; +declare function objAndPartial(primary: T, secondary: Partial): T; +declare function f20(): void; +declare function f21(): void; +interface Foo { + a: string; + b?: number; +} +declare function setState(obj: T, props: Pick): void; +declare let foo: Foo; +declare class C { + state: T; + setState(props: Pick): void; +} +declare let c: C; diff --git a/tests/baselines/reference/mappedTypeInferenceCircularity.js b/tests/baselines/reference/mappedTypeInferenceCircularity.js new file mode 100644 index 00000000000..d5918d342f6 --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceCircularity.js @@ -0,0 +1,12 @@ +//// [mappedTypeInferenceCircularity.ts] +// Repro from #12511 + +type HTML = { [K in 'div']: Block }; +type Block

= (func: HTML) => {}; + +declare var h: HTML; +h.div(h); + +//// [mappedTypeInferenceCircularity.js] +// Repro from #12511 +h.div(h); diff --git a/tests/baselines/reference/mappedTypeInferenceCircularity.symbols b/tests/baselines/reference/mappedTypeInferenceCircularity.symbols new file mode 100644 index 00000000000..33dceb5cd76 --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceCircularity.symbols @@ -0,0 +1,26 @@ +=== tests/cases/compiler/mappedTypeInferenceCircularity.ts === +// Repro from #12511 + +type HTML = { [K in 'div']: Block }; +>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0)) +>K : Symbol(K, Decl(mappedTypeInferenceCircularity.ts, 2, 15)) +>Block : Symbol(Block, Decl(mappedTypeInferenceCircularity.ts, 2, 42)) +>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0)) + +type Block

= (func: HTML) => {}; +>Block : Symbol(Block, Decl(mappedTypeInferenceCircularity.ts, 2, 42)) +>P : Symbol(P, Decl(mappedTypeInferenceCircularity.ts, 3, 11)) +>T : Symbol(T, Decl(mappedTypeInferenceCircularity.ts, 3, 17)) +>func : Symbol(func, Decl(mappedTypeInferenceCircularity.ts, 3, 20)) +>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0)) + +declare var h: HTML; +>h : Symbol(h, Decl(mappedTypeInferenceCircularity.ts, 5, 11)) +>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0)) + +h.div(h); +>h.div : Symbol(div) +>h : Symbol(h, Decl(mappedTypeInferenceCircularity.ts, 5, 11)) +>div : Symbol(div) +>h : Symbol(h, Decl(mappedTypeInferenceCircularity.ts, 5, 11)) + diff --git a/tests/baselines/reference/mappedTypeInferenceCircularity.types b/tests/baselines/reference/mappedTypeInferenceCircularity.types new file mode 100644 index 00000000000..451da474756 --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceCircularity.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/mappedTypeInferenceCircularity.ts === +// Repro from #12511 + +type HTML = { [K in 'div']: Block }; +>HTML : HTML +>K : K +>Block : Block

+>HTML : HTML + +type Block

= (func: HTML) => {}; +>Block : Block

+>P : P +>T : T +>func : HTML +>HTML : HTML + +declare var h: HTML; +>h : HTML +>HTML : HTML + +h.div(h); +>h.div(h) : {} +>h.div : Block +>h : HTML +>div : Block +>h : HTML + diff --git a/tests/baselines/reference/mappedTypeModifiers.js b/tests/baselines/reference/mappedTypeModifiers.js new file mode 100644 index 00000000000..6291fb9c42b --- /dev/null +++ b/tests/baselines/reference/mappedTypeModifiers.js @@ -0,0 +1,133 @@ +//// [mappedTypeModifiers.ts] + +type T = { a: number, b: string }; +type TP = { a?: number, b?: string }; +type TR = { readonly a: number, readonly b: string }; +type TPR = { readonly a?: number, readonly b?: string }; + +var v00: "a" | "b"; +var v00: keyof T; +var v00: keyof TP; +var v00: keyof TR; +var v00: keyof TPR; + +var v01: T; +var v01: { [P in keyof T]: T[P] }; +var v01: Pick; +var v01: Pick, keyof T>; + +var v02: TP; +var v02: { [P in keyof T]?: T[P] }; +var v02: Partial; +var v02: { [P in keyof TP]: TP[P] } +var v02: Pick; + +var v03: TR; +var v03: { readonly [P in keyof T]: T[P] }; +var v03: Readonly; +var v03: { [P in keyof TR]: TR[P] } +var v03: Pick; + +var v04: TPR; +var v04: { readonly [P in keyof T]?: T[P] }; +var v04: Partial; +var v04: Readonly; +var v04: Partial>; +var v04: Readonly>; +var v04: { [P in keyof TPR]: TPR[P] } +var v04: Pick; + +type Boxified = { [P in keyof T]: { x: T[P] } }; + +type B = { a: { x: number }, b: { x: string } }; +type BP = { a?: { x: number }, b?: { x: string } }; +type BR = { readonly a: { x: number }, readonly b: { x: string } }; +type BPR = { readonly a?: { x: number }, readonly b?: { x: string } }; + +var b00: "a" | "b"; +var b00: keyof B; +var b00: keyof BP; +var b00: keyof BR; +var b00: keyof BPR; + +var b01: B; +var b01: { [P in keyof B]: B[P] }; +var b01: Pick; +var b01: Pick, keyof B>; + +var b02: BP; +var b02: { [P in keyof B]?: B[P] }; +var b02: Partial; +var b02: { [P in keyof BP]: BP[P] } +var b02: Pick; + +var b03: BR; +var b03: { readonly [P in keyof B]: B[P] }; +var b03: Readonly; +var b03: { [P in keyof BR]: BR[P] } +var b03: Pick; + +var b04: BPR; +var b04: { readonly [P in keyof B]?: B[P] }; +var b04: Partial
; +var b04: Readonly; +var b04: Partial>; +var b04: Readonly>; +var b04: { [P in keyof BPR]: BPR[P] } +var b04: Pick; + +//// [mappedTypeModifiers.js] +var v00; +var v00; +var v00; +var v00; +var v00; +var v01; +var v01; +var v01; +var v01; +var v02; +var v02; +var v02; +var v02; +var v02; +var v03; +var v03; +var v03; +var v03; +var v03; +var v04; +var v04; +var v04; +var v04; +var v04; +var v04; +var v04; +var v04; +var b00; +var b00; +var b00; +var b00; +var b00; +var b01; +var b01; +var b01; +var b01; +var b02; +var b02; +var b02; +var b02; +var b02; +var b03; +var b03; +var b03; +var b03; +var b03; +var b04; +var b04; +var b04; +var b04; +var b04; +var b04; +var b04; +var b04; diff --git a/tests/baselines/reference/mappedTypeModifiers.symbols b/tests/baselines/reference/mappedTypeModifiers.symbols new file mode 100644 index 00000000000..5138055d08b --- /dev/null +++ b/tests/baselines/reference/mappedTypeModifiers.symbols @@ -0,0 +1,355 @@ +=== tests/cases/conformance/types/mapped/mappedTypeModifiers.ts === + +type T = { a: number, b: string }; +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 1, 10)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 1, 21)) + +type TP = { a?: number, b?: string }; +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 2, 11)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 2, 23)) + +type TR = { readonly a: number, readonly b: string }; +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 3, 11)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 3, 31)) + +type TPR = { readonly a?: number, readonly b?: string }; +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 4, 12)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 4, 33)) + +var v00: "a" | "b"; +>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3)) + +var v00: keyof T; +>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v00: keyof TP; +>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) + +var v00: keyof TR; +>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) + +var v00: keyof TPR; +>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) + +var v01: T; +>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v01: { [P in keyof T]: T[P] }; +>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 13, 12)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 13, 12)) + +var v01: Pick; +>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v01: Pick, keyof T>; +>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v02: TP; +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) + +var v02: { [P in keyof T]?: T[P] }; +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 18, 12)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 18, 12)) + +var v02: Partial; +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v02: { [P in keyof TP]: TP[P] } +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 20, 12)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 20, 12)) + +var v02: Pick; +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) + +var v03: TR; +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) + +var v03: { readonly [P in keyof T]: T[P] }; +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 24, 21)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 24, 21)) + +var v03: Readonly; +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v03: { [P in keyof TR]: TR[P] } +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 26, 12)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 26, 12)) + +var v03: Pick; +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) + +var v04: TPR; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) + +var v04: { readonly [P in keyof T]?: T[P] }; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 30, 21)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 30, 21)) + +var v04: Partial; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) + +var v04: Readonly; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) + +var v04: Partial>; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v04: Readonly>; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v04: { [P in keyof TPR]: TPR[P] } +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 35, 12)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 35, 12)) + +var v04: Pick; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +type Boxified = { [P in keyof T]: { x: T[P] } }; +>Boxified : Symbol(Boxified, Decl(mappedTypeModifiers.ts, 36, 28)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 38, 22)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 38, 38)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 38, 22)) + +type B = { a: { x: number }, b: { x: string } }; +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 40, 10)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 40, 15)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 40, 28)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 40, 33)) + +type BP = { a?: { x: number }, b?: { x: string } }; +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 41, 11)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 41, 17)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 41, 30)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 41, 36)) + +type BR = { readonly a: { x: number }, readonly b: { x: string } }; +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 42, 11)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 42, 25)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 42, 38)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 42, 52)) + +type BPR = { readonly a?: { x: number }, readonly b?: { x: string } }; +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 43, 12)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 43, 27)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 43, 40)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 43, 55)) + +var b00: "a" | "b"; +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) + +var b00: keyof B; +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b00: keyof BP; +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) + +var b00: keyof BR; +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) + +var b00: keyof BPR; +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) + +var b01: B; +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b01: { [P in keyof B]: B[P] }; +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 52, 12)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 52, 12)) + +var b01: Pick; +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b01: Pick, keyof B>; +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b02: BP; +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) + +var b02: { [P in keyof B]?: B[P] }; +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 57, 12)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 57, 12)) + +var b02: Partial; +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b02: { [P in keyof BP]: BP[P] } +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 59, 12)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 59, 12)) + +var b02: Pick; +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) + +var b03: BR; +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) + +var b03: { readonly [P in keyof B]: B[P] }; +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 63, 21)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 63, 21)) + +var b03: Readonly; +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b03: { [P in keyof BR]: BR[P] } +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 65, 12)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 65, 12)) + +var b03: Pick; +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) + +var b04: BPR; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) + +var b04: { readonly [P in keyof B]?: B[P] }; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 69, 21)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 69, 21)) + +var b04: Partial
; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) + +var b04: Readonly; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) + +var b04: Partial>; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b04: Readonly>; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b04: { [P in keyof BPR]: BPR[P] } +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 74, 12)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 74, 12)) + +var b04: Pick; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) + diff --git a/tests/baselines/reference/mappedTypeModifiers.types b/tests/baselines/reference/mappedTypeModifiers.types new file mode 100644 index 00000000000..7a30e227bd6 --- /dev/null +++ b/tests/baselines/reference/mappedTypeModifiers.types @@ -0,0 +1,355 @@ +=== tests/cases/conformance/types/mapped/mappedTypeModifiers.ts === + +type T = { a: number, b: string }; +>T : T +>a : number +>b : string + +type TP = { a?: number, b?: string }; +>TP : TP +>a : number | undefined +>b : string | undefined + +type TR = { readonly a: number, readonly b: string }; +>TR : TR +>a : number +>b : string + +type TPR = { readonly a?: number, readonly b?: string }; +>TPR : TPR +>a : number | undefined +>b : string | undefined + +var v00: "a" | "b"; +>v00 : "a" | "b" + +var v00: keyof T; +>v00 : "a" | "b" +>T : T + +var v00: keyof TP; +>v00 : "a" | "b" +>TP : TP + +var v00: keyof TR; +>v00 : "a" | "b" +>TR : TR + +var v00: keyof TPR; +>v00 : "a" | "b" +>TPR : TPR + +var v01: T; +>v01 : T +>T : T + +var v01: { [P in keyof T]: T[P] }; +>v01 : T +>P : P +>T : T +>T : T +>P : P + +var v01: Pick; +>v01 : T +>Pick : Pick +>T : T +>T : T + +var v01: Pick, keyof T>; +>v01 : T +>Pick : Pick +>Pick : Pick +>T : T +>T : T +>T : T + +var v02: TP; +>v02 : TP +>TP : TP + +var v02: { [P in keyof T]?: T[P] }; +>v02 : TP +>P : P +>T : T +>T : T +>P : P + +var v02: Partial; +>v02 : TP +>Partial : Partial +>T : T + +var v02: { [P in keyof TP]: TP[P] } +>v02 : TP +>P : P +>TP : TP +>TP : TP +>P : P + +var v02: Pick; +>v02 : TP +>Pick : Pick +>TP : TP +>TP : TP + +var v03: TR; +>v03 : TR +>TR : TR + +var v03: { readonly [P in keyof T]: T[P] }; +>v03 : TR +>P : P +>T : T +>T : T +>P : P + +var v03: Readonly; +>v03 : TR +>Readonly : Readonly +>T : T + +var v03: { [P in keyof TR]: TR[P] } +>v03 : TR +>P : P +>TR : TR +>TR : TR +>P : P + +var v03: Pick; +>v03 : TR +>Pick : Pick +>TR : TR +>TR : TR + +var v04: TPR; +>v04 : TPR +>TPR : TPR + +var v04: { readonly [P in keyof T]?: T[P] }; +>v04 : TPR +>P : P +>T : T +>T : T +>P : P + +var v04: Partial; +>v04 : TPR +>Partial : Partial +>TR : TR + +var v04: Readonly; +>v04 : TPR +>Readonly : Readonly +>TP : TP + +var v04: Partial>; +>v04 : TPR +>Partial : Partial +>Readonly : Readonly +>T : T + +var v04: Readonly>; +>v04 : TPR +>Readonly : Readonly +>Partial : Partial +>T : T + +var v04: { [P in keyof TPR]: TPR[P] } +>v04 : TPR +>P : P +>TPR : TPR +>TPR : TPR +>P : P + +var v04: Pick; +>v04 : TPR +>Pick : Pick +>TPR : TPR +>T : T + +type Boxified = { [P in keyof T]: { x: T[P] } }; +>Boxified : Boxified +>T : T +>P : P +>T : T +>x : T[P] +>T : T +>P : P + +type B = { a: { x: number }, b: { x: string } }; +>B : B +>a : { x: number; } +>x : number +>b : { x: string; } +>x : string + +type BP = { a?: { x: number }, b?: { x: string } }; +>BP : BP +>a : { x: number; } | undefined +>x : number +>b : { x: string; } | undefined +>x : string + +type BR = { readonly a: { x: number }, readonly b: { x: string } }; +>BR : BR +>a : { x: number; } +>x : number +>b : { x: string; } +>x : string + +type BPR = { readonly a?: { x: number }, readonly b?: { x: string } }; +>BPR : BPR +>a : { x: number; } | undefined +>x : number +>b : { x: string; } | undefined +>x : string + +var b00: "a" | "b"; +>b00 : "a" | "b" + +var b00: keyof B; +>b00 : "a" | "b" +>B : B + +var b00: keyof BP; +>b00 : "a" | "b" +>BP : BP + +var b00: keyof BR; +>b00 : "a" | "b" +>BR : BR + +var b00: keyof BPR; +>b00 : "a" | "b" +>BPR : BPR + +var b01: B; +>b01 : B +>B : B + +var b01: { [P in keyof B]: B[P] }; +>b01 : B +>P : P +>B : B +>B : B +>P : P + +var b01: Pick; +>b01 : B +>Pick : Pick +>B : B +>B : B + +var b01: Pick, keyof B>; +>b01 : B +>Pick : Pick +>Pick : Pick +>B : B +>B : B +>B : B + +var b02: BP; +>b02 : BP +>BP : BP + +var b02: { [P in keyof B]?: B[P] }; +>b02 : BP +>P : P +>B : B +>B : B +>P : P + +var b02: Partial; +>b02 : BP +>Partial : Partial +>B : B + +var b02: { [P in keyof BP]: BP[P] } +>b02 : BP +>P : P +>BP : BP +>BP : BP +>P : P + +var b02: Pick; +>b02 : BP +>Pick : Pick +>BP : BP +>BP : BP + +var b03: BR; +>b03 : BR +>BR : BR + +var b03: { readonly [P in keyof B]: B[P] }; +>b03 : BR +>P : P +>B : B +>B : B +>P : P + +var b03: Readonly; +>b03 : BR +>Readonly : Readonly +>B : B + +var b03: { [P in keyof BR]: BR[P] } +>b03 : BR +>P : P +>BR : BR +>BR : BR +>P : P + +var b03: Pick; +>b03 : BR +>Pick : Pick +>BR : BR +>BR : BR + +var b04: BPR; +>b04 : BPR +>BPR : BPR + +var b04: { readonly [P in keyof B]?: B[P] }; +>b04 : BPR +>P : P +>B : B +>B : B +>P : P + +var b04: Partial
; +>b04 : BPR +>Partial : Partial +>BR : BR + +var b04: Readonly; +>b04 : BPR +>Readonly : Readonly +>BP : BP + +var b04: Partial>; +>b04 : BPR +>Partial : Partial +>Readonly : Readonly +>B : B + +var b04: Readonly>; +>b04 : BPR +>Readonly : Readonly +>Partial : Partial +>B : B + +var b04: { [P in keyof BPR]: BPR[P] } +>b04 : BPR +>P : P +>BPR : BPR +>BPR : BPR +>P : P + +var b04: Pick; +>b04 : BPR +>Pick : Pick +>BPR : BPR +>BPR : BPR + diff --git a/tests/baselines/reference/mappedTypes1.js b/tests/baselines/reference/mappedTypes1.js index a172b637d1c..1998ad5ab6b 100644 --- a/tests/baselines/reference/mappedTypes1.js +++ b/tests/baselines/reference/mappedTypes1.js @@ -33,15 +33,18 @@ type T47 = { [P in string | "a" | "b" | "0" | "1"]: void }; declare function f1(): { [P in keyof T1]: void }; declare function f2(): { [P in keyof T1]: void }; declare function f3(): { [P in keyof T1]: void }; +declare function f4(): { [P in keyof T1]: void }; let x1 = f1(); let x2 = f2(); -let x3 = f3(); +let x3 = f3(); +let x4 = f4(); //// [mappedTypes1.js] var x1 = f1(); var x2 = f2(); var x3 = f3(); +var x4 = f4(); //// [mappedTypes1.d.ts] @@ -128,31 +131,13 @@ declare function f2(): { declare function f3(): { [P in keyof T1]: void; }; -declare let x1: {}; -declare let x2: { - toString: void; - charAt: void; - charCodeAt: void; - concat: void; - indexOf: void; - lastIndexOf: void; - localeCompare: void; - match: void; - replace: void; - search: void; - slice: void; - split: void; - substring: void; - toLowerCase: void; - toLocaleLowerCase: void; - toUpperCase: void; - toLocaleUpperCase: void; - trim: void; - length: void; - substr: void; - valueOf: void; +declare function f4(): { + [P in keyof T1]: void; }; -declare let x3: { +declare let x1: {}; +declare let x2: string; +declare let x3: number; +declare let x4: { toString: void; valueOf: void; toFixed: void; diff --git a/tests/baselines/reference/mappedTypes1.symbols b/tests/baselines/reference/mappedTypes1.symbols index 88ced68aa0e..e8c09b25989 100644 --- a/tests/baselines/reference/mappedTypes1.symbols +++ b/tests/baselines/reference/mappedTypes1.symbols @@ -140,15 +140,26 @@ declare function f3(): { [P in keyof T1]: void }; >P : Symbol(P, Decl(mappedTypes1.ts, 33, 45)) >T1 : Symbol(T1, Decl(mappedTypes1.ts, 33, 20)) +declare function f4(): { [P in keyof T1]: void }; +>f4 : Symbol(f4, Decl(mappedTypes1.ts, 33, 68)) +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 34, 20)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>P : Symbol(P, Decl(mappedTypes1.ts, 34, 45)) +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 34, 20)) + let x1 = f1(); ->x1 : Symbol(x1, Decl(mappedTypes1.ts, 35, 3)) +>x1 : Symbol(x1, Decl(mappedTypes1.ts, 36, 3)) >f1 : Symbol(f1, Decl(mappedTypes1.ts, 29, 59)) let x2 = f2(); ->x2 : Symbol(x2, Decl(mappedTypes1.ts, 36, 3)) +>x2 : Symbol(x2, Decl(mappedTypes1.ts, 37, 3)) >f2 : Symbol(f2, Decl(mappedTypes1.ts, 31, 53)) let x3 = f3(); ->x3 : Symbol(x3, Decl(mappedTypes1.ts, 37, 3)) +>x3 : Symbol(x3, Decl(mappedTypes1.ts, 38, 3)) >f3 : Symbol(f3, Decl(mappedTypes1.ts, 32, 68)) +let x4 = f4(); +>x4 : Symbol(x4, Decl(mappedTypes1.ts, 39, 3)) +>f4 : Symbol(f4, Decl(mappedTypes1.ts, 33, 68)) + diff --git a/tests/baselines/reference/mappedTypes1.types b/tests/baselines/reference/mappedTypes1.types index 6886810c394..35d13143bab 100644 --- a/tests/baselines/reference/mappedTypes1.types +++ b/tests/baselines/reference/mappedTypes1.types @@ -142,18 +142,30 @@ declare function f3(): { [P in keyof T1]: void }; >P : P >T1 : T1 +declare function f4(): { [P in keyof T1]: void }; +>f4 : () => { [P in keyof T1]: void; } +>T1 : T1 +>Number : Number +>P : P +>T1 : T1 + let x1 = f1(); >x1 : {} >f1() : {} >f1 : () => { [P in keyof T1]: void; } let x2 = f2(); ->x2 : { toString: void; charAt: void; charCodeAt: void; concat: void; indexOf: void; lastIndexOf: void; localeCompare: void; match: void; replace: void; search: void; slice: void; split: void; substring: void; toLowerCase: void; toLocaleLowerCase: void; toUpperCase: void; toLocaleUpperCase: void; trim: void; length: void; substr: void; valueOf: void; } ->f2() : { toString: void; charAt: void; charCodeAt: void; concat: void; indexOf: void; lastIndexOf: void; localeCompare: void; match: void; replace: void; search: void; slice: void; split: void; substring: void; toLowerCase: void; toLocaleLowerCase: void; toUpperCase: void; toLocaleUpperCase: void; trim: void; length: void; substr: void; valueOf: void; } +>x2 : string +>f2() : string >f2 : () => { [P in keyof T1]: void; } let x3 = f3(); ->x3 : { toString: void; valueOf: void; toFixed: void; toExponential: void; toPrecision: void; toLocaleString: void; } ->f3() : { toString: void; valueOf: void; toFixed: void; toExponential: void; toPrecision: void; toLocaleString: void; } +>x3 : number +>f3() : number >f3 : () => { [P in keyof T1]: void; } +let x4 = f4(); +>x4 : { toString: void; valueOf: void; toFixed: void; toExponential: void; toPrecision: void; toLocaleString: void; } +>f4() : { toString: void; valueOf: void; toFixed: void; toExponential: void; toPrecision: void; toLocaleString: void; } +>f4 : () => { [P in keyof T1]: void; } + diff --git a/tests/baselines/reference/mappedTypes2.js b/tests/baselines/reference/mappedTypes2.js index 580cb36c741..84d052b6287 100644 --- a/tests/baselines/reference/mappedTypes2.js +++ b/tests/baselines/reference/mappedTypes2.js @@ -30,25 +30,30 @@ declare function pick(obj: T, ...keys: K[]): Pick; declare function mapObject(obj: Record, f: (x: T) => U): Record; declare function proxify(obj: T): Proxify; +interface Point { + x: number; + y: number; +} + interface Shape { name: string; width: number; height: number; - visible: boolean; + location: Point; } interface PartialShape { name?: string; width?: number; height?: number; - visible?: boolean; + location?: Point; } interface ReadonlyShape { readonly name: string; readonly width: number; readonly height: number; - readonly visible: boolean; + readonly location: Point; } function f0(s1: Shape, s2: Shape) { @@ -69,7 +74,7 @@ function f2(shape: Shape) { } function f3(shape: Shape) { - const x = pick(shape, "name", "visible"); // { name: string, visible: boolean } + const x = pick(shape, "name", "location"); // { name: string, location: Point } } function f4() { @@ -80,13 +85,13 @@ function f4() { function f5(shape: Shape) { const p = proxify(shape); let name = p.name.get(); - p.visible.set(false); + p.width.set(42); } function f6(shape: DeepReadonly) { - let name = shape.name; // DeepReadonly - let length = name.length; // DeepReadonly - let toString = length.toString; // DeepReadonly<(radix?: number) => string> + let name = shape.name; // string + let location = shape.location; // DeepReadonly + let x = location.x; // number } //// [mappedTypes2.js] @@ -115,7 +120,7 @@ function f2(shape) { var partial = {}; } function f3(shape) { - var x = pick(shape, "name", "visible"); // { name: string, visible: boolean } + var x = pick(shape, "name", "location"); // { name: string, location: Point } } function f4() { var rec = { foo: "hello", bar: "world", baz: "bye" }; @@ -124,12 +129,12 @@ function f4() { function f5(shape) { var p = proxify(shape); var name = p.name.get(); - p.visible.set(false); + p.width.set(42); } function f6(shape) { - var name = shape.name; // DeepReadonly - var length = name.length; // DeepReadonly - var toString = length.toString; // DeepReadonly<(radix?: number) => string> + var name = shape.name; // string + var location = shape.location; // DeepReadonly + var x = location.x; // number } @@ -150,23 +155,27 @@ declare function freeze(obj: T): Readonly; declare function pick(obj: T, ...keys: K[]): Pick; declare function mapObject(obj: Record, f: (x: T) => U): Record; declare function proxify(obj: T): Proxify; +interface Point { + x: number; + y: number; +} interface Shape { name: string; width: number; height: number; - visible: boolean; + location: Point; } interface PartialShape { name?: string; width?: number; height?: number; - visible?: boolean; + location?: Point; } interface ReadonlyShape { readonly name: string; readonly width: number; readonly height: number; - readonly visible: boolean; + readonly location: Point; } declare function f0(s1: Shape, s2: Shape): void; declare function f1(shape: Shape): void; diff --git a/tests/baselines/reference/mappedTypes2.symbols b/tests/baselines/reference/mappedTypes2.symbols index 1b6fe299140..079a56243c5 100644 --- a/tests/baselines/reference/mappedTypes2.symbols +++ b/tests/baselines/reference/mappedTypes2.symbols @@ -151,190 +151,203 @@ declare function proxify(obj: T): Proxify; >Proxify : Symbol(Proxify, Decl(mappedTypes2.ts, 15, 1)) >T : Symbol(T, Decl(mappedTypes2.ts, 29, 25)) +interface Point { +>Point : Symbol(Point, Decl(mappedTypes2.ts, 29, 48)) + + x: number; +>x : Symbol(Point.x, Decl(mappedTypes2.ts, 31, 17)) + + y: number; +>y : Symbol(Point.y, Decl(mappedTypes2.ts, 32, 14)) +} + interface Shape { ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) name: string; ->name : Symbol(Shape.name, Decl(mappedTypes2.ts, 31, 17)) +>name : Symbol(Shape.name, Decl(mappedTypes2.ts, 36, 17)) width: number; ->width : Symbol(Shape.width, Decl(mappedTypes2.ts, 32, 17)) +>width : Symbol(Shape.width, Decl(mappedTypes2.ts, 37, 17)) height: number; ->height : Symbol(Shape.height, Decl(mappedTypes2.ts, 33, 18)) +>height : Symbol(Shape.height, Decl(mappedTypes2.ts, 38, 18)) - visible: boolean; ->visible : Symbol(Shape.visible, Decl(mappedTypes2.ts, 34, 19)) + location: Point; +>location : Symbol(Shape.location, Decl(mappedTypes2.ts, 39, 19)) +>Point : Symbol(Point, Decl(mappedTypes2.ts, 29, 48)) } interface PartialShape { ->PartialShape : Symbol(PartialShape, Decl(mappedTypes2.ts, 36, 1)) +>PartialShape : Symbol(PartialShape, Decl(mappedTypes2.ts, 41, 1)) name?: string; ->name : Symbol(PartialShape.name, Decl(mappedTypes2.ts, 38, 24)) +>name : Symbol(PartialShape.name, Decl(mappedTypes2.ts, 43, 24)) width?: number; ->width : Symbol(PartialShape.width, Decl(mappedTypes2.ts, 39, 18)) +>width : Symbol(PartialShape.width, Decl(mappedTypes2.ts, 44, 18)) height?: number; ->height : Symbol(PartialShape.height, Decl(mappedTypes2.ts, 40, 19)) +>height : Symbol(PartialShape.height, Decl(mappedTypes2.ts, 45, 19)) - visible?: boolean; ->visible : Symbol(PartialShape.visible, Decl(mappedTypes2.ts, 41, 20)) + location?: Point; +>location : Symbol(PartialShape.location, Decl(mappedTypes2.ts, 46, 20)) +>Point : Symbol(Point, Decl(mappedTypes2.ts, 29, 48)) } interface ReadonlyShape { ->ReadonlyShape : Symbol(ReadonlyShape, Decl(mappedTypes2.ts, 43, 1)) +>ReadonlyShape : Symbol(ReadonlyShape, Decl(mappedTypes2.ts, 48, 1)) readonly name: string; ->name : Symbol(ReadonlyShape.name, Decl(mappedTypes2.ts, 45, 25)) +>name : Symbol(ReadonlyShape.name, Decl(mappedTypes2.ts, 50, 25)) readonly width: number; ->width : Symbol(ReadonlyShape.width, Decl(mappedTypes2.ts, 46, 26)) +>width : Symbol(ReadonlyShape.width, Decl(mappedTypes2.ts, 51, 26)) readonly height: number; ->height : Symbol(ReadonlyShape.height, Decl(mappedTypes2.ts, 47, 27)) +>height : Symbol(ReadonlyShape.height, Decl(mappedTypes2.ts, 52, 27)) - readonly visible: boolean; ->visible : Symbol(ReadonlyShape.visible, Decl(mappedTypes2.ts, 48, 28)) + readonly location: Point; +>location : Symbol(ReadonlyShape.location, Decl(mappedTypes2.ts, 53, 28)) +>Point : Symbol(Point, Decl(mappedTypes2.ts, 29, 48)) } function f0(s1: Shape, s2: Shape) { ->f0 : Symbol(f0, Decl(mappedTypes2.ts, 50, 1)) ->s1 : Symbol(s1, Decl(mappedTypes2.ts, 52, 12)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) ->s2 : Symbol(s2, Decl(mappedTypes2.ts, 52, 22)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>f0 : Symbol(f0, Decl(mappedTypes2.ts, 55, 1)) +>s1 : Symbol(s1, Decl(mappedTypes2.ts, 57, 12)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) +>s2 : Symbol(s2, Decl(mappedTypes2.ts, 57, 22)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) assign(s1, { name: "circle" }); >assign : Symbol(assign, Decl(mappedTypes2.ts, 23, 2)) ->s1 : Symbol(s1, Decl(mappedTypes2.ts, 52, 12)) ->name : Symbol(name, Decl(mappedTypes2.ts, 53, 16)) +>s1 : Symbol(s1, Decl(mappedTypes2.ts, 57, 12)) +>name : Symbol(name, Decl(mappedTypes2.ts, 58, 16)) assign(s2, { width: 10, height: 20 }); >assign : Symbol(assign, Decl(mappedTypes2.ts, 23, 2)) ->s2 : Symbol(s2, Decl(mappedTypes2.ts, 52, 22)) ->width : Symbol(width, Decl(mappedTypes2.ts, 54, 16)) ->height : Symbol(height, Decl(mappedTypes2.ts, 54, 27)) +>s2 : Symbol(s2, Decl(mappedTypes2.ts, 57, 22)) +>width : Symbol(width, Decl(mappedTypes2.ts, 59, 16)) +>height : Symbol(height, Decl(mappedTypes2.ts, 59, 27)) } function f1(shape: Shape) { ->f1 : Symbol(f1, Decl(mappedTypes2.ts, 55, 1)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 57, 12)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>f1 : Symbol(f1, Decl(mappedTypes2.ts, 60, 1)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 62, 12)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) var frozen: ReadonlyShape; ->frozen : Symbol(frozen, Decl(mappedTypes2.ts, 58, 7), Decl(mappedTypes2.ts, 59, 7), Decl(mappedTypes2.ts, 60, 7)) ->ReadonlyShape : Symbol(ReadonlyShape, Decl(mappedTypes2.ts, 43, 1)) +>frozen : Symbol(frozen, Decl(mappedTypes2.ts, 63, 7), Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7)) +>ReadonlyShape : Symbol(ReadonlyShape, Decl(mappedTypes2.ts, 48, 1)) var frozen: Readonly; ->frozen : Symbol(frozen, Decl(mappedTypes2.ts, 58, 7), Decl(mappedTypes2.ts, 59, 7), Decl(mappedTypes2.ts, 60, 7)) +>frozen : Symbol(frozen, Decl(mappedTypes2.ts, 63, 7), Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) var frozen = freeze(shape); ->frozen : Symbol(frozen, Decl(mappedTypes2.ts, 58, 7), Decl(mappedTypes2.ts, 59, 7), Decl(mappedTypes2.ts, 60, 7)) +>frozen : Symbol(frozen, Decl(mappedTypes2.ts, 63, 7), Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7)) >freeze : Symbol(freeze, Decl(mappedTypes2.ts, 25, 60)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 57, 12)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 62, 12)) } function f2(shape: Shape) { ->f2 : Symbol(f2, Decl(mappedTypes2.ts, 61, 1)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 63, 12)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>f2 : Symbol(f2, Decl(mappedTypes2.ts, 66, 1)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 68, 12)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) var partial: PartialShape; ->partial : Symbol(partial, Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7), Decl(mappedTypes2.ts, 66, 7)) ->PartialShape : Symbol(PartialShape, Decl(mappedTypes2.ts, 36, 1)) +>partial : Symbol(partial, Decl(mappedTypes2.ts, 69, 7), Decl(mappedTypes2.ts, 70, 7), Decl(mappedTypes2.ts, 71, 7)) +>PartialShape : Symbol(PartialShape, Decl(mappedTypes2.ts, 41, 1)) var partial: Partial; ->partial : Symbol(partial, Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7), Decl(mappedTypes2.ts, 66, 7)) +>partial : Symbol(partial, Decl(mappedTypes2.ts, 69, 7), Decl(mappedTypes2.ts, 70, 7), Decl(mappedTypes2.ts, 71, 7)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) var partial: Partial = {}; ->partial : Symbol(partial, Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7), Decl(mappedTypes2.ts, 66, 7)) +>partial : Symbol(partial, Decl(mappedTypes2.ts, 69, 7), Decl(mappedTypes2.ts, 70, 7), Decl(mappedTypes2.ts, 71, 7)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) } function f3(shape: Shape) { ->f3 : Symbol(f3, Decl(mappedTypes2.ts, 67, 1)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 69, 12)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>f3 : Symbol(f3, Decl(mappedTypes2.ts, 72, 1)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 74, 12)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) - const x = pick(shape, "name", "visible"); // { name: string, visible: boolean } ->x : Symbol(x, Decl(mappedTypes2.ts, 70, 9)) + const x = pick(shape, "name", "location"); // { name: string, location: Point } +>x : Symbol(x, Decl(mappedTypes2.ts, 75, 9)) >pick : Symbol(pick, Decl(mappedTypes2.ts, 26, 48)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 69, 12)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 74, 12)) } function f4() { ->f4 : Symbol(f4, Decl(mappedTypes2.ts, 71, 1)) +>f4 : Symbol(f4, Decl(mappedTypes2.ts, 76, 1)) const rec = { foo: "hello", bar: "world", baz: "bye" }; ->rec : Symbol(rec, Decl(mappedTypes2.ts, 74, 9)) ->foo : Symbol(foo, Decl(mappedTypes2.ts, 74, 17)) ->bar : Symbol(bar, Decl(mappedTypes2.ts, 74, 31)) ->baz : Symbol(baz, Decl(mappedTypes2.ts, 74, 45)) +>rec : Symbol(rec, Decl(mappedTypes2.ts, 79, 9)) +>foo : Symbol(foo, Decl(mappedTypes2.ts, 79, 17)) +>bar : Symbol(bar, Decl(mappedTypes2.ts, 79, 31)) +>baz : Symbol(baz, Decl(mappedTypes2.ts, 79, 45)) const lengths = mapObject(rec, s => s.length); // { foo: number, bar: number, baz: number } ->lengths : Symbol(lengths, Decl(mappedTypes2.ts, 75, 9)) +>lengths : Symbol(lengths, Decl(mappedTypes2.ts, 80, 9)) >mapObject : Symbol(mapObject, Decl(mappedTypes2.ts, 27, 78)) ->rec : Symbol(rec, Decl(mappedTypes2.ts, 74, 9)) ->s : Symbol(s, Decl(mappedTypes2.ts, 75, 34)) +>rec : Symbol(rec, Decl(mappedTypes2.ts, 79, 9)) +>s : Symbol(s, Decl(mappedTypes2.ts, 80, 34)) >s.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->s : Symbol(s, Decl(mappedTypes2.ts, 75, 34)) +>s : Symbol(s, Decl(mappedTypes2.ts, 80, 34)) >length : Symbol(String.length, Decl(lib.d.ts, --, --)) } function f5(shape: Shape) { ->f5 : Symbol(f5, Decl(mappedTypes2.ts, 76, 1)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 78, 12)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>f5 : Symbol(f5, Decl(mappedTypes2.ts, 81, 1)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 83, 12)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) const p = proxify(shape); ->p : Symbol(p, Decl(mappedTypes2.ts, 79, 9)) +>p : Symbol(p, Decl(mappedTypes2.ts, 84, 9)) >proxify : Symbol(proxify, Decl(mappedTypes2.ts, 28, 100)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 78, 12)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 83, 12)) let name = p.name.get(); ->name : Symbol(name, Decl(mappedTypes2.ts, 80, 7)) +>name : Symbol(name, Decl(mappedTypes2.ts, 85, 7)) >p.name.get : Symbol(get, Decl(mappedTypes2.ts, 12, 17)) >p.name : Symbol(name) ->p : Symbol(p, Decl(mappedTypes2.ts, 79, 9)) +>p : Symbol(p, Decl(mappedTypes2.ts, 84, 9)) >name : Symbol(name) >get : Symbol(get, Decl(mappedTypes2.ts, 12, 17)) - p.visible.set(false); ->p.visible.set : Symbol(set, Decl(mappedTypes2.ts, 13, 13)) ->p.visible : Symbol(visible) ->p : Symbol(p, Decl(mappedTypes2.ts, 79, 9)) ->visible : Symbol(visible) + p.width.set(42); +>p.width.set : Symbol(set, Decl(mappedTypes2.ts, 13, 13)) +>p.width : Symbol(width) +>p : Symbol(p, Decl(mappedTypes2.ts, 84, 9)) +>width : Symbol(width) >set : Symbol(set, Decl(mappedTypes2.ts, 13, 13)) } function f6(shape: DeepReadonly) { ->f6 : Symbol(f6, Decl(mappedTypes2.ts, 82, 1)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 84, 12)) +>f6 : Symbol(f6, Decl(mappedTypes2.ts, 87, 1)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 89, 12)) >DeepReadonly : Symbol(DeepReadonly, Decl(mappedTypes2.ts, 19, 1)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) - let name = shape.name; // DeepReadonly ->name : Symbol(name, Decl(mappedTypes2.ts, 85, 7)) + let name = shape.name; // string +>name : Symbol(name, Decl(mappedTypes2.ts, 90, 7)) >shape.name : Symbol(name) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 84, 12)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 89, 12)) >name : Symbol(name) - let length = name.length; // DeepReadonly ->length : Symbol(length, Decl(mappedTypes2.ts, 86, 7)) ->name.length : Symbol(length) ->name : Symbol(name, Decl(mappedTypes2.ts, 85, 7)) ->length : Symbol(length) + let location = shape.location; // DeepReadonly +>location : Symbol(location, Decl(mappedTypes2.ts, 91, 7)) +>shape.location : Symbol(location) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 89, 12)) +>location : Symbol(location) - let toString = length.toString; // DeepReadonly<(radix?: number) => string> ->toString : Symbol(toString, Decl(mappedTypes2.ts, 87, 7)) ->length.toString : Symbol(toString) ->length : Symbol(length, Decl(mappedTypes2.ts, 86, 7)) ->toString : Symbol(toString) + let x = location.x; // number +>x : Symbol(x, Decl(mappedTypes2.ts, 92, 7)) +>location.x : Symbol(x) +>location : Symbol(location, Decl(mappedTypes2.ts, 91, 7)) +>x : Symbol(x) } diff --git a/tests/baselines/reference/mappedTypes2.types b/tests/baselines/reference/mappedTypes2.types index 14ca77e4680..f082069f569 100644 --- a/tests/baselines/reference/mappedTypes2.types +++ b/tests/baselines/reference/mappedTypes2.types @@ -151,6 +151,16 @@ declare function proxify(obj: T): Proxify; >Proxify : Proxify >T : T +interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number +} + interface Shape { >Shape : Shape @@ -163,8 +173,9 @@ interface Shape { height: number; >height : number - visible: boolean; ->visible : boolean + location: Point; +>location : Point +>Point : Point } interface PartialShape { @@ -179,8 +190,9 @@ interface PartialShape { height?: number; >height : number | undefined - visible?: boolean; ->visible : boolean | undefined + location?: Point; +>location : Point | undefined +>Point : Point } interface ReadonlyShape { @@ -195,8 +207,9 @@ interface ReadonlyShape { readonly height: number; >height : number - readonly visible: boolean; ->visible : boolean + readonly location: Point; +>location : Point +>Point : Point } function f0(s1: Shape, s2: Shape) { @@ -272,13 +285,13 @@ function f3(shape: Shape) { >shape : Shape >Shape : Shape - const x = pick(shape, "name", "visible"); // { name: string, visible: boolean } ->x : Pick ->pick(shape, "name", "visible") : Pick + const x = pick(shape, "name", "location"); // { name: string, location: Point } +>x : Pick +>pick(shape, "name", "location") : Pick >pick : (obj: T, ...keys: K[]) => Pick >shape : Shape >"name" : "name" ->"visible" : "visible" +>"location" : "location" } function f4() { @@ -326,14 +339,14 @@ function f5(shape: Shape) { >name : Proxy >get : () => string - p.visible.set(false); ->p.visible.set(false) : void ->p.visible.set : (value: boolean) => void ->p.visible : Proxy + p.width.set(42); +>p.width.set(42) : void +>p.width.set : (value: number) => void +>p.width : Proxy >p : Proxify ->visible : Proxy ->set : (value: boolean) => void ->false : false +>width : Proxy +>set : (value: number) => void +>42 : 42 } function f6(shape: DeepReadonly) { @@ -342,21 +355,21 @@ function f6(shape: DeepReadonly) { >DeepReadonly : DeepReadonly >Shape : Shape - let name = shape.name; // DeepReadonly ->name : DeepReadonly ->shape.name : DeepReadonly + let name = shape.name; // string +>name : string +>shape.name : string >shape : DeepReadonly ->name : DeepReadonly +>name : string - let length = name.length; // DeepReadonly ->length : DeepReadonly ->name.length : DeepReadonly ->name : DeepReadonly ->length : DeepReadonly + let location = shape.location; // DeepReadonly +>location : DeepReadonly +>shape.location : DeepReadonly +>shape : DeepReadonly +>location : DeepReadonly - let toString = length.toString; // DeepReadonly<(radix?: number) => string> ->toString : DeepReadonly<(radix?: number | undefined) => string> ->length.toString : DeepReadonly<(radix?: number | undefined) => string> ->length : DeepReadonly ->toString : DeepReadonly<(radix?: number | undefined) => string> + let x = location.x; // number +>x : number +>location.x : number +>location : DeepReadonly +>x : number } diff --git a/tests/baselines/reference/mappedTypes4.js b/tests/baselines/reference/mappedTypes4.js new file mode 100644 index 00000000000..bb003b1a1ec --- /dev/null +++ b/tests/baselines/reference/mappedTypes4.js @@ -0,0 +1,129 @@ +//// [mappedTypes4.ts] + +type Box = { +}; + +type Boxified = { + [P in keyof T]: Box; +}; + +function boxify(obj: T): Boxified { + if (typeof obj === "object") { + let result = {} as Boxified; + for (let k in obj) { + result[k] = { value: obj[k] }; + } + return result; + } + return obj; +} + +type A = { a: string }; +type B = { b: string }; +type C = { c: string }; + +function f1(x: A | B | C | undefined) { + return boxify(x); +} + +type T00 = Partial; +type T01 = Readonly; +type T02 = Boxified +type T03 = Readonly; +type T04 = Boxified; +type T05 = Partial<"hello" | "world" | 42>; + +type BoxifiedWithSentinel = { + [P in keyof T]: Box | U; +} + +type T10 = BoxifiedWithSentinel; +type T11 = BoxifiedWithSentinel; +type T12 = BoxifiedWithSentinel; + +type DeepReadonly = { + readonly [P in keyof T]: DeepReadonly; +}; + +type Foo = { + x: number; + y: { a: string, b: number }; + z: boolean; +}; + +type DeepReadonlyFoo = { + readonly x: number; + readonly y: { readonly a: string, readonly b: number }; + readonly z: boolean; +}; + +var x1: DeepReadonly; +var x1: DeepReadonlyFoo; + +//// [mappedTypes4.js] +function boxify(obj) { + if (typeof obj === "object") { + var result = {}; + for (var k in obj) { + result[k] = { value: obj[k] }; + } + return result; + } + return obj; +} +function f1(x) { + return boxify(x); +} +var x1; +var x1; + + +//// [mappedTypes4.d.ts] +declare type Box = {}; +declare type Boxified = { + [P in keyof T]: Box; +}; +declare function boxify(obj: T): Boxified; +declare type A = { + a: string; +}; +declare type B = { + b: string; +}; +declare type C = { + c: string; +}; +declare function f1(x: A | B | C | undefined): Boxified | Boxified | Boxified | undefined; +declare type T00 = Partial; +declare type T01 = Readonly; +declare type T02 = Boxified; +declare type T03 = Readonly; +declare type T04 = Boxified; +declare type T05 = Partial<"hello" | "world" | 42>; +declare type BoxifiedWithSentinel = { + [P in keyof T]: Box | U; +}; +declare type T10 = BoxifiedWithSentinel; +declare type T11 = BoxifiedWithSentinel; +declare type T12 = BoxifiedWithSentinel; +declare type DeepReadonly = { + readonly [P in keyof T]: DeepReadonly; +}; +declare type Foo = { + x: number; + y: { + a: string; + b: number; + }; + z: boolean; +}; +declare type DeepReadonlyFoo = { + readonly x: number; + readonly y: { + readonly a: string; + readonly b: number; + }; + readonly z: boolean; +}; +declare var x1: DeepReadonly; +declare var x1: DeepReadonlyFoo; diff --git a/tests/baselines/reference/mappedTypes4.symbols b/tests/baselines/reference/mappedTypes4.symbols new file mode 100644 index 00000000000..b57adfe9954 --- /dev/null +++ b/tests/baselines/reference/mappedTypes4.symbols @@ -0,0 +1,198 @@ +=== tests/cases/conformance/types/mapped/mappedTypes4.ts === + +type Box = { +>Box : Symbol(Box, Decl(mappedTypes4.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypes4.ts, 1, 9)) + +}; + +type Boxified = { +>Boxified : Symbol(Boxified, Decl(mappedTypes4.ts, 2, 2)) +>T : Symbol(T, Decl(mappedTypes4.ts, 4, 14)) + + [P in keyof T]: Box; +>P : Symbol(P, Decl(mappedTypes4.ts, 5, 5)) +>T : Symbol(T, Decl(mappedTypes4.ts, 4, 14)) +>Box : Symbol(Box, Decl(mappedTypes4.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypes4.ts, 4, 14)) +>P : Symbol(P, Decl(mappedTypes4.ts, 5, 5)) + +}; + +function boxify(obj: T): Boxified { +>boxify : Symbol(boxify, Decl(mappedTypes4.ts, 6, 2)) +>T : Symbol(T, Decl(mappedTypes4.ts, 8, 16)) +>obj : Symbol(obj, Decl(mappedTypes4.ts, 8, 19)) +>T : Symbol(T, Decl(mappedTypes4.ts, 8, 16)) +>Boxified : Symbol(Boxified, Decl(mappedTypes4.ts, 2, 2)) +>T : Symbol(T, Decl(mappedTypes4.ts, 8, 16)) + + if (typeof obj === "object") { +>obj : Symbol(obj, Decl(mappedTypes4.ts, 8, 19)) + + let result = {} as Boxified; +>result : Symbol(result, Decl(mappedTypes4.ts, 10, 11)) +>Boxified : Symbol(Boxified, Decl(mappedTypes4.ts, 2, 2)) +>T : Symbol(T, Decl(mappedTypes4.ts, 8, 16)) + + for (let k in obj) { +>k : Symbol(k, Decl(mappedTypes4.ts, 11, 16)) +>obj : Symbol(obj, Decl(mappedTypes4.ts, 8, 19)) + + result[k] = { value: obj[k] }; +>result : Symbol(result, Decl(mappedTypes4.ts, 10, 11)) +>k : Symbol(k, Decl(mappedTypes4.ts, 11, 16)) +>value : Symbol(value, Decl(mappedTypes4.ts, 12, 25)) +>obj : Symbol(obj, Decl(mappedTypes4.ts, 8, 19)) +>k : Symbol(k, Decl(mappedTypes4.ts, 11, 16)) + } + return result; +>result : Symbol(result, Decl(mappedTypes4.ts, 10, 11)) + } + return obj; +>obj : Symbol(obj, Decl(mappedTypes4.ts, 8, 19)) +} + +type A = { a: string }; +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>a : Symbol(a, Decl(mappedTypes4.ts, 19, 10)) + +type B = { b: string }; +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>b : Symbol(b, Decl(mappedTypes4.ts, 20, 10)) + +type C = { c: string }; +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) +>c : Symbol(c, Decl(mappedTypes4.ts, 21, 10)) + +function f1(x: A | B | C | undefined) { +>f1 : Symbol(f1, Decl(mappedTypes4.ts, 21, 23)) +>x : Symbol(x, Decl(mappedTypes4.ts, 23, 12)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + + return boxify(x); +>boxify : Symbol(boxify, Decl(mappedTypes4.ts, 6, 2)) +>x : Symbol(x, Decl(mappedTypes4.ts, 23, 12)) +} + +type T00 = Partial; +>T00 : Symbol(T00, Decl(mappedTypes4.ts, 25, 1)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + +type T01 = Readonly; +>T01 : Symbol(T01, Decl(mappedTypes4.ts, 27, 30)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + +type T02 = Boxified +>T02 : Symbol(T02, Decl(mappedTypes4.ts, 28, 50)) +>Boxified : Symbol(Boxified, Decl(mappedTypes4.ts, 2, 2)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + +type T03 = Readonly; +>T03 : Symbol(T03, Decl(mappedTypes4.ts, 29, 41)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) + +type T04 = Boxified; +>T04 : Symbol(T04, Decl(mappedTypes4.ts, 30, 73)) +>Boxified : Symbol(Boxified, Decl(mappedTypes4.ts, 2, 2)) + +type T05 = Partial<"hello" | "world" | 42>; +>T05 : Symbol(T05, Decl(mappedTypes4.ts, 31, 73)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) + +type BoxifiedWithSentinel = { +>BoxifiedWithSentinel : Symbol(BoxifiedWithSentinel, Decl(mappedTypes4.ts, 32, 43)) +>T : Symbol(T, Decl(mappedTypes4.ts, 34, 26)) +>U : Symbol(U, Decl(mappedTypes4.ts, 34, 28)) + + [P in keyof T]: Box | U; +>P : Symbol(P, Decl(mappedTypes4.ts, 35, 5)) +>T : Symbol(T, Decl(mappedTypes4.ts, 34, 26)) +>Box : Symbol(Box, Decl(mappedTypes4.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypes4.ts, 34, 26)) +>P : Symbol(P, Decl(mappedTypes4.ts, 35, 5)) +>U : Symbol(U, Decl(mappedTypes4.ts, 34, 28)) +} + +type T10 = BoxifiedWithSentinel; +>T10 : Symbol(T10, Decl(mappedTypes4.ts, 36, 1)) +>BoxifiedWithSentinel : Symbol(BoxifiedWithSentinel, Decl(mappedTypes4.ts, 32, 43)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + +type T11 = BoxifiedWithSentinel; +>T11 : Symbol(T11, Decl(mappedTypes4.ts, 38, 49)) +>BoxifiedWithSentinel : Symbol(BoxifiedWithSentinel, Decl(mappedTypes4.ts, 32, 43)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + +type T12 = BoxifiedWithSentinel; +>T12 : Symbol(T12, Decl(mappedTypes4.ts, 39, 54)) +>BoxifiedWithSentinel : Symbol(BoxifiedWithSentinel, Decl(mappedTypes4.ts, 32, 43)) + +type DeepReadonly = { +>DeepReadonly : Symbol(DeepReadonly, Decl(mappedTypes4.ts, 40, 51)) +>T : Symbol(T, Decl(mappedTypes4.ts, 42, 18)) + + readonly [P in keyof T]: DeepReadonly; +>P : Symbol(P, Decl(mappedTypes4.ts, 43, 14)) +>T : Symbol(T, Decl(mappedTypes4.ts, 42, 18)) +>DeepReadonly : Symbol(DeepReadonly, Decl(mappedTypes4.ts, 40, 51)) +>T : Symbol(T, Decl(mappedTypes4.ts, 42, 18)) +>P : Symbol(P, Decl(mappedTypes4.ts, 43, 14)) + +}; + +type Foo = { +>Foo : Symbol(Foo, Decl(mappedTypes4.ts, 44, 2)) + + x: number; +>x : Symbol(x, Decl(mappedTypes4.ts, 46, 12)) + + y: { a: string, b: number }; +>y : Symbol(y, Decl(mappedTypes4.ts, 47, 14)) +>a : Symbol(a, Decl(mappedTypes4.ts, 48, 8)) +>b : Symbol(b, Decl(mappedTypes4.ts, 48, 19)) + + z: boolean; +>z : Symbol(z, Decl(mappedTypes4.ts, 48, 32)) + +}; + +type DeepReadonlyFoo = { +>DeepReadonlyFoo : Symbol(DeepReadonlyFoo, Decl(mappedTypes4.ts, 50, 2)) + + readonly x: number; +>x : Symbol(x, Decl(mappedTypes4.ts, 52, 24)) + + readonly y: { readonly a: string, readonly b: number }; +>y : Symbol(y, Decl(mappedTypes4.ts, 53, 23)) +>a : Symbol(a, Decl(mappedTypes4.ts, 54, 17)) +>b : Symbol(b, Decl(mappedTypes4.ts, 54, 37)) + + readonly z: boolean; +>z : Symbol(z, Decl(mappedTypes4.ts, 54, 59)) + +}; + +var x1: DeepReadonly; +>x1 : Symbol(x1, Decl(mappedTypes4.ts, 58, 3), Decl(mappedTypes4.ts, 59, 3)) +>DeepReadonly : Symbol(DeepReadonly, Decl(mappedTypes4.ts, 40, 51)) +>Foo : Symbol(Foo, Decl(mappedTypes4.ts, 44, 2)) + +var x1: DeepReadonlyFoo; +>x1 : Symbol(x1, Decl(mappedTypes4.ts, 58, 3), Decl(mappedTypes4.ts, 59, 3)) +>DeepReadonlyFoo : Symbol(DeepReadonlyFoo, Decl(mappedTypes4.ts, 50, 2)) + diff --git a/tests/baselines/reference/mappedTypes4.types b/tests/baselines/reference/mappedTypes4.types new file mode 100644 index 00000000000..cc492d82120 --- /dev/null +++ b/tests/baselines/reference/mappedTypes4.types @@ -0,0 +1,213 @@ +=== tests/cases/conformance/types/mapped/mappedTypes4.ts === + +type Box = { +>Box : Box +>T : T + +}; + +type Boxified = { +>Boxified : Boxified +>T : T + + [P in keyof T]: Box; +>P : P +>T : T +>Box : Box +>T : T +>P : P + +}; + +function boxify(obj: T): Boxified { +>boxify : (obj: T) => Boxified +>T : T +>obj : T +>T : T +>Boxified : Boxified +>T : T + + if (typeof obj === "object") { +>typeof obj === "object" : boolean +>typeof obj : string +>obj : T +>"object" : "object" + + let result = {} as Boxified; +>result : Boxified +>{} as Boxified : Boxified +>{} : {} +>Boxified : Boxified +>T : T + + for (let k in obj) { +>k : keyof T +>obj : T + + result[k] = { value: obj[k] }; +>result[k] = { value: obj[k] } : { value: T[keyof T]; } +>result[k] : Box +>result : Boxified +>k : keyof T +>{ value: obj[k] } : { value: T[keyof T]; } +>value : T[keyof T] +>obj[k] : T[keyof T] +>obj : T +>k : keyof T + } + return result; +>result : Boxified + } + return obj; +>obj : any +>obj : never +} + +type A = { a: string }; +>A : A +>a : string + +type B = { b: string }; +>B : B +>b : string + +type C = { c: string }; +>C : C +>c : string + +function f1(x: A | B | C | undefined) { +>f1 : (x: A | B | C | undefined) => Boxified | Boxified | Boxified | undefined +>x : A | B | C | undefined +>A : A +>B : B +>C : C + + return boxify(x); +>boxify(x) : Boxified | Boxified | Boxified | undefined +>boxify : (obj: T) => Boxified +>x : A | B | C | undefined +} + +type T00 = Partial; +>T00 : Partial | Partial | Partial +>Partial : Partial +>A : A +>B : B +>C : C + +type T01 = Readonly; +>T01 : Readonly | Readonly | Readonly | null | undefined +>Readonly : Readonly +>A : A +>B : B +>C : C +>null : null + +type T02 = Boxified +>T02 : string | Boxified | Boxified | Boxified +>Boxified : Boxified +>A : A +>B : B +>C : C + +type T03 = Readonly; +>T03 : string | number | boolean | void | null | undefined +>Readonly : Readonly +>null : null + +type T04 = Boxified; +>T04 : string | number | boolean | void | null | undefined +>Boxified : Boxified +>null : null + +type T05 = Partial<"hello" | "world" | 42>; +>T05 : "hello" | "world" | 42 +>Partial : Partial + +type BoxifiedWithSentinel = { +>BoxifiedWithSentinel : BoxifiedWithSentinel +>T : T +>U : U + + [P in keyof T]: Box | U; +>P : P +>T : T +>Box : Box +>T : T +>P : P +>U : U +} + +type T10 = BoxifiedWithSentinel; +>T10 : BoxifiedWithSentinel | BoxifiedWithSentinel | BoxifiedWithSentinel +>BoxifiedWithSentinel : BoxifiedWithSentinel +>A : A +>B : B +>C : C +>null : null + +type T11 = BoxifiedWithSentinel; +>T11 : BoxifiedWithSentinel | BoxifiedWithSentinel | BoxifiedWithSentinel +>BoxifiedWithSentinel : BoxifiedWithSentinel +>A : A +>B : B +>C : C + +type T12 = BoxifiedWithSentinel; +>T12 : string +>BoxifiedWithSentinel : BoxifiedWithSentinel + +type DeepReadonly = { +>DeepReadonly : DeepReadonly +>T : T + + readonly [P in keyof T]: DeepReadonly; +>P : P +>T : T +>DeepReadonly : DeepReadonly +>T : T +>P : P + +}; + +type Foo = { +>Foo : Foo + + x: number; +>x : number + + y: { a: string, b: number }; +>y : { a: string; b: number; } +>a : string +>b : number + + z: boolean; +>z : boolean + +}; + +type DeepReadonlyFoo = { +>DeepReadonlyFoo : DeepReadonlyFoo + + readonly x: number; +>x : number + + readonly y: { readonly a: string, readonly b: number }; +>y : { readonly a: string; readonly b: number; } +>a : string +>b : number + + readonly z: boolean; +>z : boolean + +}; + +var x1: DeepReadonly; +>x1 : DeepReadonly +>DeepReadonly : DeepReadonly +>Foo : Foo + +var x1: DeepReadonlyFoo; +>x1 : DeepReadonly +>DeepReadonlyFoo : DeepReadonlyFoo + diff --git a/tests/baselines/reference/nestedFreshLiteral.errors.txt b/tests/baselines/reference/nestedFreshLiteral.errors.txt new file mode 100644 index 00000000000..6aff94ac0a6 --- /dev/null +++ b/tests/baselines/reference/nestedFreshLiteral.errors.txt @@ -0,0 +1,31 @@ +tests/cases/compiler/nestedFreshLiteral.ts(12,21): error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'. + Types of property 'nested' are incompatible. + Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector | undefined'. + Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'. + Types of property 'prop' are incompatible. + Type '{ colour: string; }' is not assignable to type 'CSSProps'. + Object literal may only specify known properties, and 'colour' does not exist in type 'CSSProps'. + + +==== tests/cases/compiler/nestedFreshLiteral.ts (1 errors) ==== + interface CSSProps { + color?: string + } + interface NestedCSSProps { + nested?: NestedSelector + } + interface NestedSelector { + prop: CSSProps; + } + + let stylen: NestedCSSProps = { + nested: { prop: { colour: 'red' } } + ~~~~~~~~~~~~~ +!!! error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'. +!!! error TS2322: Types of property 'nested' are incompatible. +!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector | undefined'. +!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'. +!!! error TS2322: Types of property 'prop' are incompatible. +!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'CSSProps'. +!!! error TS2322: Object literal may only specify known properties, and 'colour' does not exist in type 'CSSProps'. + } \ No newline at end of file diff --git a/tests/baselines/reference/nestedFreshLiteral.js b/tests/baselines/reference/nestedFreshLiteral.js new file mode 100644 index 00000000000..36d4743deae --- /dev/null +++ b/tests/baselines/reference/nestedFreshLiteral.js @@ -0,0 +1,19 @@ +//// [nestedFreshLiteral.ts] +interface CSSProps { + color?: string +} +interface NestedCSSProps { + nested?: NestedSelector +} +interface NestedSelector { + prop: CSSProps; +} + +let stylen: NestedCSSProps = { + nested: { prop: { colour: 'red' } } +} + +//// [nestedFreshLiteral.js] +var stylen = { + nested: { prop: { colour: 'red' } } +}; diff --git a/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js new file mode 100644 index 00000000000..8525352d415 --- /dev/null +++ b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js @@ -0,0 +1,31 @@ +//// [newLexicalEnvironmentForConvertedLoop.ts] +function baz(x: any) { + return [[x, x]]; +} + +function foo(set: any) { + for (const [value, i] of baz(set.values)) { + const bar: any = []; + (() => bar); + + set.values.push(...[]); + } +}; + +//// [newLexicalEnvironmentForConvertedLoop.js] +function baz(x) { + return [[x, x]]; +} +function foo(set) { + var _loop_1 = function (value, i) { + var bar = []; + (function () { return bar; }); + (_a = set.values).push.apply(_a, []); + var _a; + }; + for (var _i = 0, _a = baz(set.values); _i < _a.length; _i++) { + var _b = _a[_i], value = _b[0], i = _b[1]; + _loop_1(value, i); + } +} +; diff --git a/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols new file mode 100644 index 00000000000..19d657218d6 --- /dev/null +++ b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts === +function baz(x: any) { +>baz : Symbol(baz, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 0)) +>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13)) + + return [[x, x]]; +>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13)) +>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13)) +} + +function foo(set: any) { +>foo : Symbol(foo, Decl(newLexicalEnvironmentForConvertedLoop.ts, 2, 1)) +>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13)) + + for (const [value, i] of baz(set.values)) { +>value : Symbol(value, Decl(newLexicalEnvironmentForConvertedLoop.ts, 5, 14)) +>i : Symbol(i, Decl(newLexicalEnvironmentForConvertedLoop.ts, 5, 20)) +>baz : Symbol(baz, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 0)) +>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13)) + + const bar: any = []; +>bar : Symbol(bar, Decl(newLexicalEnvironmentForConvertedLoop.ts, 6, 9)) + + (() => bar); +>bar : Symbol(bar, Decl(newLexicalEnvironmentForConvertedLoop.ts, 6, 9)) + + set.values.push(...[]); +>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13)) + } +}; diff --git a/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types new file mode 100644 index 00000000000..dcc6f1375a3 --- /dev/null +++ b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts === +function baz(x: any) { +>baz : (x: any) => any[][] +>x : any + + return [[x, x]]; +>[[x, x]] : any[][] +>[x, x] : any[] +>x : any +>x : any +} + +function foo(set: any) { +>foo : (set: any) => void +>set : any + + for (const [value, i] of baz(set.values)) { +>value : any +>i : any +>baz(set.values) : any[][] +>baz : (x: any) => any[][] +>set.values : any +>set : any +>values : any + + const bar: any = []; +>bar : any +>[] : undefined[] + + (() => bar); +>(() => bar) : () => any +>() => bar : () => any +>bar : any + + set.values.push(...[]); +>set.values.push(...[]) : any +>set.values.push : any +>set.values : any +>set : any +>values : any +>push : any +>...[] : undefined +>[] : undefined[] + } +}; diff --git a/tests/baselines/reference/objectFreeze.errors.txt b/tests/baselines/reference/objectFreeze.errors.txt new file mode 100644 index 00000000000..9c28c62f534 --- /dev/null +++ b/tests/baselines/reference/objectFreeze.errors.txt @@ -0,0 +1,22 @@ +tests/cases/compiler/objectFreeze.ts(9,1): error TS2542: Index signature in type 'ReadonlyArray' only permits reading. +tests/cases/compiler/objectFreeze.ts(12,3): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. + + +==== tests/cases/compiler/objectFreeze.ts (2 errors) ==== + const f = Object.freeze(function foo(a: number, b: string) { return false; }); + f(1, "") === false; + + class C { constructor(a: number) { } } + const c = Object.freeze(C); + new c(1); + + const a = Object.freeze([1, 2, 3]); + a[0] = a[2].toString(); + ~~~~ +!!! error TS2542: Index signature in type 'ReadonlyArray' only permits reading. + + const o = Object.freeze({ a: 1, b: "string" }); + o.b = o.a.toString(); + ~ +!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. + \ No newline at end of file diff --git a/tests/baselines/reference/objectFreeze.js b/tests/baselines/reference/objectFreeze.js new file mode 100644 index 00000000000..4c37631bb10 --- /dev/null +++ b/tests/baselines/reference/objectFreeze.js @@ -0,0 +1,29 @@ +//// [objectFreeze.ts] +const f = Object.freeze(function foo(a: number, b: string) { return false; }); +f(1, "") === false; + +class C { constructor(a: number) { } } +const c = Object.freeze(C); +new c(1); + +const a = Object.freeze([1, 2, 3]); +a[0] = a[2].toString(); + +const o = Object.freeze({ a: 1, b: "string" }); +o.b = o.a.toString(); + + +//// [objectFreeze.js] +var f = Object.freeze(function foo(a, b) { return false; }); +f(1, "") === false; +var C = (function () { + function C(a) { + } + return C; +}()); +var c = Object.freeze(C); +new c(1); +var a = Object.freeze([1, 2, 3]); +a[0] = a[2].toString(); +var o = Object.freeze({ a: 1, b: "string" }); +o.b = o.a.toString(); diff --git a/tests/baselines/reference/objectRest.js b/tests/baselines/reference/objectRest.js index 85d8a6a573e..48a1bf8daf8 100644 --- a/tests/baselines/reference/objectRest.js +++ b/tests/baselines/reference/objectRest.js @@ -36,6 +36,8 @@ let computed = 'b'; let computed2 = 'a'; var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o; ({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o); + +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes']; //// [objectRest.js] @@ -43,7 +45,7 @@ var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; @@ -76,4 +78,8 @@ let computed = 'b'; let computed2 = 'a'; var _g = computed, stillNotGreat = o[_g], _h = computed2, soSo = o[_h], o = __rest(o, [typeof _g === "symbol" ? _g : _g + "", typeof _h === "symbol" ? _h : _h + ""]); (_j = computed, stillNotGreat = o[_j], _k = computed2, soSo = o[_k], o = __rest(o, [typeof _j === "symbol" ? _j : _j + "", typeof _k === "symbol" ? _k : _k + ""])); +var noContextualType = (_a) => { + var { aNumber = 12 } = _a, notEmptyObject = __rest(_a, ["aNumber"]); + return aNumber + notEmptyObject['anythingGoes']; +}; var _d, _f, _j, _k; diff --git a/tests/baselines/reference/objectRest.symbols b/tests/baselines/reference/objectRest.symbols index 325258aa8cd..46309392135 100644 --- a/tests/baselines/reference/objectRest.symbols +++ b/tests/baselines/reference/objectRest.symbols @@ -169,3 +169,10 @@ var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o; >o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) >o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes']; +>noContextualType : Symbol(noContextualType, Decl(objectRest.ts, 38, 3)) +>aNumber : Symbol(aNumber, Decl(objectRest.ts, 38, 25)) +>notEmptyObject : Symbol(notEmptyObject, Decl(objectRest.ts, 38, 39)) +>aNumber : Symbol(aNumber, Decl(objectRest.ts, 38, 25)) +>notEmptyObject : Symbol(notEmptyObject, Decl(objectRest.ts, 38, 39)) + diff --git a/tests/baselines/reference/objectRest.types b/tests/baselines/reference/objectRest.types index 7d833543747..1dc05741713 100644 --- a/tests/baselines/reference/objectRest.types +++ b/tests/baselines/reference/objectRest.types @@ -195,3 +195,15 @@ var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o; >o : { a: number; b: string; } >o : { a: number; b: string; } +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes']; +>noContextualType : ({aNumber, ...notEmptyObject}: { [x: string]: any; aNumber?: number; }) => any +>({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes'] : ({aNumber, ...notEmptyObject}: { [x: string]: any; aNumber?: number; }) => any +>aNumber : number +>12 : 12 +>notEmptyObject : { [x: string]: any; } +>aNumber + notEmptyObject['anythingGoes'] : any +>aNumber : number +>notEmptyObject['anythingGoes'] : any +>notEmptyObject : { [x: string]: any; } +>'anythingGoes' : "anythingGoes" + diff --git a/tests/baselines/reference/objectRestAssignment.js b/tests/baselines/reference/objectRestAssignment.js index 66ee00f6696..cbdff663c26 100644 --- a/tests/baselines/reference/objectRestAssignment.js +++ b/tests/baselines/reference/objectRestAssignment.js @@ -19,7 +19,7 @@ var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; diff --git a/tests/baselines/reference/objectRestForOf.js b/tests/baselines/reference/objectRestForOf.js index b4e33550cb0..fd81f77512e 100644 --- a/tests/baselines/reference/objectRestForOf.js +++ b/tests/baselines/reference/objectRestForOf.js @@ -27,7 +27,7 @@ var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; diff --git a/tests/baselines/reference/objectRestNegative.errors.txt b/tests/baselines/reference/objectRestNegative.errors.txt index 345e99723bd..6e65af4bdc1 100644 --- a/tests/baselines/reference/objectRestNegative.errors.txt +++ b/tests/baselines/reference/objectRestNegative.errors.txt @@ -3,11 +3,14 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(6,10): error TS2322: Ty Types of property 'a' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/rest/objectRestNegative.ts(9,31): error TS2462: A rest element must be last in a destructuring pattern +tests/cases/conformance/types/rest/objectRestNegative.ts(11,30): error TS7008: Member 'x' implicitly has an 'any' type. +tests/cases/conformance/types/rest/objectRestNegative.ts(11,33): error TS7008: Member 'y' implicitly has an 'any' type. tests/cases/conformance/types/rest/objectRestNegative.ts(12,17): error TS2700: Rest types may only be created from object types. tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: The target of an object rest assignment must be a variable or a property access. +tests/cases/conformance/types/rest/objectRestNegative.ts(19,90): error TS2339: Property 'anythingGoes' does not exist on type '{ [x: string]: any; }'. -==== tests/cases/conformance/types/rest/objectRestNegative.ts (5 errors) ==== +==== tests/cases/conformance/types/rest/objectRestNegative.ts (8 errors) ==== let o = { a: 1, b: 'no' }; var { ...mustBeLast, a } = o; ~~~~~~~~~~ @@ -27,6 +30,10 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th !!! error TS2462: A rest element must be last in a destructuring pattern } function generic(t: T) { + ~~ +!!! error TS7008: Member 'x' implicitly has an 'any' type. + ~ +!!! error TS7008: Member 'y' implicitly has an 'any' type. let { x, ...rest } = t; ~~~~ !!! error TS2700: Rest types may only be created from object types. @@ -37,4 +44,8 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th ({a, ...rest.b + rest.b} = o); ~~~~~~~~~~~~~~~ !!! error TS2701: The target of an object rest assignment must be a variable or a property access. + + var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject.anythingGoes; + ~~~~~~~~~~~~ +!!! error TS2339: Property 'anythingGoes' does not exist on type '{ [x: string]: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/objectRestNegative.js b/tests/baselines/reference/objectRestNegative.js index f8c5b72ada5..19559e865f2 100644 --- a/tests/baselines/reference/objectRestNegative.js +++ b/tests/baselines/reference/objectRestNegative.js @@ -16,6 +16,8 @@ function generic(t: T) { let rest: { b: string } ({a, ...rest.b + rest.b} = o); + +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject.anythingGoes; //// [objectRestNegative.js] @@ -23,7 +25,7 @@ var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; @@ -42,3 +44,7 @@ function generic(t) { } var rest; (a = o.a, o, rest.b + rest.b = __rest(o, ["a"])); +var noContextualType = function (_a) { + var _b = _a.aNumber, aNumber = _b === void 0 ? 12 : _b, notEmptyObject = __rest(_a, ["aNumber"]); + return aNumber + notEmptyObject.anythingGoes; +}; diff --git a/tests/baselines/reference/objectRestParameter.js b/tests/baselines/reference/objectRestParameter.js index 87419bd06e9..14e84eddfce 100644 --- a/tests/baselines/reference/objectRestParameter.js +++ b/tests/baselines/reference/objectRestParameter.js @@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; diff --git a/tests/baselines/reference/objectSpread.symbols b/tests/baselines/reference/objectSpread.symbols index 0b2fce46b0d..35c10faa9c0 100644 --- a/tests/baselines/reference/objectSpread.symbols +++ b/tests/baselines/reference/objectSpread.symbols @@ -200,7 +200,6 @@ let cplus: { p: number, plus(): void } = { ...c, plus() { return this.p + 1; } } >plus : Symbol(plus, Decl(objectSpread.ts, 49, 23)) >c : Symbol(c, Decl(objectSpread.ts, 45, 3)) >plus : Symbol(plus, Decl(objectSpread.ts, 49, 48)) ->this : Symbol(__object, Decl(objectSpread.ts, 41, 15)) cplus.plus(); >cplus.plus : Symbol(plus, Decl(objectSpread.ts, 49, 23)) diff --git a/tests/baselines/reference/objectSpreadNegative.errors.txt b/tests/baselines/reference/objectSpreadNegative.errors.txt index dc6a356708f..17f07bc06a2 100644 --- a/tests/baselines/reference/objectSpreadNegative.errors.txt +++ b/tests/baselines/reference/objectSpreadNegative.errors.txt @@ -7,20 +7,18 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(25,1): error TS2322 Property 's' is missing in type '{ b: boolean; }'. tests/cases/conformance/types/spread/objectSpreadNegative.ts(28,36): error TS2300: Duplicate identifier 'b'. tests/cases/conformance/types/spread/objectSpreadNegative.ts(28,53): error TS2300: Duplicate identifier 'b'. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(32,20): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(33,24): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(34,19): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(35,19): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(37,20): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(39,19): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(44,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(48,12): error TS2339: Property 'b' does not exist on type '{}'. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(54,9): error TS2339: Property 'm' does not exist on type '{ p: number; }'. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(58,14): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(61,14): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(32,19): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(33,19): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(35,20): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(37,19): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(42,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(46,12): error TS2339: Property 'b' does not exist on type '{}'. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(52,9): error TS2339: Property 'm' does not exist on type '{ p: number; }'. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(56,14): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(59,14): error TS2698: Spread types may only be created from object types. -==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (17 errors) ==== +==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (15 errors) ==== let o = { a: 1, b: 'no' } /// private propagates @@ -66,13 +64,7 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(61,14): error TS269 !!! error TS2300: Duplicate identifier 'b'. let duplicatedSpread = { ...o, ...o } - // null, undefined and primitives are not allowed - let spreadNull = { ...null }; - ~~~~~~~ -!!! error TS2698: Spread types may only be created from object types. - let spreadUndefind = { ...undefined }; - ~~~~~~~~~~~~ -!!! error TS2698: Spread types may only be created from object types. + // primitives are not allowed let spreadNum = { ...12 }; ~~~~~ !!! error TS2698: Spread types may only be created from object types. diff --git a/tests/baselines/reference/objectSpreadNegative.js b/tests/baselines/reference/objectSpreadNegative.js index 6287f4559a7..dff84355370 100644 --- a/tests/baselines/reference/objectSpreadNegative.js +++ b/tests/baselines/reference/objectSpreadNegative.js @@ -29,9 +29,7 @@ spread = b; // error, missing 's' let duplicated = { b: 'bad', ...o, b: 'bad', ...o2, b: 'bad' } let duplicatedSpread = { ...o, ...o } -// null, undefined and primitives are not allowed -let spreadNull = { ...null }; -let spreadUndefind = { ...undefined }; +// primitives are not allowed let spreadNum = { ...12 }; let spreadSum = { ...1 + 1 }; spreadSum.toFixed(); // error, no methods from number @@ -108,9 +106,7 @@ spread = b; // error, missing 's' // literal repeats are not allowed, but spread repeats are fine var duplicated = __assign({ b: 'bad' }, o, { b: 'bad' }, o2, { b: 'bad' }); var duplicatedSpread = __assign({}, o, o); -// null, undefined and primitives are not allowed -var spreadNull = __assign({}, null); -var spreadUndefind = __assign({}, undefined); +// primitives are not allowed var spreadNum = __assign({}, 12); var spreadSum = __assign({}, 1 + 1); spreadSum.toFixed(); // error, no methods from number diff --git a/tests/baselines/reference/parserExportAssignment9.errors.txt b/tests/baselines/reference/parserExportAssignment9.errors.txt index 5d84ee9836c..818b60cfc98 100644 --- a/tests/baselines/reference/parserExportAssignment9.errors.txt +++ b/tests/baselines/reference/parserExportAssignment9.errors.txt @@ -1,16 +1,16 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1318: A default export can only be used in an ECMAScript-style module. -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1318: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1319: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1319: A default export can only be used in an ECMAScript-style module. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts (2 errors) ==== namespace Foo { export default foo; ~~~~~~~~~~~~~~~~~~~ -!!! error TS1318: A default export can only be used in an ECMAScript-style module. +!!! error TS1319: A default export can only be used in an ECMAScript-style module. } module Bar { export default bar; ~~~~~~~~~~~~~~~~~~~ -!!! error TS1318: A default export can only be used in an ECMAScript-style module. +!!! error TS1319: A default export can only be used in an ECMAScript-style module. } \ No newline at end of file diff --git a/tests/baselines/reference/restIntersection.js b/tests/baselines/reference/restIntersection.js new file mode 100644 index 00000000000..d1f9aa3094c --- /dev/null +++ b/tests/baselines/reference/restIntersection.js @@ -0,0 +1,20 @@ +//// [restIntersection.ts] +var intersection: { x: number, y: number } & { w: string, z: string }; + +var rest1: { y: number, w: string, z: string }; +var {x, ...rest1 } = intersection; + + +//// [restIntersection.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var intersection; +var rest1; +var x = intersection.x, rest1 = __rest(intersection, ["x"]); diff --git a/tests/baselines/reference/restIntersection.symbols b/tests/baselines/reference/restIntersection.symbols new file mode 100644 index 00000000000..75f91d243e2 --- /dev/null +++ b/tests/baselines/reference/restIntersection.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/restIntersection.ts === +var intersection: { x: number, y: number } & { w: string, z: string }; +>intersection : Symbol(intersection, Decl(restIntersection.ts, 0, 3)) +>x : Symbol(x, Decl(restIntersection.ts, 0, 19)) +>y : Symbol(y, Decl(restIntersection.ts, 0, 30)) +>w : Symbol(w, Decl(restIntersection.ts, 0, 46)) +>z : Symbol(z, Decl(restIntersection.ts, 0, 57)) + +var rest1: { y: number, w: string, z: string }; +>rest1 : Symbol(rest1, Decl(restIntersection.ts, 2, 3), Decl(restIntersection.ts, 3, 7)) +>y : Symbol(y, Decl(restIntersection.ts, 2, 12)) +>w : Symbol(w, Decl(restIntersection.ts, 2, 23)) +>z : Symbol(z, Decl(restIntersection.ts, 2, 34)) + +var {x, ...rest1 } = intersection; +>x : Symbol(x, Decl(restIntersection.ts, 3, 5)) +>rest1 : Symbol(rest1, Decl(restIntersection.ts, 2, 3), Decl(restIntersection.ts, 3, 7)) +>intersection : Symbol(intersection, Decl(restIntersection.ts, 0, 3)) + diff --git a/tests/baselines/reference/restIntersection.types b/tests/baselines/reference/restIntersection.types new file mode 100644 index 00000000000..5779349ba29 --- /dev/null +++ b/tests/baselines/reference/restIntersection.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/restIntersection.ts === +var intersection: { x: number, y: number } & { w: string, z: string }; +>intersection : { x: number; y: number; } & { w: string; z: string; } +>x : number +>y : number +>w : string +>z : string + +var rest1: { y: number, w: string, z: string }; +>rest1 : { y: number; w: string; z: string; } +>y : number +>w : string +>z : string + +var {x, ...rest1 } = intersection; +>x : number +>rest1 : { y: number; w: string; z: string; } +>intersection : { x: number; y: number; } & { w: string; z: string; } + diff --git a/tests/baselines/reference/restInvalidArgumentType.errors.txt b/tests/baselines/reference/restInvalidArgumentType.errors.txt new file mode 100644 index 00000000000..fff2c7b3563 --- /dev/null +++ b/tests/baselines/reference/restInvalidArgumentType.errors.txt @@ -0,0 +1,104 @@ +tests/cases/compiler/restInvalidArgumentType.ts(31,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(33,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(35,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(36,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(38,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(41,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(42,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(44,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(45,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(47,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(48,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(55,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(56,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(58,13): error TS2700: Rest types may only be created from object types. + + +==== tests/cases/compiler/restInvalidArgumentType.ts (14 errors) ==== + enum E { v1, v2 }; + + function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var {...r1} = p1; // Error, generic type paramterre + ~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r2} = p2; // OK + var {...r3} = t; // Error, generic type paramter + ~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r4} = i; // Error, index access + ~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r5} = k; // Error, index + ~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r6} = mapped_generic; // Error, generic mapped object type + ~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r7} = mapped; // OK, non-generic mapped type + + var {...r8} = union_generic; // Error, union with generic type parameter + ~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r9} = union_primitive; // Error, union with generic type parameter + ~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r10} = intersection_generic; // Error, intersection with generic type parameter + ~~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r11} = intersection_premitive; // Error, intersection with generic type parameter + ~~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r12} = num; // Error + ~~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r13} = str; // Error + ~~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r14} = u; // OK + var {...r15} = n; // OK + + var {...r16} = a; // OK + + var {...r17} = literal_string; // Error + ~~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r18} = literal_number; // Error + ~~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r19} = e; // Error, enum + ~~~ +!!! error TS2700: Rest types may only be created from object types. + } \ No newline at end of file diff --git a/tests/baselines/reference/restInvalidArgumentType.js b/tests/baselines/reference/restInvalidArgumentType.js new file mode 100644 index 00000000000..48e4e11e805 --- /dev/null +++ b/tests/baselines/reference/restInvalidArgumentType.js @@ -0,0 +1,115 @@ +//// [restInvalidArgumentType.ts] +enum E { v1, v2 }; + +function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var {...r1} = p1; // Error, generic type paramterre + var {...r2} = p2; // OK + var {...r3} = t; // Error, generic type paramter + + var {...r4} = i; // Error, index access + var {...r5} = k; // Error, index + + var {...r6} = mapped_generic; // Error, generic mapped object type + var {...r7} = mapped; // OK, non-generic mapped type + + var {...r8} = union_generic; // Error, union with generic type parameter + var {...r9} = union_primitive; // Error, union with generic type parameter + + var {...r10} = intersection_generic; // Error, intersection with generic type parameter + var {...r11} = intersection_premitive; // Error, intersection with generic type parameter + + var {...r12} = num; // Error + var {...r13} = str; // Error + + var {...r14} = u; // OK + var {...r15} = n; // OK + + var {...r16} = a; // OK + + var {...r17} = literal_string; // Error + var {...r18} = literal_number; // Error + + var {...r19} = e; // Error, enum +} + +//// [restInvalidArgumentType.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var E; +(function (E) { + E[E["v1"] = 0] = "v1"; + E[E["v2"] = 1] = "v2"; +})(E || (E = {})); +; +function f(p1, p2) { + var t; + var i; + var k; + var mapped_generic; + var mapped; + var union_generic; + var union_primitive; + var intersection_generic; + var intersection_premitive; + var num; + var str; + var u; + var n; + var a; + var literal_string; + var literal_number; + var e; + var r1 = __rest(p1, []); // Error, generic type paramterre + var r2 = __rest(p2, []); // OK + var r3 = __rest(t, []); // Error, generic type paramter + var r4 = __rest(i, []); // Error, index access + var r5 = __rest(k, []); // Error, index + var r6 = __rest(mapped_generic, []); // Error, generic mapped object type + var r7 = __rest(mapped, []); // OK, non-generic mapped type + var r8 = __rest(union_generic, []); // Error, union with generic type parameter + var r9 = __rest(union_primitive, []); // Error, union with generic type parameter + var r10 = __rest(intersection_generic, []); // Error, intersection with generic type parameter + var r11 = __rest(intersection_premitive, []); // Error, intersection with generic type parameter + var r12 = __rest(num, []); // Error + var r13 = __rest(str, []); // Error + var r14 = __rest(u, []); // OK + var r15 = __rest(n, []); // OK + var r16 = __rest(a, []); // OK + var r17 = __rest(literal_string, []); // Error + var r18 = __rest(literal_number, []); // Error + var r19 = __rest(e, []); // Error, enum +} diff --git a/tests/baselines/reference/restUnion.js b/tests/baselines/reference/restUnion.js new file mode 100644 index 00000000000..09a6243d2a9 --- /dev/null +++ b/tests/baselines/reference/restUnion.js @@ -0,0 +1,36 @@ +//// [restUnion.ts] +var union: { a: number, c: boolean } | { a: string, b: string }; + +var rest1: { c: boolean } | { b: string }; +var {a, ...rest1 } = union; + + +var undefinedUnion: { n: number } | undefined; +var rest2: {}; +var {n, ...rest2 } = undefinedUnion; + + +var nullUnion: { n: number } | null; +var rest3: {}; +var {n, ...rest3 } = nullUnion; + + +//// [restUnion.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var union; +var rest1; +var a = union.a, rest1 = __rest(union, ["a"]); +var undefinedUnion; +var rest2; +var n = undefinedUnion.n, rest2 = __rest(undefinedUnion, ["n"]); +var nullUnion; +var rest3; +var n = nullUnion.n, rest3 = __rest(nullUnion, ["n"]); diff --git a/tests/baselines/reference/restUnion.symbols b/tests/baselines/reference/restUnion.symbols new file mode 100644 index 00000000000..660c85badb4 --- /dev/null +++ b/tests/baselines/reference/restUnion.symbols @@ -0,0 +1,44 @@ +=== tests/cases/compiler/restUnion.ts === +var union: { a: number, c: boolean } | { a: string, b: string }; +>union : Symbol(union, Decl(restUnion.ts, 0, 3)) +>a : Symbol(a, Decl(restUnion.ts, 0, 12)) +>c : Symbol(c, Decl(restUnion.ts, 0, 23)) +>a : Symbol(a, Decl(restUnion.ts, 0, 40)) +>b : Symbol(b, Decl(restUnion.ts, 0, 51)) + +var rest1: { c: boolean } | { b: string }; +>rest1 : Symbol(rest1, Decl(restUnion.ts, 2, 3), Decl(restUnion.ts, 3, 7)) +>c : Symbol(c, Decl(restUnion.ts, 2, 12)) +>b : Symbol(b, Decl(restUnion.ts, 2, 29)) + +var {a, ...rest1 } = union; +>a : Symbol(a, Decl(restUnion.ts, 3, 5)) +>rest1 : Symbol(rest1, Decl(restUnion.ts, 2, 3), Decl(restUnion.ts, 3, 7)) +>union : Symbol(union, Decl(restUnion.ts, 0, 3)) + + +var undefinedUnion: { n: number } | undefined; +>undefinedUnion : Symbol(undefinedUnion, Decl(restUnion.ts, 6, 3)) +>n : Symbol(n, Decl(restUnion.ts, 6, 21)) + +var rest2: {}; +>rest2 : Symbol(rest2, Decl(restUnion.ts, 7, 3), Decl(restUnion.ts, 8, 7)) + +var {n, ...rest2 } = undefinedUnion; +>n : Symbol(n, Decl(restUnion.ts, 8, 5), Decl(restUnion.ts, 13, 5)) +>rest2 : Symbol(rest2, Decl(restUnion.ts, 7, 3), Decl(restUnion.ts, 8, 7)) +>undefinedUnion : Symbol(undefinedUnion, Decl(restUnion.ts, 6, 3)) + + +var nullUnion: { n: number } | null; +>nullUnion : Symbol(nullUnion, Decl(restUnion.ts, 11, 3)) +>n : Symbol(n, Decl(restUnion.ts, 11, 16)) + +var rest3: {}; +>rest3 : Symbol(rest3, Decl(restUnion.ts, 12, 3), Decl(restUnion.ts, 13, 7)) + +var {n, ...rest3 } = nullUnion; +>n : Symbol(n, Decl(restUnion.ts, 8, 5), Decl(restUnion.ts, 13, 5)) +>rest3 : Symbol(rest3, Decl(restUnion.ts, 12, 3), Decl(restUnion.ts, 13, 7)) +>nullUnion : Symbol(nullUnion, Decl(restUnion.ts, 11, 3)) + diff --git a/tests/baselines/reference/restUnion.types b/tests/baselines/reference/restUnion.types new file mode 100644 index 00000000000..9837466684b --- /dev/null +++ b/tests/baselines/reference/restUnion.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/restUnion.ts === +var union: { a: number, c: boolean } | { a: string, b: string }; +>union : { a: number; c: boolean; } | { a: string; b: string; } +>a : number +>c : boolean +>a : string +>b : string + +var rest1: { c: boolean } | { b: string }; +>rest1 : { c: boolean; } | { b: string; } +>c : boolean +>b : string + +var {a, ...rest1 } = union; +>a : string | number +>rest1 : { c: boolean; } | { b: string; } +>union : { a: number; c: boolean; } | { a: string; b: string; } + + +var undefinedUnion: { n: number } | undefined; +>undefinedUnion : { n: number; } +>n : number + +var rest2: {}; +>rest2 : {} + +var {n, ...rest2 } = undefinedUnion; +>n : number +>rest2 : {} +>undefinedUnion : { n: number; } + + +var nullUnion: { n: number } | null; +>nullUnion : { n: number; } +>n : number +>null : null + +var rest3: {}; +>rest3 : {} + +var {n, ...rest3 } = nullUnion; +>n : number +>rest3 : {} +>nullUnion : { n: number; } + diff --git a/tests/baselines/reference/restUnion2.js b/tests/baselines/reference/restUnion2.js new file mode 100644 index 00000000000..44a0acfbcf8 --- /dev/null +++ b/tests/baselines/reference/restUnion2.js @@ -0,0 +1,38 @@ +//// [restUnion2.ts] + +declare const undefinedUnion: { n: number } | undefined; +var rest2: { n: number }; +var {...rest2 } = undefinedUnion; + + +declare const nullUnion: { n: number } | null; +var rest3: { n: number }; +var {...rest3 } = nullUnion; + + +declare const nullAndUndefinedUnion: null | undefined; +var rest4: { }; +var {...rest4 } = nullAndUndefinedUnion; + +declare const unionWithIntersection: ({ n: number } & { s: string }) & undefined | null; +var rest5: { n: number, s: string }; +var {...rest5 } = unionWithIntersection; + +//// [restUnion2.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var rest2; +var rest2 = __rest(undefinedUnion, []); +var rest3; +var rest3 = __rest(nullUnion, []); +var rest4; +var rest4 = __rest(nullAndUndefinedUnion, []); +var rest5; +var rest5 = __rest(unionWithIntersection, []); diff --git a/tests/baselines/reference/restUnion2.symbols b/tests/baselines/reference/restUnion2.symbols new file mode 100644 index 00000000000..20a113a23b4 --- /dev/null +++ b/tests/baselines/reference/restUnion2.symbols @@ -0,0 +1,52 @@ +=== tests/cases/compiler/restUnion2.ts === + +declare const undefinedUnion: { n: number } | undefined; +>undefinedUnion : Symbol(undefinedUnion, Decl(restUnion2.ts, 1, 13)) +>n : Symbol(n, Decl(restUnion2.ts, 1, 31)) + +var rest2: { n: number }; +>rest2 : Symbol(rest2, Decl(restUnion2.ts, 2, 3), Decl(restUnion2.ts, 3, 5)) +>n : Symbol(n, Decl(restUnion2.ts, 2, 12)) + +var {...rest2 } = undefinedUnion; +>rest2 : Symbol(rest2, Decl(restUnion2.ts, 2, 3), Decl(restUnion2.ts, 3, 5)) +>undefinedUnion : Symbol(undefinedUnion, Decl(restUnion2.ts, 1, 13)) + + +declare const nullUnion: { n: number } | null; +>nullUnion : Symbol(nullUnion, Decl(restUnion2.ts, 6, 13)) +>n : Symbol(n, Decl(restUnion2.ts, 6, 26)) + +var rest3: { n: number }; +>rest3 : Symbol(rest3, Decl(restUnion2.ts, 7, 3), Decl(restUnion2.ts, 8, 5)) +>n : Symbol(n, Decl(restUnion2.ts, 7, 12)) + +var {...rest3 } = nullUnion; +>rest3 : Symbol(rest3, Decl(restUnion2.ts, 7, 3), Decl(restUnion2.ts, 8, 5)) +>nullUnion : Symbol(nullUnion, Decl(restUnion2.ts, 6, 13)) + + +declare const nullAndUndefinedUnion: null | undefined; +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(restUnion2.ts, 11, 13)) + +var rest4: { }; +>rest4 : Symbol(rest4, Decl(restUnion2.ts, 12, 3), Decl(restUnion2.ts, 13, 5)) + +var {...rest4 } = nullAndUndefinedUnion; +>rest4 : Symbol(rest4, Decl(restUnion2.ts, 12, 3), Decl(restUnion2.ts, 13, 5)) +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(restUnion2.ts, 11, 13)) + +declare const unionWithIntersection: ({ n: number } & { s: string }) & undefined | null; +>unionWithIntersection : Symbol(unionWithIntersection, Decl(restUnion2.ts, 15, 13)) +>n : Symbol(n, Decl(restUnion2.ts, 15, 39)) +>s : Symbol(s, Decl(restUnion2.ts, 15, 55)) + +var rest5: { n: number, s: string }; +>rest5 : Symbol(rest5, Decl(restUnion2.ts, 16, 3), Decl(restUnion2.ts, 17, 5)) +>n : Symbol(n, Decl(restUnion2.ts, 16, 12)) +>s : Symbol(s, Decl(restUnion2.ts, 16, 23)) + +var {...rest5 } = unionWithIntersection; +>rest5 : Symbol(rest5, Decl(restUnion2.ts, 16, 3), Decl(restUnion2.ts, 17, 5)) +>unionWithIntersection : Symbol(unionWithIntersection, Decl(restUnion2.ts, 15, 13)) + diff --git a/tests/baselines/reference/restUnion2.types b/tests/baselines/reference/restUnion2.types new file mode 100644 index 00000000000..81b768777fd --- /dev/null +++ b/tests/baselines/reference/restUnion2.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/restUnion2.ts === + +declare const undefinedUnion: { n: number } | undefined; +>undefinedUnion : { n: number; } | undefined +>n : number + +var rest2: { n: number }; +>rest2 : { n: number; } +>n : number + +var {...rest2 } = undefinedUnion; +>rest2 : { n: number; } +>undefinedUnion : { n: number; } | undefined + + +declare const nullUnion: { n: number } | null; +>nullUnion : { n: number; } | null +>n : number +>null : null + +var rest3: { n: number }; +>rest3 : { n: number; } +>n : number + +var {...rest3 } = nullUnion; +>rest3 : { n: number; } +>nullUnion : { n: number; } | null + + +declare const nullAndUndefinedUnion: null | undefined; +>nullAndUndefinedUnion : null | undefined +>null : null + +var rest4: { }; +>rest4 : {} + +var {...rest4 } = nullAndUndefinedUnion; +>rest4 : {} +>nullAndUndefinedUnion : null | undefined + +declare const unionWithIntersection: ({ n: number } & { s: string }) & undefined | null; +>unionWithIntersection : ({ n: number; } & { s: string; } & undefined) | null +>n : number +>s : string +>null : null + +var rest5: { n: number, s: string }; +>rest5 : { n: number; s: string; } +>n : number +>s : string + +var {...rest5 } = unionWithIntersection; +>rest5 : { n: number; s: string; } +>unionWithIntersection : ({ n: number; } & { s: string; } & undefined) | null + diff --git a/tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt b/tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt new file mode 100644 index 00000000000..599c9fbedb0 --- /dev/null +++ b/tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/selfReferencingSpreadInLoop.ts(1,5): error TS7034: Variable 'additional' implicitly has type 'any[]' in some locations where its type cannot be determined. +tests/cases/compiler/selfReferencingSpreadInLoop.ts(3,22): error TS7005: Variable 'additional' implicitly has an 'any[]' type. + + +==== tests/cases/compiler/selfReferencingSpreadInLoop.ts (2 errors) ==== + let additional = []; + ~~~~~~~~~~ +!!! error TS7034: Variable 'additional' implicitly has type 'any[]' in some locations where its type cannot be determined. + for (const subcomponent of [1, 2, 3]) { + additional = [...additional, subcomponent]; + ~~~~~~~~~~ +!!! error TS7005: Variable 'additional' implicitly has an 'any[]' type. + } + \ No newline at end of file diff --git a/tests/baselines/reference/selfReferencingSpreadInLoop.js b/tests/baselines/reference/selfReferencingSpreadInLoop.js new file mode 100644 index 00000000000..1b8d5ace4f3 --- /dev/null +++ b/tests/baselines/reference/selfReferencingSpreadInLoop.js @@ -0,0 +1,13 @@ +//// [selfReferencingSpreadInLoop.ts] +let additional = []; +for (const subcomponent of [1, 2, 3]) { + additional = [...additional, subcomponent]; +} + + +//// [selfReferencingSpreadInLoop.js] +var additional = []; +for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) { + var subcomponent = _a[_i]; + additional = additional.concat([subcomponent]); +} diff --git a/tests/baselines/reference/spreadIntersection.js b/tests/baselines/reference/spreadIntersection.js new file mode 100644 index 00000000000..b3fa9f0c2fb --- /dev/null +++ b/tests/baselines/reference/spreadIntersection.js @@ -0,0 +1,23 @@ +//// [spreadIntersection.ts] +var intersection: { a: number } & { b: string }; + +var o1: { a: number, b: string }; +var o1 = { ...intersection }; + +var o2: { a: number, b: string, c: boolean }; +var o2 = { ...intersection, c: false }; + +//// [spreadIntersection.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +var intersection; +var o1; +var o1 = __assign({}, intersection); +var o2; +var o2 = __assign({}, intersection, { c: false }); diff --git a/tests/baselines/reference/spreadIntersection.symbols b/tests/baselines/reference/spreadIntersection.symbols new file mode 100644 index 00000000000..1f6b3c12de1 --- /dev/null +++ b/tests/baselines/reference/spreadIntersection.symbols @@ -0,0 +1,26 @@ +=== tests/cases/compiler/spreadIntersection.ts === +var intersection: { a: number } & { b: string }; +>intersection : Symbol(intersection, Decl(spreadIntersection.ts, 0, 3)) +>a : Symbol(a, Decl(spreadIntersection.ts, 0, 19)) +>b : Symbol(b, Decl(spreadIntersection.ts, 0, 35)) + +var o1: { a: number, b: string }; +>o1 : Symbol(o1, Decl(spreadIntersection.ts, 2, 3), Decl(spreadIntersection.ts, 3, 3)) +>a : Symbol(a, Decl(spreadIntersection.ts, 2, 9)) +>b : Symbol(b, Decl(spreadIntersection.ts, 2, 20)) + +var o1 = { ...intersection }; +>o1 : Symbol(o1, Decl(spreadIntersection.ts, 2, 3), Decl(spreadIntersection.ts, 3, 3)) +>intersection : Symbol(intersection, Decl(spreadIntersection.ts, 0, 3)) + +var o2: { a: number, b: string, c: boolean }; +>o2 : Symbol(o2, Decl(spreadIntersection.ts, 5, 3), Decl(spreadIntersection.ts, 6, 3)) +>a : Symbol(a, Decl(spreadIntersection.ts, 5, 9)) +>b : Symbol(b, Decl(spreadIntersection.ts, 5, 20)) +>c : Symbol(c, Decl(spreadIntersection.ts, 5, 31)) + +var o2 = { ...intersection, c: false }; +>o2 : Symbol(o2, Decl(spreadIntersection.ts, 5, 3), Decl(spreadIntersection.ts, 6, 3)) +>intersection : Symbol(intersection, Decl(spreadIntersection.ts, 0, 3)) +>c : Symbol(c, Decl(spreadIntersection.ts, 6, 27)) + diff --git a/tests/baselines/reference/spreadIntersection.types b/tests/baselines/reference/spreadIntersection.types new file mode 100644 index 00000000000..c3c6b99adee --- /dev/null +++ b/tests/baselines/reference/spreadIntersection.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/spreadIntersection.ts === +var intersection: { a: number } & { b: string }; +>intersection : { a: number; } & { b: string; } +>a : number +>b : string + +var o1: { a: number, b: string }; +>o1 : { a: number; b: string; } +>a : number +>b : string + +var o1 = { ...intersection }; +>o1 : { a: number; b: string; } +>{ ...intersection } : { a: number; b: string; } +>intersection : { a: number; } & { b: string; } + +var o2: { a: number, b: string, c: boolean }; +>o2 : { a: number; b: string; c: boolean; } +>a : number +>b : string +>c : boolean + +var o2 = { ...intersection, c: false }; +>o2 : { a: number; b: string; c: boolean; } +>{ ...intersection, c: false } : { c: boolean; a: number; b: string; } +>intersection : { a: number; } & { b: string; } +>c : boolean +>false : false + diff --git a/tests/baselines/reference/spreadInvalidArgumentType.errors.txt b/tests/baselines/reference/spreadInvalidArgumentType.errors.txt new file mode 100644 index 00000000000..5088390f9ee --- /dev/null +++ b/tests/baselines/reference/spreadInvalidArgumentType.errors.txt @@ -0,0 +1,104 @@ +tests/cases/compiler/spreadInvalidArgumentType.ts(31,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(33,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(35,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(36,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(38,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(41,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(42,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(44,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(45,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(47,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(48,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(55,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(56,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(58,17): error TS2698: Spread types may only be created from object types. + + +==== tests/cases/compiler/spreadInvalidArgumentType.ts (14 errors) ==== + enum E { v1, v2 }; + + function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var o1 = { ...p1 }; // Error, generic type paramterre + ~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o2 = { ...p2 }; // OK + var o3 = { ...t }; // Error, generic type paramter + ~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o4 = { ...i }; // Error, index access + ~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o5 = { ...k }; // Error, index + ~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o6 = { ...mapped_generic }; // Error, generic mapped object type + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o7 = { ...mapped }; // OK, non-generic mapped type + + var o8 = { ...union_generic }; // Error, union with generic type parameter + ~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o9 = { ...union_primitive }; // Error, union with generic type parameter + ~~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o10 = { ...intersection_generic }; // Error, intersection with generic type parameter + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o11 = { ...intersection_premitive }; // Error, intersection with generic type parameter + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o12 = { ...num }; // Error + ~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o13 = { ...str }; // Error + ~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o14 = { ...u }; // OK + var o15 = { ...n }; // OK + + var o16 = { ...a }; // OK + + var o17 = { ...literal_string }; // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o18 = { ...literal_number }; // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o19 = { ...e }; // Error, enum + ~~~~ +!!! error TS2698: Spread types may only be created from object types. + } \ No newline at end of file diff --git a/tests/baselines/reference/spreadInvalidArgumentType.js b/tests/baselines/reference/spreadInvalidArgumentType.js new file mode 100644 index 00000000000..26f958f224d --- /dev/null +++ b/tests/baselines/reference/spreadInvalidArgumentType.js @@ -0,0 +1,114 @@ +//// [spreadInvalidArgumentType.ts] +enum E { v1, v2 }; + +function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var o1 = { ...p1 }; // Error, generic type paramterre + var o2 = { ...p2 }; // OK + var o3 = { ...t }; // Error, generic type paramter + + var o4 = { ...i }; // Error, index access + var o5 = { ...k }; // Error, index + + var o6 = { ...mapped_generic }; // Error, generic mapped object type + var o7 = { ...mapped }; // OK, non-generic mapped type + + var o8 = { ...union_generic }; // Error, union with generic type parameter + var o9 = { ...union_primitive }; // Error, union with generic type parameter + + var o10 = { ...intersection_generic }; // Error, intersection with generic type parameter + var o11 = { ...intersection_premitive }; // Error, intersection with generic type parameter + + var o12 = { ...num }; // Error + var o13 = { ...str }; // Error + + var o14 = { ...u }; // OK + var o15 = { ...n }; // OK + + var o16 = { ...a }; // OK + + var o17 = { ...literal_string }; // Error + var o18 = { ...literal_number }; // Error + + var o19 = { ...e }; // Error, enum +} + +//// [spreadInvalidArgumentType.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +var E; +(function (E) { + E[E["v1"] = 0] = "v1"; + E[E["v2"] = 1] = "v2"; +})(E || (E = {})); +; +function f(p1, p2) { + var t; + var i; + var k; + var mapped_generic; + var mapped; + var union_generic; + var union_primitive; + var intersection_generic; + var intersection_premitive; + var num; + var str; + var u; + var n; + var a; + var literal_string; + var literal_number; + var e; + var o1 = __assign({}, p1); // Error, generic type paramterre + var o2 = __assign({}, p2); // OK + var o3 = __assign({}, t); // Error, generic type paramter + var o4 = __assign({}, i); // Error, index access + var o5 = __assign({}, k); // Error, index + var o6 = __assign({}, mapped_generic); // Error, generic mapped object type + var o7 = __assign({}, mapped); // OK, non-generic mapped type + var o8 = __assign({}, union_generic); // Error, union with generic type parameter + var o9 = __assign({}, union_primitive); // Error, union with generic type parameter + var o10 = __assign({}, intersection_generic); // Error, intersection with generic type parameter + var o11 = __assign({}, intersection_premitive); // Error, intersection with generic type parameter + var o12 = __assign({}, num); // Error + var o13 = __assign({}, str); // Error + var o14 = __assign({}, u); // OK + var o15 = __assign({}, n); // OK + var o16 = __assign({}, a); // OK + var o17 = __assign({}, literal_string); // Error + var o18 = __assign({}, literal_number); // Error + var o19 = __assign({}, e); // Error, enum +} diff --git a/tests/baselines/reference/spreadUnion.js b/tests/baselines/reference/spreadUnion.js new file mode 100644 index 00000000000..2691a3acdcc --- /dev/null +++ b/tests/baselines/reference/spreadUnion.js @@ -0,0 +1,28 @@ +//// [spreadUnion.ts] +var union: { a: number } | { b: string }; + +var o3: { a: number } | { b: string }; +var o3 = { ...union }; + +var o4: { a: boolean } | { b: string , a: boolean}; +var o4 = { ...union, a: false }; + +var o5: { a: number } | { b: string } | { a: number, b: string }; +var o5 = { ...union, ...union }; + +//// [spreadUnion.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +var union; +var o3; +var o3 = __assign({}, union); +var o4; +var o4 = __assign({}, union, { a: false }); +var o5; +var o5 = __assign({}, union, union); diff --git a/tests/baselines/reference/spreadUnion.symbols b/tests/baselines/reference/spreadUnion.symbols new file mode 100644 index 00000000000..40a63d56d49 --- /dev/null +++ b/tests/baselines/reference/spreadUnion.symbols @@ -0,0 +1,38 @@ +=== tests/cases/compiler/spreadUnion.ts === +var union: { a: number } | { b: string }; +>union : Symbol(union, Decl(spreadUnion.ts, 0, 3)) +>a : Symbol(a, Decl(spreadUnion.ts, 0, 12)) +>b : Symbol(b, Decl(spreadUnion.ts, 0, 28)) + +var o3: { a: number } | { b: string }; +>o3 : Symbol(o3, Decl(spreadUnion.ts, 2, 3), Decl(spreadUnion.ts, 3, 3)) +>a : Symbol(a, Decl(spreadUnion.ts, 2, 9)) +>b : Symbol(b, Decl(spreadUnion.ts, 2, 25)) + +var o3 = { ...union }; +>o3 : Symbol(o3, Decl(spreadUnion.ts, 2, 3), Decl(spreadUnion.ts, 3, 3)) +>union : Symbol(union, Decl(spreadUnion.ts, 0, 3)) + +var o4: { a: boolean } | { b: string , a: boolean}; +>o4 : Symbol(o4, Decl(spreadUnion.ts, 5, 3), Decl(spreadUnion.ts, 6, 3)) +>a : Symbol(a, Decl(spreadUnion.ts, 5, 9)) +>b : Symbol(b, Decl(spreadUnion.ts, 5, 26)) +>a : Symbol(a, Decl(spreadUnion.ts, 5, 38)) + +var o4 = { ...union, a: false }; +>o4 : Symbol(o4, Decl(spreadUnion.ts, 5, 3), Decl(spreadUnion.ts, 6, 3)) +>union : Symbol(union, Decl(spreadUnion.ts, 0, 3)) +>a : Symbol(a, Decl(spreadUnion.ts, 6, 21)) + +var o5: { a: number } | { b: string } | { a: number, b: string }; +>o5 : Symbol(o5, Decl(spreadUnion.ts, 8, 3), Decl(spreadUnion.ts, 9, 3)) +>a : Symbol(a, Decl(spreadUnion.ts, 8, 9)) +>b : Symbol(b, Decl(spreadUnion.ts, 8, 25)) +>a : Symbol(a, Decl(spreadUnion.ts, 8, 41)) +>b : Symbol(b, Decl(spreadUnion.ts, 8, 52)) + +var o5 = { ...union, ...union }; +>o5 : Symbol(o5, Decl(spreadUnion.ts, 8, 3), Decl(spreadUnion.ts, 9, 3)) +>union : Symbol(union, Decl(spreadUnion.ts, 0, 3)) +>union : Symbol(union, Decl(spreadUnion.ts, 0, 3)) + diff --git a/tests/baselines/reference/spreadUnion.types b/tests/baselines/reference/spreadUnion.types new file mode 100644 index 00000000000..9e5ac1cffd5 --- /dev/null +++ b/tests/baselines/reference/spreadUnion.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/spreadUnion.ts === +var union: { a: number } | { b: string }; +>union : { a: number; } | { b: string; } +>a : number +>b : string + +var o3: { a: number } | { b: string }; +>o3 : { a: number; } | { b: string; } +>a : number +>b : string + +var o3 = { ...union }; +>o3 : { a: number; } | { b: string; } +>{ ...union } : { a: number; } | { b: string; } +>union : { a: number; } | { b: string; } + +var o4: { a: boolean } | { b: string , a: boolean}; +>o4 : { a: boolean; } | { b: string; a: boolean; } +>a : boolean +>b : string +>a : boolean + +var o4 = { ...union, a: false }; +>o4 : { a: boolean; } | { b: string; a: boolean; } +>{ ...union, a: false } : { a: boolean; } | { a: boolean; b: string; } +>union : { a: number; } | { b: string; } +>a : boolean +>false : false + +var o5: { a: number } | { b: string } | { a: number, b: string }; +>o5 : { a: number; } | { b: string; } | { a: number; b: string; } +>a : number +>b : string +>a : number +>b : string + +var o5 = { ...union, ...union }; +>o5 : { a: number; } | { b: string; } | { a: number; b: string; } +>{ ...union, ...union } : { a: number; } | { b: string; a: number; } | { a: number; b: string; } | { b: string; } +>union : { a: number; } | { b: string; } +>union : { a: number; } | { b: string; } + diff --git a/tests/baselines/reference/spreadUnion2.js b/tests/baselines/reference/spreadUnion2.js new file mode 100644 index 00000000000..6c7527af9dd --- /dev/null +++ b/tests/baselines/reference/spreadUnion2.js @@ -0,0 +1,49 @@ +//// [spreadUnion2.ts] + +declare const undefinedUnion: { a: number } | undefined; +declare const nullUnion: { b: number } | null; +declare const nullAndUndefinedUnion: null | undefined; + +var o1: { a: number }; +var o1 = { ...undefinedUnion }; + +var o2: { b: number }; +var o2 = { ...nullUnion }; + +var o3: { a: number, b: number }; +var o3 = { ...undefinedUnion, ...nullUnion }; +var o3 = { ...nullUnion, ...undefinedUnion }; + +var o4: { a: number }; +var o4 = { ...undefinedUnion, ...undefinedUnion }; + +var o5: { b: number }; +var o5 = { ...nullUnion, ...nullUnion }; + +var o6: { }; +var o6 = { ...nullAndUndefinedUnion, ...nullAndUndefinedUnion }; +var o6 = { ...nullAndUndefinedUnion }; + +//// [spreadUnion2.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +var o1; +var o1 = __assign({}, undefinedUnion); +var o2; +var o2 = __assign({}, nullUnion); +var o3; +var o3 = __assign({}, undefinedUnion, nullUnion); +var o3 = __assign({}, nullUnion, undefinedUnion); +var o4; +var o4 = __assign({}, undefinedUnion, undefinedUnion); +var o5; +var o5 = __assign({}, nullUnion, nullUnion); +var o6; +var o6 = __assign({}, nullAndUndefinedUnion, nullAndUndefinedUnion); +var o6 = __assign({}, nullAndUndefinedUnion); diff --git a/tests/baselines/reference/spreadUnion2.symbols b/tests/baselines/reference/spreadUnion2.symbols new file mode 100644 index 00000000000..cc2c194f2a6 --- /dev/null +++ b/tests/baselines/reference/spreadUnion2.symbols @@ -0,0 +1,74 @@ +=== tests/cases/compiler/spreadUnion2.ts === + +declare const undefinedUnion: { a: number } | undefined; +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) +>a : Symbol(a, Decl(spreadUnion2.ts, 1, 31)) + +declare const nullUnion: { b: number } | null; +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) +>b : Symbol(b, Decl(spreadUnion2.ts, 2, 26)) + +declare const nullAndUndefinedUnion: null | undefined; +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion2.ts, 3, 13)) + +var o1: { a: number }; +>o1 : Symbol(o1, Decl(spreadUnion2.ts, 5, 3), Decl(spreadUnion2.ts, 6, 3)) +>a : Symbol(a, Decl(spreadUnion2.ts, 5, 9)) + +var o1 = { ...undefinedUnion }; +>o1 : Symbol(o1, Decl(spreadUnion2.ts, 5, 3), Decl(spreadUnion2.ts, 6, 3)) +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) + +var o2: { b: number }; +>o2 : Symbol(o2, Decl(spreadUnion2.ts, 8, 3), Decl(spreadUnion2.ts, 9, 3)) +>b : Symbol(b, Decl(spreadUnion2.ts, 8, 9)) + +var o2 = { ...nullUnion }; +>o2 : Symbol(o2, Decl(spreadUnion2.ts, 8, 3), Decl(spreadUnion2.ts, 9, 3)) +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) + +var o3: { a: number, b: number }; +>o3 : Symbol(o3, Decl(spreadUnion2.ts, 11, 3), Decl(spreadUnion2.ts, 12, 3), Decl(spreadUnion2.ts, 13, 3)) +>a : Symbol(a, Decl(spreadUnion2.ts, 11, 9)) +>b : Symbol(b, Decl(spreadUnion2.ts, 11, 20)) + +var o3 = { ...undefinedUnion, ...nullUnion }; +>o3 : Symbol(o3, Decl(spreadUnion2.ts, 11, 3), Decl(spreadUnion2.ts, 12, 3), Decl(spreadUnion2.ts, 13, 3)) +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) + +var o3 = { ...nullUnion, ...undefinedUnion }; +>o3 : Symbol(o3, Decl(spreadUnion2.ts, 11, 3), Decl(spreadUnion2.ts, 12, 3), Decl(spreadUnion2.ts, 13, 3)) +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) + +var o4: { a: number }; +>o4 : Symbol(o4, Decl(spreadUnion2.ts, 15, 3), Decl(spreadUnion2.ts, 16, 3)) +>a : Symbol(a, Decl(spreadUnion2.ts, 15, 9)) + +var o4 = { ...undefinedUnion, ...undefinedUnion }; +>o4 : Symbol(o4, Decl(spreadUnion2.ts, 15, 3), Decl(spreadUnion2.ts, 16, 3)) +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) + +var o5: { b: number }; +>o5 : Symbol(o5, Decl(spreadUnion2.ts, 18, 3), Decl(spreadUnion2.ts, 19, 3)) +>b : Symbol(b, Decl(spreadUnion2.ts, 18, 9)) + +var o5 = { ...nullUnion, ...nullUnion }; +>o5 : Symbol(o5, Decl(spreadUnion2.ts, 18, 3), Decl(spreadUnion2.ts, 19, 3)) +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) + +var o6: { }; +>o6 : Symbol(o6, Decl(spreadUnion2.ts, 21, 3), Decl(spreadUnion2.ts, 22, 3), Decl(spreadUnion2.ts, 23, 3)) + +var o6 = { ...nullAndUndefinedUnion, ...nullAndUndefinedUnion }; +>o6 : Symbol(o6, Decl(spreadUnion2.ts, 21, 3), Decl(spreadUnion2.ts, 22, 3), Decl(spreadUnion2.ts, 23, 3)) +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion2.ts, 3, 13)) +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion2.ts, 3, 13)) + +var o6 = { ...nullAndUndefinedUnion }; +>o6 : Symbol(o6, Decl(spreadUnion2.ts, 21, 3), Decl(spreadUnion2.ts, 22, 3), Decl(spreadUnion2.ts, 23, 3)) +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion2.ts, 3, 13)) + diff --git a/tests/baselines/reference/spreadUnion2.types b/tests/baselines/reference/spreadUnion2.types new file mode 100644 index 00000000000..cf90381ca77 --- /dev/null +++ b/tests/baselines/reference/spreadUnion2.types @@ -0,0 +1,84 @@ +=== tests/cases/compiler/spreadUnion2.ts === + +declare const undefinedUnion: { a: number } | undefined; +>undefinedUnion : { a: number; } | undefined +>a : number + +declare const nullUnion: { b: number } | null; +>nullUnion : { b: number; } | null +>b : number +>null : null + +declare const nullAndUndefinedUnion: null | undefined; +>nullAndUndefinedUnion : null | undefined +>null : null + +var o1: { a: number }; +>o1 : { a: number; } +>a : number + +var o1 = { ...undefinedUnion }; +>o1 : { a: number; } +>{ ...undefinedUnion } : { a: number; } +>undefinedUnion : { a: number; } | undefined + +var o2: { b: number }; +>o2 : { b: number; } +>b : number + +var o2 = { ...nullUnion }; +>o2 : { b: number; } +>{ ...nullUnion } : { b: number; } +>nullUnion : { b: number; } | null + +var o3: { a: number, b: number }; +>o3 : { a: number; b: number; } +>a : number +>b : number + +var o3 = { ...undefinedUnion, ...nullUnion }; +>o3 : { a: number; b: number; } +>{ ...undefinedUnion, ...nullUnion } : { b: number; a: number; } +>undefinedUnion : { a: number; } | undefined +>nullUnion : { b: number; } | null + +var o3 = { ...nullUnion, ...undefinedUnion }; +>o3 : { a: number; b: number; } +>{ ...nullUnion, ...undefinedUnion } : { a: number; b: number; } +>nullUnion : { b: number; } | null +>undefinedUnion : { a: number; } | undefined + +var o4: { a: number }; +>o4 : { a: number; } +>a : number + +var o4 = { ...undefinedUnion, ...undefinedUnion }; +>o4 : { a: number; } +>{ ...undefinedUnion, ...undefinedUnion } : { a: number; } +>undefinedUnion : { a: number; } | undefined +>undefinedUnion : { a: number; } | undefined + +var o5: { b: number }; +>o5 : { b: number; } +>b : number + +var o5 = { ...nullUnion, ...nullUnion }; +>o5 : { b: number; } +>{ ...nullUnion, ...nullUnion } : { b: number; } +>nullUnion : { b: number; } | null +>nullUnion : { b: number; } | null + +var o6: { }; +>o6 : {} + +var o6 = { ...nullAndUndefinedUnion, ...nullAndUndefinedUnion }; +>o6 : {} +>{ ...nullAndUndefinedUnion, ...nullAndUndefinedUnion } : {} +>nullAndUndefinedUnion : null | undefined +>nullAndUndefinedUnion : null | undefined + +var o6 = { ...nullAndUndefinedUnion }; +>o6 : {} +>{ ...nullAndUndefinedUnion } : {} +>nullAndUndefinedUnion : null | undefined + diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt index 0dff64c9a31..fafffb563ea 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt @@ -16,9 +16,9 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(21,9): error TS tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(21,17): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(23,20): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS2693: 'public' only refers to a type, but is being used as a value here. +tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS2702: 'public' only refers to a type, but is being used as a namespace here. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS2693: 'public' only refers to a type, but is being used as a value here. +tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS2702: 'public' only refers to a type, but is being used as a namespace here. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(27,17): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(27,17): error TS2304: Cannot find name 'package'. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. @@ -88,12 +88,12 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error T ~~~~~~ !!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS2693: 'public' only refers to a type, but is being used as a value here. +!!! error TS2702: 'public' only refers to a type, but is being used as a namespace here. class F1 implements public.private.implements { } ~~~~~~ !!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS2693: 'public' only refers to a type, but is being used as a value here. +!!! error TS2702: 'public' only refers to a type, but is being used as a namespace here. class G extends package { } ~~~~~~~ !!! error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. diff --git a/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js new file mode 100644 index 00000000000..15d6fc70da5 --- /dev/null +++ b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js @@ -0,0 +1,51 @@ +//// [subSubClassCanAccessProtectedConstructor.ts] +class Base { + protected constructor() { } + public instance1 = new Base(); // allowed +} + +class Subclass extends Base { + public instance1_1 = new Base(); // allowed + public instance1_2 = new Subclass(); // allowed +} + +class SubclassOfSubclass extends Subclass { + public instance2_1 = new Base(); // allowed + public instance2_2 = new Subclass(); // allowed + public instance2_3 = new SubclassOfSubclass(); // allowed +} + + +//// [subSubClassCanAccessProtectedConstructor.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base() { + this.instance1 = new Base(); // allowed + } + return Base; +}()); +var Subclass = (function (_super) { + __extends(Subclass, _super); + function Subclass() { + var _this = _super.apply(this, arguments) || this; + _this.instance1_1 = new Base(); // allowed + _this.instance1_2 = new Subclass(); // allowed + return _this; + } + return Subclass; +}(Base)); +var SubclassOfSubclass = (function (_super) { + __extends(SubclassOfSubclass, _super); + function SubclassOfSubclass() { + var _this = _super.apply(this, arguments) || this; + _this.instance2_1 = new Base(); // allowed + _this.instance2_2 = new Subclass(); // allowed + _this.instance2_3 = new SubclassOfSubclass(); // allowed + return _this; + } + return SubclassOfSubclass; +}(Subclass)); diff --git a/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.symbols b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.symbols new file mode 100644 index 00000000000..8a09e1d742f --- /dev/null +++ b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.symbols @@ -0,0 +1,40 @@ +=== tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts === +class Base { +>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0)) + + protected constructor() { } + public instance1 = new Base(); // allowed +>instance1 : Symbol(Base.instance1, Decl(subSubClassCanAccessProtectedConstructor.ts, 1, 31)) +>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0)) +} + +class Subclass extends Base { +>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1)) +>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0)) + + public instance1_1 = new Base(); // allowed +>instance1_1 : Symbol(Subclass.instance1_1, Decl(subSubClassCanAccessProtectedConstructor.ts, 5, 29)) +>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0)) + + public instance1_2 = new Subclass(); // allowed +>instance1_2 : Symbol(Subclass.instance1_2, Decl(subSubClassCanAccessProtectedConstructor.ts, 6, 36)) +>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1)) +} + +class SubclassOfSubclass extends Subclass { +>SubclassOfSubclass : Symbol(SubclassOfSubclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 8, 1)) +>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1)) + + public instance2_1 = new Base(); // allowed +>instance2_1 : Symbol(SubclassOfSubclass.instance2_1, Decl(subSubClassCanAccessProtectedConstructor.ts, 10, 43)) +>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0)) + + public instance2_2 = new Subclass(); // allowed +>instance2_2 : Symbol(SubclassOfSubclass.instance2_2, Decl(subSubClassCanAccessProtectedConstructor.ts, 11, 36)) +>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1)) + + public instance2_3 = new SubclassOfSubclass(); // allowed +>instance2_3 : Symbol(SubclassOfSubclass.instance2_3, Decl(subSubClassCanAccessProtectedConstructor.ts, 12, 40)) +>SubclassOfSubclass : Symbol(SubclassOfSubclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 8, 1)) +} + diff --git a/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.types b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.types new file mode 100644 index 00000000000..253f6221c78 --- /dev/null +++ b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts === +class Base { +>Base : Base + + protected constructor() { } + public instance1 = new Base(); // allowed +>instance1 : Base +>new Base() : Base +>Base : typeof Base +} + +class Subclass extends Base { +>Subclass : Subclass +>Base : Base + + public instance1_1 = new Base(); // allowed +>instance1_1 : Base +>new Base() : Base +>Base : typeof Base + + public instance1_2 = new Subclass(); // allowed +>instance1_2 : Subclass +>new Subclass() : Subclass +>Subclass : typeof Subclass +} + +class SubclassOfSubclass extends Subclass { +>SubclassOfSubclass : SubclassOfSubclass +>Subclass : Subclass + + public instance2_1 = new Base(); // allowed +>instance2_1 : Base +>new Base() : Base +>Base : typeof Base + + public instance2_2 = new Subclass(); // allowed +>instance2_2 : Subclass +>new Subclass() : Subclass +>Subclass : typeof Subclass + + public instance2_3 = new SubclassOfSubclass(); // allowed +>instance2_3 : SubclassOfSubclass +>new SubclassOfSubclass() : SubclassOfSubclass +>SubclassOfSubclass : typeof SubclassOfSubclass +} + diff --git a/tests/baselines/reference/superAccess2.errors.txt b/tests/baselines/reference/superAccess2.errors.txt index d8b39284f65..edcd4031c47 100644 --- a/tests/baselines/reference/superAccess2.errors.txt +++ b/tests/baselines/reference/superAccess2.errors.txt @@ -2,10 +2,13 @@ tests/cases/compiler/superAccess2.ts(7,15): error TS1034: 'super' must be follow tests/cases/compiler/superAccess2.ts(8,17): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class. tests/cases/compiler/superAccess2.ts(8,22): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(11,28): error TS2336: 'super' cannot be referenced in constructor arguments. +tests/cases/compiler/superAccess2.ts(11,28): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superAccess2.ts(11,33): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(11,40): error TS2336: 'super' cannot be referenced in constructor arguments. +tests/cases/compiler/superAccess2.ts(11,40): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superAccess2.ts(11,45): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(11,59): error TS2336: 'super' cannot be referenced in constructor arguments. +tests/cases/compiler/superAccess2.ts(11,59): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superAccess2.ts(11,64): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(15,19): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(17,15): error TS2339: Property 'y' does not exist on type 'P'. @@ -13,7 +16,7 @@ tests/cases/compiler/superAccess2.ts(20,26): error TS1034: 'super' must be follo tests/cases/compiler/superAccess2.ts(21,15): error TS2339: Property 'x' does not exist on type 'typeof P'. -==== tests/cases/compiler/superAccess2.ts (13 errors) ==== +==== tests/cases/compiler/superAccess2.ts (16 errors) ==== class P { x() { } static y() { } @@ -33,14 +36,20 @@ tests/cases/compiler/superAccess2.ts(21,15): error TS2339: Property 'x' does not constructor(public z = super, zz = super, zzz = () => super) { ~~~~~ !!! error TS2336: 'super' cannot be referenced in constructor arguments. + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ !!! error TS2336: 'super' cannot be referenced in constructor arguments. + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ !!! error TS2336: 'super' cannot be referenced in constructor arguments. + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. super(); diff --git a/tests/baselines/reference/superInConstructorParam1.errors.txt b/tests/baselines/reference/superInConstructorParam1.errors.txt index 96735c92547..4220fcb9b0e 100644 --- a/tests/baselines/reference/superInConstructorParam1.errors.txt +++ b/tests/baselines/reference/superInConstructorParam1.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/superInConstructorParam1.ts(8,3): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/compiler/superInConstructorParam1.ts(8,19): error TS2336: 'super' cannot be referenced in constructor arguments. +tests/cases/compiler/superInConstructorParam1.ts(8,19): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. -==== tests/cases/compiler/superInConstructorParam1.ts (2 errors) ==== +==== tests/cases/compiler/superInConstructorParam1.ts (3 errors) ==== class B { public foo(): number { return 0; @@ -14,6 +15,8 @@ tests/cases/compiler/superInConstructorParam1.ts(8,19): error TS2336: 'super' ca ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ !!! error TS2336: 'super' cannot be referenced in constructor arguments. + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. } ~~~ !!! error TS2377: Constructors for derived classes must contain a 'super' call. diff --git a/tests/baselines/reference/superNewCall1.errors.txt b/tests/baselines/reference/superNewCall1.errors.txt index 2b104e7d647..c8fd5c471fb 100644 --- a/tests/baselines/reference/superNewCall1.errors.txt +++ b/tests/baselines/reference/superNewCall1.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/superNewCall1.ts(9,5): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/compiler/superNewCall1.ts(10,9): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/superNewCall1.ts(10,13): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. -==== tests/cases/compiler/superNewCall1.ts (2 errors) ==== +==== tests/cases/compiler/superNewCall1.ts (3 errors) ==== class A { constructor(private map: (value: T1) => T2) { @@ -17,6 +18,8 @@ tests/cases/compiler/superNewCall1.ts(10,9): error TS2351: Cannot use 'new' with ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. } ~~~~~ !!! error TS2377: Constructors for derived classes must contain a 'super' call. From ec72ad64b65c427a1c23bfce5aaa91c27d8af0ee Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Wed, 14 Dec 2016 23:55:18 +0900 Subject: [PATCH 053/125] update --- ...rtyInConstructorBeforeSuperCall.errors.txt | 24 ++ ...perPropertyInConstructorBeforeSuperCall.js | 46 +++ .../superWithTypeArgument.errors.txt | 5 +- .../superWithTypeArgument2.errors.txt | 5 +- .../superWithTypeArgument3.errors.txt | 5 +- .../reference/systemModuleTrailingComments.js | 18 + .../systemModuleTrailingComments.symbols | 5 + .../systemModuleTrailingComments.types | 6 + .../reference/unionTypeWithLeadingOperator.js | 10 + .../unionTypeWithLeadingOperator.symbols | 16 + .../unionTypeWithLeadingOperator.types | 16 + ...dModuleImport_withAugmentation2.errors.txt | 19 + .../untypedModuleImport_withAugmentation2.js | 19 + .../unusedLocalsAndObjectSpread.errors.txt | 40 +++ .../reference/unusedLocalsAndObjectSpread.js | 67 ++++ .../useObjectValuesAndEntries1.types | 30 +- .../useObjectValuesAndEntries4.types | 8 +- .../reference/widenedTypes.errors.txt | 5 +- .../compiler/circularReferenceInImport.ts | 15 + .../declarationEmitIndexTypeNotFound.ts | 5 + ...orMetadataRestParameterWithImportedType.ts | 42 +++ .../compiler/decoratorWithUnderscoreMethod.ts | 18 + ...xhaustiveSwitchWithWideningLiteralTypes.ts | 18 + ...xplicitAnyAfterSpreadNoImplicitAnyError.ts | 3 + .../compiler/importHelpersDeclarations.ts | 9 + .../compiler/intersectionTypeNormalization.ts | 45 +++ .../intersectionTypeWithLeadingOperator.ts | 6 + .../compiler/invalidUseOfTypeAsNamespace.ts | 4 + .../jsxFactoryQualifiedNameWithEs5.ts | 17 + .../compiler/keyofIsLiteralContexualType.ts | 13 + .../mappedTypeInferenceCircularity.ts | 7 + tests/cases/compiler/nestedFreshLiteral.ts | 14 + .../newLexicalEnvironmentForConvertedLoop.ts | 13 + tests/cases/compiler/objectFreeze.ts | 12 + tests/cases/compiler/restIntersection.ts | 4 + .../cases/compiler/restInvalidArgumentType.ts | 59 ++++ tests/cases/compiler/restUnion.ts | 14 + tests/cases/compiler/restUnion2.ts | 19 + .../compiler/selfReferencingSpreadInLoop.ts | 5 + tests/cases/compiler/spreadIntersection.ts | 7 + .../compiler/spreadInvalidArgumentType.ts | 59 ++++ tests/cases/compiler/spreadUnion.ts | 10 + tests/cases/compiler/spreadUnion2.ts | 25 ++ ...ubSubClassCanAccessProtectedConstructor.ts | 15 + .../compiler/systemModuleTrailingComments.ts | 4 + .../compiler/unionTypeWithLeadingOperator.ts | 6 + .../untypedModuleImport_withAugmentation2.ts | 14 + .../compiler/unusedLocalsAndObjectSpread.ts | 31 ++ .../es2017/awaitInheritedPromise_es2017.ts | 7 + .../classAbstractAccessor.ts | 8 + ...perPropertyInConstructorBeforeSuperCall.ts | 15 + .../accessor/decoratorOnClassAccessor7.ts | 34 ++ .../accessor/decoratorOnClassAccessor8.ts | 32 ++ .../decoratorOnClassConstructor4.ts | 18 + .../keyof/circularIndexedAccessErrors.ts | 31 ++ .../conformance/types/keyof/keyofAndForIn.ts | 36 ++ .../types/keyof/keyofAndIndexedAccess.ts | 197 ++++++++++- .../keyof/keyofAndIndexedAccessErrors.ts | 11 + .../mapped/isomorphicMappedTypeInference.ts | 155 ++++++++ .../types/mapped/mappedTypeErrors.ts | 59 +++- .../types/mapped/mappedTypeModifiers.ts | 77 ++++ .../conformance/types/mapped/mappedTypes1.ts | 4 +- .../conformance/types/mapped/mappedTypes2.ts | 21 +- .../conformance/types/mapped/mappedTypes4.ts | 62 ++++ .../conformance/types/rest/objectRest.ts | 2 + .../types/rest/objectRestNegative.ts | 3 + .../types/spread/objectSpreadNegative.ts | 4 +- tests/cases/fourslash/basicClassMembers.ts | 6 +- .../commentBraceCompletionPosition.ts | 6 +- tests/cases/fourslash/commentsClassMembers.ts | 334 +++++++++--------- tests/cases/fourslash/commentsEnums.ts | 8 +- .../fourslash/commentsExternalModules.ts | 22 +- .../fourslash/commentsImportDeclaration.ts | 12 +- tests/cases/fourslash/commentsInheritance.ts | 216 +++++------ tests/cases/fourslash/commentsInterface.ts | 24 +- .../fourslash/commentsLinePreservation.ts | 13 +- tests/cases/fourslash/commentsModules.ts | 48 +-- tests/cases/fourslash/commentsOverloads.ts | 18 +- .../completionEntryForUnionProperty.ts | 6 +- .../completionEntryForUnionProperty2.ts | 6 +- ...nForQuotedPropertyInPropertyAssignment1.ts | 4 +- ...nForQuotedPropertyInPropertyAssignment2.ts | 4 +- ...nForQuotedPropertyInPropertyAssignment3.ts | 4 +- ...nForQuotedPropertyInPropertyAssignment4.ts | 4 +- .../fourslash/completionForStringLiteral.ts | 4 +- .../fourslash/completionForStringLiteral2.ts | 4 +- .../fourslash/completionForStringLiteral3.ts | 4 +- .../fourslash/completionForStringLiteral4.ts | 2 +- tests/cases/fourslash/completionInJsDoc.ts | 1 + .../fourslash/completionListAfterAnyType.ts | 4 +- .../completionListAfterInvalidCharacter.ts | 2 +- .../completionListAfterObjectLiteral1.ts | 4 +- ...tionListAfterRegularExpressionLiteral01.ts | 4 +- ...etionListAfterRegularExpressionLiteral1.ts | 4 +- .../completionListAfterStringLiteral1.ts | 4 +- ...mpletionListAndMemberListOnCommentedDot.ts | 2 +- ...nListAndMemberListOnCommentedWhiteSpace.ts | 2 +- tests/cases/fourslash/completionListAtEOF1.ts | 2 +- tests/cases/fourslash/completionListAtEOF2.ts | 2 +- .../fourslash/completionListAtNodeBoundry.ts | 2 +- .../fourslash/completionListBeforeKeyword.ts | 8 +- .../cases/fourslash/completionListCladule.ts | 16 +- .../fourslash/completionListClassMembers.ts | 52 +-- .../fourslash/completionListEnumMembers.ts | 14 +- .../fourslash/completionListEnumValues.ts | 14 +- .../fourslash/completionListErrorRecovery.ts | 2 +- ...berInAmbientModuleWithExportAssignment1.ts | 2 +- .../completionListForObjectSpread.ts | 22 +- .../cases/fourslash/completionListForRest.ts | 6 +- ...etionListForShorthandPropertyAssignment.ts | 4 +- ...tionListForShorthandPropertyAssignment2.ts | 4 +- .../completionListFunctionMembers.ts | 2 +- .../completionListGenericConstraints.ts | 34 +- .../completionListInClosedFunction01.ts | 8 +- .../completionListInClosedFunction02.ts | 16 +- .../completionListInClosedFunction03.ts | 16 +- .../completionListInClosedFunction04.ts | 16 +- .../completionListInClosedFunction05.ts | 18 +- .../completionListInClosedFunction06.ts | 2 +- .../completionListInClosedFunction07.ts | 20 +- ...tInClosedObjectTypeLiteralInSignature01.ts | 10 +- ...tInClosedObjectTypeLiteralInSignature02.ts | 10 +- ...tInClosedObjectTypeLiteralInSignature03.ts | 10 +- ...tInClosedObjectTypeLiteralInSignature04.ts | 10 +- .../fourslash/completionListInEmptyFile.ts | 2 +- .../completionListInExtendsClauseAtEOF.ts | 4 +- .../completionListInFunctionExpression.ts | 8 +- ...completionListInNamedFunctionExpression.ts | 6 +- .../completionListInObjectLiteral.ts | 4 +- ...ectLiteralThatIsParameterOfFunctionCall.ts | 6 +- .../cases/fourslash/completionListInScope.ts | 56 +-- ...mpletionListInTypeParameterOfTypeAlias3.ts | 12 +- .../completionListInTypedObjectLiterals2.ts | 4 +- .../completionListInTypedObjectLiterals3.ts | 4 +- .../completionListInTypedObjectLiterals4.ts | 6 +- ...dObjectLiteralsWithPartialPropertyNames.ts | 24 +- ...ObjectLiteralsWithPartialPropertyNames2.ts | 6 +- .../completionListInUnclosedFunction01.ts | 8 +- .../completionListInUnclosedFunction02.ts | 16 +- .../completionListInUnclosedFunction03.ts | 16 +- .../completionListInUnclosedFunction04.ts | 16 +- .../completionListInUnclosedFunction05.ts | 16 +- .../completionListInUnclosedFunction06.ts | 16 +- .../completionListInUnclosedFunction07.ts | 16 +- .../completionListInUnclosedFunction08.ts | 18 +- .../completionListInUnclosedFunction09.ts | 18 +- .../completionListInUnclosedFunction10.ts | 2 +- .../completionListInUnclosedFunction11.ts | 2 +- .../completionListInUnclosedFunction12.ts | 2 +- .../completionListInUnclosedFunction13.ts | 2 +- .../completionListInUnclosedFunction14.ts | 20 +- .../completionListInUnclosedFunction15.ts | 20 +- .../completionListInUnclosedFunction16.ts | 20 +- .../completionListInUnclosedFunction17.ts | 20 +- .../completionListInUnclosedFunction18.ts | 20 +- .../completionListInUnclosedFunction19.ts | 20 +- ...nUnclosedObjectTypeLiteralInSignature01.ts | 10 +- ...nUnclosedObjectTypeLiteralInSignature02.ts | 10 +- ...nUnclosedObjectTypeLiteralInSignature03.ts | 10 +- ...nUnclosedObjectTypeLiteralInSignature04.ts | 10 +- .../completionListInstanceProtectedMembers.ts | 48 +-- ...completionListInstanceProtectedMembers2.ts | 64 ++-- ...completionListInstanceProtectedMembers3.ts | 32 +- ...completionListInstanceProtectedMembers4.ts | 16 +- .../completionListInvalidMemberNames.ts | 2 +- .../completionListInvalidMemberNames2.ts | 6 +- .../cases/fourslash/completionListKeywords.ts | 86 ++--- .../fourslash/completionListModuleMembers.ts | 38 +- .../fourslash/completionListObjectMembers.ts | 4 +- .../fourslash/completionListOfGnericSymbol.ts | 4 +- .../completionListOfSplitInterface.ts | 26 +- .../fourslash/completionListOnAliases.ts | 4 +- .../fourslash/completionListOnAliases2.ts | 38 +- .../fourslash/completionListOnAliases3.ts | 2 +- ...nListOnFunctionCallWithOptionalArgument.ts | 2 +- .../cases/fourslash/completionListOnParam.ts | 2 +- .../completionListOnParamOfGenericType1.ts | 18 +- .../cases/fourslash/completionListOnSuper.ts | 6 +- .../completionListOnVarBetweenModules.ts | 4 +- .../fourslash/completionListPrimitives.ts | 14 +- .../fourslash/completionListPrivateMembers.ts | 4 +- .../completionListPrivateMembers2.ts | 8 +- .../completionListPrivateMembers3.ts | 12 +- .../completionListProtectedMembers.ts | 30 +- .../completionListStaticProtectedMembers.ts | 48 +-- .../completionListStaticProtectedMembers2.ts | 64 ++-- .../completionListStaticProtectedMembers3.ts | 32 +- .../completionListStaticProtectedMembers4.ts | 32 +- .../fourslash/completionListSuperMembers.ts | 12 +- tests/cases/fourslash/exportEqualTypes.ts | 2 +- tests/cases/fourslash/extendArrayInterface.ts | 2 +- .../fourslash/externalModuleIntellisense.ts | 2 +- ...ernceResolutionOrderInImportDeclaration.ts | 4 +- tests/cases/fourslash/forwardReference.ts | 2 +- tests/cases/fourslash/fourslash.ts | 5 +- tests/cases/fourslash/functionTypes.ts | 2 +- .../fourslash/getJavaScriptCompletions20.ts | 2 +- .../fourslash/getJavaScriptQuickInfo8.ts | 4 +- tests/cases/fourslash/javaScriptModules13.ts | 4 +- tests/cases/fourslash/javaScriptModules19.ts | 4 +- tests/cases/fourslash/javaScriptPrototype1.ts | 14 +- .../fourslash/jsDocFunctionSignatures3.ts | 4 +- tests/cases/fourslash/jsDocGenerics1.ts | 6 +- tests/cases/fourslash/jsdocNullableUnion.ts | 6 +- tests/cases/fourslash/lambdaThisMembers.ts | 2 +- .../memberCompletionFromFunctionCall.ts | 4 +- .../fourslash/memberCompletionInForEach1.ts | 8 +- .../memberCompletionOnTypeParameters.ts | 18 +- .../memberCompletionOnTypeParameters2.ts | 4 +- .../fourslash/memberListAfterDoubleDot.ts | 2 +- .../fourslash/memberListAfterSingleDot.ts | 2 +- .../fourslash/memberListErrorRecovery.ts | 2 +- .../fourslash/memberListInFunctionCall.ts | 2 +- .../fourslash/memberListInReopenedEnum.ts | 8 +- .../cases/fourslash/memberListInWithBlock.ts | 2 +- .../cases/fourslash/memberListInWithBlock2.ts | 2 +- .../cases/fourslash/memberListInWithBlock3.ts | 2 +- .../memberListInsideObjectLiterals.ts | 10 +- tests/cases/fourslash/memberListOfClass.ts | 6 +- .../memberListOfEnumFromExternalModule.ts | 2 +- .../fourslash/memberListOfEnumInModule.ts | 4 +- .../fourslash/memberListOfExportedClass.ts | 4 +- tests/cases/fourslash/memberListOfModule.ts | 6 +- .../memberListOfVarInArrowExpression.ts | 2 +- .../fourslash/memberListOnContextualThis.ts | 2 +- .../fourslash/memberListOnExplicitThis.ts | 14 +- .../memberListOnFunctionParameter.ts | 10 +- .../memberListOnThisInClassWithPrivates.ts | 6 +- tests/cases/fourslash/memberlistOnDDot.ts | 2 +- .../quickInfoOnNarrowedTypeInModule.ts | 6 +- .../quickInfoOnObjectLiteralWithAccessors.ts | 4 +- .../quickInfoOnObjectLiteralWithOnlyGetter.ts | 2 +- .../quickInfoOnObjectLiteralWithOnlySetter.ts | 4 +- ...WithNestedDestructuredParameterInLambda.ts | 15 + tests/cases/fourslash/server/completions01.ts | 8 +- .../cases/fourslash/server/jsdocTypedefTag.ts | 36 +- .../server/jsdocTypedefTagNamespace.ts | 10 +- tests/cases/fourslash/tsxCompletion10.ts | 2 +- .../fourslash/tsxCompletionOnClosingTag1.ts | 2 +- .../fourslash/tsxCompletionOnClosingTag2.ts | 4 +- .../tsxCompletionOnClosingTagWithoutJSX1.ts | 2 +- .../tsxCompletionOnClosingTagWithoutJSX2.ts | 4 +- .../tsxCompletionOnOpeningTagWithoutJSX1.ts | 2 +- .../unclosedStringLiteralErrorRecovery.ts | 2 +- tests/cases/fourslash/untypedModuleImport.ts | 1 - 245 files changed, 2848 insertions(+), 1284 deletions(-) create mode 100644 tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.errors.txt create mode 100644 tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js create mode 100644 tests/baselines/reference/systemModuleTrailingComments.js create mode 100644 tests/baselines/reference/systemModuleTrailingComments.symbols create mode 100644 tests/baselines/reference/systemModuleTrailingComments.types create mode 100644 tests/baselines/reference/unionTypeWithLeadingOperator.js create mode 100644 tests/baselines/reference/unionTypeWithLeadingOperator.symbols create mode 100644 tests/baselines/reference/unionTypeWithLeadingOperator.types create mode 100644 tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt create mode 100644 tests/baselines/reference/untypedModuleImport_withAugmentation2.js create mode 100644 tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt create mode 100644 tests/baselines/reference/unusedLocalsAndObjectSpread.js create mode 100644 tests/cases/compiler/circularReferenceInImport.ts create mode 100644 tests/cases/compiler/declarationEmitIndexTypeNotFound.ts create mode 100644 tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts create mode 100644 tests/cases/compiler/decoratorWithUnderscoreMethod.ts create mode 100644 tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts create mode 100644 tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts create mode 100644 tests/cases/compiler/importHelpersDeclarations.ts create mode 100644 tests/cases/compiler/intersectionTypeWithLeadingOperator.ts create mode 100644 tests/cases/compiler/invalidUseOfTypeAsNamespace.ts create mode 100644 tests/cases/compiler/jsxFactoryQualifiedNameWithEs5.ts create mode 100644 tests/cases/compiler/keyofIsLiteralContexualType.ts create mode 100644 tests/cases/compiler/mappedTypeInferenceCircularity.ts create mode 100644 tests/cases/compiler/nestedFreshLiteral.ts create mode 100644 tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts create mode 100644 tests/cases/compiler/objectFreeze.ts create mode 100644 tests/cases/compiler/restIntersection.ts create mode 100644 tests/cases/compiler/restInvalidArgumentType.ts create mode 100644 tests/cases/compiler/restUnion.ts create mode 100644 tests/cases/compiler/restUnion2.ts create mode 100644 tests/cases/compiler/selfReferencingSpreadInLoop.ts create mode 100644 tests/cases/compiler/spreadIntersection.ts create mode 100644 tests/cases/compiler/spreadInvalidArgumentType.ts create mode 100644 tests/cases/compiler/spreadUnion.ts create mode 100644 tests/cases/compiler/spreadUnion2.ts create mode 100644 tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts create mode 100644 tests/cases/compiler/systemModuleTrailingComments.ts create mode 100644 tests/cases/compiler/unionTypeWithLeadingOperator.ts create mode 100644 tests/cases/compiler/untypedModuleImport_withAugmentation2.ts create mode 100644 tests/cases/compiler/unusedLocalsAndObjectSpread.ts create mode 100644 tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts create mode 100644 tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts create mode 100644 tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts create mode 100644 tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts create mode 100644 tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts create mode 100644 tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts create mode 100644 tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts create mode 100644 tests/cases/conformance/types/keyof/keyofAndForIn.ts create mode 100644 tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts create mode 100644 tests/cases/conformance/types/mapped/mappedTypeModifiers.ts create mode 100644 tests/cases/conformance/types/mapped/mappedTypes4.ts create mode 100644 tests/cases/fourslash/quickInfoWithNestedDestructuredParameterInLambda.ts diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.errors.txt b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.errors.txt new file mode 100644 index 00000000000..407e984c5d1 --- /dev/null +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts(7,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. +tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts(13,15): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + + +==== tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts (2 errors) ==== + class B { + constructor(x?: string) {} + x(): string { return ""; } + } + class C1 extends B { + constructor() { + super.x(); + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + super(); + } + } + class C2 extends B { + constructor() { + super(super.x()); + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js new file mode 100644 index 00000000000..15bc0c40f37 --- /dev/null +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js @@ -0,0 +1,46 @@ +//// [superPropertyInConstructorBeforeSuperCall.ts] +class B { + constructor(x?: string) {} + x(): string { return ""; } +} +class C1 extends B { + constructor() { + super.x(); + super(); + } +} +class C2 extends B { + constructor() { + super(super.x()); + } +} + +//// [superPropertyInConstructorBeforeSuperCall.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var B = (function () { + function B(x) { + } + B.prototype.x = function () { return ""; }; + return B; +}()); +var C1 = (function (_super) { + __extends(C1, _super); + function C1() { + var _this; + _super.prototype.x.call(_this); + _this = _super.call(this) || this; + return _this; + } + return C1; +}(B)); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + return _super.call(this, _super.x.call(_this)) || this; + } + return C2; +}(B)); diff --git a/tests/baselines/reference/superWithTypeArgument.errors.txt b/tests/baselines/reference/superWithTypeArgument.errors.txt index d749cbd5157..5860cb466d9 100644 --- a/tests/baselines/reference/superWithTypeArgument.errors.txt +++ b/tests/baselines/reference/superWithTypeArgument.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/superWithTypeArgument.ts(6,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/superWithTypeArgument.ts(7,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superWithTypeArgument.ts(7,14): error TS1034: 'super' must be followed by an argument list or member access. -==== tests/cases/compiler/superWithTypeArgument.ts (2 errors) ==== +==== tests/cases/compiler/superWithTypeArgument.ts (3 errors) ==== class C { } @@ -12,6 +13,8 @@ tests/cases/compiler/superWithTypeArgument.ts(7,14): error TS1034: 'super' must ~~~~~~~~~~~~~~~ super(); ~~~~~~~~~~~~~~~~~~~ + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. } diff --git a/tests/baselines/reference/superWithTypeArgument2.errors.txt b/tests/baselines/reference/superWithTypeArgument2.errors.txt index 766327c5c81..473e7f3b7ad 100644 --- a/tests/baselines/reference/superWithTypeArgument2.errors.txt +++ b/tests/baselines/reference/superWithTypeArgument2.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/superWithTypeArgument2.ts(6,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/superWithTypeArgument2.ts(7,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superWithTypeArgument2.ts(7,14): error TS1034: 'super' must be followed by an argument list or member access. -==== tests/cases/compiler/superWithTypeArgument2.ts (2 errors) ==== +==== tests/cases/compiler/superWithTypeArgument2.ts (3 errors) ==== class C { foo: T; } @@ -12,6 +13,8 @@ tests/cases/compiler/superWithTypeArgument2.ts(7,14): error TS1034: 'super' must ~~~~~~~~~~~~~~~~ super(x); ~~~~~~~~~~~~~~~~~~~~ + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. } diff --git a/tests/baselines/reference/superWithTypeArgument3.errors.txt b/tests/baselines/reference/superWithTypeArgument3.errors.txt index 323b2958fcb..37e6681d770 100644 --- a/tests/baselines/reference/superWithTypeArgument3.errors.txt +++ b/tests/baselines/reference/superWithTypeArgument3.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/superWithTypeArgument3.ts(7,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/superWithTypeArgument3.ts(8,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superWithTypeArgument3.ts(8,14): error TS1034: 'super' must be followed by an argument list or member access. -==== tests/cases/compiler/superWithTypeArgument3.ts (2 errors) ==== +==== tests/cases/compiler/superWithTypeArgument3.ts (3 errors) ==== class C { foo: T; bar(x: U) { } @@ -13,6 +14,8 @@ tests/cases/compiler/superWithTypeArgument3.ts(8,14): error TS1034: 'super' must ~~~~~~~~~~~~~~~ super(); ~~~~~~~~~~~~~~~~~~~ + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. } diff --git a/tests/baselines/reference/systemModuleTrailingComments.js b/tests/baselines/reference/systemModuleTrailingComments.js new file mode 100644 index 00000000000..41b0bd299a0 --- /dev/null +++ b/tests/baselines/reference/systemModuleTrailingComments.js @@ -0,0 +1,18 @@ +//// [systemModuleTrailingComments.ts] +export const test = "TEST"; + +//some comment + +//// [systemModuleTrailingComments.js] +System.register([], function (exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var test; + return { + setters: [], + execute: function () { + exports_1("test", test = "TEST"); + //some comment + } + }; +}); diff --git a/tests/baselines/reference/systemModuleTrailingComments.symbols b/tests/baselines/reference/systemModuleTrailingComments.symbols new file mode 100644 index 00000000000..4df59b45faa --- /dev/null +++ b/tests/baselines/reference/systemModuleTrailingComments.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/systemModuleTrailingComments.ts === +export const test = "TEST"; +>test : Symbol(test, Decl(systemModuleTrailingComments.ts, 0, 12)) + +//some comment diff --git a/tests/baselines/reference/systemModuleTrailingComments.types b/tests/baselines/reference/systemModuleTrailingComments.types new file mode 100644 index 00000000000..235b46e6e8f --- /dev/null +++ b/tests/baselines/reference/systemModuleTrailingComments.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/systemModuleTrailingComments.ts === +export const test = "TEST"; +>test : "TEST" +>"TEST" : "TEST" + +//some comment diff --git a/tests/baselines/reference/unionTypeWithLeadingOperator.js b/tests/baselines/reference/unionTypeWithLeadingOperator.js new file mode 100644 index 00000000000..0fb366d538e --- /dev/null +++ b/tests/baselines/reference/unionTypeWithLeadingOperator.js @@ -0,0 +1,10 @@ +//// [unionTypeWithLeadingOperator.ts] +type A = | string; +type B = + | { type: "INCREMENT" } + | { type: "DECREMENT" }; + +type C = [| 0 | 1, | "foo" | "bar"]; + + +//// [unionTypeWithLeadingOperator.js] diff --git a/tests/baselines/reference/unionTypeWithLeadingOperator.symbols b/tests/baselines/reference/unionTypeWithLeadingOperator.symbols new file mode 100644 index 00000000000..8c15d299c48 --- /dev/null +++ b/tests/baselines/reference/unionTypeWithLeadingOperator.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/unionTypeWithLeadingOperator.ts === +type A = | string; +>A : Symbol(A, Decl(unionTypeWithLeadingOperator.ts, 0, 0)) + +type B = +>B : Symbol(B, Decl(unionTypeWithLeadingOperator.ts, 0, 18)) + + | { type: "INCREMENT" } +>type : Symbol(type, Decl(unionTypeWithLeadingOperator.ts, 2, 5)) + + | { type: "DECREMENT" }; +>type : Symbol(type, Decl(unionTypeWithLeadingOperator.ts, 3, 5)) + +type C = [| 0 | 1, | "foo" | "bar"]; +>C : Symbol(C, Decl(unionTypeWithLeadingOperator.ts, 3, 26)) + diff --git a/tests/baselines/reference/unionTypeWithLeadingOperator.types b/tests/baselines/reference/unionTypeWithLeadingOperator.types new file mode 100644 index 00000000000..2ca15fb54a2 --- /dev/null +++ b/tests/baselines/reference/unionTypeWithLeadingOperator.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/unionTypeWithLeadingOperator.ts === +type A = | string; +>A : string + +type B = +>B : B + + | { type: "INCREMENT" } +>type : "INCREMENT" + + | { type: "DECREMENT" }; +>type : "DECREMENT" + +type C = [| 0 | 1, | "foo" | "bar"]; +>C : [0 | 1, "foo" | "bar"] + diff --git a/tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt b/tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt new file mode 100644 index 00000000000..628533b93d5 --- /dev/null +++ b/tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt @@ -0,0 +1,19 @@ +/node_modules/augmenter/index.d.ts(3,16): error TS2665: Invalid module name in augmentation. Module 'js' resolves to an untyped module at '/node_modules/js/index.js', which cannot be augmented. + + +==== /a.ts (0 errors) ==== + import { } from "augmenter"; + +==== /node_modules/augmenter/index.d.ts (1 errors) ==== + // This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`. + + declare module "js" { + ~~~~ +!!! error TS2665: Invalid module name in augmentation. Module 'js' resolves to an untyped module at '/node_modules/js/index.js', which cannot be augmented. + export const j: number; + } + export {}; + +==== /node_modules/js/index.js (0 errors) ==== + This file is not processed. + \ No newline at end of file diff --git a/tests/baselines/reference/untypedModuleImport_withAugmentation2.js b/tests/baselines/reference/untypedModuleImport_withAugmentation2.js new file mode 100644 index 00000000000..f9fa7443224 --- /dev/null +++ b/tests/baselines/reference/untypedModuleImport_withAugmentation2.js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/untypedModuleImport_withAugmentation2.ts] //// + +//// [index.d.ts] +// This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`. + +declare module "js" { + export const j: number; +} +export {}; + +//// [index.js] +This file is not processed. + +//// [a.ts] +import { } from "augmenter"; + + +//// [a.js] +"use strict"; diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt b/tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt new file mode 100644 index 00000000000..56f2ba927fb --- /dev/null +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt @@ -0,0 +1,40 @@ +tests/cases/compiler/unusedLocalsAndObjectSpread.ts(21,18): error TS6133: 'bar' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread.ts(28,21): error TS6133: 'bar' is declared but never used. + + +==== tests/cases/compiler/unusedLocalsAndObjectSpread.ts (2 errors) ==== + + declare var console: { log(a: any): void }; + + function one() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; + console.log(bar); + } + + function two() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; + console.log(bar); + } + + function three() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; // bar should be unused + ~~~ +!!! error TS6133: 'bar' is declared but never used. + //console.log(bar); + } + + function four() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; // bar should be unused + ~~~ +!!! error TS6133: 'bar' is declared but never used. + //console.log(bar); + } + \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread.js b/tests/baselines/reference/unusedLocalsAndObjectSpread.js new file mode 100644 index 00000000000..2878f1b5c5c --- /dev/null +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread.js @@ -0,0 +1,67 @@ +//// [unusedLocalsAndObjectSpread.ts] + +declare var console: { log(a: any): void }; + +function one() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; + console.log(bar); +} + +function two() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; + console.log(bar); +} + +function three() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; // bar should be unused + //console.log(bar); +} + +function four() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; // bar should be unused + //console.log(bar); +} + + +//// [unusedLocalsAndObjectSpread.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +function one() { + var foo = { a: 1, b: 2 }; + // 'a' is declared but never used + var a = foo.a, bar = __rest(foo, ["a"]); + console.log(bar); +} +function two() { + var foo = { a: 1, b: 2 }; + // '_' is declared but never used + var _ = foo.a, bar = __rest(foo, ["a"]); + console.log(bar); +} +function three() { + var foo = { a: 1, b: 2 }; + // 'a' is declared but never used + var a = foo.a, bar = __rest(foo, ["a"]); // bar should be unused + //console.log(bar); +} +function four() { + var foo = { a: 1, b: 2 }; + // '_' is declared but never used + var _ = foo.a, bar = __rest(foo, ["a"]); // bar should be unused + //console.log(bar); +} diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.types b/tests/baselines/reference/useObjectValuesAndEntries1.types index f04201450c0..d9ccc019f75 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries1.types +++ b/tests/baselines/reference/useObjectValuesAndEntries1.types @@ -22,38 +22,38 @@ for (var x of Object.values(o)) { } var entries = Object.entries(o); // <-- entries: ['a' | 'b', number][] ->entries : ["a" | "b", number][] ->Object.entries(o) : ["a" | "b", number][] ->Object.entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : [string, number][] +>Object.entries(o) : [string, number][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >o : { a: number; b: number; } var entries1 = Object.entries(1); // <-- entries: [string, any][] >entries1 : [string, any][] >Object.entries(1) : [string, any][] ->Object.entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >1 : 1 var entries2 = Object.entries({a: true, b: 2}) // ['a' | 'b', number | boolean][] ->entries2 : ["a" | "b", number | boolean][] ->Object.entries({a: true, b: 2}) : ["a" | "b", number | boolean][] ->Object.entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries2 : [string, number | boolean][] +>Object.entries({a: true, b: 2}) : [string, number | boolean][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } ->{a: true, b: 2} : { a: true; b: number; } +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } +>{a: true, b: 2} : { a: true; b: 2; } >a : boolean >true : true >b : number >2 : 2 var entries3 = Object.entries({}) // [never, any][] ->entries3 : [never, any][] ->Object.entries({}) : [never, any][] ->Object.entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries3 : [string, {}][] +>Object.entries({}) : [string, {}][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >{} : {} diff --git a/tests/baselines/reference/useObjectValuesAndEntries4.types b/tests/baselines/reference/useObjectValuesAndEntries4.types index d68193993e2..05af55d42cb 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries4.types +++ b/tests/baselines/reference/useObjectValuesAndEntries4.types @@ -22,10 +22,10 @@ for (var x of Object.values(o)) { } var entries = Object.entries(o); ->entries : ["a" | "b", number][] ->Object.entries(o) : ["a" | "b", number][] ->Object.entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : [string, number][] +>Object.entries(o) : [string, number][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >o : { a: number; b: number; } diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index ea7c2b2f92a..5ea097acf2e 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/widenedTypes.ts(2,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. -tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/compiler/widenedTypes.ts(6,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/compiler/widenedTypes.ts(8,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/compiler/widenedTypes.ts(10,14): error TS2695: Left side of comma operator is unused and has no side effects. @@ -12,7 +11,7 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: Type 'number' is not assignable to type 'string'. -==== tests/cases/compiler/widenedTypes.ts (9 errors) ==== +==== tests/cases/compiler/widenedTypes.ts (8 errors) ==== null instanceof (() => { }); ~~~~ @@ -20,8 +19,6 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: ({}) instanceof null; // Ok because null is a subtype of function null in {}; - ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. "" in null; ~~~~ !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter diff --git a/tests/cases/compiler/circularReferenceInImport.ts b/tests/cases/compiler/circularReferenceInImport.ts new file mode 100644 index 00000000000..869beeaa3a9 --- /dev/null +++ b/tests/cases/compiler/circularReferenceInImport.ts @@ -0,0 +1,15 @@ +// @declaration: true + +// @filename: db.d.ts +declare namespace Db { + export import Types = Db; +} + +export = Db; + +// @filename: app.ts +import * as Db from "./db" + +export function foo() { + return new Object() +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmitIndexTypeNotFound.ts b/tests/cases/compiler/declarationEmitIndexTypeNotFound.ts new file mode 100644 index 00000000000..de3316cd56f --- /dev/null +++ b/tests/cases/compiler/declarationEmitIndexTypeNotFound.ts @@ -0,0 +1,5 @@ +// @declaration: true + +export interface Test { + [index: TypeNotFound]: any; +} diff --git a/tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts b/tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts new file mode 100644 index 00000000000..3bc22df8928 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts @@ -0,0 +1,42 @@ +// @experimentalDecorators: true +// @emitDecoratorMetadata: true +// @target: es5 + +// @filename: aux.ts +export class SomeClass { + field: string; +} + +// @filename: aux1.ts +export class SomeClass1 { + field: string; +} + +// @filename: aux2.ts +export class SomeClass2 { + field: string; +} +// @filename: main.ts +import { SomeClass } from './aux'; +import { SomeClass1 } from './aux1'; + +function annotation(): ClassDecorator { + return (target: any): void => { }; +} + +function annotation1(): MethodDecorator { + return (target: any): void => { }; +} + +@annotation() +export class ClassA { + array: SomeClass[]; + + constructor(...init: SomeClass[]) { + this.array = init; + } + + @annotation1() + foo(... args: SomeClass1[]) { + } +} \ No newline at end of file diff --git a/tests/cases/compiler/decoratorWithUnderscoreMethod.ts b/tests/cases/compiler/decoratorWithUnderscoreMethod.ts new file mode 100644 index 00000000000..e6551c91284 --- /dev/null +++ b/tests/cases/compiler/decoratorWithUnderscoreMethod.ts @@ -0,0 +1,18 @@ +// @noemithelpers: true +// @experimentaldecorators: true + +declare var console : { log(arg: string): void }; +function dec(): Function { + return function (target: any, propKey: string, descr: PropertyDescriptor): void { + console.log(target[propKey]); + //logs undefined + //propKey has three underscores as prefix, but the method has only two underscores + }; +} + +class A { + @dec() + private __foo(bar: string): void { + // do something with bar + } +} \ No newline at end of file diff --git a/tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts b/tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts new file mode 100644 index 00000000000..14183a5de59 --- /dev/null +++ b/tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts @@ -0,0 +1,18 @@ +// @strictNullChecks: true + +// Repro from #12529 + +class A { + readonly kind = "A"; // (property) A.kind: "A" +} + +class B { + readonly kind = "B"; // (property) B.kind: "B" +} + +function f(value: A | B): number { + switch(value.kind) { + case "A": return 0; + case "B": return 1; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts b/tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts new file mode 100644 index 00000000000..1c5ebac3d91 --- /dev/null +++ b/tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts @@ -0,0 +1,3 @@ +// @noImplicitAny: true +({ a: [], ...(null as any) }); +let x: any; diff --git a/tests/cases/compiler/importHelpersDeclarations.ts b/tests/cases/compiler/importHelpersDeclarations.ts new file mode 100644 index 00000000000..7b958cda789 --- /dev/null +++ b/tests/cases/compiler/importHelpersDeclarations.ts @@ -0,0 +1,9 @@ +// @importHelpers: true +// @target: es5 +// @module: commonjs +// @moduleResolution: classic +// @filename: declaration.d.ts +export declare class D { +} +export declare class E extends D { +} \ No newline at end of file diff --git a/tests/cases/compiler/intersectionTypeNormalization.ts b/tests/cases/compiler/intersectionTypeNormalization.ts index f31c3d49014..3d07aeb1a23 100644 --- a/tests/cases/compiler/intersectionTypeNormalization.ts +++ b/tests/cases/compiler/intersectionTypeNormalization.ts @@ -57,4 +57,49 @@ function getValueAsString(value: IntersectionFail): string { return '' + value.num; } return value.str; +} + +// Repro from #12535 + +namespace enums { + export const enum A { + a1, + a2, + a3, + // ... elements omitted for the sake of clarity + a75, + a76, + a77, + } + export const enum B { + b1, + b2, + // ... elements omitted for the sake of clarity + b86, + b87, + } + export const enum C { + c1, + c2, + // ... elements omitted for the sake of clarity + c210, + c211, + } + export type Genre = A | B | C; +} + +type Foo = { + genreId: enums.Genre; +}; + +type Bar = { + genreId: enums.Genre; +}; + +type FooBar = Foo & Bar; + +function foo(so: any) { + const val = so as FooBar; + const isGenre = val.genreId; + return isGenre; } \ No newline at end of file diff --git a/tests/cases/compiler/intersectionTypeWithLeadingOperator.ts b/tests/cases/compiler/intersectionTypeWithLeadingOperator.ts new file mode 100644 index 00000000000..4138dee4261 --- /dev/null +++ b/tests/cases/compiler/intersectionTypeWithLeadingOperator.ts @@ -0,0 +1,6 @@ +type A = & string; +type B = + & { foo: string } + & { bar: number }; + +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; diff --git a/tests/cases/compiler/invalidUseOfTypeAsNamespace.ts b/tests/cases/compiler/invalidUseOfTypeAsNamespace.ts new file mode 100644 index 00000000000..5391715cb3a --- /dev/null +++ b/tests/cases/compiler/invalidUseOfTypeAsNamespace.ts @@ -0,0 +1,4 @@ +interface OhNo { +} + +declare let y: OhNo.hello; diff --git a/tests/cases/compiler/jsxFactoryQualifiedNameWithEs5.ts b/tests/cases/compiler/jsxFactoryQualifiedNameWithEs5.ts new file mode 100644 index 00000000000..86fd9935a1f --- /dev/null +++ b/tests/cases/compiler/jsxFactoryQualifiedNameWithEs5.ts @@ -0,0 +1,17 @@ +//@module: commonjs +//@target: es5 +//@jsx: react +//@jsxFactory: skate.h +//@noEmit: false + +// @filename: index.tsx +import "./jsx"; + +var skate: any; +const React = { createElement: skate.h }; + +class Component { + renderCallback() { + return

; + } +}; \ No newline at end of file diff --git a/tests/cases/compiler/keyofIsLiteralContexualType.ts b/tests/cases/compiler/keyofIsLiteralContexualType.ts new file mode 100644 index 00000000000..dd14de92289 --- /dev/null +++ b/tests/cases/compiler/keyofIsLiteralContexualType.ts @@ -0,0 +1,13 @@ +// keyof T is a literal contextual type + +function foo() { + let a: (keyof T)[] = ["a", "b"]; + let b: (keyof T)[] = ["a", "b", "c"]; +} + +// Repro from #12455 + +declare function pick(obj: T, propNames: K[]): Pick; + +let x = pick({ a: 10, b: 20, c: 30 }, ["a", "c"]); +let b = x.b; // Error \ No newline at end of file diff --git a/tests/cases/compiler/mappedTypeInferenceCircularity.ts b/tests/cases/compiler/mappedTypeInferenceCircularity.ts new file mode 100644 index 00000000000..56fe08c5fe2 --- /dev/null +++ b/tests/cases/compiler/mappedTypeInferenceCircularity.ts @@ -0,0 +1,7 @@ +// Repro from #12511 + +type HTML = { [K in 'div']: Block }; +type Block
{`${someBoolean}${someString}`}); + +goTo.marker("1"); +verify.quickInfoExists(); diff --git a/tests/cases/fourslash/server/completions01.ts b/tests/cases/fourslash/server/completions01.ts index a837a74849d..38fdbab4eda 100644 --- a/tests/cases/fourslash/server/completions01.ts +++ b/tests/cases/fourslash/server/completions01.ts @@ -6,11 +6,11 @@ goTo.marker('1'); edit.insert('.'); -verify.memberListContains('trim'); -verify.memberListCount(21); +verify.completionListContains('trim'); +verify.completionListCount(21); edit.insert('});'); // need the following lines to not have parse errors in order for completion list to appear goTo.marker('2'); edit.insert('.'); -verify.memberListContains('trim'); -verify.memberListCount(21); +verify.completionListContains('trim'); +verify.completionListCount(21); diff --git a/tests/cases/fourslash/server/jsdocTypedefTag.ts b/tests/cases/fourslash/server/jsdocTypedefTag.ts index 968e30a412d..9e980114835 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTag.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTag.ts @@ -52,37 +52,37 @@ //// d.dogAge./*dogAge*/; goTo.marker('numberLike'); -verify.memberListContains('charAt'); -verify.memberListContains('toExponential'); +verify.completionListContains('charAt'); +verify.completionListContains('toExponential'); goTo.marker('person'); -verify.memberListContains('personName'); -verify.memberListContains('personAge'); +verify.completionListContains('personName'); +verify.completionListContains('personAge'); goTo.marker('personName'); -verify.memberListContains('charAt'); +verify.completionListContains('charAt'); goTo.marker('personAge'); -verify.memberListContains('toExponential'); +verify.completionListContains('toExponential'); goTo.marker('animal'); -verify.memberListContains('animalName'); -verify.memberListContains('animalAge'); +verify.completionListContains('animalName'); +verify.completionListContains('animalAge'); goTo.marker('animalName'); -verify.memberListContains('charAt'); +verify.completionListContains('charAt'); goTo.marker('animalAge'); -verify.memberListContains('toExponential'); +verify.completionListContains('toExponential'); goTo.marker('dog'); -verify.memberListContains('dogName'); -verify.memberListContains('dogAge'); +verify.completionListContains('dogName'); +verify.completionListContains('dogAge'); goTo.marker('dogName'); -verify.memberListContains('charAt'); +verify.completionListContains('charAt'); goTo.marker('dogAge'); -verify.memberListContains('toExponential'); +verify.completionListContains('toExponential'); goTo.marker('cat'); -verify.memberListContains('catName'); -verify.memberListContains('catAge'); +verify.completionListContains('catName'); +verify.completionListContains('catAge'); goTo.marker('catName'); -verify.memberListContains('charAt'); +verify.completionListContains('charAt'); goTo.marker('catAge'); -verify.memberListContains('toExponential'); \ No newline at end of file +verify.completionListContains('toExponential'); \ No newline at end of file diff --git a/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts b/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts index 1d7a0bf318a..29330a73d3c 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts @@ -16,12 +16,12 @@ //// var x1; x1./*3*/; goTo.marker("1"); -verify.memberListContains('charAt'); -verify.memberListContains('toExponential'); +verify.completionListContains('charAt'); +verify.completionListContains('toExponential'); goTo.marker("2"); -verify.memberListContains('age'); +verify.completionListContains('age'); goTo.marker("3"); -verify.memberListContains('charAt'); -verify.memberListContains('toExponential'); \ No newline at end of file +verify.completionListContains('charAt'); +verify.completionListContains('toExponential'); \ No newline at end of file diff --git a/tests/cases/fourslash/tsxCompletion10.ts b/tests/cases/fourslash/tsxCompletion10.ts index f10e014c282..d36b2369218 100644 --- a/tests/cases/fourslash/tsxCompletion10.ts +++ b/tests/cases/fourslash/tsxCompletion10.ts @@ -10,5 +10,5 @@ //// var x1 =
goTo.marker("1"); -verify.memberListCount(1); +verify.completionListCount(1); verify.completionListContains('div'); goTo.marker("2"); -verify.memberListCount(1); +verify.completionListCount(1); verify.completionListContains('h1') diff --git a/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts b/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts index 742009b487e..7719e04a9ef 100644 --- a/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts +++ b/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts @@ -4,5 +4,5 @@ //// var x1 =
goTo.marker("1"); -verify.memberListCount(1); +verify.completionListCount(1); verify.completionListContains('div'); goTo.marker("2"); -verify.memberListCount(1); +verify.completionListCount(1); verify.completionListContains('h1') diff --git a/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts b/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts index d0ef579f401..f208b0a44a4 100644 --- a/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts +++ b/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts @@ -4,4 +4,4 @@ //// var x = Date: Wed, 14 Dec 2016 12:47:36 -0800 Subject: [PATCH 054/125] Added a tests for super property accesses within super calls of derived classes. --- .../captureSuperPropertyAccessInSuperCall01.ts | 11 +++++++++++ .../compiler/superPropertyAccessInSuperCall01.ts | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/cases/compiler/captureSuperPropertyAccessInSuperCall01.ts create mode 100644 tests/cases/compiler/superPropertyAccessInSuperCall01.ts diff --git a/tests/cases/compiler/captureSuperPropertyAccessInSuperCall01.ts b/tests/cases/compiler/captureSuperPropertyAccessInSuperCall01.ts new file mode 100644 index 00000000000..e60b9801c02 --- /dev/null +++ b/tests/cases/compiler/captureSuperPropertyAccessInSuperCall01.ts @@ -0,0 +1,11 @@ +class A { + constructor(f: () => string) { + } + public blah(): string { return ""; } +} + +class B extends A { + constructor() { + super(() => { return super.blah(); }) + } +} \ No newline at end of file diff --git a/tests/cases/compiler/superPropertyAccessInSuperCall01.ts b/tests/cases/compiler/superPropertyAccessInSuperCall01.ts new file mode 100644 index 00000000000..38373e9eef6 --- /dev/null +++ b/tests/cases/compiler/superPropertyAccessInSuperCall01.ts @@ -0,0 +1,11 @@ +class A { + constructor(f: string) { + } + public blah(): string { return ""; } +} + +class B extends A { + constructor() { + super(super.blah()) + } +} \ No newline at end of file From a01c195b4b8c1dd316b22d18406905e67447f919 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 14 Dec 2016 12:53:19 -0800 Subject: [PATCH 055/125] Accepted baselines. --- ...uperPropertyAccessInSuperCall01.errors.txt | 17 ++++++++++ ...captureSuperPropertyAccessInSuperCall01.js | 33 +++++++++++++++++++ ...uperPropertyAccessInSuperCall01.errors.txt | 17 ++++++++++ .../superPropertyAccessInSuperCall01.js | 33 +++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.errors.txt create mode 100644 tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js create mode 100644 tests/baselines/reference/superPropertyAccessInSuperCall01.errors.txt create mode 100644 tests/baselines/reference/superPropertyAccessInSuperCall01.js diff --git a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.errors.txt b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.errors.txt new file mode 100644 index 00000000000..6e2b7ef5787 --- /dev/null +++ b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/captureSuperPropertyAccessInSuperCall01.ts(9,24): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + + +==== tests/cases/compiler/captureSuperPropertyAccessInSuperCall01.ts (1 errors) ==== + class A { + constructor(f: () => string) { + } + public blah(): string { return ""; } + } + + class B extends A { + constructor() { + super(() => { return super.blah(); }) + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js new file mode 100644 index 00000000000..7fde44106c6 --- /dev/null +++ b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js @@ -0,0 +1,33 @@ +//// [captureSuperPropertyAccessInSuperCall01.ts] +class A { + constructor(f: () => string) { + } + public blah(): string { return ""; } +} + +class B extends A { + constructor() { + super(() => { return super.blah(); }) + } +} + +//// [captureSuperPropertyAccessInSuperCall01.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = (function () { + function A(f) { + } + A.prototype.blah = function () { return ""; }; + return A; +}()); +var B = (function (_super) { + __extends(B, _super); + function B() { + var _this = _super.call(this, function () { return _super.blah.call(_this); }) || this; + return _this; + } + return B; +}(A)); diff --git a/tests/baselines/reference/superPropertyAccessInSuperCall01.errors.txt b/tests/baselines/reference/superPropertyAccessInSuperCall01.errors.txt new file mode 100644 index 00000000000..f7449a26d5a --- /dev/null +++ b/tests/baselines/reference/superPropertyAccessInSuperCall01.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/superPropertyAccessInSuperCall01.ts(9,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + + +==== tests/cases/compiler/superPropertyAccessInSuperCall01.ts (1 errors) ==== + class A { + constructor(f: string) { + } + public blah(): string { return ""; } + } + + class B extends A { + constructor() { + super(super.blah()) + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/superPropertyAccessInSuperCall01.js b/tests/baselines/reference/superPropertyAccessInSuperCall01.js new file mode 100644 index 00000000000..f0dc925682c --- /dev/null +++ b/tests/baselines/reference/superPropertyAccessInSuperCall01.js @@ -0,0 +1,33 @@ +//// [superPropertyAccessInSuperCall01.ts] +class A { + constructor(f: string) { + } + public blah(): string { return ""; } +} + +class B extends A { + constructor() { + super(super.blah()) + } +} + +//// [superPropertyAccessInSuperCall01.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = (function () { + function A(f) { + } + A.prototype.blah = function () { return ""; }; + return A; +}()); +var B = (function (_super) { + __extends(B, _super); + function B() { + var _this = _super.call(this, _super.blah.call(_this)) || this; + return _this; + } + return B; +}(A)); From 784eac5cbdb6bb5b0f02e05e67b13206cedfab44 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 14 Dec 2016 12:56:40 -0800 Subject: [PATCH 056/125] Indented and-ed expressions. --- src/compiler/transformers/es2015.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 7f3f0bb8ba7..3c7f3539e76 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -1027,8 +1027,8 @@ namespace ts { // Return the result if we have an immediate super() call on the last statement, // but only if the constructor itself doesn't use 'this' elsewhere. if (superCallExpression - && statementOffset === ctorStatements.length - 1 - && !(ctor.transformFlags & (TransformFlags.ContainsLexicalThis | TransformFlags.ContainsCapturedLexicalThis))) { + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (TransformFlags.ContainsLexicalThis | TransformFlags.ContainsCapturedLexicalThis))) { const returnStatement = createReturn(superCallExpression); if (superCallExpression.kind !== SyntaxKind.BinaryExpression From 8290f8bf422d520af18f242c7965487b70c5aa6b Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 14 Dec 2016 14:40:04 -0800 Subject: [PATCH 057/125] Normalize line endings for lib files while building them --- Jakefile.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Jakefile.js b/Jakefile.js index 17346e8bc1f..275303dda13 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -353,19 +353,16 @@ function prependFile(prefixFile, destinationFile) { // concatenate a list of sourceFiles to a destinationFile function concatenateFiles(destinationFile, sourceFiles) { var temp = "temptemp"; - // Copy the first file to temp - if (!fs.existsSync(sourceFiles[0])) { - fail(sourceFiles[0] + " does not exist!"); - } - jake.cpR(sourceFiles[0], temp, { silent: true }); // append all files in sequence - for (var i = 1; i < sourceFiles.length; i++) { + var text = ""; + for (var i = 0; i < sourceFiles.length; i++) { if (!fs.existsSync(sourceFiles[i])) { fail(sourceFiles[i] + " does not exist!"); } - fs.appendFileSync(temp, "\n\n"); - fs.appendFileSync(temp, fs.readFileSync(sourceFiles[i])); + if (i > 0) { text += "\n\n"; } + text += fs.readFileSync(sourceFiles[i]).toString().replace(/\r?\n/g, "\n"); } + fs.writeFileSync(temp, text); // Move the file to the final destination fs.renameSync(temp, destinationFile); } From dda24f6d70d971b36535844d15ec69a9ac49fe5b Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 14 Dec 2016 14:43:45 -0800 Subject: [PATCH 058/125] allow to compute change ranges only for snapshots from the same script version cache --- .../unittests/tsserverProjectSystem.ts | 27 ++++++++++++++++++- src/server/scriptVersionCache.ts | 4 +-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 783a6016f7a..c1c7828fd3b 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -1799,7 +1799,6 @@ namespace ts.projectSystem { }); it("language service disabled state is updated in external projects", () => { - debugger const f1 = { path: "/a/app.js", content: "var x = 1" @@ -1940,6 +1939,32 @@ namespace ts.projectSystem { const edits = project.getLanguageService().getFormattingEditsForDocument(f1.path, options); assert.deepEqual(edits, [{ span: createTextSpan(/*start*/ 7, /*length*/ 3), newText: " " }]); }); + + it("snapshot from different caches are incompatible", () => { + const f1 = { + path: "/a/b/app.ts", + content: "let x = 1;" + }; + debugger + const host = createServerHost([f1]); + const projectFileName = "/a/b/proj.csproj"; + const projectService = createProjectService(host); + projectService.openExternalProject({ + projectFileName, + rootFiles: [toExternalFile(f1.path)], + options: {} + }) + projectService.openClientFile(f1.path, "let x = 1;\nlet y = 2;"); + + projectService.checkNumberOfProjects({ externalProjects: 1 }); + projectService.externalProjects[0].getLanguageService(/*ensureSynchronized*/false).getNavigationBarItems(f1.path); + projectService.closeClientFile(f1.path); + + projectService.openClientFile(f1.path); + projectService.checkNumberOfProjects({ externalProjects: 1 }); + const navbar = projectService.externalProjects[0].getLanguageService(/*ensureSynchronized*/false).getNavigationBarItems(f1.path); + assert.equal(navbar[0].spans[0].length, f1.content.length); + }); }); describe("Proper errors", () => { diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index aaf04d39a1f..e087c3b6dde 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -398,7 +398,7 @@ namespace ts.server { index: LineIndex; changesSincePreviousVersion: TextChange[] = []; - constructor(public version: number, public cache: ScriptVersionCache) { + constructor(readonly version: number, readonly cache: ScriptVersionCache) { } getText(rangeStart: number, rangeEnd: number) { @@ -438,7 +438,7 @@ namespace ts.server { } } getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange { - if (oldSnapshot instanceof LineIndexSnapshot) { + if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) { return this.getTextChangeRangeSinceVersion(oldSnapshot.version); } } From f58e1a2b17ad5299e8ac9624e8a6d1619dc21ee4 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 14 Dec 2016 14:59:00 -0800 Subject: [PATCH 059/125] Map both declared properties and string index signatures --- src/compiler/checker.ts | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 26164a528f3..5246bbfc700 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4536,15 +4536,27 @@ namespace ts { const typeParameter = getTypeParameterFromMappedType(type); const constraintType = getConstraintTypeFromMappedType(type); const templateType = getTemplateTypeFromMappedType(type); - const modifiersType = getModifiersTypeFromMappedType(type); + const modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); const templateReadonly = !!type.declaration.readonlyToken; const templateOptional = !!type.declaration.questionToken; - // First, if the constraint type is a type parameter, obtain the base constraint. Then, - // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. - // Finally, iterate over the constituents of the resulting iteration type. - const keyType = constraintType.flags & TypeFlags.TypeVariable ? getApparentType(constraintType) : constraintType; - const iterationType = keyType.flags & TypeFlags.Index ? getIndexType(getApparentType((keyType).type)) : keyType; - forEachType(iterationType, t => { + if (type.declaration.typeParameter.constraint.kind === SyntaxKind.TypeOperator) { + // We have a { [P in keyof T]: X } + forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + if (getIndexInfoOfType(modifiersType, IndexKind.String)) { + addMemberForKeyType(stringType); + } + } + else { + // First, if the constraint type is a type parameter, obtain the base constraint. Then, + // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. + // Finally, iterate over the constituents of the resulting iteration type. + const keyType = constraintType.flags & TypeFlags.TypeVariable ? getApparentType(constraintType) : constraintType; + const iterationType = keyType.flags & TypeFlags.Index ? getIndexType(getApparentType((keyType).type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + + function addMemberForKeyType(t: Type) { // Create a mapper from T to the current iteration type constituent. Then, if the // mapped type is itself an instantiated type, combine the iteration mapper with the // instantiation mapper. @@ -4565,8 +4577,7 @@ namespace ts { else if (t.flags & TypeFlags.String) { stringIndexInfo = createIndexInfo(propType, templateReadonly); } - }); - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + } } function getTypeParameterFromMappedType(type: MappedType) { From 6cd7454a9b7e3db223295c18d51a668c4eaddc4f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 14 Dec 2016 14:59:10 -0800 Subject: [PATCH 060/125] Add tests --- .../types/mapped/mappedTypeErrors.ts | 6 +++++ .../types/mapped/mappedTypeModifiers.ts | 25 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts index 4be6b6b098d..458dbe9caa4 100644 --- a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts +++ b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts @@ -125,3 +125,9 @@ c.setState({ }); c.setState(foo); c.setState({ a: undefined }); // Error c.setState({ c: true }); // Error + +type T2 = { a?: number, [key: string]: any }; + +let x1: T2 = { a: 'no' }; // Error +let x2: Partial = { a: 'no' }; // Error +let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts b/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts index 1fe6872965c..a111d186d16 100644 --- a/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts +++ b/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts @@ -1,4 +1,5 @@ // @strictNullChecks: true +// @noimplicitany: true type T = { a: number, b: string }; type TP = { a?: number, b?: string }; @@ -74,4 +75,26 @@ var b04: Readonly; var b04: Partial>; var b04: Readonly>; var b04: { [P in keyof BPR]: BPR[P] } -var b04: Pick; \ No newline at end of file +var b04: Pick; + +type Foo = { prop: number, [x: string]: number }; + +function f1(x: Partial) { + x.prop; // ok + (x["other"] || 0).toFixed(); +} + +function f2(x: Readonly) { + x.prop; // ok + x["other"].toFixed(); +} + +function f3(x: Boxified) { + x.prop; // ok + x["other"].x.toFixed(); +} + +function f4(x: { [P in keyof Foo]: Foo[P] }) { + x.prop; // ok + x["other"].toFixed(); +} From 321b23525acca61a06fdef42c509d9d9fdc6efa2 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 14 Dec 2016 15:01:46 -0800 Subject: [PATCH 061/125] remove debugger statement --- src/harness/unittests/tsserverProjectSystem.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index c1c7828fd3b..13d8a6bf824 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -1945,7 +1945,6 @@ namespace ts.projectSystem { path: "/a/b/app.ts", content: "let x = 1;" }; - debugger const host = createServerHost([f1]); const projectFileName = "/a/b/proj.csproj"; const projectService = createProjectService(host); From a597d3c2666b73596b123358f2e5bedad6f29d2e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 14 Dec 2016 15:03:13 -0800 Subject: [PATCH 062/125] Accept new baselines --- .../reference/mappedTypeErrors.errors.txt | 30 +++++- tests/baselines/reference/mappedTypeErrors.js | 19 +++- .../reference/mappedTypeModifiers.js | 41 ++++++++- .../reference/mappedTypeModifiers.symbols | 77 ++++++++++++++++ .../reference/mappedTypeModifiers.types | 92 +++++++++++++++++++ 5 files changed, 255 insertions(+), 4 deletions(-) diff --git a/tests/baselines/reference/mappedTypeErrors.errors.txt b/tests/baselines/reference/mappedTypeErrors.errors.txt index 17c77fa50a0..f98a11dbaf9 100644 --- a/tests/baselines/reference/mappedTypeErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeErrors.errors.txt @@ -36,9 +36,18 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(124,12): error TS2345: Type 'undefined' is not assignable to type 'string'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(125,14): error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(129,5): error TS2322: Type '{ a: string; }' is not assignable to type 'T2'. + Types of property 'a' are incompatible. + Type 'string' is not assignable to type 'number | undefined'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(130,5): error TS2322: Type '{ a: string; }' is not assignable to type 'Partial'. + Types of property 'a' are incompatible. + Type 'string' is not assignable to type 'number | undefined'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(131,5): error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'. + Types of property 'a' are incompatible. + Type 'string' is not assignable to type 'number | undefined'. -==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (21 errors) ==== +==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (24 errors) ==== interface Shape { name: string; @@ -223,4 +232,21 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(125,14): error TS2345: ~~~~~~~ !!! error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. !!! error TS2345: Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. - \ No newline at end of file + + type T2 = { a?: number, [key: string]: any }; + + let x1: T2 = { a: 'no' }; // Error + ~~ +!!! error TS2322: Type '{ a: string; }' is not assignable to type 'T2'. +!!! error TS2322: Types of property 'a' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. + let x2: Partial = { a: 'no' }; // Error + ~~ +!!! error TS2322: Type '{ a: string; }' is not assignable to type 'Partial'. +!!! error TS2322: Types of property 'a' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. + let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error + ~~ +!!! error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'. +!!! error TS2322: Types of property 'a' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeErrors.js b/tests/baselines/reference/mappedTypeErrors.js index e1b458565bb..83dc235c705 100644 --- a/tests/baselines/reference/mappedTypeErrors.js +++ b/tests/baselines/reference/mappedTypeErrors.js @@ -124,7 +124,12 @@ c.setState({ }); c.setState(foo); c.setState({ a: undefined }); // Error c.setState({ c: true }); // Error - + +type T2 = { a?: number, [key: string]: any }; + +let x1: T2 = { a: 'no' }; // Error +let x2: Partial = { a: 'no' }; // Error +let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error //// [mappedTypeErrors.js] function f1(x) { @@ -196,6 +201,9 @@ c.setState({}); c.setState(foo); c.setState({ a: undefined }); // Error c.setState({ c: true }); // Error +var x1 = { a: 'no' }; // Error +var x2 = { a: 'no' }; // Error +var x3 = { a: 'no' }; // Error //// [mappedTypeErrors.d.ts] @@ -251,3 +259,12 @@ declare class C { setState(props: Pick): void; } declare let c: C; +declare type T2 = { + a?: number; + [key: string]: any; +}; +declare let x1: T2; +declare let x2: Partial; +declare let x3: { + [P in keyof T2]: T2[P]; +}; diff --git a/tests/baselines/reference/mappedTypeModifiers.js b/tests/baselines/reference/mappedTypeModifiers.js index 6291fb9c42b..a247d18f2d4 100644 --- a/tests/baselines/reference/mappedTypeModifiers.js +++ b/tests/baselines/reference/mappedTypeModifiers.js @@ -74,7 +74,30 @@ var b04: Readonly; var b04: Partial>; var b04: Readonly>; var b04: { [P in keyof BPR]: BPR[P] } -var b04: Pick; +var b04: Pick; + +type Foo = { prop: number, [x: string]: number }; + +function f1(x: Partial) { + x.prop; // ok + (x["other"] || 0).toFixed(); +} + +function f2(x: Readonly) { + x.prop; // ok + x["other"].toFixed(); +} + +function f3(x: Boxified) { + x.prop; // ok + x["other"].x.toFixed(); +} + +function f4(x: { [P in keyof Foo]: Foo[P] }) { + x.prop; // ok + x["other"].toFixed(); +} + //// [mappedTypeModifiers.js] var v00; @@ -131,3 +154,19 @@ var b04; var b04; var b04; var b04; +function f1(x) { + x.prop; // ok + (x["other"] || 0).toFixed(); +} +function f2(x) { + x.prop; // ok + x["other"].toFixed(); +} +function f3(x) { + x.prop; // ok + x["other"].x.toFixed(); +} +function f4(x) { + x.prop; // ok + x["other"].toFixed(); +} diff --git a/tests/baselines/reference/mappedTypeModifiers.symbols b/tests/baselines/reference/mappedTypeModifiers.symbols index 5138055d08b..b2b8faed4cf 100644 --- a/tests/baselines/reference/mappedTypeModifiers.symbols +++ b/tests/baselines/reference/mappedTypeModifiers.symbols @@ -353,3 +353,80 @@ var b04: Pick; >BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) >BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +type Foo = { prop: number, [x: string]: number }; +>Foo : Symbol(Foo, Decl(mappedTypeModifiers.ts, 75, 30)) +>prop : Symbol(prop, Decl(mappedTypeModifiers.ts, 77, 12)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 77, 28)) + +function f1(x: Partial) { +>f1 : Symbol(f1, Decl(mappedTypeModifiers.ts, 77, 49)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 79, 12)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>Foo : Symbol(Foo, Decl(mappedTypeModifiers.ts, 75, 30)) + + x.prop; // ok +>x.prop : Symbol(prop) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 79, 12)) +>prop : Symbol(prop) + + (x["other"] || 0).toFixed(); +>(x["other"] || 0).toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 79, 12)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +} + +function f2(x: Readonly) { +>f2 : Symbol(f2, Decl(mappedTypeModifiers.ts, 82, 1)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 84, 12)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>Foo : Symbol(Foo, Decl(mappedTypeModifiers.ts, 75, 30)) + + x.prop; // ok +>x.prop : Symbol(prop) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 84, 12)) +>prop : Symbol(prop) + + x["other"].toFixed(); +>x["other"].toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 84, 12)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +} + +function f3(x: Boxified) { +>f3 : Symbol(f3, Decl(mappedTypeModifiers.ts, 87, 1)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 89, 12)) +>Boxified : Symbol(Boxified, Decl(mappedTypeModifiers.ts, 36, 28)) +>Foo : Symbol(Foo, Decl(mappedTypeModifiers.ts, 75, 30)) + + x.prop; // ok +>x.prop : Symbol(prop) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 89, 12)) +>prop : Symbol(prop) + + x["other"].x.toFixed(); +>x["other"].x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x["other"].x : Symbol(x, Decl(mappedTypeModifiers.ts, 38, 38)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 89, 12)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 38, 38)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +} + +function f4(x: { [P in keyof Foo]: Foo[P] }) { +>f4 : Symbol(f4, Decl(mappedTypeModifiers.ts, 92, 1)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 94, 12)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 94, 18)) +>Foo : Symbol(Foo, Decl(mappedTypeModifiers.ts, 75, 30)) +>Foo : Symbol(Foo, Decl(mappedTypeModifiers.ts, 75, 30)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 94, 18)) + + x.prop; // ok +>x.prop : Symbol(prop) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 94, 12)) +>prop : Symbol(prop) + + x["other"].toFixed(); +>x["other"].toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 94, 12)) +>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --)) +} + diff --git a/tests/baselines/reference/mappedTypeModifiers.types b/tests/baselines/reference/mappedTypeModifiers.types index 7a30e227bd6..7771de023f1 100644 --- a/tests/baselines/reference/mappedTypeModifiers.types +++ b/tests/baselines/reference/mappedTypeModifiers.types @@ -353,3 +353,95 @@ var b04: Pick; >BPR : BPR >BPR : BPR +type Foo = { prop: number, [x: string]: number }; +>Foo : Foo +>prop : number +>x : string + +function f1(x: Partial) { +>f1 : (x: Partial) => void +>x : Partial +>Partial : Partial +>Foo : Foo + + x.prop; // ok +>x.prop : number | undefined +>x : Partial +>prop : number | undefined + + (x["other"] || 0).toFixed(); +>(x["other"] || 0).toFixed() : string +>(x["other"] || 0).toFixed : (fractionDigits?: number | undefined) => string +>(x["other"] || 0) : number +>x["other"] || 0 : number +>x["other"] : number | undefined +>x : Partial +>"other" : "other" +>0 : 0 +>toFixed : (fractionDigits?: number | undefined) => string +} + +function f2(x: Readonly) { +>f2 : (x: Readonly) => void +>x : Readonly +>Readonly : Readonly +>Foo : Foo + + x.prop; // ok +>x.prop : number +>x : Readonly +>prop : number + + x["other"].toFixed(); +>x["other"].toFixed() : string +>x["other"].toFixed : (fractionDigits?: number | undefined) => string +>x["other"] : number +>x : Readonly +>"other" : "other" +>toFixed : (fractionDigits?: number | undefined) => string +} + +function f3(x: Boxified) { +>f3 : (x: Boxified) => void +>x : Boxified +>Boxified : Boxified +>Foo : Foo + + x.prop; // ok +>x.prop : { x: number; } +>x : Boxified +>prop : { x: number; } + + x["other"].x.toFixed(); +>x["other"].x.toFixed() : string +>x["other"].x.toFixed : (fractionDigits?: number | undefined) => string +>x["other"].x : number +>x["other"] : { x: number; } +>x : Boxified +>"other" : "other" +>x : number +>toFixed : (fractionDigits?: number | undefined) => string +} + +function f4(x: { [P in keyof Foo]: Foo[P] }) { +>f4 : (x: { [x: string]: number; prop: number; }) => void +>x : { [x: string]: number; prop: number; } +>P : P +>Foo : Foo +>Foo : Foo +>P : P + + x.prop; // ok +>x.prop : number +>x : { [x: string]: number; prop: number; } +>prop : number + + x["other"].toFixed(); +>x["other"].toFixed() : string +>x["other"].toFixed : (fractionDigits?: number | undefined) => string +>x["other"] : number +>x : { [x: string]: number; prop: number; } +>"other" : "other" +>toFixed : (fractionDigits?: number | undefined) => string +} + From b0f42f04eea70f4912fd85ef8d48cafda31e3107 Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Mon, 12 Dec 2016 18:20:09 -0800 Subject: [PATCH 063/125] Fix __awaiter helper for IE8 compat --- src/compiler/transformers/es2017.ts | 2 +- tests/baselines/reference/asyncAwaitIsolatedModules_es5.js | 2 +- tests/baselines/reference/asyncAwaitIsolatedModules_es6.js | 2 +- tests/baselines/reference/asyncAwait_es5.js | 2 +- tests/baselines/reference/asyncAwait_es6.js | 2 +- tests/baselines/reference/asyncFunctionNoReturnType.js | 2 +- tests/baselines/reference/asyncFunctionReturnType.js | 2 +- tests/baselines/reference/asyncFunctionsAcrossFiles.js | 4 ++-- .../baselines/reference/asyncFunctionsAndStrictNullChecks.js | 2 +- tests/baselines/reference/asyncIIFE.js | 2 +- tests/baselines/reference/asyncImportedPromise_es5.js | 2 +- tests/baselines/reference/asyncImportedPromise_es6.js | 2 +- tests/baselines/reference/asyncMultiFile_es5.js | 2 +- tests/baselines/reference/asyncMultiFile_es6.js | 2 +- tests/baselines/reference/await_unaryExpression_es6.js | 2 +- tests/baselines/reference/await_unaryExpression_es6_1.js | 2 +- tests/baselines/reference/await_unaryExpression_es6_2.js | 2 +- tests/baselines/reference/await_unaryExpression_es6_3.js | 2 +- tests/baselines/reference/castOfAwait.js | 2 +- tests/baselines/reference/declarationEmitPromise.js | 2 +- tests/baselines/reference/decoratorMetadataPromise.js | 2 +- tests/baselines/reference/defaultExportInAwaitExpression01.js | 2 +- tests/baselines/reference/defaultExportInAwaitExpression02.js | 2 +- tests/baselines/reference/es5-asyncFunction.js | 2 +- tests/baselines/reference/es5-importHelpersAsyncFunctions.js | 2 +- tests/baselines/reference/exportDefaultAsyncFunction.js | 2 +- tests/baselines/reference/exportDefaultAsyncFunction2.js | 2 +- tests/baselines/reference/inferenceLimit.js | 2 +- .../modularizeLibrary_NoErrorDuplicateLibOptions1.js | 2 +- .../modularizeLibrary_NoErrorDuplicateLibOptions2.js | 2 +- .../reference/modularizeLibrary_TargetES5UsingES6Lib.js | 2 +- tests/baselines/reference/noImplicitReturnsInAsync1.js | 2 +- tests/baselines/reference/noImplicitReturnsInAsync2.js | 2 +- tests/baselines/reference/objectRest2.js | 2 +- tests/baselines/reference/promiseType.js | 2 +- tests/baselines/reference/promiseTypeStrictNull.js | 2 +- tests/baselines/reference/reachabilityChecks7.js | 2 +- tests/baselines/reference/transformNestedGeneratorsWithTry.js | 2 +- 38 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index 14f840f2e66..c87dbe32518 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -494,7 +494,7 @@ namespace ts { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); };` }; diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js index 2f11dddf7de..49404267009 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js @@ -46,7 +46,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js index 98d11d72bfb..046b74e6569 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js @@ -45,7 +45,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function f0() { diff --git a/tests/baselines/reference/asyncAwait_es5.js b/tests/baselines/reference/asyncAwait_es5.js index 043e68abeab..e4dc62ea1cf 100644 --- a/tests/baselines/reference/asyncAwait_es5.js +++ b/tests/baselines/reference/asyncAwait_es5.js @@ -45,7 +45,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { diff --git a/tests/baselines/reference/asyncAwait_es6.js b/tests/baselines/reference/asyncAwait_es6.js index 4ba9e096e10..d6635098aed 100644 --- a/tests/baselines/reference/asyncAwait_es6.js +++ b/tests/baselines/reference/asyncAwait_es6.js @@ -45,7 +45,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function f0() { diff --git a/tests/baselines/reference/asyncFunctionNoReturnType.js b/tests/baselines/reference/asyncFunctionNoReturnType.js index fd39fc74d0e..b1c55416566 100644 --- a/tests/baselines/reference/asyncFunctionNoReturnType.js +++ b/tests/baselines/reference/asyncFunctionNoReturnType.js @@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { diff --git a/tests/baselines/reference/asyncFunctionReturnType.js b/tests/baselines/reference/asyncFunctionReturnType.js index 76f9952ab9f..dcdead47c6b 100644 --- a/tests/baselines/reference/asyncFunctionReturnType.js +++ b/tests/baselines/reference/asyncFunctionReturnType.js @@ -16,7 +16,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function fAsync() { diff --git a/tests/baselines/reference/asyncFunctionsAcrossFiles.js b/tests/baselines/reference/asyncFunctionsAcrossFiles.js index e9b5710dc07..b1a766e4e41 100644 --- a/tests/baselines/reference/asyncFunctionsAcrossFiles.js +++ b/tests/baselines/reference/asyncFunctionsAcrossFiles.js @@ -21,7 +21,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import { a } from './a'; @@ -36,7 +36,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import { b } from './b'; diff --git a/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js index ac9a558a53f..50ecbbb2beb 100644 --- a/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js +++ b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js @@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function sample(promise) { diff --git a/tests/baselines/reference/asyncIIFE.js b/tests/baselines/reference/asyncIIFE.js index 79779af62f3..2460dbdf26b 100644 --- a/tests/baselines/reference/asyncIIFE.js +++ b/tests/baselines/reference/asyncIIFE.js @@ -16,7 +16,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function f1() { diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js index e5c28eb2dc1..641b8e0381f 100644 --- a/tests/baselines/reference/asyncImportedPromise_es5.js +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -31,7 +31,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { diff --git a/tests/baselines/reference/asyncImportedPromise_es6.js b/tests/baselines/reference/asyncImportedPromise_es6.js index 17c9de51ee6..6c6e34e7b1d 100644 --- a/tests/baselines/reference/asyncImportedPromise_es6.js +++ b/tests/baselines/reference/asyncImportedPromise_es6.js @@ -21,7 +21,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; class Test { diff --git a/tests/baselines/reference/asyncMultiFile_es5.js b/tests/baselines/reference/asyncMultiFile_es5.js index 6b44f5393fc..547135e5c19 100644 --- a/tests/baselines/reference/asyncMultiFile_es5.js +++ b/tests/baselines/reference/asyncMultiFile_es5.js @@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { diff --git a/tests/baselines/reference/asyncMultiFile_es6.js b/tests/baselines/reference/asyncMultiFile_es6.js index 0c45aa6c8a3..e7dd854b95b 100644 --- a/tests/baselines/reference/asyncMultiFile_es6.js +++ b/tests/baselines/reference/asyncMultiFile_es6.js @@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function f() { diff --git a/tests/baselines/reference/await_unaryExpression_es6.js b/tests/baselines/reference/await_unaryExpression_es6.js index 6609cc6f3f4..f9183f7af3e 100644 --- a/tests/baselines/reference/await_unaryExpression_es6.js +++ b/tests/baselines/reference/await_unaryExpression_es6.js @@ -22,7 +22,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function bar() { diff --git a/tests/baselines/reference/await_unaryExpression_es6_1.js b/tests/baselines/reference/await_unaryExpression_es6_1.js index 48f50d76f4a..948e537cb01 100644 --- a/tests/baselines/reference/await_unaryExpression_es6_1.js +++ b/tests/baselines/reference/await_unaryExpression_es6_1.js @@ -26,7 +26,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function bar() { diff --git a/tests/baselines/reference/await_unaryExpression_es6_2.js b/tests/baselines/reference/await_unaryExpression_es6_2.js index 5e9d63a21d2..4b4c1cd6513 100644 --- a/tests/baselines/reference/await_unaryExpression_es6_2.js +++ b/tests/baselines/reference/await_unaryExpression_es6_2.js @@ -18,7 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function bar1() { diff --git a/tests/baselines/reference/await_unaryExpression_es6_3.js b/tests/baselines/reference/await_unaryExpression_es6_3.js index 469c8ea3ee9..6db5d5a7c31 100644 --- a/tests/baselines/reference/await_unaryExpression_es6_3.js +++ b/tests/baselines/reference/await_unaryExpression_es6_3.js @@ -24,7 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function bar1() { diff --git a/tests/baselines/reference/castOfAwait.js b/tests/baselines/reference/castOfAwait.js index 1f66d49e0f3..9f67f74b11b 100644 --- a/tests/baselines/reference/castOfAwait.js +++ b/tests/baselines/reference/castOfAwait.js @@ -14,7 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function f() { diff --git a/tests/baselines/reference/declarationEmitPromise.js b/tests/baselines/reference/declarationEmitPromise.js index e6f3f922b46..9e820a789c9 100644 --- a/tests/baselines/reference/declarationEmitPromise.js +++ b/tests/baselines/reference/declarationEmitPromise.js @@ -29,7 +29,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; class bluebird { diff --git a/tests/baselines/reference/decoratorMetadataPromise.js b/tests/baselines/reference/decoratorMetadataPromise.js index 52449f91755..23491449dfa 100644 --- a/tests/baselines/reference/decoratorMetadataPromise.js +++ b/tests/baselines/reference/decoratorMetadataPromise.js @@ -27,7 +27,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; class A { diff --git a/tests/baselines/reference/defaultExportInAwaitExpression01.js b/tests/baselines/reference/defaultExportInAwaitExpression01.js index a16e2f07f5f..9a122ae99c5 100644 --- a/tests/baselines/reference/defaultExportInAwaitExpression01.js +++ b/tests/baselines/reference/defaultExportInAwaitExpression01.js @@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; (function (dependencies, factory) { diff --git a/tests/baselines/reference/defaultExportInAwaitExpression02.js b/tests/baselines/reference/defaultExportInAwaitExpression02.js index db05d62a2ad..8499164f675 100644 --- a/tests/baselines/reference/defaultExportInAwaitExpression02.js +++ b/tests/baselines/reference/defaultExportInAwaitExpression02.js @@ -24,7 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const a_1 = require("./a"); diff --git a/tests/baselines/reference/es5-asyncFunction.js b/tests/baselines/reference/es5-asyncFunction.js index 5123566dc8c..6f04c7ed7ef 100644 --- a/tests/baselines/reference/es5-asyncFunction.js +++ b/tests/baselines/reference/es5-asyncFunction.js @@ -14,7 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { diff --git a/tests/baselines/reference/es5-importHelpersAsyncFunctions.js b/tests/baselines/reference/es5-importHelpersAsyncFunctions.js index 0fd308cee3b..71c4af8d559 100644 --- a/tests/baselines/reference/es5-importHelpersAsyncFunctions.js +++ b/tests/baselines/reference/es5-importHelpersAsyncFunctions.js @@ -34,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { diff --git a/tests/baselines/reference/exportDefaultAsyncFunction.js b/tests/baselines/reference/exportDefaultAsyncFunction.js index 22f686b6ec8..9931d1f1eea 100644 --- a/tests/baselines/reference/exportDefaultAsyncFunction.js +++ b/tests/baselines/reference/exportDefaultAsyncFunction.js @@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; export default function foo() { diff --git a/tests/baselines/reference/exportDefaultAsyncFunction2.js b/tests/baselines/reference/exportDefaultAsyncFunction2.js index aed6eb6c879..7b79bed9408 100644 --- a/tests/baselines/reference/exportDefaultAsyncFunction2.js +++ b/tests/baselines/reference/exportDefaultAsyncFunction2.js @@ -40,7 +40,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; export default () => __awaiter(this, void 0, void 0, function* () { return 0; }); diff --git a/tests/baselines/reference/inferenceLimit.js b/tests/baselines/reference/inferenceLimit.js index b9423ebd655..84f0989e987 100644 --- a/tests/baselines/reference/inferenceLimit.js +++ b/tests/baselines/reference/inferenceLimit.js @@ -49,7 +49,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; class BrokenClass { diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.js b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.js index 180b53028ff..b83efdce890 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.js +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.js @@ -87,7 +87,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; // Using Es6 array diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.js b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.js index cf69f260223..32d7135916b 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.js +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.js @@ -87,7 +87,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; // Using Es6 array diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.js b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.js index 350113ec6a0..d0de3c93da0 100644 --- a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.js +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.js @@ -87,7 +87,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; // Using Es6 array diff --git a/tests/baselines/reference/noImplicitReturnsInAsync1.js b/tests/baselines/reference/noImplicitReturnsInAsync1.js index 5274264a6b1..5ab86a91d3b 100644 --- a/tests/baselines/reference/noImplicitReturnsInAsync1.js +++ b/tests/baselines/reference/noImplicitReturnsInAsync1.js @@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function test(isError = false) { diff --git a/tests/baselines/reference/noImplicitReturnsInAsync2.js b/tests/baselines/reference/noImplicitReturnsInAsync2.js index 93f8c97d1fb..7e7f22bd691 100644 --- a/tests/baselines/reference/noImplicitReturnsInAsync2.js +++ b/tests/baselines/reference/noImplicitReturnsInAsync2.js @@ -42,7 +42,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; // Should be an error, Promise, currently retorted correctly diff --git a/tests/baselines/reference/objectRest2.js b/tests/baselines/reference/objectRest2.js index e21c8c79853..6abff9e56a1 100644 --- a/tests/baselines/reference/objectRest2.js +++ b/tests/baselines/reference/objectRest2.js @@ -28,7 +28,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function rootConnection(name) { diff --git a/tests/baselines/reference/promiseType.js b/tests/baselines/reference/promiseType.js index 9fbdb2ab2b6..4e42ea24073 100644 --- a/tests/baselines/reference/promiseType.js +++ b/tests/baselines/reference/promiseType.js @@ -161,7 +161,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const a = p.then(); diff --git a/tests/baselines/reference/promiseTypeStrictNull.js b/tests/baselines/reference/promiseTypeStrictNull.js index 8c5cef4c7c4..4aefeb3403e 100644 --- a/tests/baselines/reference/promiseTypeStrictNull.js +++ b/tests/baselines/reference/promiseTypeStrictNull.js @@ -161,7 +161,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const a = p.then(); diff --git a/tests/baselines/reference/reachabilityChecks7.js b/tests/baselines/reference/reachabilityChecks7.js index b8334f4276b..c17472205a4 100644 --- a/tests/baselines/reference/reachabilityChecks7.js +++ b/tests/baselines/reference/reachabilityChecks7.js @@ -36,7 +36,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; // async function without return type annotation - error diff --git a/tests/baselines/reference/transformNestedGeneratorsWithTry.js b/tests/baselines/reference/transformNestedGeneratorsWithTry.js index 69273e62633..7c3597ddc4b 100644 --- a/tests/baselines/reference/transformNestedGeneratorsWithTry.js +++ b/tests/baselines/reference/transformNestedGeneratorsWithTry.js @@ -29,7 +29,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { From 366dfc052f5c1104e2b5cdfdb44c1de581093120 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 14 Dec 2016 21:53:33 -0800 Subject: [PATCH 064/125] expose parseCommandLine (#12934) --- src/compiler/commandLineParser.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 251eeb58b15..a4257a610e1 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -572,7 +572,6 @@ namespace ts { } } - /* @internal */ export function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine { const options: CompilerOptions = {}; const fileNames: string[] = []; From 371e4f7bc2672c6d3137a776af1f163b47eb9100 Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Wed, 14 Dec 2016 22:03:00 -0800 Subject: [PATCH 065/125] Make line-endings LF only in the /lib dir --- lib/.gitattributes | 1 + lib/README.md | 10 +- lib/cancellationToken.js | 30 +- lib/lib.d.ts | 38154 +++++++++++------------ lib/lib.dom.d.ts | 29290 ++++++++--------- lib/lib.dom.iterable.d.ts | 58 +- lib/lib.es2015.collection.d.ts | 176 +- lib/lib.es2015.core.d.ts | 1080 +- lib/lib.es2015.d.ts | 50 +- lib/lib.es2015.generator.d.ts | 56 +- lib/lib.es2015.iterable.d.ts | 920 +- lib/lib.es2015.promise.d.ts | 538 +- lib/lib.es2015.proxy.d.ts | 76 +- lib/lib.es2015.reflect.d.ts | 60 +- lib/lib.es2015.symbol.d.ts | 102 +- lib/lib.es2015.symbol.wellknown.d.ts | 684 +- lib/lib.es2016.array.include.d.ts | 208 +- lib/lib.es2016.d.ts | 34 +- lib/lib.es2017.d.ts | 40 +- lib/lib.es2017.object.d.ts | 60 +- lib/lib.es2017.sharedmemory.d.ts | 84 +- lib/lib.es2017.string.d.ts | 32 +- lib/lib.es5.d.ts | 8302 ++--- lib/lib.es6.d.ts | 41588 ++++++++++++------------- lib/lib.scripthost.d.ts | 614 +- lib/lib.webworker.d.ts | 2442 +- lib/protocol.d.ts | 3532 +-- lib/tsc.js | 30 +- lib/tsserver.js | 30 +- lib/tsserverlibrary.js | 30 +- lib/typescript.d.ts | 32 +- lib/typescript.js | 30 +- lib/typescriptServices.d.ts | 30 +- lib/typescriptServices.js | 30 +- lib/typingsInstaller.js | 30 +- 35 files changed, 64232 insertions(+), 64231 deletions(-) create mode 100644 lib/.gitattributes diff --git a/lib/.gitattributes b/lib/.gitattributes new file mode 100644 index 00000000000..fcadb2cf979 --- /dev/null +++ b/lib/.gitattributes @@ -0,0 +1 @@ +* text eol=lf diff --git a/lib/README.md b/lib/README.md index 852d449f1e5..0a85a9e7b5c 100644 --- a/lib/README.md +++ b/lib/README.md @@ -1,5 +1,5 @@ -# Read This! - -**These files are not meant to be edited by hand.** -If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. -Running `jake LKG` will then appropriately update the files in this directory. +# Read This! + +**These files are not meant to be edited by hand.** +If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. +Running `jake LKG` will then appropriately update the files in this directory. diff --git a/lib/cancellationToken.js b/lib/cancellationToken.js index 8af21172df4..003999d2e8a 100644 --- a/lib/cancellationToken.js +++ b/lib/cancellationToken.js @@ -1,18 +1,18 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + "use strict"; var fs = require("fs"); function createCancellationToken(args) { diff --git a/lib/lib.d.ts b/lib/lib.d.ts index 4eb501c04d2..ce9c63c3242 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -1,19087 +1,19087 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare const NaN: number; -declare const Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has null prototype. - * @param o Object to use as a prototype. May be null - */ - create(o: null): any; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - */ - create(o: T): T; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): T; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare const Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(this: Function, thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(this: Function, thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(this: Function, thisArg: any, ...argArray: any[]): any; - - /** Returns a string representation of a function. */ - toString(): string; - - prototype: any; - readonly length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} - -declare const Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray | null; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray | null; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - readonly length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - readonly [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare const String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - readonly prototype: Boolean; -} - -declare const Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - readonly prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} - -/** 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 ReadonlyArray { - readonly raw: ReadonlyArray -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - readonly E: number; - /** The natural logarithm of 10. */ - readonly LN10: number; - /** The natural logarithm of 2. */ - readonly LN2: number; - /** The base-2 logarithm of e. */ - readonly LOG2E: number; - /** The base-10 logarithm of e. */ - readonly LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - readonly PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - readonly SQRT1_2: number; - /** The square root of 2. */ - readonly SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare const Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare const Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray | null; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): this; -} - -interface RegExpConstructor { - new (pattern: RegExp): RegExp; - new (pattern: string, flags?: string): RegExp; - (pattern: RegExp): RegExp; - (pattern: string, flags?: string): RegExp; - readonly prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare const RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; - stack?: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare const Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare const EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare const RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare const ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} - -declare const SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} - -declare const TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} - -declare const URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; -} - -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare const JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat>(...items: U[]): T[]; - /** - * 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. - */ - 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. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - - readonly [n: number]: T; -} - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * 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. - */ - 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. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T | undefined; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: T, b: T) => number): this; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: T, index: number, array: 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(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - readonly prototype: Array; -} - -declare const Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * 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) | undefined | null, - onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; - - /** - * 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) | undefined | null, - onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; - - /** - * 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) => TResult | PromiseLike, - onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; - - /** - * 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) => TResult1 | PromiseLike, - onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; -} - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare const ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare const DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare const Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare const Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare const Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare const Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare const Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare const Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare const Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare const Float64Array: Float64ArrayConstructor; - -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string | string[], options?: CollatorOptions): Collator; - (locales?: string | string[], options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - 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 or specified locale. - * @param that String to compare to target string - * @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 | string[], options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @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 | string[], options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @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 | string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @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 | string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @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(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; -} +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare const NaN: number; +declare const Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + readonly prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has null prototype. + * @param o Object to use as a prototype. May be null + */ + create(o: null): any; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + */ + create(o: T): T; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: any, properties: PropertyDescriptorMap): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): T; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare const Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(this: Function, thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(this: Function, thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(this: Function, thisArg: any, ...argArray: any[]): any; + + /** Returns a string representation of a function. */ + toString(): string; + + prototype: any; + readonly length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + readonly prototype: Function; +} + +declare const Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string): RegExpMatchArray | null; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + */ + match(regexp: RegExp): RegExpMatchArray | null; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string that represents the regular expression. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: string, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string that represents the regular expression. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string): number; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string, limit?: number): string[]; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + readonly length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): string; + + readonly [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + readonly prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare const String: StringConstructor; + +interface Boolean { + /** Returns the primitive value of the specified object. */ + valueOf(): boolean; +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + readonly prototype: Boolean; +} + +declare const Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + readonly prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + readonly MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + readonly MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + readonly NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; +} + +/** 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 ReadonlyArray { + readonly raw: ReadonlyArray +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + readonly E: number; + /** The natural logarithm of 10. */ + readonly LN10: number; + /** The natural logarithm of 2. */ + readonly LN2: number; + /** The base-2 logarithm of e. */ + readonly LOG2E: number; + /** The base-10 logarithm of e. */ + readonly LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + readonly PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + readonly SQRT1_2: number; + /** The square root of 2. */ + readonly SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point. + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare const Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + readonly prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare const Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray | null; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ + readonly source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + readonly global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + readonly ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + readonly multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): this; +} + +interface RegExpConstructor { + new (pattern: RegExp): RegExp; + new (pattern: string, flags?: string): RegExp; + (pattern: RegExp): RegExp; + (pattern: string, flags?: string): RegExp; + readonly prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare const RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; + stack?: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + readonly prototype: Error; +} + +declare const Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + readonly prototype: EvalError; +} + +declare const EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + readonly prototype: RangeError; +} + +declare const RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + readonly prototype: ReferenceError; +} + +declare const ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + readonly prototype: SyntaxError; +} + +declare const SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + readonly prototype: TypeError; +} + +declare const TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + readonly prototype: URIError; +} + +declare const URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; +} + +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare const JSON: JSON; - -///////////////////////////// -/// IE DOM APIs -///////////////////////////// - -interface Algorithm { - name: string; -} - -interface AriaRequestEventInit extends EventInit { - attributeName?: string; - attributeValue?: string; -} - -interface CommandEventInit extends EventInit { - commandName?: string; - detail?: string; -} - -interface CompositionEventInit extends UIEventInit { - data?: string; -} - -interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { - arrayOfDomainStrings?: string[]; -} - -interface ConstrainBooleanParameters { - exact?: boolean; - ideal?: boolean; -} - -interface ConstrainDOMStringParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface ConstrainDoubleRange extends DoubleRange { - exact?: number; - ideal?: number; -} - -interface ConstrainLongRange extends LongRange { - exact?: number; - ideal?: number; -} - -interface ConstrainVideoFacingModeParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface CustomEventInit extends EventInit { - detail?: any; -} - -interface DeviceAccelerationDict { - x?: number; - y?: number; - z?: number; -} - -interface DeviceLightEventInit extends EventInit { - value?: number; -} - -interface DeviceRotationRateDict { - alpha?: number; - beta?: number; - gamma?: number; -} - -interface DoubleRange { - max?: number; - min?: number; -} - -interface EventInit { - bubbles?: boolean; - cancelable?: boolean; -} - -interface EventModifierInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - modifierAltGraph?: boolean; - modifierCapsLock?: boolean; - modifierFn?: boolean; - modifierFnLock?: boolean; - modifierHyper?: boolean; - modifierNumLock?: boolean; - modifierOS?: boolean; - modifierScrollLock?: boolean; - modifierSuper?: boolean; - modifierSymbol?: boolean; - modifierSymbolLock?: boolean; -} - -interface ExceptionInformation { - domain?: string; -} - -interface FocusEventInit extends UIEventInit { - relatedTarget?: EventTarget; -} - -interface HashChangeEventInit extends EventInit { - newURL?: string; - oldURL?: string; -} - -interface IDBIndexParameters { - multiEntry?: boolean; - unique?: boolean; -} - -interface IDBObjectStoreParameters { - autoIncrement?: boolean; - keyPath?: IDBKeyPath; -} - -interface KeyAlgorithm { - name?: string; -} - -interface KeyboardEventInit extends EventModifierInit { - code?: string; - key?: string; - location?: number; - repeat?: boolean; -} - -interface LongRange { - max?: number; - min?: number; -} - -interface MSAccountInfo { - rpDisplayName?: string; - userDisplayName?: string; - accountName?: string; - userId?: string; - accountImageUri?: string; -} - -interface MSAudioLocalClientEvent extends MSLocalClientEventBase { - networkSendQualityEventRatio?: number; - networkDelayEventRatio?: number; - cpuInsufficientEventRatio?: number; - deviceHalfDuplexAECEventRatio?: number; - deviceRenderNotFunctioningEventRatio?: number; - deviceCaptureNotFunctioningEventRatio?: number; - deviceGlitchesEventRatio?: number; - deviceLowSNREventRatio?: number; - deviceLowSpeechLevelEventRatio?: number; - deviceClippingEventRatio?: number; - deviceEchoEventRatio?: number; - deviceNearEndToEchoRatioEventRatio?: number; - deviceRenderZeroVolumeEventRatio?: number; - deviceRenderMuteEventRatio?: number; - deviceMultipleEndpointsEventCount?: number; - deviceHowlingEventCount?: number; -} - -interface MSAudioRecvPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioRecvSignal; - packetReorderRatio?: number; - packetReorderDepthAvg?: number; - packetReorderDepthMax?: number; - burstLossLength1?: number; - burstLossLength2?: number; - burstLossLength3?: number; - burstLossLength4?: number; - burstLossLength5?: number; - burstLossLength6?: number; - burstLossLength7?: number; - burstLossLength8OrHigher?: number; - fecRecvDistance1?: number; - fecRecvDistance2?: number; - fecRecvDistance3?: number; - ratioConcealedSamplesAvg?: number; - ratioStretchedSamplesAvg?: number; - ratioCompressedSamplesAvg?: number; -} - -interface MSAudioRecvSignal { - initialSignalLevelRMS?: number; - recvSignalLevelCh1?: number; - recvNoiseLevelCh1?: number; - renderSignalLevel?: number; - renderNoiseLevel?: number; - renderLoopbackSignalLevel?: number; -} - -interface MSAudioSendPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioSendSignal; - audioFECUsed?: boolean; - sendMutePercent?: number; -} - -interface MSAudioSendSignal { - noiseLevel?: number; - sendSignalLevelCh1?: number; - sendNoiseLevelCh1?: number; -} - -interface MSConnectivity { - iceType?: string; - iceWarningFlags?: MSIceWarningFlags; - relayAddress?: MSRelayAddress; -} - -interface MSCredentialFilter { - accept?: MSCredentialSpec[]; -} - -interface MSCredentialParameters { - type?: string; -} - -interface MSCredentialSpec { - type?: string; - id?: string; -} - -interface MSDelay { - roundTrip?: number; - roundTripMax?: number; -} - -interface MSDescription extends RTCStats { - connectivity?: MSConnectivity; - transport?: string; - networkconnectivity?: MSNetworkConnectivityInfo; - localAddr?: MSIPAddressInfo; - remoteAddr?: MSIPAddressInfo; - deviceDevName?: string; - reflexiveLocalIPAddr?: MSIPAddressInfo; -} - -interface MSFIDOCredentialParameters extends MSCredentialParameters { - algorithm?: string | Algorithm; - authenticators?: AAGUID[]; -} - -interface MSIPAddressInfo { - ipAddr?: string; - port?: number; - manufacturerMacAddrMask?: string; -} - -interface MSIceWarningFlags { - turnTcpTimedOut?: boolean; - turnUdpAllocateFailed?: boolean; - turnUdpSendFailed?: boolean; - turnTcpAllocateFailed?: boolean; - turnTcpSendFailed?: boolean; - udpLocalConnectivityFailed?: boolean; - udpNatConnectivityFailed?: boolean; - udpRelayConnectivityFailed?: boolean; - tcpNatConnectivityFailed?: boolean; - tcpRelayConnectivityFailed?: boolean; - connCheckMessageIntegrityFailed?: boolean; - allocationMessageIntegrityFailed?: boolean; - connCheckOtherError?: boolean; - turnAuthUnknownUsernameError?: boolean; - noRelayServersConfigured?: boolean; - multipleRelayServersAttempted?: boolean; - portRangeExhausted?: boolean; - alternateServerReceived?: boolean; - pseudoTLSFailure?: boolean; - turnTurnTcpConnectivityFailed?: boolean; - useCandidateChecksFailed?: boolean; - fipsAllocationFailure?: boolean; -} - -interface MSJitter { - interArrival?: number; - interArrivalMax?: number; - interArrivalSD?: number; -} - -interface MSLocalClientEventBase extends RTCStats { - networkReceiveQualityEventRatio?: number; - networkBandwidthLowEventRatio?: number; -} - -interface MSNetwork extends RTCStats { - jitter?: MSJitter; - delay?: MSDelay; - packetLoss?: MSPacketLoss; - utilization?: MSUtilization; -} - -interface MSNetworkConnectivityInfo { - vpn?: boolean; - linkspeed?: number; - networkConnectionDetails?: string; -} - -interface MSNetworkInterfaceType { - interfaceTypeEthernet?: boolean; - interfaceTypeWireless?: boolean; - interfaceTypePPP?: boolean; - interfaceTypeTunnel?: boolean; - interfaceTypeWWAN?: boolean; -} - -interface MSOutboundNetwork extends MSNetwork { - appliedBandwidthLimit?: number; -} - -interface MSPacketLoss { - lossRate?: number; - lossRateMax?: number; -} - -interface MSPayloadBase extends RTCStats { - payloadDescription?: string; -} - -interface MSRelayAddress { - relayAddress?: string; - port?: number; -} - -interface MSSignatureParameters { - userPrompt?: string; -} - -interface MSTransportDiagnosticsStats extends RTCStats { - baseAddress?: string; - localAddress?: string; - localSite?: string; - networkName?: string; - remoteAddress?: string; - remoteSite?: string; - localMR?: string; - remoteMR?: string; - iceWarningFlags?: MSIceWarningFlags; - portRangeMin?: number; - portRangeMax?: number; - localMRTCPPort?: number; - remoteMRTCPPort?: number; - stunVer?: number; - numConsentReqSent?: number; - numConsentReqReceived?: number; - numConsentRespSent?: number; - numConsentRespReceived?: number; - interfaces?: MSNetworkInterfaceType; - baseInterface?: MSNetworkInterfaceType; - protocol?: string; - localInterface?: MSNetworkInterfaceType; - localAddrType?: string; - remoteAddrType?: string; - iceRole?: string; - rtpRtcpMux?: boolean; - allocationTimeInMs?: number; - msRtcEngineVersion?: string; -} - -interface MSUtilization { - packets?: number; - bandwidthEstimation?: number; - bandwidthEstimationMin?: number; - bandwidthEstimationMax?: number; - bandwidthEstimationStdDev?: number; - bandwidthEstimationAvg?: number; -} - -interface MSVideoPayload extends MSPayloadBase { - resoluton?: string; - videoBitRateAvg?: number; - videoBitRateMax?: number; - videoFrameRateAvg?: number; - videoPacketLossRate?: number; - durationSeconds?: number; -} - -interface MSVideoRecvPayload extends MSVideoPayload { - videoFrameLossRate?: number; - recvCodecType?: string; - recvResolutionWidth?: number; - recvResolutionHeight?: number; - videoResolutions?: MSVideoResolutionDistribution; - recvFrameRateAverage?: number; - recvBitRateMaximum?: number; - recvBitRateAverage?: number; - recvVideoStreamsMax?: number; - recvVideoStreamsMin?: number; - recvVideoStreamsMode?: number; - videoPostFECPLR?: number; - lowBitRateCallPercent?: number; - lowFrameRateCallPercent?: number; - reorderBufferTotalPackets?: number; - recvReorderBufferReorderedPackets?: number; - recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; - recvReorderBufferMaxSuccessfullyOrderedExtent?: number; - recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; - recvReorderBufferPacketsDroppedDueToTimeout?: number; - recvFpsHarmonicAverage?: number; - recvNumResSwitches?: number; -} - -interface MSVideoResolutionDistribution { - cifQuality?: number; - vgaQuality?: number; - h720Quality?: number; - h1080Quality?: number; - h1440Quality?: number; - h2160Quality?: number; -} - -interface MSVideoSendPayload extends MSVideoPayload { - sendFrameRateAverage?: number; - sendBitRateMaximum?: number; - sendBitRateAverage?: number; - sendVideoStreamsMax?: number; - sendResolutionWidth?: number; - sendResolutionHeight?: number; -} - -interface MediaEncryptedEventInit extends EventInit { - initDataType?: string; - initData?: ArrayBuffer; -} - -interface MediaKeyMessageEventInit extends EventInit { - messageType?: string; - message?: ArrayBuffer; -} - -interface MediaKeySystemConfiguration { - initDataTypes?: string[]; - audioCapabilities?: MediaKeySystemMediaCapability[]; - videoCapabilities?: MediaKeySystemMediaCapability[]; - distinctiveIdentifier?: string; - persistentState?: string; -} - -interface MediaKeySystemMediaCapability { - contentType?: string; - robustness?: string; -} - -interface MediaStreamConstraints { - video?: boolean | MediaTrackConstraints; - audio?: boolean | MediaTrackConstraints; -} - -interface MediaStreamErrorEventInit extends EventInit { - error?: MediaStreamError; -} - -interface MediaStreamTrackEventInit extends EventInit { - track?: MediaStreamTrack; -} - -interface MediaTrackCapabilities { - width?: number | LongRange; - height?: number | LongRange; - aspectRatio?: number | DoubleRange; - frameRate?: number | DoubleRange; - facingMode?: string; - volume?: number | DoubleRange; - sampleRate?: number | LongRange; - sampleSize?: number | LongRange; - echoCancellation?: boolean[]; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackConstraintSet { - width?: number | ConstrainLongRange; - height?: number | ConstrainLongRange; - aspectRatio?: number | ConstrainDoubleRange; - frameRate?: number | ConstrainDoubleRange; - facingMode?: string | string[] | ConstrainDOMStringParameters; - volume?: number | ConstrainDoubleRange; - sampleRate?: number | ConstrainLongRange; - sampleSize?: number | ConstrainLongRange; - echoCancelation?: boolean | ConstrainBooleanParameters; - deviceId?: string | string[] | ConstrainDOMStringParameters; - groupId?: string | string[] | ConstrainDOMStringParameters; -} - -interface MediaTrackConstraints extends MediaTrackConstraintSet { - advanced?: MediaTrackConstraintSet[]; -} - -interface MediaTrackSettings { - width?: number; - height?: number; - aspectRatio?: number; - frameRate?: number; - facingMode?: string; - volume?: number; - sampleRate?: number; - sampleSize?: number; - echoCancellation?: boolean; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackSupportedConstraints { - width?: boolean; - height?: boolean; - aspectRatio?: boolean; - frameRate?: boolean; - facingMode?: boolean; - volume?: boolean; - sampleRate?: boolean; - sampleSize?: boolean; - echoCancellation?: boolean; - deviceId?: boolean; - groupId?: boolean; -} - -interface MouseEventInit extends EventModifierInit { - screenX?: number; - screenY?: number; - clientX?: number; - clientY?: number; - button?: number; - buttons?: number; - relatedTarget?: EventTarget; -} - -interface MsZoomToOptions { - contentX?: number; - contentY?: number; - viewportX?: string; - viewportY?: string; - scaleFactor?: number; - animate?: string; -} - -interface MutationObserverInit { - childList?: boolean; - attributes?: boolean; - characterData?: boolean; - subtree?: boolean; - attributeOldValue?: boolean; - characterDataOldValue?: boolean; - attributeFilter?: string[]; -} - -interface ObjectURLOptions { - oneTimeOnly?: boolean; -} - -interface PeriodicWaveConstraints { - disableNormalization?: boolean; -} - -interface PointerEventInit extends MouseEventInit { - pointerId?: number; - width?: number; - height?: number; - pressure?: number; - tiltX?: number; - tiltY?: number; - pointerType?: string; - isPrimary?: boolean; -} - -interface PositionOptions { - enableHighAccuracy?: boolean; - timeout?: number; - maximumAge?: number; -} - -interface RTCDTMFToneChangeEventInit extends EventInit { - tone?: string; -} - -interface RTCDtlsFingerprint { - algorithm?: string; - value?: string; -} - -interface RTCDtlsParameters { - role?: string; - fingerprints?: RTCDtlsFingerprint[]; -} - -interface RTCIceCandidate { - foundation?: string; - priority?: number; - ip?: string; - protocol?: string; - port?: number; - type?: string; - tcpType?: string; - relatedAddress?: string; - relatedPort?: number; -} - -interface RTCIceCandidateAttributes extends RTCStats { - ipAddress?: string; - portNumber?: number; - transport?: string; - candidateType?: string; - priority?: number; - addressSourceUrl?: string; -} - -interface RTCIceCandidateComplete { -} - -interface RTCIceCandidatePair { - local?: RTCIceCandidate; - remote?: RTCIceCandidate; -} - -interface RTCIceCandidatePairStats extends RTCStats { - transportId?: string; - localCandidateId?: string; - remoteCandidateId?: string; - state?: string; - priority?: number; - nominated?: boolean; - writable?: boolean; - readable?: boolean; - bytesSent?: number; - bytesReceived?: number; - roundTripTime?: number; - availableOutgoingBitrate?: number; - availableIncomingBitrate?: number; -} - -interface RTCIceGatherOptions { - gatherPolicy?: string; - iceservers?: RTCIceServer[]; -} - -interface RTCIceParameters { - usernameFragment?: string; - password?: string; -} - -interface RTCIceServer { - urls?: any; - username?: string; - credential?: string; -} - -interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { - packetsReceived?: number; - bytesReceived?: number; - packetsLost?: number; - jitter?: number; - fractionLost?: number; -} - -interface RTCMediaStreamTrackStats extends RTCStats { - trackIdentifier?: string; - remoteSource?: boolean; - ssrcIds?: string[]; - frameWidth?: number; - frameHeight?: number; - framesPerSecond?: number; - framesSent?: number; - framesReceived?: number; - framesDecoded?: number; - framesDropped?: number; - framesCorrupted?: number; - audioLevel?: number; - echoReturnLoss?: number; - echoReturnLossEnhancement?: number; -} - -interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { - packetsSent?: number; - bytesSent?: number; - targetBitrate?: number; - roundTripTime?: number; -} - -interface RTCRTPStreamStats extends RTCStats { - ssrc?: string; - associateStatsId?: string; - isRemote?: boolean; - mediaTrackId?: string; - transportId?: string; - codecId?: string; - firCount?: number; - pliCount?: number; - nackCount?: number; - sliCount?: number; -} - -interface RTCRtcpFeedback { - type?: string; - parameter?: string; -} - -interface RTCRtcpParameters { - ssrc?: number; - cname?: string; - reducedSize?: boolean; - mux?: boolean; -} - -interface RTCRtpCapabilities { - codecs?: RTCRtpCodecCapability[]; - headerExtensions?: RTCRtpHeaderExtension[]; - fecMechanisms?: string[]; -} - -interface RTCRtpCodecCapability { - name?: string; - kind?: string; - clockRate?: number; - preferredPayloadType?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; - options?: any; - maxTemporalLayers?: number; - maxSpatialLayers?: number; - svcMultiStreamSupport?: boolean; -} - -interface RTCRtpCodecParameters { - name?: string; - payloadType?: any; - clockRate?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; -} - -interface RTCRtpContributingSource { - timestamp?: number; - csrc?: number; - audioLevel?: number; -} - -interface RTCRtpEncodingParameters { - ssrc?: number; - codecPayloadType?: number; - fec?: RTCRtpFecParameters; - rtx?: RTCRtpRtxParameters; - priority?: number; - maxBitrate?: number; - minQuality?: number; - framerateBias?: number; - resolutionScale?: number; - framerateScale?: number; - active?: boolean; - encodingId?: string; - dependencyEncodingIds?: string[]; - ssrcRange?: RTCSsrcRange; -} - -interface RTCRtpFecParameters { - ssrc?: number; - mechanism?: string; -} - -interface RTCRtpHeaderExtension { - kind?: string; - uri?: string; - preferredId?: number; - preferredEncrypt?: boolean; -} - -interface RTCRtpHeaderExtensionParameters { - uri?: string; - id?: number; - encrypt?: boolean; -} - -interface RTCRtpParameters { - muxId?: string; - codecs?: RTCRtpCodecParameters[]; - headerExtensions?: RTCRtpHeaderExtensionParameters[]; - encodings?: RTCRtpEncodingParameters[]; - rtcp?: RTCRtcpParameters; -} - -interface RTCRtpRtxParameters { - ssrc?: number; -} - -interface RTCRtpUnhandled { - ssrc?: number; - payloadType?: number; - muxId?: string; -} - -interface RTCSrtpKeyParam { - keyMethod?: string; - keySalt?: string; - lifetime?: string; - mkiValue?: number; - mkiLength?: number; -} - -interface RTCSrtpSdesParameters { - tag?: number; - cryptoSuite?: string; - keyParams?: RTCSrtpKeyParam[]; - sessionParams?: string[]; -} - -interface RTCSsrcRange { - min?: number; - max?: number; -} - -interface RTCStats { - timestamp?: number; - type?: string; - id?: string; - msType?: string; -} - -interface RTCStatsReport { -} - -interface RTCTransportStats extends RTCStats { - bytesSent?: number; - bytesReceived?: number; - rtcpTransportStatsId?: string; - activeConnection?: boolean; - selectedCandidatePairId?: string; - localCertificateId?: string; - remoteCertificateId?: string; -} - -interface StoreExceptionsInformation extends ExceptionInformation { - siteName?: string; - explanationString?: string; - detailURI?: string; -} - -interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { - arrayOfDomainStrings?: string[]; -} - -interface UIEventInit extends EventInit { - view?: Window; - detail?: number; -} - -interface WebGLContextAttributes { - failIfMajorPerformanceCaveat?: boolean; - alpha?: boolean; - depth?: boolean; - stencil?: boolean; - antialias?: boolean; - premultipliedAlpha?: boolean; - preserveDrawingBuffer?: boolean; -} - -interface WebGLContextEventInit extends EventInit { - statusMessage?: string; -} - -interface WheelEventInit extends MouseEventInit { - deltaX?: number; - deltaY?: number; - deltaZ?: number; - deltaMode?: number; -} - -interface EventListener { - (evt: Event): void; -} - -interface ANGLE_instanced_arrays { - drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; - drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; - vertexAttribDivisorANGLE(index: number, divisor: number): void; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -declare var ANGLE_instanced_arrays: { - prototype: ANGLE_instanced_arrays; - new(): ANGLE_instanced_arrays; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -interface AnalyserNode extends AudioNode { - fftSize: number; - readonly frequencyBinCount: number; - maxDecibels: number; - minDecibels: number; - smoothingTimeConstant: number; - getByteFrequencyData(array: Uint8Array): void; - getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: Float32Array): void; - getFloatTimeDomainData(array: Float32Array): void; -} - -declare var AnalyserNode: { - prototype: AnalyserNode; - new(): AnalyserNode; -} - -interface AnimationEvent extends Event { - readonly animationName: string; - readonly elapsedTime: number; - initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; -} - -declare var AnimationEvent: { - prototype: AnimationEvent; - new(): AnimationEvent; -} - -interface ApplicationCache extends EventTarget { - oncached: (this: this, ev: Event) => any; - onchecking: (this: this, ev: Event) => any; - ondownloading: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onnoupdate: (this: this, ev: Event) => any; - onobsolete: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onupdateready: (this: this, ev: Event) => any; - readonly status: number; - abort(): void; - swapCache(): void; - update(): void; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; - addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ApplicationCache: { - prototype: ApplicationCache; - new(): ApplicationCache; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; -} - -interface AriaRequestEvent extends Event { - readonly attributeName: string; - attributeValue: string | null; -} - -declare var AriaRequestEvent: { - prototype: AriaRequestEvent; - new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; -} - -interface Attr extends Node { - readonly name: string; - readonly ownerElement: Element; - readonly prefix: string | null; - readonly specified: boolean; - value: string; -} - -declare var Attr: { - prototype: Attr; - new(): Attr; -} - -interface AudioBuffer { - readonly duration: number; - readonly length: number; - readonly numberOfChannels: number; - readonly sampleRate: number; - copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; - copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(): AudioBuffer; -} - -interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer | null; - readonly detune: AudioParam; - loop: boolean; - loopEnd: number; - loopStart: number; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - readonly playbackRate: AudioParam; - start(when?: number, offset?: number, duration?: number): void; - stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var AudioBufferSourceNode: { - prototype: AudioBufferSourceNode; - new(): AudioBufferSourceNode; -} - -interface AudioContext extends EventTarget { - readonly currentTime: number; - readonly destination: AudioDestinationNode; - readonly listener: AudioListener; - readonly sampleRate: number; - state: string; - createAnalyser(): AnalyserNode; - createBiquadFilter(): BiquadFilterNode; - createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; - createBufferSource(): AudioBufferSourceNode; - createChannelMerger(numberOfInputs?: number): ChannelMergerNode; - createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; - createConvolver(): ConvolverNode; - createDelay(maxDelayTime?: number): DelayNode; - createDynamicsCompressor(): DynamicsCompressorNode; - createGain(): GainNode; - createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; - createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; - createOscillator(): OscillatorNode; - createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; - createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; - createStereoPanner(): StereoPannerNode; - createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; -} - -declare var AudioContext: { - prototype: AudioContext; - new(): AudioContext; -} - -interface AudioDestinationNode extends AudioNode { - readonly maxChannelCount: number; -} - -declare var AudioDestinationNode: { - prototype: AudioDestinationNode; - new(): AudioDestinationNode; -} - -interface AudioListener { - dopplerFactor: number; - speedOfSound: number; - setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var AudioListener: { - prototype: AudioListener; - new(): AudioListener; -} - -interface AudioNode extends EventTarget { - channelCount: number; - channelCountMode: string; - channelInterpretation: string; - readonly context: AudioContext; - readonly numberOfInputs: number; - readonly numberOfOutputs: number; - connect(destination: AudioNode, output?: number, input?: number): void; - disconnect(output?: number): void; - disconnect(destination: AudioNode, output?: number, input?: number): void; - disconnect(destination: AudioParam, output?: number): void; -} - -declare var AudioNode: { - prototype: AudioNode; - new(): AudioNode; -} - -interface AudioParam { - readonly defaultValue: number; - value: number; - cancelScheduledValues(startTime: number): void; - exponentialRampToValueAtTime(value: number, endTime: number): void; - linearRampToValueAtTime(value: number, endTime: number): void; - setTargetAtTime(target: number, startTime: number, timeConstant: number): void; - setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; -} - -declare var AudioParam: { - prototype: AudioParam; - new(): AudioParam; -} - -interface AudioProcessingEvent extends Event { - readonly inputBuffer: AudioBuffer; - readonly outputBuffer: AudioBuffer; - readonly playbackTime: number; -} - -declare var AudioProcessingEvent: { - prototype: AudioProcessingEvent; - new(): AudioProcessingEvent; -} - -interface AudioTrack { - enabled: boolean; - readonly id: string; - kind: string; - readonly label: string; - language: string; - readonly sourceBuffer: SourceBuffer; -} - -declare var AudioTrack: { - prototype: AudioTrack; - new(): AudioTrack; -} - -interface AudioTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack | null; - item(index: number): AudioTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: AudioTrack; -} - -declare var AudioTrackList: { - prototype: AudioTrackList; - new(): AudioTrackList; -} - -interface BarProp { - readonly visible: boolean; -} - -declare var BarProp: { - prototype: BarProp; - new(): BarProp; -} - -interface BeforeUnloadEvent extends Event { - returnValue: any; -} - -declare var BeforeUnloadEvent: { - prototype: BeforeUnloadEvent; - new(): BeforeUnloadEvent; -} - -interface BiquadFilterNode extends AudioNode { - readonly Q: AudioParam; - readonly detune: AudioParam; - readonly frequency: AudioParam; - readonly gain: AudioParam; - type: string; - getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; -} - -declare var BiquadFilterNode: { - prototype: BiquadFilterNode; - new(): BiquadFilterNode; -} - -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface CDATASection extends Text { -} - -declare var CDATASection: { - prototype: CDATASection; - new(): CDATASection; -} - -interface CSS { - supports(property: string, value?: string): boolean; -} -declare var CSS: CSS; - -interface CSSConditionRule extends CSSGroupingRule { - conditionText: string; -} - -declare var CSSConditionRule: { - prototype: CSSConditionRule; - new(): CSSConditionRule; -} - -interface CSSFontFaceRule extends CSSRule { - readonly style: CSSStyleDeclaration; -} - -declare var CSSFontFaceRule: { - prototype: CSSFontFaceRule; - new(): CSSFontFaceRule; -} - -interface CSSGroupingRule extends CSSRule { - readonly cssRules: CSSRuleList; - deleteRule(index: number): void; - insertRule(rule: string, index: number): number; -} - -declare var CSSGroupingRule: { - prototype: CSSGroupingRule; - new(): CSSGroupingRule; -} - -interface CSSImportRule extends CSSRule { - readonly href: string; - readonly media: MediaList; - readonly styleSheet: CSSStyleSheet; -} - -declare var CSSImportRule: { - prototype: CSSImportRule; - new(): CSSImportRule; -} - -interface CSSKeyframeRule extends CSSRule { - keyText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSKeyframeRule: { - prototype: CSSKeyframeRule; - new(): CSSKeyframeRule; -} - -interface CSSKeyframesRule extends CSSRule { - readonly cssRules: CSSRuleList; - name: string; - appendRule(rule: string): void; - deleteRule(rule: string): void; - findRule(rule: string): CSSKeyframeRule; -} - -declare var CSSKeyframesRule: { - prototype: CSSKeyframesRule; - new(): CSSKeyframesRule; -} - -interface CSSMediaRule extends CSSConditionRule { - readonly media: MediaList; -} - -declare var CSSMediaRule: { - prototype: CSSMediaRule; - new(): CSSMediaRule; -} - -interface CSSNamespaceRule extends CSSRule { - readonly namespaceURI: string; - readonly prefix: string; -} - -declare var CSSNamespaceRule: { - prototype: CSSNamespaceRule; - new(): CSSNamespaceRule; -} - -interface CSSPageRule extends CSSRule { - readonly pseudoClass: string; - readonly selector: string; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSPageRule: { - prototype: CSSPageRule; - new(): CSSPageRule; -} - -interface CSSRule { - cssText: string; - readonly parentRule: CSSRule; - readonly parentStyleSheet: CSSStyleSheet; - readonly type: number; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -declare var CSSRule: { - prototype: CSSRule; - new(): CSSRule; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -interface CSSRuleList { - readonly length: number; - item(index: number): CSSRule; - [index: number]: CSSRule; -} - -declare var CSSRuleList: { - prototype: CSSRuleList; - new(): CSSRuleList; -} - -interface CSSStyleDeclaration { - alignContent: string | null; - alignItems: string | null; - alignSelf: string | null; - alignmentBaseline: string | null; - animation: string | null; - animationDelay: string | null; - animationDirection: string | null; - animationDuration: string | null; - animationFillMode: string | null; - animationIterationCount: string | null; - animationName: string | null; - animationPlayState: string | null; - animationTimingFunction: string | null; - backfaceVisibility: string | null; - background: string | null; - backgroundAttachment: string | null; - backgroundClip: string | null; - backgroundColor: string | null; - backgroundImage: string | null; - backgroundOrigin: string | null; - backgroundPosition: string | null; - backgroundPositionX: string | null; - backgroundPositionY: string | null; - backgroundRepeat: string | null; - backgroundSize: string | null; - baselineShift: string | null; - border: string | null; - borderBottom: string | null; - borderBottomColor: string | null; - borderBottomLeftRadius: string | null; - borderBottomRightRadius: string | null; - borderBottomStyle: string | null; - borderBottomWidth: string | null; - borderCollapse: string | null; - borderColor: string | null; - borderImage: string | null; - borderImageOutset: string | null; - borderImageRepeat: string | null; - borderImageSlice: string | null; - borderImageSource: string | null; - borderImageWidth: string | null; - borderLeft: string | null; - borderLeftColor: string | null; - borderLeftStyle: string | null; - borderLeftWidth: string | null; - borderRadius: string | null; - borderRight: string | null; - borderRightColor: string | null; - borderRightStyle: string | null; - borderRightWidth: string | null; - borderSpacing: string | null; - borderStyle: string | null; - borderTop: string | null; - borderTopColor: string | null; - borderTopLeftRadius: string | null; - borderTopRightRadius: string | null; - borderTopStyle: string | null; - borderTopWidth: string | null; - borderWidth: string | null; - bottom: string | null; - boxShadow: string | null; - boxSizing: string | null; - breakAfter: string | null; - breakBefore: string | null; - breakInside: string | null; - captionSide: string | null; - clear: string | null; - clip: string | null; - clipPath: string | null; - clipRule: string | null; - color: string | null; - colorInterpolationFilters: string | null; - columnCount: any; - columnFill: string | null; - columnGap: any; - columnRule: string | null; - columnRuleColor: any; - columnRuleStyle: string | null; - columnRuleWidth: any; - columnSpan: string | null; - columnWidth: any; - columns: string | null; - content: string | null; - counterIncrement: string | null; - counterReset: string | null; - cssFloat: string | null; - cssText: string; - cursor: string | null; - direction: string | null; - display: string | null; - dominantBaseline: string | null; - emptyCells: string | null; - enableBackground: string | null; - fill: string | null; - fillOpacity: string | null; - fillRule: string | null; - filter: string | null; - flex: string | null; - flexBasis: string | null; - flexDirection: string | null; - flexFlow: string | null; - flexGrow: string | null; - flexShrink: string | null; - flexWrap: string | null; - floodColor: string | null; - floodOpacity: string | null; - font: string | null; - fontFamily: string | null; - fontFeatureSettings: string | null; - fontSize: string | null; - fontSizeAdjust: string | null; - fontStretch: string | null; - fontStyle: string | null; - fontVariant: string | null; - fontWeight: string | null; - glyphOrientationHorizontal: string | null; - glyphOrientationVertical: string | null; - height: string | null; - imeMode: string | null; - justifyContent: string | null; - kerning: string | null; - left: string | null; - readonly length: number; - letterSpacing: string | null; - lightingColor: string | null; - lineHeight: string | null; - listStyle: string | null; - listStyleImage: string | null; - listStylePosition: string | null; - listStyleType: string | null; - margin: string | null; - marginBottom: string | null; - marginLeft: string | null; - marginRight: string | null; - marginTop: string | null; - marker: string | null; - markerEnd: string | null; - markerMid: string | null; - markerStart: string | null; - mask: string | null; - maxHeight: string | null; - maxWidth: string | null; - minHeight: string | null; - minWidth: string | null; - msContentZoomChaining: string | null; - msContentZoomLimit: string | null; - msContentZoomLimitMax: any; - msContentZoomLimitMin: any; - msContentZoomSnap: string | null; - msContentZoomSnapPoints: string | null; - msContentZoomSnapType: string | null; - msContentZooming: string | null; - msFlowFrom: string | null; - msFlowInto: string | null; - msFontFeatureSettings: string | null; - msGridColumn: any; - msGridColumnAlign: string | null; - msGridColumnSpan: any; - msGridColumns: string | null; - msGridRow: any; - msGridRowAlign: string | null; - msGridRowSpan: any; - msGridRows: string | null; - msHighContrastAdjust: string | null; - msHyphenateLimitChars: string | null; - msHyphenateLimitLines: any; - msHyphenateLimitZone: any; - msHyphens: string | null; - msImeAlign: string | null; - msOverflowStyle: string | null; - msScrollChaining: string | null; - msScrollLimit: string | null; - msScrollLimitXMax: any; - msScrollLimitXMin: any; - msScrollLimitYMax: any; - msScrollLimitYMin: any; - msScrollRails: string | null; - msScrollSnapPointsX: string | null; - msScrollSnapPointsY: string | null; - msScrollSnapType: string | null; - msScrollSnapX: string | null; - msScrollSnapY: string | null; - msScrollTranslation: string | null; - msTextCombineHorizontal: string | null; - msTextSizeAdjust: any; - msTouchAction: string | null; - msTouchSelect: string | null; - msUserSelect: string | null; - msWrapFlow: string; - msWrapMargin: any; - msWrapThrough: string; - opacity: string | null; - order: string | null; - orphans: string | null; - outline: string | null; - outlineColor: string | null; - outlineStyle: string | null; - outlineWidth: string | null; - overflow: string | null; - overflowX: string | null; - overflowY: string | null; - padding: string | null; - paddingBottom: string | null; - paddingLeft: string | null; - paddingRight: string | null; - paddingTop: string | null; - pageBreakAfter: string | null; - pageBreakBefore: string | null; - pageBreakInside: string | null; - readonly parentRule: CSSRule; - perspective: string | null; - perspectiveOrigin: string | null; - pointerEvents: string | null; - position: string | null; - quotes: string | null; - right: string | null; - rubyAlign: string | null; - rubyOverhang: string | null; - rubyPosition: string | null; - stopColor: string | null; - stopOpacity: string | null; - stroke: string | null; - strokeDasharray: string | null; - strokeDashoffset: string | null; - strokeLinecap: string | null; - strokeLinejoin: string | null; - strokeMiterlimit: string | null; - strokeOpacity: string | null; - strokeWidth: string | null; - tableLayout: string | null; - textAlign: string | null; - textAlignLast: string | null; - textAnchor: string | null; - textDecoration: string | null; - textIndent: string | null; - textJustify: string | null; - textKashida: string | null; - textKashidaSpace: string | null; - textOverflow: string | null; - textShadow: string | null; - textTransform: string | null; - textUnderlinePosition: string | null; - top: string | null; - touchAction: string | null; - transform: string | null; - transformOrigin: string | null; - transformStyle: string | null; - transition: string | null; - transitionDelay: string | null; - transitionDuration: string | null; - transitionProperty: string | null; - transitionTimingFunction: string | null; - unicodeBidi: string | null; - verticalAlign: string | null; - visibility: string | null; - webkitAlignContent: string | null; - webkitAlignItems: string | null; - webkitAlignSelf: string | null; - webkitAnimation: string | null; - webkitAnimationDelay: string | null; - webkitAnimationDirection: string | null; - webkitAnimationDuration: string | null; - webkitAnimationFillMode: string | null; - webkitAnimationIterationCount: string | null; - webkitAnimationName: string | null; - webkitAnimationPlayState: string | null; - webkitAnimationTimingFunction: string | null; - webkitAppearance: string | null; - webkitBackfaceVisibility: string | null; - webkitBackgroundClip: string | null; - webkitBackgroundOrigin: string | null; - webkitBackgroundSize: string | null; - webkitBorderBottomLeftRadius: string | null; - webkitBorderBottomRightRadius: string | null; - webkitBorderImage: string | null; - webkitBorderRadius: string | null; - webkitBorderTopLeftRadius: string | null; - webkitBorderTopRightRadius: string | null; - webkitBoxAlign: string | null; - webkitBoxDirection: string | null; - webkitBoxFlex: string | null; - webkitBoxOrdinalGroup: string | null; - webkitBoxOrient: string | null; - webkitBoxPack: string | null; - webkitBoxSizing: string | null; - webkitColumnBreakAfter: string | null; - webkitColumnBreakBefore: string | null; - webkitColumnBreakInside: string | null; - webkitColumnCount: any; - webkitColumnGap: any; - webkitColumnRule: string | null; - webkitColumnRuleColor: any; - webkitColumnRuleStyle: string | null; - webkitColumnRuleWidth: any; - webkitColumnSpan: string | null; - webkitColumnWidth: any; - webkitColumns: string | null; - webkitFilter: string | null; - webkitFlex: string | null; - webkitFlexBasis: string | null; - webkitFlexDirection: string | null; - webkitFlexFlow: string | null; - webkitFlexGrow: string | null; - webkitFlexShrink: string | null; - webkitFlexWrap: string | null; - webkitJustifyContent: string | null; - webkitOrder: string | null; - webkitPerspective: string | null; - webkitPerspectiveOrigin: string | null; - webkitTapHighlightColor: string | null; - webkitTextFillColor: string | null; - webkitTextSizeAdjust: any; - webkitTransform: string | null; - webkitTransformOrigin: string | null; - webkitTransformStyle: string | null; - webkitTransition: string | null; - webkitTransitionDelay: string | null; - webkitTransitionDuration: string | null; - webkitTransitionProperty: string | null; - webkitTransitionTimingFunction: string | null; - webkitUserModify: string | null; - webkitUserSelect: string | null; - webkitWritingMode: string | null; - whiteSpace: string | null; - widows: string | null; - width: string | null; - wordBreak: string | null; - wordSpacing: string | null; - wordWrap: string | null; - writingMode: string | null; - zIndex: string | null; - zoom: string | null; - resize: string | null; - getPropertyPriority(propertyName: string): string; - getPropertyValue(propertyName: string): string; - item(index: number): string; - removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string | null, priority?: string): void; - [index: number]: string; -} - -declare var CSSStyleDeclaration: { - prototype: CSSStyleDeclaration; - new(): CSSStyleDeclaration; -} - -interface CSSStyleRule extends CSSRule { - readonly readOnly: boolean; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSStyleRule: { - prototype: CSSStyleRule; - new(): CSSStyleRule; -} - -interface CSSStyleSheet extends StyleSheet { - readonly cssRules: CSSRuleList; - cssText: string; - readonly href: string; - readonly id: string; - readonly imports: StyleSheetList; - readonly isAlternate: boolean; - readonly isPrefAlternate: boolean; - readonly ownerRule: CSSRule; - readonly owningElement: Element; - readonly pages: StyleSheetPageList; - readonly readOnly: boolean; - readonly rules: CSSRuleList; - addImport(bstrURL: string, lIndex?: number): number; - addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; - addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; - removeImport(lIndex: number): void; - removeRule(lIndex: number): void; -} - -declare var CSSStyleSheet: { - prototype: CSSStyleSheet; - new(): CSSStyleSheet; -} - -interface CSSSupportsRule extends CSSConditionRule { -} - -declare var CSSSupportsRule: { - prototype: CSSSupportsRule; - new(): CSSSupportsRule; -} - -interface CanvasGradient { - addColorStop(offset: number, color: string): void; -} - -declare var CanvasGradient: { - prototype: CanvasGradient; - new(): CanvasGradient; -} - -interface CanvasPattern { - setTransform(matrix: SVGMatrix): void; -} - -declare var CanvasPattern: { - prototype: CanvasPattern; - new(): CanvasPattern; -} - -interface CanvasRenderingContext2D extends Object, CanvasPathMethods { - readonly canvas: HTMLCanvasElement; - fillStyle: string | CanvasGradient | CanvasPattern; - font: string; - globalAlpha: number; - globalCompositeOperation: string; - lineCap: string; - lineDashOffset: number; - lineJoin: string; - lineWidth: number; - miterLimit: number; - msFillRule: string; - msImageSmoothingEnabled: boolean; - shadowBlur: number; - shadowColor: string; - shadowOffsetX: number; - shadowOffsetY: number; - strokeStyle: string | CanvasGradient | CanvasPattern; - textAlign: string; - textBaseline: string; - mozImageSmoothingEnabled: boolean; - webkitImageSmoothingEnabled: boolean; - oImageSmoothingEnabled: boolean; - beginPath(): void; - clearRect(x: number, y: number, w: number, h: number): void; - clip(fillRule?: string): void; - createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; - createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; - createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; - drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; - fill(fillRule?: string): void; - fillRect(x: number, y: number, w: number, h: number): void; - fillText(text: string, x: number, y: number, maxWidth?: number): void; - getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; - getLineDash(): number[]; - isPointInPath(x: number, y: number, fillRule?: string): boolean; - measureText(text: string): TextMetrics; - putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - restore(): void; - rotate(angle: number): void; - save(): void; - scale(x: number, y: number): void; - setLineDash(segments: number[]): void; - setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - stroke(): void; - strokeRect(x: number, y: number, w: number, h: number): void; - strokeText(text: string, x: number, y: number, maxWidth?: number): void; - transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - translate(x: number, y: number): void; -} - -declare var CanvasRenderingContext2D: { - prototype: CanvasRenderingContext2D; - new(): CanvasRenderingContext2D; -} - -interface ChannelMergerNode extends AudioNode { -} - -declare var ChannelMergerNode: { - prototype: ChannelMergerNode; - new(): ChannelMergerNode; -} - -interface ChannelSplitterNode extends AudioNode { -} - -declare var ChannelSplitterNode: { - prototype: ChannelSplitterNode; - new(): ChannelSplitterNode; -} - -interface CharacterData extends Node, ChildNode { - data: string; - readonly length: number; - appendData(arg: string): void; - deleteData(offset: number, count: number): void; - insertData(offset: number, arg: string): void; - replaceData(offset: number, count: number, arg: string): void; - substringData(offset: number, count: number): string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var CharacterData: { - prototype: CharacterData; - new(): CharacterData; -} - -interface ClientRect { - bottom: number; - readonly height: number; - left: number; - right: number; - top: number; - readonly width: number; -} - -declare var ClientRect: { - prototype: ClientRect; - new(): ClientRect; -} - -interface ClientRectList { - readonly length: number; - item(index: number): ClientRect; - [index: number]: ClientRect; -} - -declare var ClientRectList: { - prototype: ClientRectList; - new(): ClientRectList; -} - -interface ClipboardEvent extends Event { - readonly clipboardData: DataTransfer; -} - -declare var ClipboardEvent: { - prototype: ClipboardEvent; - new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; -} - -interface CloseEvent extends Event { - readonly code: number; - readonly reason: string; - readonly wasClean: boolean; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(): CloseEvent; -} - -interface CommandEvent extends Event { - readonly commandName: string; - readonly detail: string | null; -} - -declare var CommandEvent: { - prototype: CommandEvent; - new(type: string, eventInitDict?: CommandEventInit): CommandEvent; -} - -interface Comment extends CharacterData { - text: string; -} - -declare var Comment: { - prototype: Comment; - new(): Comment; -} - -interface CompositionEvent extends UIEvent { - readonly data: string; - readonly locale: string; - initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; -} - -declare var CompositionEvent: { - prototype: CompositionEvent; - new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; -} - -interface Console { - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - clear(): void; - count(countTitle?: string): void; - debug(message?: string, ...optionalParams: any[]): void; - dir(value?: any, ...optionalParams: any[]): void; - dirxml(value: any): void; - error(message?: any, ...optionalParams: any[]): void; - exception(message?: string, ...optionalParams: any[]): void; - group(groupTitle?: string): void; - groupCollapsed(groupTitle?: string): void; - groupEnd(): void; - info(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: Element): boolean; - profile(reportName?: string): void; - profileEnd(): void; - select(element: Element): void; - table(...data: any[]): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(message?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; -} - -declare var Console: { - prototype: Console; - new(): Console; -} - -interface ConvolverNode extends AudioNode { - buffer: AudioBuffer | null; - normalize: boolean; -} - -declare var ConvolverNode: { - prototype: ConvolverNode; - new(): ConvolverNode; -} - -interface Coordinates { - readonly accuracy: number; - readonly altitude: number | null; - readonly altitudeAccuracy: number | null; - readonly heading: number | null; - readonly latitude: number; - readonly longitude: number; - readonly speed: number | null; -} - -declare var Coordinates: { - prototype: Coordinates; - new(): Coordinates; -} - -interface Crypto extends Object, RandomSource { - readonly subtle: SubtleCrypto; -} - -declare var Crypto: { - prototype: Crypto; - new(): Crypto; -} - -interface CryptoKey { - readonly algorithm: KeyAlgorithm; - readonly extractable: boolean; - readonly type: string; - readonly usages: string[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -} - -interface CryptoKeyPair { - privateKey: CryptoKey; - publicKey: CryptoKey; -} - -declare var CryptoKeyPair: { - prototype: CryptoKeyPair; - new(): CryptoKeyPair; -} - -interface CustomEvent extends Event { - readonly detail: any; - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; -} - -declare var CustomEvent: { - prototype: CustomEvent; - new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; -} - -interface DOMError { - readonly name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -} - -interface DOMException { - readonly code: number; - readonly message: string; - readonly name: string; - toString(): string; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(): DOMException; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -interface DOMImplementation { - createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; - createHTMLDocument(title: string): Document; - hasFeature(feature: string | null, version: string | null): boolean; -} - -declare var DOMImplementation: { - prototype: DOMImplementation; - new(): DOMImplementation; -} - -interface DOMParser { - parseFromString(source: string, mimeType: string): Document; -} - -declare var DOMParser: { - prototype: DOMParser; - new(): DOMParser; -} - -interface DOMSettableTokenList extends DOMTokenList { - value: string; -} - -declare var DOMSettableTokenList: { - prototype: DOMSettableTokenList; - new(): DOMSettableTokenList; -} - -interface DOMStringList { - readonly length: number; - contains(str: string): boolean; - item(index: number): string | null; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -} - -interface DOMStringMap { - [name: string]: string; -} - -declare var DOMStringMap: { - prototype: DOMStringMap; - new(): DOMStringMap; -} - -interface DOMTokenList { - readonly length: number; - add(...token: string[]): void; - contains(token: string): boolean; - item(index: number): string; - remove(...token: string[]): void; - toString(): string; - toggle(token: string, force?: boolean): boolean; - [index: number]: string; -} - -declare var DOMTokenList: { - prototype: DOMTokenList; - new(): DOMTokenList; -} - -interface DataCue extends TextTrackCue { - data: ArrayBuffer; -} - -declare var DataCue: { - prototype: DataCue; - new(): DataCue; -} - -interface DataTransfer { - dropEffect: string; - effectAllowed: string; - readonly files: FileList; - readonly items: DataTransferItemList; - readonly types: string[]; - clearData(format?: string): boolean; - getData(format: string): string; - setData(format: string, data: string): boolean; -} - -declare var DataTransfer: { - prototype: DataTransfer; - new(): DataTransfer; -} - -interface DataTransferItem { - readonly kind: string; - readonly type: string; - getAsFile(): File | null; - getAsString(_callback: FunctionStringCallback | null): void; -} - -declare var DataTransferItem: { - prototype: DataTransferItem; - new(): DataTransferItem; -} - -interface DataTransferItemList { - readonly length: number; - add(data: File): DataTransferItem | null; - clear(): void; - item(index: number): DataTransferItem; - remove(index: number): void; - [index: number]: DataTransferItem; -} - -declare var DataTransferItemList: { - prototype: DataTransferItemList; - new(): DataTransferItemList; -} - -interface DeferredPermissionRequest { - readonly id: number; - readonly type: string; - readonly uri: string; - allow(): void; - deny(): void; -} - -declare var DeferredPermissionRequest: { - prototype: DeferredPermissionRequest; - new(): DeferredPermissionRequest; -} - -interface DelayNode extends AudioNode { - readonly delayTime: AudioParam; -} - -declare var DelayNode: { - prototype: DelayNode; - new(): DelayNode; -} - -interface DeviceAcceleration { - readonly x: number | null; - readonly y: number | null; - readonly z: number | null; -} - -declare var DeviceAcceleration: { - prototype: DeviceAcceleration; - new(): DeviceAcceleration; -} - -interface DeviceLightEvent extends Event { - readonly value: number; -} - -declare var DeviceLightEvent: { - prototype: DeviceLightEvent; - new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; -} - -interface DeviceMotionEvent extends Event { - readonly acceleration: DeviceAcceleration | null; - readonly accelerationIncludingGravity: DeviceAcceleration | null; - readonly interval: number | null; - readonly rotationRate: DeviceRotationRate | null; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; -} - -declare var DeviceMotionEvent: { - prototype: DeviceMotionEvent; - new(): DeviceMotionEvent; -} - -interface DeviceOrientationEvent extends Event { - readonly absolute: boolean; - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; -} - -declare var DeviceOrientationEvent: { - prototype: DeviceOrientationEvent; - new(): DeviceOrientationEvent; -} - -interface DeviceRotationRate { - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; -} - -declare var DeviceRotationRate: { - prototype: DeviceRotationRate; - new(): DeviceRotationRate; -} - -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode { - /** - * Sets or gets the URL for the current document. - */ - readonly URL: string; - /** - * Gets the URL for the document, stripped of any character encoding. - */ - readonly URLUnencoded: string; - /** - * Gets the object that has the focus when the parent document has focus. - */ - readonly activeElement: Element; - /** - * Sets or gets the color of all active links in the document. - */ - alinkColor: string; - /** - * Returns a reference to the collection of elements contained by the object. - */ - readonly all: HTMLAllCollection; - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. - */ - anchors: HTMLCollectionOf; - /** - * Retrieves a collection of all applet objects in the document. - */ - applets: HTMLCollectionOf; - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. - */ - bgColor: string; - /** - * Specifies the beginning and end of the document body. - */ - body: HTMLElement; - readonly characterSet: string; - /** - * Gets or sets the character set used to encode the object. - */ - charset: string; - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. - */ - readonly compatMode: string; - cookie: string; - readonly currentScript: HTMLScriptElement | SVGScriptElement; - /** - * Gets the default character set from the current regional language settings. - */ - readonly defaultCharset: string; - readonly defaultView: Window; - /** - * Sets or gets a value that indicates whether the document can be edited. - */ - designMode: string; - /** - * Sets or retrieves a value that indicates the reading order of the object. - */ - dir: string; - /** - * Gets an object representing the document type declaration associated with the current document. - */ - readonly doctype: DocumentType; - /** - * Gets a reference to the root node of the document. - */ - documentElement: HTMLElement; - /** - * Sets or gets the security domain of the document. - */ - domain: string; - /** - * Retrieves a collection of all embed objects in the document. - */ - embeds: HTMLCollectionOf; - /** - * Sets or gets the foreground (text) color of the document. - */ - fgColor: string; - /** - * Retrieves a collection, in source order, of all form objects in the document. - */ - forms: HTMLCollectionOf; - readonly fullscreenElement: Element | null; - readonly fullscreenEnabled: boolean; - readonly head: HTMLHeadElement; - readonly hidden: boolean; - /** - * Retrieves a collection, in source order, of img objects in the document. - */ - images: HTMLCollectionOf; - /** - * Gets the implementation object of the current document. - */ - readonly implementation: DOMImplementation; - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. - */ - readonly inputEncoding: string | null; - /** - * Gets the date that the page was last modified, if the page supplies one. - */ - readonly lastModified: string; - /** - * Sets or gets the color of the document links. - */ - linkColor: string; - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. - */ - links: HTMLCollectionOf; - /** - * Contains information about the current URL. - */ - readonly location: Location; - msCSSOMElementFloatMetrics: boolean; - msCapsLockWarningOff: boolean; - /** - * Fires when the user aborts the download. - * @param ev The event. - */ - onabort: (this: this, ev: UIEvent) => any; - /** - * Fires when the object is set as the active element. - * @param ev The event. - */ - onactivate: (this: this, ev: UIEvent) => any; - /** - * Fires immediately before the object is set as the active element. - * @param ev The event. - */ - onbeforeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires immediately before the activeElement is changed from the current object to another object in the parent document. - * @param ev The event. - */ - onbeforedeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. - * @param ev The focus event. - */ - onblur: (this: this, ev: FocusEvent) => any; - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. - */ - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. - */ - onchange: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. - */ - onclick: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. - */ - oncontextmenu: (this: this, ev: PointerEvent) => any; - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. - */ - ondblclick: (this: this, ev: MouseEvent) => any; - /** - * Fires when the activeElement is changed from the current object to another object in the parent document. - * @param ev The UI Event - */ - ondeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. - */ - ondrag: (this: this, ev: DragEvent) => any; - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. - */ - ondragend: (this: this, ev: DragEvent) => any; - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. - */ - ondragenter: (this: this, ev: DragEvent) => any; - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. - */ - ondragleave: (this: this, ev: DragEvent) => any; - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. - */ - ondragover: (this: this, ev: DragEvent) => any; - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. - */ - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - /** - * Occurs when the duration attribute is updated. - * @param ev The event. - */ - ondurationchange: (this: this, ev: Event) => any; - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. - */ - onemptied: (this: this, ev: Event) => any; - /** - * Occurs when the end of playback is reached. - * @param ev The event - */ - onended: (this: this, ev: MediaStreamErrorEvent) => any; - /** - * Fires when an error occurs during object loading. - * @param ev The event. - */ - onerror: (this: this, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - * @param ev The event. - */ - onfocus: (this: this, ev: FocusEvent) => any; - onfullscreenchange: (this: this, ev: Event) => any; - onfullscreenerror: (this: this, ev: Event) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - /** - * Fires when the user presses a key. - * @param ev The keyboard event - */ - onkeydown: (this: this, ev: KeyboardEvent) => any; - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. - */ - onkeypress: (this: this, ev: KeyboardEvent) => any; - /** - * Fires when the user releases a key. - * @param ev The keyboard event - */ - onkeyup: (this: this, ev: KeyboardEvent) => any; - /** - * Fires immediately after the browser loads the object. - * @param ev The event. - */ - onload: (this: this, ev: Event) => any; - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. - */ - onloadeddata: (this: this, ev: Event) => any; - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. - */ - onloadedmetadata: (this: this, ev: Event) => any; - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. - */ - onloadstart: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. - */ - onmousedown: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. - */ - onmousemove: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. - */ - onmouseout: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. - */ - onmouseover: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. - */ - onmouseup: (this: this, ev: MouseEvent) => any; - /** - * Fires when the wheel button is rotated. - * @param ev The mouse event - */ - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. - * @param ev The event. - */ - onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any; - /** - * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. - * @param ev The event. - */ - onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any; - /** - * Occurs when playback is paused. - * @param ev The event. - */ - onpause: (this: this, ev: Event) => any; - /** - * Occurs when the play method is requested. - * @param ev The event. - */ - onplay: (this: this, ev: Event) => any; - /** - * Occurs when the audio or video has started playing. - * @param ev The event. - */ - onplaying: (this: this, ev: Event) => any; - onpointerlockchange: (this: this, ev: Event) => any; - onpointerlockerror: (this: this, ev: Event) => any; - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. - */ - onprogress: (this: this, ev: ProgressEvent) => any; - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. - */ - onratechange: (this: this, ev: Event) => any; - /** - * Fires when the state of the object has changed. - * @param ev The event - */ - onreadystatechange: (this: this, ev: ProgressEvent) => any; - /** - * Fires when the user resets a form. - * @param ev The event. - */ - onreset: (this: this, ev: Event) => any; - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. - */ - onscroll: (this: this, ev: UIEvent) => any; - /** - * Occurs when the seek operation ends. - * @param ev The event. - */ - onseeked: (this: this, ev: Event) => any; - /** - * Occurs when the current playback position is moved. - * @param ev The event. - */ - onseeking: (this: this, ev: Event) => any; - /** - * Fires when the current selection changes. - * @param ev The event. - */ - onselect: (this: this, ev: UIEvent) => any; - /** - * Fires when the selection state of a document changes. - * @param ev The event. - */ - onselectionchange: (this: this, ev: Event) => any; - onselectstart: (this: this, ev: Event) => any; - /** - * Occurs when the download has stopped. - * @param ev The event. - */ - onstalled: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the Stop button or leaves the Web page. - * @param ev The event. - */ - onstop: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. - */ - onsuspend: (this: this, ev: Event) => any; - /** - * Occurs to indicate the current playback position. - * @param ev The event. - */ - ontimeupdate: (this: this, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. - */ - onvolumechange: (this: this, ev: Event) => any; - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. - */ - onwaiting: (this: this, ev: Event) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; - plugins: HTMLCollectionOf; - readonly pointerLockElement: Element; - /** - * Retrieves a value that indicates the current state of the object. - */ - readonly readyState: string; - /** - * Gets the URL of the location that referred the user to the current page. - */ - readonly referrer: string; - /** - * Gets the root svg element in the document hierarchy. - */ - readonly rootElement: SVGSVGElement; - /** - * Retrieves a collection of all script objects in the document. - */ - scripts: HTMLCollectionOf; - readonly scrollingElement: Element | null; - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. - */ - readonly styleSheets: StyleSheetList; - /** - * Contains the title of the document. - */ - title: string; - readonly visibilityState: string; - /** - * Sets or gets the color of the links that the user has visited. - */ - vlinkColor: string; - readonly webkitCurrentFullScreenElement: Element | null; - readonly webkitFullscreenElement: Element | null; - readonly webkitFullscreenEnabled: boolean; - readonly webkitIsFullScreen: boolean; - readonly xmlEncoding: string | null; - xmlStandalone: boolean; - /** - * Gets or sets the version attribute specified in the declaration of an XML document. - */ - xmlVersion: string | null; - adoptNode(source: Node): Node; - captureEvents(): void; - caretRangeFromPoint(x: number, y: number): Range; - clear(): void; - /** - * Closes an output stream and forces the sent data to display. - */ - close(): void; - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. - */ - createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; - createCDATASection(data: string): CDATASection; - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. - */ - createComment(data: string): Comment; - /** - * Creates a new document. - */ - createDocumentFragment(): DocumentFragment; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "applet"): HTMLAppletElement; - createElement(tagName: "area"): HTMLAreaElement; - createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "base"): HTMLBaseElement; - createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "blockquote"): HTMLQuoteElement; - createElement(tagName: "body"): HTMLBodyElement; - createElement(tagName: "br"): HTMLBRElement; - createElement(tagName: "button"): HTMLButtonElement; - createElement(tagName: "canvas"): HTMLCanvasElement; - createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "col"): HTMLTableColElement; - createElement(tagName: "colgroup"): HTMLTableColElement; - createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dir"): HTMLDirectoryElement; - createElement(tagName: "div"): HTMLDivElement; - createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "embed"): HTMLEmbedElement; - createElement(tagName: "fieldset"): HTMLFieldSetElement; - createElement(tagName: "font"): HTMLFontElement; - createElement(tagName: "form"): HTMLFormElement; - createElement(tagName: "frame"): HTMLFrameElement; - createElement(tagName: "frameset"): HTMLFrameSetElement; - createElement(tagName: "h1"): HTMLHeadingElement; - createElement(tagName: "h2"): HTMLHeadingElement; - createElement(tagName: "h3"): HTMLHeadingElement; - createElement(tagName: "h4"): HTMLHeadingElement; - createElement(tagName: "h5"): HTMLHeadingElement; - createElement(tagName: "h6"): HTMLHeadingElement; - createElement(tagName: "head"): HTMLHeadElement; - createElement(tagName: "hr"): HTMLHRElement; - createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "iframe"): HTMLIFrameElement; - createElement(tagName: "img"): HTMLImageElement; - createElement(tagName: "input"): HTMLInputElement; - createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLUnknownElement; - createElement(tagName: "label"): HTMLLabelElement; - createElement(tagName: "legend"): HTMLLegendElement; - createElement(tagName: "li"): HTMLLIElement; - createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLPreElement; - createElement(tagName: "map"): HTMLMapElement; - createElement(tagName: "marquee"): HTMLMarqueeElement; - createElement(tagName: "menu"): HTMLMenuElement; - createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "meter"): HTMLMeterElement; - createElement(tagName: "nextid"): HTMLUnknownElement; - createElement(tagName: "object"): HTMLObjectElement; - createElement(tagName: "ol"): HTMLOListElement; - createElement(tagName: "optgroup"): HTMLOptGroupElement; - createElement(tagName: "option"): HTMLOptionElement; - createElement(tagName: "p"): HTMLParagraphElement; - createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "picture"): HTMLPictureElement; - createElement(tagName: "pre"): HTMLPreElement; - createElement(tagName: "progress"): HTMLProgressElement; - createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "script"): HTMLScriptElement; - createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "source"): HTMLSourceElement; - createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "table"): HTMLTableElement; - createElement(tagName: "tbody"): HTMLTableSectionElement; - createElement(tagName: "td"): HTMLTableDataCellElement; - createElement(tagName: "template"): HTMLTemplateElement; - createElement(tagName: "textarea"): HTMLTextAreaElement; - createElement(tagName: "tfoot"): HTMLTableSectionElement; - createElement(tagName: "th"): HTMLTableHeaderCellElement; - createElement(tagName: "thead"): HTMLTableSectionElement; - createElement(tagName: "title"): HTMLTitleElement; - createElement(tagName: "tr"): HTMLTableRowElement; - createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "video"): HTMLVideoElement; - createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLPreElement; - createElement(tagName: string): HTMLElement; - createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string | null, qualifiedName: string): Element; - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver: Node): XPathNSResolver; - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; - createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. - */ - createRange(): Range; - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. - */ - createTextNode(data: string): Text; - createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; - createTouchList(...touches: Touch[]): TouchList; - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset - */ - elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. - */ - execCommand(commandId: string, showUI?: boolean, value?: any): boolean; - /** - * Displays help information for the given command identifier. - * @param commandId Displays help information for the given command identifier. - */ - execCommandShowHelp(commandId: string): boolean; - exitFullscreen(): void; - exitPointerLock(): void; - /** - * Causes the element to receive the focus and executes the code specified by the onfocus event. - */ - focus(): void; - /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. - */ - getElementById(elementId: string): HTMLElement | null; - getElementsByClassName(classNames: string): HTMLCollectionOf; - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. - */ - getElementsByName(elementName: string): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; - getElementsByTagName(tagname: "applet"): NodeListOf; - getElementsByTagName(tagname: "area"): NodeListOf; - getElementsByTagName(tagname: "article"): NodeListOf; - getElementsByTagName(tagname: "aside"): NodeListOf; - getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; - getElementsByTagName(tagname: "base"): NodeListOf; - getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; - getElementsByTagName(tagname: "body"): NodeListOf; - getElementsByTagName(tagname: "br"): NodeListOf; - getElementsByTagName(tagname: "button"): NodeListOf; - getElementsByTagName(tagname: "canvas"): NodeListOf; - getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; - getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; - getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; - getElementsByTagName(tagname: "col"): NodeListOf; - getElementsByTagName(tagname: "colgroup"): NodeListOf; - getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; - getElementsByTagName(tagname: "defs"): NodeListOf; - getElementsByTagName(tagname: "del"): NodeListOf; - getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; - getElementsByTagName(tagname: "dir"): NodeListOf; - getElementsByTagName(tagname: "div"): NodeListOf; - getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; - getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; - getElementsByTagName(tagname: "embed"): NodeListOf; - getElementsByTagName(tagname: "feblend"): NodeListOf; - getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; - getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(tagname: "fecomposite"): NodeListOf; - getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; - getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; - getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; - getElementsByTagName(tagname: "fedistantlight"): NodeListOf; - getElementsByTagName(tagname: "feflood"): NodeListOf; - getElementsByTagName(tagname: "fefunca"): NodeListOf; - getElementsByTagName(tagname: "fefuncb"): NodeListOf; - getElementsByTagName(tagname: "fefuncg"): NodeListOf; - getElementsByTagName(tagname: "fefuncr"): NodeListOf; - getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; - getElementsByTagName(tagname: "feimage"): NodeListOf; - getElementsByTagName(tagname: "femerge"): NodeListOf; - getElementsByTagName(tagname: "femergenode"): NodeListOf; - getElementsByTagName(tagname: "femorphology"): NodeListOf; - getElementsByTagName(tagname: "feoffset"): NodeListOf; - getElementsByTagName(tagname: "fepointlight"): NodeListOf; - getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; - getElementsByTagName(tagname: "fespotlight"): NodeListOf; - getElementsByTagName(tagname: "fetile"): NodeListOf; - getElementsByTagName(tagname: "feturbulence"): NodeListOf; - getElementsByTagName(tagname: "fieldset"): NodeListOf; - getElementsByTagName(tagname: "figcaption"): NodeListOf; - getElementsByTagName(tagname: "figure"): NodeListOf; - getElementsByTagName(tagname: "filter"): NodeListOf; - getElementsByTagName(tagname: "font"): NodeListOf; - getElementsByTagName(tagname: "footer"): NodeListOf; - getElementsByTagName(tagname: "foreignobject"): NodeListOf; - getElementsByTagName(tagname: "form"): NodeListOf; - getElementsByTagName(tagname: "frame"): NodeListOf; - getElementsByTagName(tagname: "frameset"): NodeListOf; - getElementsByTagName(tagname: "g"): NodeListOf; - getElementsByTagName(tagname: "h1"): NodeListOf; - getElementsByTagName(tagname: "h2"): NodeListOf; - getElementsByTagName(tagname: "h3"): NodeListOf; - getElementsByTagName(tagname: "h4"): NodeListOf; - getElementsByTagName(tagname: "h5"): NodeListOf; - getElementsByTagName(tagname: "h6"): NodeListOf; - getElementsByTagName(tagname: "head"): NodeListOf; - getElementsByTagName(tagname: "header"): NodeListOf; - getElementsByTagName(tagname: "hgroup"): NodeListOf; - getElementsByTagName(tagname: "hr"): NodeListOf; - getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; - getElementsByTagName(tagname: "iframe"): NodeListOf; - getElementsByTagName(tagname: "image"): NodeListOf; - getElementsByTagName(tagname: "img"): NodeListOf; - getElementsByTagName(tagname: "input"): NodeListOf; - getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; - getElementsByTagName(tagname: "label"): NodeListOf; - getElementsByTagName(tagname: "legend"): NodeListOf; - getElementsByTagName(tagname: "li"): NodeListOf; - getElementsByTagName(tagname: "line"): NodeListOf; - getElementsByTagName(tagname: "lineargradient"): NodeListOf; - getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; - getElementsByTagName(tagname: "map"): NodeListOf; - getElementsByTagName(tagname: "mark"): NodeListOf; - getElementsByTagName(tagname: "marker"): NodeListOf; - getElementsByTagName(tagname: "marquee"): NodeListOf; - getElementsByTagName(tagname: "mask"): NodeListOf; - getElementsByTagName(tagname: "menu"): NodeListOf; - getElementsByTagName(tagname: "meta"): NodeListOf; - getElementsByTagName(tagname: "metadata"): NodeListOf; - getElementsByTagName(tagname: "meter"): NodeListOf; - getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; - getElementsByTagName(tagname: "noframes"): NodeListOf; - getElementsByTagName(tagname: "noscript"): NodeListOf; - getElementsByTagName(tagname: "object"): NodeListOf; - getElementsByTagName(tagname: "ol"): NodeListOf; - getElementsByTagName(tagname: "optgroup"): NodeListOf; - getElementsByTagName(tagname: "option"): NodeListOf; - getElementsByTagName(tagname: "p"): NodeListOf; - getElementsByTagName(tagname: "param"): NodeListOf; - getElementsByTagName(tagname: "path"): NodeListOf; - getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "picture"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; - getElementsByTagName(tagname: "polygon"): NodeListOf; - getElementsByTagName(tagname: "polyline"): NodeListOf; - getElementsByTagName(tagname: "pre"): NodeListOf; - getElementsByTagName(tagname: "progress"): NodeListOf; - getElementsByTagName(tagname: "q"): NodeListOf; - getElementsByTagName(tagname: "radialgradient"): NodeListOf; - getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; - getElementsByTagName(tagname: "script"): NodeListOf; - getElementsByTagName(tagname: "section"): NodeListOf; - getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; - getElementsByTagName(tagname: "source"): NodeListOf; - getElementsByTagName(tagname: "span"): NodeListOf; - getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; - getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; - getElementsByTagName(tagname: "svg"): NodeListOf; - getElementsByTagName(tagname: "switch"): NodeListOf; - getElementsByTagName(tagname: "symbol"): NodeListOf; - getElementsByTagName(tagname: "table"): NodeListOf; - getElementsByTagName(tagname: "tbody"): NodeListOf; - getElementsByTagName(tagname: "td"): NodeListOf; - getElementsByTagName(tagname: "template"): NodeListOf; - getElementsByTagName(tagname: "text"): NodeListOf; - getElementsByTagName(tagname: "textpath"): NodeListOf; - getElementsByTagName(tagname: "textarea"): NodeListOf; - getElementsByTagName(tagname: "tfoot"): NodeListOf; - getElementsByTagName(tagname: "th"): NodeListOf; - getElementsByTagName(tagname: "thead"): NodeListOf; - getElementsByTagName(tagname: "title"): NodeListOf; - getElementsByTagName(tagname: "tr"): NodeListOf; - getElementsByTagName(tagname: "track"): NodeListOf; - getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; - getElementsByTagName(tagname: "ul"): NodeListOf; - getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; - getElementsByTagName(tagname: "video"): NodeListOf; - getElementsByTagName(tagname: "view"): NodeListOf; - getElementsByTagName(tagname: "wbr"): NodeListOf; - getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; - getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. - */ - getSelection(): Selection; - /** - * Gets a value indicating whether the object currently has focus. - */ - hasFocus(): boolean; - importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeListOf; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. - */ - queryCommandEnabled(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. - */ - queryCommandIndeterm(commandId: string): boolean; - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. - */ - queryCommandState(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. - */ - queryCommandSupported(commandId: string): boolean; - /** - * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. - */ - queryCommandText(commandId: string): string; - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. - */ - queryCommandValue(commandId: string): string; - releaseEvents(): void; - /** - * Allows updating the print settings for the page. - */ - updateSettings(): void; - webkitCancelFullScreen(): void; - webkitExitFullscreen(): void; - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. - */ - write(...content: string[]): void; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...content: string[]): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var Document: { - prototype: Document; - new(): Document; -} - -interface DocumentFragment extends Node, NodeSelector, ParentNode { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DocumentFragment: { - prototype: DocumentFragment; - new(): DocumentFragment; -} - -interface DocumentType extends Node, ChildNode { - readonly entities: NamedNodeMap; - readonly internalSubset: string | null; - readonly name: string; - readonly notations: NamedNodeMap; - readonly publicId: string | null; - readonly systemId: string | null; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DocumentType: { - prototype: DocumentType; - new(): DocumentType; -} - -interface DragEvent extends MouseEvent { - readonly dataTransfer: DataTransfer; - initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; - msConvertURL(file: File, targetType: string, targetURL?: string): void; -} - -declare var DragEvent: { - prototype: DragEvent; - new(): DragEvent; -} - -interface DynamicsCompressorNode extends AudioNode { - readonly attack: AudioParam; - readonly knee: AudioParam; - readonly ratio: AudioParam; - readonly reduction: AudioParam; - readonly release: AudioParam; - readonly threshold: AudioParam; -} - -declare var DynamicsCompressorNode: { - prototype: DynamicsCompressorNode; - new(): DynamicsCompressorNode; -} - -interface EXT_frag_depth { -} - -declare var EXT_frag_depth: { - prototype: EXT_frag_depth; - new(): EXT_frag_depth; -} - -interface EXT_texture_filter_anisotropic { - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -declare var EXT_texture_filter_anisotropic: { - prototype: EXT_texture_filter_anisotropic; - new(): EXT_texture_filter_anisotropic; - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { - readonly classList: DOMTokenList; - className: string; - readonly clientHeight: number; - readonly clientLeft: number; - readonly clientTop: number; - readonly clientWidth: number; - id: string; - msContentZoomFactor: number; - readonly msRegionOverflow: string; - onariarequest: (this: this, ev: AriaRequestEvent) => any; - oncommand: (this: this, ev: CommandEvent) => any; - ongotpointercapture: (this: this, ev: PointerEvent) => any; - onlostpointercapture: (this: this, ev: PointerEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmslostpointercapture: (this: this, ev: MSPointerEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; - readonly prefix: string | null; - readonly scrollHeight: number; - scrollLeft: number; - scrollTop: number; - readonly scrollWidth: number; - readonly tagName: string; - innerHTML: string; - getAttribute(name: string): string | null; - getAttributeNS(namespaceURI: string, localName: string): string; - getAttributeNode(name: string): Attr; - getAttributeNodeNS(namespaceURI: string, localName: string): Attr; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; - getElementsByTagName(name: "applet"): NodeListOf; - getElementsByTagName(name: "area"): NodeListOf; - getElementsByTagName(name: "article"): NodeListOf; - getElementsByTagName(name: "aside"): NodeListOf; - getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; - getElementsByTagName(name: "base"): NodeListOf; - getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; - getElementsByTagName(name: "body"): NodeListOf; - getElementsByTagName(name: "br"): NodeListOf; - getElementsByTagName(name: "button"): NodeListOf; - getElementsByTagName(name: "canvas"): NodeListOf; - getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; - getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; - getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; - getElementsByTagName(name: "col"): NodeListOf; - getElementsByTagName(name: "colgroup"): NodeListOf; - getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; - getElementsByTagName(name: "defs"): NodeListOf; - getElementsByTagName(name: "del"): NodeListOf; - getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; - getElementsByTagName(name: "dir"): NodeListOf; - getElementsByTagName(name: "div"): NodeListOf; - getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; - getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; - getElementsByTagName(name: "embed"): NodeListOf; - getElementsByTagName(name: "feblend"): NodeListOf; - getElementsByTagName(name: "fecolormatrix"): NodeListOf; - getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(name: "fecomposite"): NodeListOf; - getElementsByTagName(name: "feconvolvematrix"): NodeListOf; - getElementsByTagName(name: "fediffuselighting"): NodeListOf; - getElementsByTagName(name: "fedisplacementmap"): NodeListOf; - getElementsByTagName(name: "fedistantlight"): NodeListOf; - getElementsByTagName(name: "feflood"): NodeListOf; - getElementsByTagName(name: "fefunca"): NodeListOf; - getElementsByTagName(name: "fefuncb"): NodeListOf; - getElementsByTagName(name: "fefuncg"): NodeListOf; - getElementsByTagName(name: "fefuncr"): NodeListOf; - getElementsByTagName(name: "fegaussianblur"): NodeListOf; - getElementsByTagName(name: "feimage"): NodeListOf; - getElementsByTagName(name: "femerge"): NodeListOf; - getElementsByTagName(name: "femergenode"): NodeListOf; - getElementsByTagName(name: "femorphology"): NodeListOf; - getElementsByTagName(name: "feoffset"): NodeListOf; - getElementsByTagName(name: "fepointlight"): NodeListOf; - getElementsByTagName(name: "fespecularlighting"): NodeListOf; - getElementsByTagName(name: "fespotlight"): NodeListOf; - getElementsByTagName(name: "fetile"): NodeListOf; - getElementsByTagName(name: "feturbulence"): NodeListOf; - getElementsByTagName(name: "fieldset"): NodeListOf; - getElementsByTagName(name: "figcaption"): NodeListOf; - getElementsByTagName(name: "figure"): NodeListOf; - getElementsByTagName(name: "filter"): NodeListOf; - getElementsByTagName(name: "font"): NodeListOf; - getElementsByTagName(name: "footer"): NodeListOf; - getElementsByTagName(name: "foreignobject"): NodeListOf; - getElementsByTagName(name: "form"): NodeListOf; - getElementsByTagName(name: "frame"): NodeListOf; - getElementsByTagName(name: "frameset"): NodeListOf; - getElementsByTagName(name: "g"): NodeListOf; - getElementsByTagName(name: "h1"): NodeListOf; - getElementsByTagName(name: "h2"): NodeListOf; - getElementsByTagName(name: "h3"): NodeListOf; - getElementsByTagName(name: "h4"): NodeListOf; - getElementsByTagName(name: "h5"): NodeListOf; - getElementsByTagName(name: "h6"): NodeListOf; - getElementsByTagName(name: "head"): NodeListOf; - getElementsByTagName(name: "header"): NodeListOf; - getElementsByTagName(name: "hgroup"): NodeListOf; - getElementsByTagName(name: "hr"): NodeListOf; - getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; - getElementsByTagName(name: "iframe"): NodeListOf; - getElementsByTagName(name: "image"): NodeListOf; - getElementsByTagName(name: "img"): NodeListOf; - getElementsByTagName(name: "input"): NodeListOf; - getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; - getElementsByTagName(name: "label"): NodeListOf; - getElementsByTagName(name: "legend"): NodeListOf; - getElementsByTagName(name: "li"): NodeListOf; - getElementsByTagName(name: "line"): NodeListOf; - getElementsByTagName(name: "lineargradient"): NodeListOf; - getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; - getElementsByTagName(name: "map"): NodeListOf; - getElementsByTagName(name: "mark"): NodeListOf; - getElementsByTagName(name: "marker"): NodeListOf; - getElementsByTagName(name: "marquee"): NodeListOf; - getElementsByTagName(name: "mask"): NodeListOf; - getElementsByTagName(name: "menu"): NodeListOf; - getElementsByTagName(name: "meta"): NodeListOf; - getElementsByTagName(name: "metadata"): NodeListOf; - getElementsByTagName(name: "meter"): NodeListOf; - getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; - getElementsByTagName(name: "noframes"): NodeListOf; - getElementsByTagName(name: "noscript"): NodeListOf; - getElementsByTagName(name: "object"): NodeListOf; - getElementsByTagName(name: "ol"): NodeListOf; - getElementsByTagName(name: "optgroup"): NodeListOf; - getElementsByTagName(name: "option"): NodeListOf; - getElementsByTagName(name: "p"): NodeListOf; - getElementsByTagName(name: "param"): NodeListOf; - getElementsByTagName(name: "path"): NodeListOf; - getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "picture"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; - getElementsByTagName(name: "polygon"): NodeListOf; - getElementsByTagName(name: "polyline"): NodeListOf; - getElementsByTagName(name: "pre"): NodeListOf; - getElementsByTagName(name: "progress"): NodeListOf; - getElementsByTagName(name: "q"): NodeListOf; - getElementsByTagName(name: "radialgradient"): NodeListOf; - getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; - getElementsByTagName(name: "script"): NodeListOf; - getElementsByTagName(name: "section"): NodeListOf; - getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; - getElementsByTagName(name: "source"): NodeListOf; - getElementsByTagName(name: "span"): NodeListOf; - getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; - getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; - getElementsByTagName(name: "svg"): NodeListOf; - getElementsByTagName(name: "switch"): NodeListOf; - getElementsByTagName(name: "symbol"): NodeListOf; - getElementsByTagName(name: "table"): NodeListOf; - getElementsByTagName(name: "tbody"): NodeListOf; - getElementsByTagName(name: "td"): NodeListOf; - getElementsByTagName(name: "template"): NodeListOf; - getElementsByTagName(name: "text"): NodeListOf; - getElementsByTagName(name: "textpath"): NodeListOf; - getElementsByTagName(name: "textarea"): NodeListOf; - getElementsByTagName(name: "tfoot"): NodeListOf; - getElementsByTagName(name: "th"): NodeListOf; - getElementsByTagName(name: "thead"): NodeListOf; - getElementsByTagName(name: "title"): NodeListOf; - getElementsByTagName(name: "tr"): NodeListOf; - getElementsByTagName(name: "track"): NodeListOf; - getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; - getElementsByTagName(name: "ul"): NodeListOf; - getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; - getElementsByTagName(name: "video"): NodeListOf; - getElementsByTagName(name: "view"): NodeListOf; - getElementsByTagName(name: "wbr"): NodeListOf; - getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; - getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - hasAttribute(name: string): boolean; - hasAttributeNS(namespaceURI: string, localName: string): boolean; - msGetRegionContent(): MSRangeCollection; - msGetUntransformedBounds(): ClientRect; - msMatchesSelector(selectors: string): boolean; - msReleasePointerCapture(pointerId: number): void; - msSetPointerCapture(pointerId: number): void; - msZoomTo(args: MsZoomToOptions): void; - releasePointerCapture(pointerId: number): void; - removeAttribute(name?: string): void; - removeAttributeNS(namespaceURI: string, localName: string): void; - removeAttributeNode(oldAttr: Attr): Attr; - requestFullscreen(): void; - requestPointerLock(): void; - setAttribute(name: string, value: string): void; - setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; - setAttributeNode(newAttr: Attr): Attr; - setAttributeNodeNS(newAttr: Attr): Attr; - setPointerCapture(pointerId: number): void; - webkitMatchesSelector(selectors: string): boolean; - webkitRequestFullScreen(): void; - webkitRequestFullscreen(): void; - getElementsByClassName(classNames: string): NodeListOf; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var Element: { - prototype: Element; - new(): Element; -} - -interface ErrorEvent extends Event { - readonly colno: number; - readonly error: any; - readonly filename: string; - readonly lineno: number; - readonly message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(): ErrorEvent; -} - -interface Event { - readonly bubbles: boolean; - cancelBubble: boolean; - readonly cancelable: boolean; - readonly currentTarget: EventTarget; - readonly defaultPrevented: boolean; - readonly eventPhase: number; - readonly isTrusted: boolean; - returnValue: boolean; - readonly srcElement: Element | null; - readonly target: EventTarget; - readonly timeStamp: number; - readonly type: string; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - preventDefault(): void; - stopImmediatePropagation(): void; - stopPropagation(): void; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -interface EventTarget { - addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -} - -interface External { -} - -declare var External: { - prototype: External; - new(): External; -} - -interface File extends Blob { - readonly lastModifiedDate: any; - readonly name: string; - readonly webkitRelativePath: string; -} - -declare var File: { - prototype: File; - new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; -} - -interface FileList { - readonly length: number; - item(index: number): File; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -} - -interface FileReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; -} - -interface FocusEvent extends UIEvent { - readonly relatedTarget: EventTarget; - initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; -} - -declare var FocusEvent: { - prototype: FocusEvent; - new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; -} - -interface FormData { - append(name: any, value: any, blobName?: string): void; -} - -declare var FormData: { - prototype: FormData; - new (form?: HTMLFormElement): FormData; -} - -interface GainNode extends AudioNode { - readonly gain: AudioParam; -} - -declare var GainNode: { - prototype: GainNode; - new(): GainNode; -} - -interface Gamepad { - readonly axes: number[]; - readonly buttons: GamepadButton[]; - readonly connected: boolean; - readonly id: string; - readonly index: number; - readonly mapping: string; - readonly timestamp: number; -} - -declare var Gamepad: { - prototype: Gamepad; - new(): Gamepad; -} - -interface GamepadButton { - readonly pressed: boolean; - readonly value: number; -} - -declare var GamepadButton: { - prototype: GamepadButton; - new(): GamepadButton; -} - -interface GamepadEvent extends Event { - readonly gamepad: Gamepad; -} - -declare var GamepadEvent: { - prototype: GamepadEvent; - new(): GamepadEvent; -} - -interface Geolocation { - clearWatch(watchId: number): void; - getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; - watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; -} - -declare var Geolocation: { - prototype: Geolocation; - new(): Geolocation; -} - -interface HTMLAllCollection extends HTMLCollection { - namedItem(name: string): Element; -} - -declare var HTMLAllCollection: { - prototype: HTMLAllCollection; - new(): HTMLAllCollection; -} - -interface HTMLAnchorElement extends HTMLElement { - Methods: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Contains the anchor portion of the URL including the hash sign (#). - */ - hash: string; - /** - * Contains the hostname and port values of the URL. - */ - host: string; - /** - * Contains the hostname of a URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - readonly mimeType: string; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - readonly nameProp: string; - /** - * Contains the pathname of the URL. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Contains the protocol of the URL. - */ - protocol: string; - readonly protocolLong: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - type: string; - urn: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} - -declare var HTMLAnchorElement: { - prototype: HTMLAnchorElement; - new(): HTMLAnchorElement; -} - -interface HTMLAppletElement extends HTMLElement { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - /** - * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. - */ - declare: boolean; - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - object: string | null; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - vspace: number; - width: number; -} - -declare var HTMLAppletElement: { - prototype: HTMLAppletElement; - new(): HTMLAppletElement; -} - -interface HTMLAreaElement extends HTMLElement { - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Sets or retrieves the subsection of the href property that follows the number sign (#). - */ - hash: string; - /** - * Sets or retrieves the hostname and port number of the location or URL. - */ - host: string; - /** - * Sets or retrieves the host name part of the location or URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or gets whether clicks in this region cause action. - */ - noHref: boolean; - /** - * Sets or retrieves the file name or path specified by the object. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Sets or retrieves the protocol portion of a URL. - */ - protocol: string; - rel: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} - -declare var HTMLAreaElement: { - prototype: HTMLAreaElement; - new(): HTMLAreaElement; -} - -interface HTMLAreasCollection extends HTMLCollection { - /** - * Adds an element to the areas, controlRange, or options collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Removes an element from the collection. - */ - remove(index?: number): void; -} - -declare var HTMLAreasCollection: { - prototype: HTMLAreasCollection; - new(): HTMLAreasCollection; -} - -interface HTMLAudioElement extends HTMLMediaElement { -} - -declare var HTMLAudioElement: { - prototype: HTMLAudioElement; - new(): HTMLAudioElement; -} - -interface HTMLBRElement extends HTMLElement { - /** - * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. - */ - clear: string; -} - -declare var HTMLBRElement: { - prototype: HTMLBRElement; - new(): HTMLBRElement; -} - -interface HTMLBaseElement extends HTMLElement { - /** - * Gets or sets the baseline URL on which relative links are based. - */ - href: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; -} - -declare var HTMLBaseElement: { - prototype: HTMLBaseElement; - new(): HTMLBaseElement; -} - -interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - /** - * Sets or retrieves the font size of the object. - */ - size: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseFontElement: { - prototype: HTMLBaseFontElement; - new(): HTMLBaseFontElement; -} - -interface HTMLBodyElement extends HTMLElement { - aLink: any; - background: string; - bgColor: any; - bgProperties: string; - link: any; - noWrap: boolean; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; - text: any; - vLink: any; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLBodyElement: { - prototype: HTMLBodyElement; - new(): HTMLBodyElement; -} - -interface HTMLButtonElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - status: any; - /** - * Gets the classification and default behavior of the button. - */ - type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the default or selected value of the control. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -declare var HTMLButtonElement: { - prototype: HTMLButtonElement; - new(): HTMLButtonElement; -} - -interface HTMLCanvasElement extends HTMLElement { - /** - * Gets or sets the height of a canvas element on a document. - */ - height: number; - /** - * Gets or sets the width of a canvas element on a document. - */ - width: number; - /** - * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. - * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); - */ - getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; - getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; - getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; - /** - * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. - */ - msToBlob(): Blob; - /** - * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. - * @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, type?: string, ...arguments: any[]): void; -} - -declare var HTMLCanvasElement: { - prototype: HTMLCanvasElement; - new(): HTMLCanvasElement; -} - -interface HTMLCollection { - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Retrieves an object from various collections. - */ - item(index: number): Element; - /** - * Retrieves a select object or an object from an options collection. - */ - namedItem(name: string): Element; - [index: number]: Element; -} - -declare var HTMLCollection: { - prototype: HTMLCollection; - new(): HTMLCollection; -} - -interface HTMLDListElement extends HTMLElement { - compact: boolean; -} - -declare var HTMLDListElement: { - prototype: HTMLDListElement; - new(): HTMLDListElement; -} - -interface HTMLDataListElement extends HTMLElement { - options: HTMLCollectionOf; -} - -declare var HTMLDataListElement: { - prototype: HTMLDataListElement; - new(): HTMLDataListElement; -} - -interface HTMLDirectoryElement extends HTMLElement { - compact: boolean; -} - -declare var HTMLDirectoryElement: { - prototype: HTMLDirectoryElement; - new(): HTMLDirectoryElement; -} - -interface HTMLDivElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDivElement: { - prototype: HTMLDivElement; - new(): HTMLDivElement; -} - -interface HTMLDocument extends Document { -} - -declare var HTMLDocument: { - prototype: HTMLDocument; - new(): HTMLDocument; -} - -interface HTMLElement extends Element { - accessKey: string; - readonly children: HTMLCollection; - contentEditable: string; - readonly dataset: DOMStringMap; - dir: string; - draggable: boolean; - hidden: boolean; - hideFocus: boolean; - innerHTML: string; - innerText: string; - readonly isContentEditable: boolean; - lang: string; - readonly offsetHeight: number; - readonly offsetLeft: number; - readonly offsetParent: Element; - readonly offsetTop: number; - readonly offsetWidth: number; - onabort: (this: this, ev: UIEvent) => any; - onactivate: (this: this, ev: UIEvent) => any; - onbeforeactivate: (this: this, ev: UIEvent) => any; - onbeforecopy: (this: this, ev: ClipboardEvent) => any; - onbeforecut: (this: this, ev: ClipboardEvent) => any; - onbeforedeactivate: (this: this, ev: UIEvent) => any; - onbeforepaste: (this: this, ev: ClipboardEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - oncopy: (this: this, ev: ClipboardEvent) => any; - oncuechange: (this: this, ev: Event) => any; - oncut: (this: this, ev: ClipboardEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondeactivate: (this: this, ev: UIEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onpaste: (this: this, ev: ClipboardEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreset: (this: this, ev: Event) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onselectstart: (this: this, ev: Event) => any; - onstalled: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; - outerHTML: string; - outerText: string; - spellcheck: boolean; - readonly style: CSSStyleDeclaration; - tabIndex: number; - title: string; - blur(): void; - click(): void; - dragDrop(): boolean; - focus(): void; - msGetInputContext(): MSInputMethodContext; - 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLElement: { - prototype: HTMLElement; - new(): HTMLElement; -} - -interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves the height of the object. - */ - height: string; - hidden: any; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the palette used for the embedded document. - */ - readonly palette: string; - /** - * Retrieves the URL of the plug-in used to view an embedded document. - */ - readonly pluginspage: string; - readonly readyState: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the height and width units of the embed object. - */ - units: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLEmbedElement: { - prototype: HTMLEmbedElement; - new(): HTMLEmbedElement; -} - -interface HTMLFieldSetElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -declare var HTMLFieldSetElement: { - prototype: HTMLFieldSetElement; - new(): HTMLFieldSetElement; -} - -interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFontElement: { - prototype: HTMLFontElement; - new(): HTMLFontElement; -} - -interface HTMLFormElement extends HTMLElement { - /** - * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. - */ - acceptCharset: string; - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Retrieves a collection, in source order, of all controls in a given form. - */ - readonly elements: HTMLCollection; - /** - * Sets or retrieves the MIME encoding for the form. - */ - encoding: string; - /** - * Sets or retrieves the encoding type for the form. - */ - enctype: string; - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Sets or retrieves how to send the form data to the server. - */ - method: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Designates a form that is not validated when submitted. - */ - noValidate: boolean; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a form object or an object from an elements collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a form object or an object from an elements collection. - */ - namedItem(name: string): any; - /** - * Fires when the user resets a form. - */ - reset(): void; - /** - * Fires when a FORM is about to be submitted. - */ - submit(): void; - [name: string]: any; -} - -declare var HTMLFormElement: { - prototype: HTMLFormElement; - new(): HTMLFormElement; -} - -interface HTMLFrameElement extends HTMLElement, GetSVGDocument { - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string | number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: this, ev: Event) => any; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the width of the object. - */ - width: string | number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLFrameElement: { - prototype: HTMLFrameElement; - new(): HTMLFrameElement; -} - -interface HTMLFrameSetElement extends HTMLElement { - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the frame widths of the object. - */ - cols: string; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - name: string; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object loses the input focus. - */ - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - */ - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; - /** - * Sets or retrieves the frame heights of the object. - */ - rows: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLFrameSetElement: { - prototype: HTMLFrameSetElement; - new(): HTMLFrameSetElement; -} - -interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. - */ - noShade: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHRElement: { - prototype: HTMLHRElement; - new(): HTMLHRElement; -} - -interface HTMLHeadElement extends HTMLElement { - profile: string; -} - -declare var HTMLHeadElement: { - prototype: HTMLHeadElement; - new(): HTMLHeadElement; -} - -interface HTMLHeadingElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; -} - -declare var HTMLHeadingElement: { - prototype: HTMLHeadingElement; - new(): HTMLHeadingElement; -} - -interface HTMLHtmlElement extends HTMLElement { - /** - * Sets or retrieves the DTD version that governs the current document. - */ - version: string; -} - -declare var HTMLHtmlElement: { - prototype: HTMLHtmlElement; - new(): HTMLHtmlElement; -} - -interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - allowFullscreen: boolean; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the horizontal margin for the object. - */ - hspace: number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: this, ev: Event) => any; - readonly sandbox: DOMSettableTokenList; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLIFrameElement: { - prototype: HTMLIFrameElement; - new(): HTMLIFrameElement; -} - -interface HTMLImageElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - crossOrigin: string; - readonly currentSrc: string; - /** - * Sets or retrieves the height of the object. - */ - height: number; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - /** - * Sets or retrieves whether the image is a server-side image map. - */ - isMap: boolean; - /** - * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. - */ - longDesc: string; - lowsrc: string; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * The original height of the image resource before sizing. - */ - readonly naturalHeight: number; - /** - * The original width of the image resource before sizing. - */ - readonly naturalWidth: number; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: number; - readonly x: number; - readonly y: number; - msGetAsCastingSource(): any; -} - -declare var HTMLImageElement: { - prototype: HTMLImageElement; - new(): HTMLImageElement; - create(): HTMLImageElement; -} - -interface HTMLInputElement extends HTMLElement { - /** - * Sets or retrieves a comma-separated list of content types. - */ - accept: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the state of the check box or radio button. - */ - checked: boolean; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - /** - * Sets or retrieves the state of the check box or radio button. - */ - defaultChecked: boolean; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Returns a FileList object on a file type input object. - */ - readonly files: FileList | null; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - indeterminate: boolean; - /** - * Specifies the ID of a pre-defined datalist of options for an input element. - */ - readonly list: HTMLElement; - /** - * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. - */ - max: string; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. - */ - min: string; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a string containing a regular expression that the user's input must match. - */ - pattern: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - selectionDirection: string; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - size: number; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - status: boolean; - /** - * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. - */ - step: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns the value of the data at the cursor's current position. - */ - value: string; - valueAsDate: Date; - /** - * Returns the input field value as a number. - */ - valueAsNumber: number; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - webkitdirectory: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Makes the selection equal to the current object. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start?: number, end?: number, direction?: string): void; - /** - * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. - * @param n Value to decrement the value by. - */ - stepDown(n?: number): void; - /** - * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. - * @param n Value to increment the value by. - */ - stepUp(n?: number): void; -} - -declare var HTMLInputElement: { - prototype: HTMLInputElement; - new(): HTMLInputElement; -} - -interface HTMLLIElement extends HTMLElement { - type: string; - /** - * Sets or retrieves the value of a list item. - */ - value: number; -} - -declare var HTMLLIElement: { - prototype: HTMLLIElement; - new(): HTMLLIElement; -} - -interface HTMLLabelElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the object to which the given label object is assigned. - */ - htmlFor: string; -} - -declare var HTMLLabelElement: { - prototype: HTMLLabelElement; - new(): HTMLLabelElement; -} - -interface HTMLLegendElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - align: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; -} - -declare var HTMLLegendElement: { - prototype: HTMLLegendElement; - new(): HTMLLegendElement; -} - -interface HTMLLinkElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - disabled: boolean; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - import?: Document; - integrity: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLinkElement: { - prototype: HTMLLinkElement; - new(): HTMLLinkElement; -} - -interface HTMLMapElement extends HTMLElement { - /** - * Retrieves a collection of the area objects defined for the given map object. - */ - readonly areas: HTMLAreasCollection; - /** - * Sets or retrieves the name of the object. - */ - name: string; -} - -declare var HTMLMapElement: { - prototype: HTMLMapElement; - new(): HTMLMapElement; -} - -interface HTMLMarqueeElement extends HTMLElement { - behavior: string; - bgColor: any; - direction: string; - height: string; - hspace: number; - loop: number; - onbounce: (this: this, ev: Event) => any; - onfinish: (this: this, ev: Event) => any; - onstart: (this: this, ev: Event) => any; - scrollAmount: number; - scrollDelay: number; - trueSpeed: boolean; - vspace: number; - width: string; - start(): void; - stop(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLMarqueeElement: { - prototype: HTMLMarqueeElement; - new(): HTMLMarqueeElement; -} - -interface HTMLMediaElement extends HTMLElement { - /** - * Returns an AudioTrackList object with the audio tracks for a given video element. - */ - readonly audioTracks: AudioTrackList; - /** - * Gets or sets a value that indicates whether to start playing the media automatically. - */ - autoplay: boolean; - /** - * Gets a collection of buffered time ranges. - */ - readonly buffered: TimeRanges; - /** - * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). - */ - controls: boolean; - crossOrigin: string; - /** - * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. - */ - readonly currentSrc: string; - /** - * Gets or sets the current playback position, in seconds. - */ - currentTime: number; - defaultMuted: boolean; - /** - * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. - */ - defaultPlaybackRate: number; - /** - * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. - */ - readonly duration: number; - /** - * Gets information about whether the playback has ended or not. - */ - readonly ended: boolean; - /** - * Returns an object representing the current error state of the audio or video element. - */ - readonly error: MediaError; - /** - * Gets or sets a flag to specify whether playback should restart after it completes. - */ - loop: boolean; - readonly mediaKeys: MediaKeys | null; - /** - * Specifies the purpose of the audio or video media, such as background audio or alerts. - */ - msAudioCategory: string; - /** - * Specifies the output device id that the audio will be sent to. - */ - msAudioDeviceType: string; - readonly msGraphicsTrustStatus: MSGraphicsTrust; - /** - * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. - */ - readonly msKeys: MSMediaKeys; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Specifies whether or not to enable low-latency playback on the media element. - */ - msRealTime: boolean; - /** - * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. - */ - muted: boolean; - /** - * Gets the current network activity for the element. - */ - readonly networkState: number; - onencrypted: (this: this, ev: MediaEncryptedEvent) => any; - onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any; - /** - * Gets a flag that specifies whether playback is paused. - */ - readonly paused: boolean; - /** - * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. - */ - playbackRate: number; - /** - * Gets TimeRanges for the current media resource that has been played. - */ - readonly played: TimeRanges; - /** - * Gets or sets the current playback position, in seconds. - */ - preload: string; - readyState: number; - /** - * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. - */ - readonly seekable: TimeRanges; - /** - * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. - */ - readonly seeking: boolean; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcObject: MediaStream | null; - readonly textTracks: TextTrackList; - readonly videoTracks: VideoTrackList; - /** - * Gets or sets the volume level for audio portions of the media element. - */ - volume: number; - addTextTrack(kind: string, label?: string, language?: string): TextTrack; - /** - * Returns a string that specifies whether the client can play a given media resource type. - */ - canPlayType(type: string): string; - /** - * Resets the audio or video object and loads a new media resource. - */ - load(): void; - /** - * Clears all effects from the media pipeline. - */ - msClearEffects(): void; - msGetAsCastingSource(): any; - /** - * Inserts the specified audio effect into media pipeline. - */ - msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetMediaKeys(mediaKeys: MSMediaKeys): void; - /** - * Specifies the media protection manager for a given media pipeline. - */ - msSetMediaProtectionManager(mediaProtectionManager?: any): void; - /** - * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. - */ - pause(): void; - /** - * Loads and starts playback of a media resource. - */ - play(): void; - setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLMediaElement: { - prototype: HTMLMediaElement; - new(): HTMLMediaElement; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; -} - -interface HTMLMenuElement extends HTMLElement { - compact: boolean; - type: string; -} - -declare var HTMLMenuElement: { - prototype: HTMLMenuElement; - new(): HTMLMenuElement; -} - -interface HTMLMetaElement extends HTMLElement { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Gets or sets meta-information to associate with httpEquiv or name. - */ - content: string; - /** - * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. - */ - httpEquiv: string; - /** - * Sets or retrieves the value specified in the content attribute of the meta object. - */ - name: string; - /** - * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. - */ - scheme: string; - /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. - */ - url: string; -} - -declare var HTMLMetaElement: { - prototype: HTMLMetaElement; - new(): HTMLMetaElement; -} - -interface HTMLMeterElement extends HTMLElement { - high: number; - low: number; - max: number; - min: number; - optimum: number; - value: number; -} - -declare var HTMLMeterElement: { - prototype: HTMLMeterElement; - new(): HTMLMeterElement; -} - -interface HTMLModElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; -} - -declare var HTMLModElement: { - prototype: HTMLModElement; - new(): HTMLModElement; -} - -interface HTMLOListElement extends HTMLElement { - compact: boolean; - /** - * The starting number. - */ - start: number; - type: string; -} - -declare var HTMLOListElement: { - prototype: HTMLOListElement; - new(): HTMLOListElement; -} - -interface HTMLObjectElement extends HTMLElement, GetSVGDocument { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - /** - * Sets or retrieves the URL of the file containing the compiled Java class. - */ - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - declare: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the contained object. - */ - readonly object: any; - readonly readyState: number; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLObjectElement: { - prototype: HTMLObjectElement; - new(): HTMLObjectElement; -} - -interface HTMLOptGroupElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - readonly text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; -} - -declare var HTMLOptGroupElement: { - prototype: HTMLOptGroupElement; - new(): HTMLOptGroupElement; -} - -interface HTMLOptionElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; -} - -declare var HTMLOptionElement: { - prototype: HTMLOptionElement; - new(): HTMLOptionElement; - create(): HTMLOptionElement; -} - -interface HTMLOptionsCollection extends HTMLCollectionOf { - length: number; - selectedIndex: number; - add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; - remove(index: number): void; -} - -declare var HTMLOptionsCollection: { - prototype: HTMLOptionsCollection; - new(): HTMLOptionsCollection; -} - -interface HTMLParagraphElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - clear: string; -} - -declare var HTMLParagraphElement: { - prototype: HTMLParagraphElement; - new(): HTMLParagraphElement; -} - -interface HTMLParamElement extends HTMLElement { - /** - * Sets or retrieves the name of an input parameter for an element. - */ - name: string; - /** - * Sets or retrieves the content type of the resource designated by the value attribute. - */ - type: string; - /** - * Sets or retrieves the value of an input parameter for an element. - */ - value: string; - /** - * Sets or retrieves the data type of the value attribute. - */ - valueType: string; -} - -declare var HTMLParamElement: { - prototype: HTMLParamElement; - new(): HTMLParamElement; -} - -interface HTMLPictureElement extends HTMLElement { -} - -declare var HTMLPictureElement: { - prototype: HTMLPictureElement; - new(): HTMLPictureElement; -} - -interface HTMLPreElement extends HTMLElement { - /** - * Sets or gets a value that you can use to implement your own width functionality for the object. - */ - width: number; -} - -declare var HTMLPreElement: { - prototype: HTMLPreElement; - new(): HTMLPreElement; -} - -interface HTMLProgressElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Defines the maximum, or "done" value for a progress element. - */ - max: number; - /** - * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). - */ - readonly position: number; - /** - * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. - */ - value: number; -} - -declare var HTMLProgressElement: { - prototype: HTMLProgressElement; - new(): HTMLProgressElement; -} - -interface HTMLQuoteElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; -} - -declare var HTMLQuoteElement: { - prototype: HTMLQuoteElement; - new(): HTMLQuoteElement; -} - -interface HTMLScriptElement extends HTMLElement { - async: boolean; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the status of the script. - */ - defer: boolean; - /** - * Sets or retrieves the event for which the script is written. - */ - event: string; - /** - * Sets or retrieves the object that is bound to the event script. - */ - htmlFor: string; - /** - * Retrieves the URL to an external file that contains the source code or data. - */ - src: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - /** - * Sets or retrieves the MIME type for the associated scripting engine. - */ - type: string; - integrity: string; -} - -declare var HTMLScriptElement: { - prototype: HTMLScriptElement; - new(): HTMLScriptElement; -} - -interface HTMLSelectElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - readonly options: HTMLOptionsCollection; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the index of the selected option in a select object. - */ - selectedIndex: number; - selectedOptions: HTMLCollectionOf; - /** - * Sets or retrieves the number of rows in the list box. - */ - size: number; - /** - * Retrieves the type of select control based on the value of the MULTIPLE attribute. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Adds an element to the areas, controlRange, or options collection. - * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a select object or an object from an options collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a select object or an object from an options collection. - * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. - */ - namedItem(name: string): any; - /** - * Removes an element from the collection. - * @param index Number that specifies the zero-based index of the element to remove from the collection. - */ - remove(index?: number): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - [name: string]: any; -} - -declare var HTMLSelectElement: { - prototype: HTMLSelectElement; - new(): HTMLSelectElement; -} - -interface HTMLSourceElement extends HTMLElement { - /** - * Gets or sets the intended media type of the media source. - */ - media: string; - msKeySystem: string; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Gets or sets the MIME type of a media resource. - */ - type: string; -} - -declare var HTMLSourceElement: { - prototype: HTMLSourceElement; - new(): HTMLSourceElement; -} - -interface HTMLSpanElement extends HTMLElement { -} - -declare var HTMLSpanElement: { - prototype: HTMLSpanElement; - new(): HTMLSpanElement; -} - -interface HTMLStyleElement extends HTMLElement, LinkStyle { - disabled: boolean; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Retrieves the CSS language in which the style sheet is written. - */ - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLStyleElement: { - prototype: HTMLStyleElement; - new(): HTMLStyleElement; -} - -interface HTMLTableCaptionElement extends HTMLElement { - /** - * Sets or retrieves the alignment of the caption or legend. - */ - align: string; - /** - * Sets or retrieves whether the caption appears at the top or bottom of the table. - */ - vAlign: string; -} - -declare var HTMLTableCaptionElement: { - prototype: HTMLTableCaptionElement; - new(): HTMLTableCaptionElement; -} - -interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves abbreviated text for the object. - */ - abbr: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. - */ - axis: string; - bgColor: any; - /** - * Retrieves the position of the object in the cells collection of a row. - */ - readonly cellIndex: number; - /** - * Sets or retrieves the number columns in the table that the object should span. - */ - colSpan: number; - /** - * Sets or retrieves a list of header cells that provide information for the object. - */ - headers: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - /** - * Sets or retrieves how many rows in a table the cell should span. - */ - rowSpan: number; - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCellElement: { - prototype: HTMLTableCellElement; - new(): HTMLTableCellElement; -} - -interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves the alignment of the object relative to the display or table. - */ - align: string; - /** - * Sets or retrieves the number of columns in the group. - */ - span: number; - /** - * Sets or retrieves the width of the object. - */ - width: any; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableColElement: { - prototype: HTMLTableColElement; - new(): HTMLTableColElement; -} - -interface HTMLTableDataCellElement extends HTMLTableCellElement { -} - -declare var HTMLTableDataCellElement: { - prototype: HTMLTableDataCellElement; - new(): HTMLTableDataCellElement; -} - -interface HTMLTableElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - bgColor: any; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the caption object of a table. - */ - caption: HTMLTableCaptionElement; - /** - * Sets or retrieves the amount of space between the border of the cell and the content of the cell. - */ - cellPadding: string; - /** - * Sets or retrieves the amount of space between cells in a table. - */ - cellSpacing: string; - /** - * Sets or retrieves the number of columns in the table. - */ - cols: number; - /** - * Sets or retrieves the way the border frame around the table is displayed. - */ - frame: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Sets or retrieves which dividing lines (inner borders) are displayed. - */ - rules: string; - /** - * Sets or retrieves a description and/or structure of the object. - */ - summary: string; - /** - * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. - */ - tBodies: HTMLCollectionOf; - /** - * Retrieves the tFoot object of the table. - */ - tFoot: HTMLTableSectionElement; - /** - * Retrieves the tHead object of the table. - */ - tHead: HTMLTableSectionElement; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Creates an empty caption element in the table. - */ - createCaption(): HTMLTableCaptionElement; - /** - * Creates an empty tBody element in the table. - */ - createTBody(): HTMLTableSectionElement; - /** - * Creates an empty tFoot element in the table. - */ - createTFoot(): HTMLTableSectionElement; - /** - * Returns the tHead element object if successful, or null otherwise. - */ - createTHead(): HTMLTableSectionElement; - /** - * Deletes the caption element and its contents from the table. - */ - deleteCaption(): void; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Deletes the tFoot element and its contents from the table. - */ - deleteTFoot(): void; - /** - * Deletes the tHead element and its contents from the table. - */ - deleteTHead(): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; -} - -declare var HTMLTableElement: { - prototype: HTMLTableElement; - new(): HTMLTableElement; -} - -interface HTMLTableHeaderCellElement extends HTMLTableCellElement { - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; -} - -declare var HTMLTableHeaderCellElement: { - prototype: HTMLTableHeaderCellElement; - new(): HTMLTableHeaderCellElement; -} - -interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - bgColor: any; - /** - * Retrieves a collection of all cells in the table row. - */ - cells: HTMLCollectionOf; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Retrieves the position of the object in the rows collection for the table. - */ - readonly rowIndex: number; - /** - * Retrieves the position of the object in the collection. - */ - readonly sectionRowIndex: number; - /** - * Removes the specified cell from the table row, as well as from the cells collection. - * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. - */ - deleteCell(index?: number): void; - /** - * Creates a new cell in the table row, and adds the cell to the cells collection. - * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. - */ - insertCell(index?: number): HTMLTableDataCellElement; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableRowElement: { - prototype: HTMLTableRowElement; - new(): HTMLTableRowElement; -} - -interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableSectionElement: { - prototype: HTMLTableSectionElement; - new(): HTMLTableSectionElement; -} - -interface HTMLTemplateElement extends HTMLElement { - readonly content: DocumentFragment; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - -interface HTMLTextAreaElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the object. - */ - cols: number; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - /** - * Sets or retrieves the value indicated whether the content of the object is read-only. - */ - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: number; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - /** - * Sets or retrieves the value indicating whether the control is selected. - */ - status: any; - /** - * Retrieves the type of control. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Retrieves or sets the text in the entry field of the textArea element. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Sets or retrieves how to handle wordwrapping in the object. - */ - wrap: string; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Highlights the input area of a form element. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; -} - -declare var HTMLTextAreaElement: { - prototype: HTMLTextAreaElement; - new(): HTMLTextAreaElement; -} - -interface HTMLTitleElement extends HTMLElement { - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; -} - -declare var HTMLTitleElement: { - prototype: HTMLTitleElement; - new(): HTMLTitleElement; -} - -interface HTMLTrackElement extends HTMLElement { - default: boolean; - kind: string; - label: string; - readonly readyState: number; - src: string; - srclang: string; - readonly track: TextTrack; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -declare var HTMLTrackElement: { - prototype: HTMLTrackElement; - new(): HTMLTrackElement; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -interface HTMLUListElement extends HTMLElement { - compact: boolean; - type: string; -} - -declare var HTMLUListElement: { - prototype: HTMLUListElement; - new(): HTMLUListElement; -} - -interface HTMLUnknownElement extends HTMLElement { -} - -declare var HTMLUnknownElement: { - prototype: HTMLUnknownElement; - new(): HTMLUnknownElement; -} - -interface HTMLVideoElement extends HTMLMediaElement { - /** - * Gets or sets the height of the video element. - */ - height: number; - msHorizontalMirror: boolean; - readonly msIsLayoutOptimalForPlayback: boolean; - readonly msIsStereo3D: boolean; - msStereo3DPackingMode: string; - msStereo3DRenderMode: string; - msZoom: boolean; - onMSVideoFormatChanged: (this: this, ev: Event) => any; - onMSVideoFrameStepCompleted: (this: this, ev: Event) => any; - onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any; - /** - * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. - */ - poster: string; - /** - * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoHeight: number; - /** - * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoWidth: number; - readonly webkitDisplayingFullscreen: boolean; - readonly webkitSupportsFullscreen: boolean; - /** - * Gets or sets the width of the video element. - */ - width: number; - getVideoPlaybackQuality(): VideoPlaybackQuality; - msFrameStep(forward: boolean): void; - msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; - webkitEnterFullScreen(): void; - webkitEnterFullscreen(): void; - webkitExitFullScreen(): void; - webkitExitFullscreen(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLVideoElement: { - prototype: HTMLVideoElement; - new(): HTMLVideoElement; -} - -interface HashChangeEvent extends Event { - readonly newURL: string | null; - readonly oldURL: string | null; -} - -declare var HashChangeEvent: { - prototype: HashChangeEvent; - new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; -} - -interface History { - readonly length: number; - readonly state: any; - 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: { - prototype: History; - new(): History; -} - -interface IDBCursor { - readonly direction: string; - key: IDBKeyRange | IDBValidKey; - readonly primaryKey: any; - source: IDBObjectStore | IDBIndex; - advance(count: number): void; - continue(key?: IDBKeyRange | IDBValidKey): void; - delete(): IDBRequest; - update(value: any): IDBRequest; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -declare var IDBCursor: { - prototype: IDBCursor; - new(): IDBCursor; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -interface IDBCursorWithValue extends IDBCursor { - readonly value: any; -} - -declare var IDBCursorWithValue: { - prototype: IDBCursorWithValue; - new(): IDBCursorWithValue; -} - -interface IDBDatabase extends EventTarget { - readonly name: string; - readonly objectStoreNames: DOMStringList; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - version: number; - onversionchange: (ev: IDBVersionChangeEvent) => any; - close(): void; - createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; - deleteObjectStore(name: string): void; - transaction(storeNames: string | string[], mode?: string): IDBTransaction; - addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBDatabase: { - prototype: IDBDatabase; - new(): IDBDatabase; -} - -interface IDBFactory { - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; - open(name: string, version?: number): IDBOpenDBRequest; -} - -declare var IDBFactory: { - prototype: IDBFactory; - new(): IDBFactory; -} - -interface IDBIndex { - keyPath: string | string[]; - readonly name: string; - readonly objectStore: IDBObjectStore; - readonly unique: boolean; - multiEntry: boolean; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - get(key: IDBKeyRange | IDBValidKey): IDBRequest; - getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; -} - -declare var IDBIndex: { - prototype: IDBIndex; - new(): IDBIndex; -} - -interface IDBKeyRange { - readonly lower: any; - readonly lowerOpen: boolean; - readonly upper: any; - readonly upperOpen: boolean; -} - -declare var IDBKeyRange: { - prototype: IDBKeyRange; - new(): IDBKeyRange; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(lower: any, open?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - upperBound(upper: any, open?: boolean): IDBKeyRange; -} - -interface IDBObjectStore { - readonly indexNames: DOMStringList; - keyPath: string | string[]; - readonly name: string; - readonly transaction: IDBTransaction; - autoIncrement: boolean; - add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; - clear(): IDBRequest; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: IDBKeyRange | IDBValidKey): IDBRequest; - deleteIndex(indexName: string): void; - get(key: any): IDBRequest; - index(name: string): IDBIndex; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; -} - -declare var IDBObjectStore: { - prototype: IDBObjectStore; - new(): IDBObjectStore; -} - -interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: this, ev: Event) => any; - onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; - addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBOpenDBRequest: { - prototype: IDBOpenDBRequest; - new(): IDBOpenDBRequest; -} - -interface IDBRequest extends EventTarget { - readonly error: DOMError; - onerror: (this: this, ev: ErrorEvent) => any; - onsuccess: (this: this, ev: Event) => any; - readonly readyState: string; - readonly result: any; - source: IDBObjectStore | IDBIndex | IDBCursor; - readonly transaction: IDBTransaction; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBRequest: { - prototype: IDBRequest; - new(): IDBRequest; -} - -interface IDBTransaction extends EventTarget { - readonly db: IDBDatabase; - readonly error: DOMError; - readonly mode: string; - onabort: (this: this, ev: Event) => any; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBTransaction: { - prototype: IDBTransaction; - new(): IDBTransaction; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; -} - -interface IDBVersionChangeEvent extends Event { - readonly newVersion: number | null; - readonly oldVersion: number; -} - -declare var IDBVersionChangeEvent: { - prototype: IDBVersionChangeEvent; - new(): IDBVersionChangeEvent; -} - -interface ImageData { - data: Uint8ClampedArray; - readonly height: number; - readonly width: number; -} - -declare var ImageData: { - prototype: ImageData; - new(width: number, height: number): ImageData; - new(array: Uint8ClampedArray, width: number, height: number): ImageData; -} - -interface KeyboardEvent extends UIEvent { - readonly altKey: boolean; - readonly char: string | null; - readonly charCode: number; - readonly ctrlKey: boolean; - readonly key: string; - readonly keyCode: number; - readonly locale: string; - readonly location: number; - readonly metaKey: boolean; - 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; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -declare var KeyboardEvent: { - prototype: KeyboardEvent; - new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -interface ListeningStateChangedEvent extends Event { - readonly label: string; - readonly state: string; -} - -declare var ListeningStateChangedEvent: { - prototype: ListeningStateChangedEvent; - new(): ListeningStateChangedEvent; -} - -interface Location { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - pathname: string; - port: string; - protocol: string; - search: string; - assign(url: string): void; - reload(forcedReload?: boolean): void; - replace(url: string): void; - toString(): string; -} - -declare var Location: { - prototype: Location; - new(): Location; -} - -interface LongRunningScriptDetectedEvent extends Event { - readonly executionTime: number; - stopPageScriptExecution: boolean; -} - -declare var LongRunningScriptDetectedEvent: { - prototype: LongRunningScriptDetectedEvent; - new(): LongRunningScriptDetectedEvent; -} - -interface MSApp { - clearTemporaryWebDataAsync(): MSAppAsyncOperation; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createDataPackage(object: any): any; - createDataPackageFromSelection(): any; - createFileFromStorageFile(storageFile: any): File; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; - getViewId(view: any): any; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - pageHandlesAllApplicationActivations(enabled: boolean): void; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - terminateApp(exceptionObject: any): void; - readonly CURRENT: string; - readonly HIGH: string; - readonly IDLE: string; - readonly NORMAL: string; -} -declare var MSApp: MSApp; - -interface MSAppAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSAppAsyncOperation: { - prototype: MSAppAsyncOperation; - new(): MSAppAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; -} - -interface MSAssertion { - readonly id: string; - readonly type: string; -} - -declare var MSAssertion: { - prototype: MSAssertion; - new(): MSAssertion; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} - -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new(): MSBlobBuilder; -} - -interface MSCredentials { - getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; - makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; -} - -declare var MSCredentials: { - prototype: MSCredentials; - new(): MSCredentials; -} - -interface MSFIDOCredentialAssertion extends MSAssertion { - readonly algorithm: string | Algorithm; - readonly attestation: any; - readonly publicKey: string; - readonly transportHints: string[]; -} - -declare var MSFIDOCredentialAssertion: { - prototype: MSFIDOCredentialAssertion; - new(): MSFIDOCredentialAssertion; -} - -interface MSFIDOSignature { - readonly authnrData: string; - readonly clientData: string; - readonly signature: string; -} - -declare var MSFIDOSignature: { - prototype: MSFIDOSignature; - new(): MSFIDOSignature; -} - -interface MSFIDOSignatureAssertion extends MSAssertion { - readonly signature: MSFIDOSignature; -} - -declare var MSFIDOSignatureAssertion: { - prototype: MSFIDOSignatureAssertion; - new(): MSFIDOSignatureAssertion; -} - -interface MSGesture { - target: Element; - addPointer(pointerId: number): void; - stop(): void; -} - -declare var MSGesture: { - prototype: MSGesture; - new(): MSGesture; -} - -interface MSGestureEvent extends UIEvent { - readonly clientX: number; - readonly clientY: number; - readonly expansion: number; - readonly gestureObject: any; - readonly hwTimestamp: number; - readonly offsetX: number; - readonly offsetY: number; - readonly rotation: number; - readonly scale: number; - readonly screenX: number; - readonly screenY: number; - readonly translationX: number; - readonly translationY: number; - readonly velocityAngular: number; - readonly velocityExpansion: number; - readonly velocityX: number; - readonly velocityY: number; - initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -declare var MSGestureEvent: { - prototype: MSGestureEvent; - new(): MSGestureEvent; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -interface MSGraphicsTrust { - readonly constrictionActive: boolean; - readonly status: string; -} - -declare var MSGraphicsTrust: { - prototype: MSGraphicsTrust; - new(): MSGraphicsTrust; -} - -interface MSHTMLWebViewElement extends HTMLElement { - readonly canGoBack: boolean; - readonly canGoForward: boolean; - readonly containsFullScreenElement: boolean; - readonly documentTitle: string; - height: number; - readonly settings: MSWebViewSettings; - src: string; - width: number; - addWebAllowedObject(name: string, applicationObject: any): void; - buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; - capturePreviewToBlobAsync(): MSWebViewAsyncOperation; - captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; - getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; - getDeferredPermissionRequests(): DeferredPermissionRequest[]; - goBack(): void; - goForward(): void; - invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; - navigate(uri: string): void; - navigateToLocalStreamUri(source: string, streamResolver: any): void; - navigateToString(contents: string): void; - navigateWithHttpRequestMessage(requestMessage: any): void; - refresh(): void; - stop(): void; -} - -declare var MSHTMLWebViewElement: { - prototype: MSHTMLWebViewElement; - new(): MSHTMLWebViewElement; -} - -interface MSInputMethodContext extends EventTarget { - readonly compositionEndOffset: number; - readonly compositionStartOffset: number; - oncandidatewindowhide: (this: this, ev: Event) => any; - oncandidatewindowshow: (this: this, ev: Event) => any; - oncandidatewindowupdate: (this: this, ev: Event) => any; - readonly target: HTMLElement; - getCandidateWindowClientRect(): ClientRect; - getCompositionAlternatives(): string[]; - hasComposition(): boolean; - isCandidateWindowVisible(): boolean; - addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSInputMethodContext: { - prototype: MSInputMethodContext; - new(): MSInputMethodContext; -} - -interface MSManipulationEvent extends UIEvent { - readonly currentState: number; - readonly inertiaDestinationX: number; - readonly inertiaDestinationY: number; - readonly lastState: number; - initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -declare var MSManipulationEvent: { - prototype: MSManipulationEvent; - new(): MSManipulationEvent; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -interface MSMediaKeyError { - readonly code: number; - readonly systemCode: number; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -declare var MSMediaKeyError: { - prototype: MSMediaKeyError; - new(): MSMediaKeyError; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -interface MSMediaKeyMessageEvent extends Event { - readonly destinationURL: string | null; - readonly message: Uint8Array; -} - -declare var MSMediaKeyMessageEvent: { - prototype: MSMediaKeyMessageEvent; - new(): MSMediaKeyMessageEvent; -} - -interface MSMediaKeyNeededEvent extends Event { - readonly initData: Uint8Array | null; -} - -declare var MSMediaKeyNeededEvent: { - prototype: MSMediaKeyNeededEvent; - new(): MSMediaKeyNeededEvent; -} - -interface MSMediaKeySession extends EventTarget { - readonly error: MSMediaKeyError | null; - readonly keySystem: string; - readonly sessionId: string; - close(): void; - update(key: Uint8Array): void; -} - -declare var MSMediaKeySession: { - prototype: MSMediaKeySession; - new(): MSMediaKeySession; -} - -interface MSMediaKeys { - readonly keySystem: string; - createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; -} - -declare var MSMediaKeys: { - prototype: MSMediaKeys; - new(keySystem: string): MSMediaKeys; - isTypeSupported(keySystem: string, type?: string): boolean; - isTypeSupportedWithFeatures(keySystem: string, type?: string): string; -} - -interface MSPointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var MSPointerEvent: { - prototype: MSPointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; -} - -interface MSRangeCollection { - readonly length: number; - item(index: number): Range; - [index: number]: Range; -} - -declare var MSRangeCollection: { - prototype: MSRangeCollection; - new(): MSRangeCollection; -} - -interface MSSiteModeEvent extends Event { - readonly actionURL: string; - readonly buttonID: number; -} - -declare var MSSiteModeEvent: { - prototype: MSSiteModeEvent; - new(): MSSiteModeEvent; -} - -interface MSStream { - readonly type: string; - msClose(): void; - msDetachStream(): any; -} - -declare var MSStream: { - prototype: MSStream; - new(): MSStream; -} - -interface MSStreamReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBinaryString(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSStreamReader: { - prototype: MSStreamReader; - new(): MSStreamReader; -} - -interface MSWebViewAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - readonly target: MSHTMLWebViewElement; - readonly type: number; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSWebViewAsyncOperation: { - prototype: MSWebViewAsyncOperation; - new(): MSWebViewAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; -} - -interface MSWebViewSettings { - isIndexedDBEnabled: boolean; - isJavaScriptEnabled: boolean; -} - -declare var MSWebViewSettings: { - prototype: MSWebViewSettings; - new(): MSWebViewSettings; -} - -interface MediaDeviceInfo { - readonly deviceId: string; - readonly groupId: string; - readonly kind: string; - readonly label: string; -} - -declare var MediaDeviceInfo: { - prototype: MediaDeviceInfo; - new(): MediaDeviceInfo; -} - -interface MediaDevices extends EventTarget { - ondevicechange: (this: this, ev: Event) => any; - enumerateDevices(): any; - getSupportedConstraints(): MediaTrackSupportedConstraints; - getUserMedia(constraints: MediaStreamConstraints): PromiseLike; - addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaDevices: { - prototype: MediaDevices; - new(): MediaDevices; -} - -interface MediaElementAudioSourceNode extends AudioNode { -} - -declare var MediaElementAudioSourceNode: { - prototype: MediaElementAudioSourceNode; - new(): MediaElementAudioSourceNode; -} - -interface MediaEncryptedEvent extends Event { - readonly initData: ArrayBuffer | null; - readonly initDataType: string; -} - -declare var MediaEncryptedEvent: { - prototype: MediaEncryptedEvent; - new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; -} - -interface MediaError { - readonly code: number; - readonly msExtendedCode: number; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -declare var MediaError: { - prototype: MediaError; - new(): MediaError; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -interface MediaKeyMessageEvent extends Event { - readonly message: ArrayBuffer; - readonly messageType: string; -} - -declare var MediaKeyMessageEvent: { - prototype: MediaKeyMessageEvent; - new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; -} - -interface MediaKeySession extends EventTarget { - readonly closed: PromiseLike; - readonly expiration: number; - readonly keyStatuses: MediaKeyStatusMap; - readonly sessionId: string; - close(): PromiseLike; - generateRequest(initDataType: string, initData: any): PromiseLike; - load(sessionId: string): PromiseLike; - remove(): PromiseLike; - update(response: any): PromiseLike; -} - -declare var MediaKeySession: { - prototype: MediaKeySession; - new(): MediaKeySession; -} - -interface MediaKeyStatusMap { - readonly size: number; - forEach(callback: ForEachCallback): void; - get(keyId: any): string; - has(keyId: any): boolean; -} - -declare var MediaKeyStatusMap: { - prototype: MediaKeyStatusMap; - new(): MediaKeyStatusMap; -} - -interface MediaKeySystemAccess { - readonly keySystem: string; - createMediaKeys(): PromiseLike; - getConfiguration(): MediaKeySystemConfiguration; -} - -declare var MediaKeySystemAccess: { - prototype: MediaKeySystemAccess; - new(): MediaKeySystemAccess; -} - -interface MediaKeys { - createSession(sessionType?: string): MediaKeySession; - setServerCertificate(serverCertificate: any): PromiseLike; -} - -declare var MediaKeys: { - prototype: MediaKeys; - new(): MediaKeys; -} - -interface MediaList { - readonly length: number; - mediaText: string; - appendMedium(newMedium: string): void; - deleteMedium(oldMedium: string): void; - item(index: number): string; - toString(): string; - [index: number]: string; -} - -declare var MediaList: { - prototype: MediaList; - new(): MediaList; -} - -interface MediaQueryList { - readonly matches: boolean; - readonly media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -declare var MediaQueryList: { - prototype: MediaQueryList; - new(): MediaQueryList; -} - -interface MediaSource extends EventTarget { - readonly activeSourceBuffers: SourceBufferList; - duration: number; - readonly readyState: string; - readonly sourceBuffers: SourceBufferList; - addSourceBuffer(type: string): SourceBuffer; - endOfStream(error?: number): void; - removeSourceBuffer(sourceBuffer: SourceBuffer): void; -} - -declare var MediaSource: { - prototype: MediaSource; - new(): MediaSource; - isTypeSupported(type: string): boolean; -} - -interface MediaStream extends EventTarget { - readonly active: boolean; - readonly id: string; - onactive: (this: this, ev: Event) => any; - onaddtrack: (this: this, ev: TrackEvent) => any; - oninactive: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - addTrack(track: MediaStreamTrack): void; - clone(): MediaStream; - getAudioTracks(): MediaStreamTrack[]; - getTrackById(trackId: string): MediaStreamTrack | null; - getTracks(): MediaStreamTrack[]; - getVideoTracks(): MediaStreamTrack[]; - removeTrack(track: MediaStreamTrack): void; - stop(): void; - addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStream: { - prototype: MediaStream; - new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; -} - -interface MediaStreamAudioSourceNode extends AudioNode { -} - -declare var MediaStreamAudioSourceNode: { - prototype: MediaStreamAudioSourceNode; - new(): MediaStreamAudioSourceNode; -} - -interface MediaStreamError { - readonly constraintName: string | null; - readonly message: string | null; - readonly name: string; -} - -declare var MediaStreamError: { - prototype: MediaStreamError; - new(): MediaStreamError; -} - -interface MediaStreamErrorEvent extends Event { - readonly error: MediaStreamError | null; -} - -declare var MediaStreamErrorEvent: { - prototype: MediaStreamErrorEvent; - new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; -} - -interface MediaStreamTrack extends EventTarget { - enabled: boolean; - readonly id: string; - readonly kind: string; - readonly label: string; - readonly muted: boolean; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onmute: (this: this, ev: Event) => any; - onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any; - onunmute: (this: this, ev: Event) => any; - readonly readonly: boolean; - readonly readyState: string; - readonly remote: boolean; - applyConstraints(constraints: MediaTrackConstraints): PromiseLike; - clone(): MediaStreamTrack; - getCapabilities(): MediaTrackCapabilities; - getConstraints(): MediaTrackConstraints; - getSettings(): MediaTrackSettings; - stop(): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStreamTrack: { - prototype: MediaStreamTrack; - new(): MediaStreamTrack; -} - -interface MediaStreamTrackEvent extends Event { - readonly track: MediaStreamTrack; -} - -declare var MediaStreamTrackEvent: { - prototype: MediaStreamTrackEvent; - new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; -} - -interface MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; -} - -declare var MessageChannel: { - prototype: MessageChannel; - new(): MessageChannel; -} - -interface MessageEvent extends Event { - readonly data: any; - readonly origin: string; - readonly ports: any; - readonly source: Window; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; -} - -declare var MessageEvent: { - prototype: MessageEvent; - new(type: string, eventInitDict?: MessageEventInit): MessageEvent; -} - -interface MessagePort extends EventTarget { - onmessage: (this: this, ev: MessageEvent) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MessagePort: { - prototype: MessagePort; - new(): MessagePort; -} - -interface MimeType { - readonly description: string; - readonly enabledPlugin: Plugin; - readonly suffixes: string; - readonly type: string; -} - -declare var MimeType: { - prototype: MimeType; - new(): MimeType; -} - -interface MimeTypeArray { - readonly length: number; - item(index: number): Plugin; - namedItem(type: string): Plugin; - [index: number]: Plugin; -} - -declare var MimeTypeArray: { - prototype: MimeTypeArray; - new(): MimeTypeArray; -} - -interface MouseEvent extends UIEvent { - readonly altKey: boolean; - readonly button: number; - readonly buttons: number; - readonly clientX: number; - readonly clientY: number; - readonly ctrlKey: boolean; - readonly fromElement: Element; - readonly layerX: number; - readonly layerY: number; - readonly metaKey: boolean; - readonly movementX: number; - readonly movementY: number; - readonly offsetX: number; - readonly offsetY: number; - readonly pageX: number; - readonly pageY: number; - readonly relatedTarget: EventTarget; - readonly screenX: number; - readonly screenY: number; - readonly shiftKey: boolean; - readonly toElement: Element; - readonly which: number; - readonly x: number; - readonly y: number; - getModifierState(keyArg: string): boolean; - initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; -} - -declare var MouseEvent: { - prototype: MouseEvent; - new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; -} - -interface MutationEvent extends Event { - readonly attrChange: number; - readonly attrName: string; - readonly newValue: string; - readonly prevValue: string; - readonly relatedNode: Node; - initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -declare var MutationEvent: { - prototype: MutationEvent; - new(): MutationEvent; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -interface MutationObserver { - disconnect(): void; - observe(target: Node, options: MutationObserverInit): void; - takeRecords(): MutationRecord[]; -} - -declare var MutationObserver: { - prototype: MutationObserver; - new(callback: MutationCallback): MutationObserver; -} - -interface MutationRecord { - readonly addedNodes: NodeList; - readonly attributeName: string | null; - readonly attributeNamespace: string | null; - readonly nextSibling: Node | null; - readonly oldValue: string | null; - readonly previousSibling: Node | null; - readonly removedNodes: NodeList; - readonly target: Node; - readonly type: string; -} - -declare var MutationRecord: { - prototype: MutationRecord; - new(): MutationRecord; -} - -interface NamedNodeMap { - readonly length: number; - getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - item(index: number): Attr; - removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - setNamedItem(arg: Attr): Attr; - setNamedItemNS(arg: Attr): Attr; - [index: number]: Attr; -} - -declare var NamedNodeMap: { - prototype: NamedNodeMap; - new(): NamedNodeMap; -} - -interface NavigationCompletedEvent extends NavigationEvent { - readonly isSuccess: boolean; - readonly webErrorStatus: number; -} - -declare var NavigationCompletedEvent: { - prototype: NavigationCompletedEvent; - new(): NavigationCompletedEvent; -} - -interface NavigationEvent extends Event { - readonly uri: string; -} - -declare var NavigationEvent: { - prototype: NavigationEvent; - new(): NavigationEvent; -} - -interface NavigationEventWithReferrer extends NavigationEvent { - readonly referer: string; -} - -declare var NavigationEventWithReferrer: { - prototype: NavigationEventWithReferrer; - new(): NavigationEventWithReferrer; -} - -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { - readonly appCodeName: string; - readonly cookieEnabled: boolean; - readonly language: string; - readonly maxTouchPoints: number; - readonly mimeTypes: MimeTypeArray; - readonly msManipulationViewsEnabled: boolean; - readonly msMaxTouchPoints: number; - readonly msPointerEnabled: boolean; - readonly plugins: PluginArray; - readonly pointerEnabled: boolean; - readonly webdriver: boolean; - readonly hardwareConcurrency: number; - getGamepads(): Gamepad[]; - javaEnabled(): boolean; - msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; - vibrate(pattern: number | number[]): boolean; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Navigator: { - prototype: Navigator; - new(): Navigator; -} - -interface Node extends EventTarget { - readonly attributes: NamedNodeMap; - readonly baseURI: string | null; - readonly childNodes: NodeList; - readonly firstChild: Node | null; - readonly lastChild: Node | null; - readonly localName: string | null; - readonly namespaceURI: string | null; - readonly nextSibling: Node | null; - readonly nodeName: string; - readonly nodeType: number; - nodeValue: string | null; - readonly ownerDocument: Document; - readonly parentElement: HTMLElement | null; - readonly parentNode: Node | null; - readonly previousSibling: Node | null; - textContent: string | null; - appendChild(newChild: Node): Node; - cloneNode(deep?: boolean): Node; - compareDocumentPosition(other: Node): number; - contains(child: Node): boolean; - hasAttributes(): boolean; - hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild: Node | null): Node; - isDefaultNamespace(namespaceURI: string | null): boolean; - isEqualNode(arg: Node): boolean; - isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string | null): string | null; - lookupPrefix(namespaceURI: string | null): string | null; - normalize(): void; - removeChild(oldChild: Node): Node; - replaceChild(newChild: Node, oldChild: Node): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -declare var Node: { - prototype: Node; - new(): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -interface NodeFilter { - acceptNode(n: Node): number; -} - -declare var NodeFilter: { - readonly FILTER_ACCEPT: number; - readonly FILTER_REJECT: number; - readonly FILTER_SKIP: number; - readonly SHOW_ALL: number; - readonly SHOW_ATTRIBUTE: number; - readonly SHOW_CDATA_SECTION: number; - readonly SHOW_COMMENT: number; - readonly SHOW_DOCUMENT: number; - readonly SHOW_DOCUMENT_FRAGMENT: number; - readonly SHOW_DOCUMENT_TYPE: number; - readonly SHOW_ELEMENT: number; - readonly SHOW_ENTITY: number; - readonly SHOW_ENTITY_REFERENCE: number; - readonly SHOW_NOTATION: number; - readonly SHOW_PROCESSING_INSTRUCTION: number; - readonly SHOW_TEXT: number; -} - -interface NodeIterator { - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - detach(): void; - nextNode(): Node; - previousNode(): Node; -} - -declare var NodeIterator: { - prototype: NodeIterator; - new(): NodeIterator; -} - -interface NodeList { - readonly length: number; - item(index: number): Node; - [index: number]: Node; -} - -declare var NodeList: { - prototype: NodeList; - new(): NodeList; -} - -interface OES_element_index_uint { -} - -declare var OES_element_index_uint: { - prototype: OES_element_index_uint; - new(): OES_element_index_uint; -} - -interface OES_standard_derivatives { - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -declare var OES_standard_derivatives: { - prototype: OES_standard_derivatives; - new(): OES_standard_derivatives; - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -interface OES_texture_float { -} - -declare var OES_texture_float: { - prototype: OES_texture_float; - new(): OES_texture_float; -} - -interface OES_texture_float_linear { -} - -declare var OES_texture_float_linear: { - prototype: OES_texture_float_linear; - new(): OES_texture_float_linear; -} - -interface OfflineAudioCompletionEvent extends Event { - readonly renderedBuffer: AudioBuffer; -} - -declare var OfflineAudioCompletionEvent: { - prototype: OfflineAudioCompletionEvent; - new(): OfflineAudioCompletionEvent; -} - -interface OfflineAudioContext extends AudioContext { - oncomplete: (this: this, ev: Event) => any; - startRendering(): PromiseLike; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OfflineAudioContext: { - prototype: OfflineAudioContext; - new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; -} - -interface OscillatorNode extends AudioNode { - readonly detune: AudioParam; - readonly frequency: AudioParam; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - type: string; - setPeriodicWave(periodicWave: PeriodicWave): void; - start(when?: number): void; - stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OscillatorNode: { - prototype: OscillatorNode; - new(): OscillatorNode; -} - -interface OverflowEvent extends UIEvent { - readonly horizontalOverflow: boolean; - readonly orient: number; - readonly verticalOverflow: boolean; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -declare var OverflowEvent: { - prototype: OverflowEvent; - new(): OverflowEvent; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -interface PageTransitionEvent extends Event { - readonly persisted: boolean; -} - -declare var PageTransitionEvent: { - prototype: PageTransitionEvent; - new(): PageTransitionEvent; -} - -interface PannerNode extends AudioNode { - coneInnerAngle: number; - coneOuterAngle: number; - coneOuterGain: number; - distanceModel: string; - maxDistance: number; - panningModel: string; - refDistance: number; - rolloffFactor: number; - setOrientation(x: number, y: number, z: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var PannerNode: { - prototype: PannerNode; - new(): PannerNode; -} - -interface PerfWidgetExternal { - readonly activeNetworkRequestCount: number; - readonly averageFrameTime: number; - readonly averagePaintTime: number; - readonly extraInformationEnabled: boolean; - readonly independentRenderingEnabled: boolean; - readonly irDisablingContentString: string; - readonly irStatusAvailable: boolean; - readonly maxCpuSpeed: number; - readonly paintRequestsPerSecond: number; - readonly performanceCounter: number; - readonly performanceCounterFrequency: number; - addEventListener(eventType: string, callback: Function): void; - getMemoryUsage(): number; - getProcessCpuUsage(): number; - getRecentCpuUsage(last: number | null): any; - getRecentFrames(last: number | null): any; - getRecentMemoryUsage(last: number | null): any; - getRecentPaintRequests(last: number | null): any; - removeEventListener(eventType: string, callback: Function): void; - repositionWindow(x: number, y: number): void; - resizeWindow(width: number, height: number): void; -} - -declare var PerfWidgetExternal: { - prototype: PerfWidgetExternal; - new(): PerfWidgetExternal; -} - -interface Performance { - readonly navigation: PerformanceNavigation; - readonly timing: PerformanceTiming; - clearMarks(markName?: string): void; - clearMeasures(measureName?: string): void; - clearResourceTimings(): void; - getEntries(): any; - getEntriesByName(name: string, entryType?: string): any; - getEntriesByType(entryType: string): any; - getMarks(markName?: string): any; - getMeasures(measureName?: string): any; - mark(markName: string): void; - measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - now(): number; - setResourceTimingBufferSize(maxSize: number): void; - toJSON(): any; -} - -declare var Performance: { - prototype: Performance; - new(): Performance; -} - -interface PerformanceEntry { - readonly duration: number; - readonly entryType: string; - readonly name: string; - readonly startTime: number; -} - -declare var PerformanceEntry: { - prototype: PerformanceEntry; - new(): PerformanceEntry; -} - -interface PerformanceMark extends PerformanceEntry { -} - -declare var PerformanceMark: { - prototype: PerformanceMark; - new(): PerformanceMark; -} - -interface PerformanceMeasure extends PerformanceEntry { -} - -declare var PerformanceMeasure: { - prototype: PerformanceMeasure; - new(): PerformanceMeasure; -} - -interface PerformanceNavigation { - readonly redirectCount: number; - readonly type: number; - toJSON(): any; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -declare var PerformanceNavigation: { - prototype: PerformanceNavigation; - new(): PerformanceNavigation; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -interface PerformanceNavigationTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly navigationStart: number; - readonly redirectCount: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly type: string; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; -} - -declare var PerformanceNavigationTiming: { - prototype: PerformanceNavigationTiming; - new(): PerformanceNavigationTiming; -} - -interface PerformanceResourceTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly initiatorType: string; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; -} - -declare var PerformanceResourceTiming: { - prototype: PerformanceResourceTiming; - new(): PerformanceResourceTiming; -} - -interface PerformanceTiming { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly msFirstPaint: number; - readonly navigationStart: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; - readonly secureConnectionStart: number; - toJSON(): any; -} - -declare var PerformanceTiming: { - prototype: PerformanceTiming; - new(): PerformanceTiming; -} - -interface PeriodicWave { -} - -declare var PeriodicWave: { - prototype: PeriodicWave; - new(): PeriodicWave; -} - -interface PermissionRequest extends DeferredPermissionRequest { - readonly state: string; - defer(): void; -} - -declare var PermissionRequest: { - prototype: PermissionRequest; - new(): PermissionRequest; -} - -interface PermissionRequestedEvent extends Event { - readonly permissionRequest: PermissionRequest; -} - -declare var PermissionRequestedEvent: { - prototype: PermissionRequestedEvent; - new(): PermissionRequestedEvent; -} - -interface Plugin { - readonly description: string; - readonly filename: string; - readonly length: number; - readonly name: string; - readonly version: string; - item(index: number): MimeType; - namedItem(type: string): MimeType; - [index: number]: MimeType; -} - -declare var Plugin: { - prototype: Plugin; - new(): Plugin; -} - -interface PluginArray { - readonly length: number; - item(index: number): Plugin; - namedItem(name: string): Plugin; - refresh(reload?: boolean): void; - [index: number]: Plugin; -} - -declare var PluginArray: { - prototype: PluginArray; - new(): PluginArray; -} - -interface PointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var PointerEvent: { - prototype: PointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; -} - -interface PopStateEvent extends Event { - readonly state: any; - initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; -} - -declare var PopStateEvent: { - prototype: PopStateEvent; - new(): PopStateEvent; -} - -interface Position { - readonly coords: Coordinates; - readonly timestamp: number; -} - -declare var Position: { - prototype: Position; - new(): Position; -} - -interface PositionError { - readonly code: number; - readonly message: string; - toString(): string; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -declare var PositionError: { - prototype: PositionError; - new(): PositionError; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -interface ProcessingInstruction extends CharacterData { - readonly target: string; -} - -declare var ProcessingInstruction: { - prototype: ProcessingInstruction; - new(): ProcessingInstruction; -} - -interface ProgressEvent extends Event { - readonly lengthComputable: boolean; - readonly loaded: number; - readonly total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -declare var ProgressEvent: { - prototype: ProgressEvent; - new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; -} - -interface RTCDTMFToneChangeEvent extends Event { - readonly tone: string; -} - -declare var RTCDTMFToneChangeEvent: { - prototype: RTCDTMFToneChangeEvent; - new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; -} - -interface RTCDtlsTransport extends RTCStatsProvider { - ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly state: string; - readonly transport: RTCIceTransport; - getLocalParameters(): RTCDtlsParameters; - getRemoteCertificates(): ArrayBuffer[]; - getRemoteParameters(): RTCDtlsParameters | null; - start(remoteParameters: RTCDtlsParameters): void; - stop(): void; - addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtlsTransport: { - prototype: RTCDtlsTransport; - new(transport: RTCIceTransport): RTCDtlsTransport; -} - -interface RTCDtlsTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCDtlsTransportStateChangedEvent: { - prototype: RTCDtlsTransportStateChangedEvent; - new(): RTCDtlsTransportStateChangedEvent; -} - -interface RTCDtmfSender extends EventTarget { - readonly canInsertDTMF: boolean; - readonly duration: number; - readonly interToneGap: number; - ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any; - readonly sender: RTCRtpSender; - readonly toneBuffer: string; - insertDTMF(tones: string, duration?: number, interToneGap?: number): void; - addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtmfSender: { - prototype: RTCDtmfSender; - new(sender: RTCRtpSender): RTCDtmfSender; -} - -interface RTCIceCandidatePairChangedEvent extends Event { - readonly pair: RTCIceCandidatePair; -} - -declare var RTCIceCandidatePairChangedEvent: { - prototype: RTCIceCandidatePairChangedEvent; - new(): RTCIceCandidatePairChangedEvent; -} - -interface RTCIceGatherer extends RTCStatsProvider { - readonly component: string; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null; - createAssociatedGatherer(): RTCIceGatherer; - getLocalCandidates(): RTCIceCandidate[]; - getLocalParameters(): RTCIceParameters; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceGatherer: { - prototype: RTCIceGatherer; - new(options: RTCIceGatherOptions): RTCIceGatherer; -} - -interface RTCIceGathererEvent extends Event { - readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; -} - -declare var RTCIceGathererEvent: { - prototype: RTCIceGathererEvent; - new(): RTCIceGathererEvent; -} - -interface RTCIceTransport extends RTCStatsProvider { - readonly component: string; - readonly iceGatherer: RTCIceGatherer | null; - oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null; - onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null; - readonly role: string; - readonly state: string; - addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; - createAssociatedTransport(): RTCIceTransport; - getNominatedCandidatePair(): RTCIceCandidatePair | null; - getRemoteCandidates(): RTCIceCandidate[]; - getRemoteParameters(): RTCIceParameters | null; - setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; - start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; - stop(): void; - addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceTransport: { - prototype: RTCIceTransport; - new(): RTCIceTransport; -} - -interface RTCIceTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCIceTransportStateChangedEvent: { - prototype: RTCIceTransportStateChangedEvent; - new(): RTCIceTransportStateChangedEvent; -} - -interface RTCRtpReceiver extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack | null; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - getContributingSources(): RTCRtpContributingSource[]; - receive(parameters: RTCRtpParameters): void; - requestSendCSRC(csrc: number): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpReceiver: { - prototype: RTCRtpReceiver; - new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCRtpSender extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - send(parameters: RTCRtpParameters): void; - setTrack(track: MediaStreamTrack): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpSender: { - prototype: RTCRtpSender; - new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCSrtpSdesTransport extends EventTarget { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly transport: RTCIceTransport; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCSrtpSdesTransport: { - prototype: RTCSrtpSdesTransport; - new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; - getLocalParameters(): RTCSrtpSdesParameters[]; -} - -interface RTCSsrcConflictEvent extends Event { - readonly ssrc: number; -} - -declare var RTCSsrcConflictEvent: { - prototype: RTCSsrcConflictEvent; - new(): RTCSsrcConflictEvent; -} - -interface RTCStatsProvider extends EventTarget { - getStats(): PromiseLike; - msGetStats(): PromiseLike; -} - -declare var RTCStatsProvider: { - prototype: RTCStatsProvider; - new(): RTCStatsProvider; -} - -interface Range { - readonly collapsed: boolean; - readonly commonAncestorContainer: Node; - readonly endContainer: Node; - readonly endOffset: number; - readonly startContainer: Node; - readonly startOffset: number; - cloneContents(): DocumentFragment; - cloneRange(): Range; - collapse(toStart: boolean): void; - compareBoundaryPoints(how: number, sourceRange: Range): number; - createContextualFragment(fragment: string): DocumentFragment; - deleteContents(): void; - detach(): void; - expand(Unit: string): boolean; - extractContents(): DocumentFragment; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - insertNode(newNode: Node): void; - selectNode(refNode: Node): void; - selectNodeContents(refNode: Node): void; - setEnd(refNode: Node, offset: number): void; - setEndAfter(refNode: Node): void; - setEndBefore(refNode: Node): void; - setStart(refNode: Node, offset: number): void; - setStartAfter(refNode: Node): void; - setStartBefore(refNode: Node): void; - surroundContents(newParent: Node): void; - toString(): string; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -declare var Range: { - prototype: Range; - new(): Range; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly target: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGAElement: { - prototype: SVGAElement; - new(): SVGAElement; -} - -interface SVGAngle { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -declare var SVGAngle: { - prototype: SVGAngle; - new(): SVGAngle; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -interface SVGAnimatedAngle { - readonly animVal: SVGAngle; - readonly baseVal: SVGAngle; -} - -declare var SVGAnimatedAngle: { - prototype: SVGAnimatedAngle; - new(): SVGAnimatedAngle; -} - -interface SVGAnimatedBoolean { - readonly animVal: boolean; - baseVal: boolean; -} - -declare var SVGAnimatedBoolean: { - prototype: SVGAnimatedBoolean; - new(): SVGAnimatedBoolean; -} - -interface SVGAnimatedEnumeration { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedEnumeration: { - prototype: SVGAnimatedEnumeration; - new(): SVGAnimatedEnumeration; -} - -interface SVGAnimatedInteger { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedInteger: { - prototype: SVGAnimatedInteger; - new(): SVGAnimatedInteger; -} - -interface SVGAnimatedLength { - readonly animVal: SVGLength; - readonly baseVal: SVGLength; -} - -declare var SVGAnimatedLength: { - prototype: SVGAnimatedLength; - new(): SVGAnimatedLength; -} - -interface SVGAnimatedLengthList { - readonly animVal: SVGLengthList; - readonly baseVal: SVGLengthList; -} - -declare var SVGAnimatedLengthList: { - prototype: SVGAnimatedLengthList; - new(): SVGAnimatedLengthList; -} - -interface SVGAnimatedNumber { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedNumber: { - prototype: SVGAnimatedNumber; - new(): SVGAnimatedNumber; -} - -interface SVGAnimatedNumberList { - readonly animVal: SVGNumberList; - readonly baseVal: SVGNumberList; -} - -declare var SVGAnimatedNumberList: { - prototype: SVGAnimatedNumberList; - new(): SVGAnimatedNumberList; -} - -interface SVGAnimatedPreserveAspectRatio { - readonly animVal: SVGPreserveAspectRatio; - readonly baseVal: SVGPreserveAspectRatio; -} - -declare var SVGAnimatedPreserveAspectRatio: { - prototype: SVGAnimatedPreserveAspectRatio; - new(): SVGAnimatedPreserveAspectRatio; -} - -interface SVGAnimatedRect { - readonly animVal: SVGRect; - readonly baseVal: SVGRect; -} - -declare var SVGAnimatedRect: { - prototype: SVGAnimatedRect; - new(): SVGAnimatedRect; -} - -interface SVGAnimatedString { - readonly animVal: string; - baseVal: string; -} - -declare var SVGAnimatedString: { - prototype: SVGAnimatedString; - new(): SVGAnimatedString; -} - -interface SVGAnimatedTransformList { - readonly animVal: SVGTransformList; - readonly baseVal: SVGTransformList; -} - -declare var SVGAnimatedTransformList: { - prototype: SVGAnimatedTransformList; - new(): SVGAnimatedTransformList; -} - -interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGCircleElement: { - prototype: SVGCircleElement; - new(): SVGCircleElement; -} - -interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly clipPathUnits: SVGAnimatedEnumeration; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGClipPathElement: { - prototype: SVGClipPathElement; - new(): SVGClipPathElement; -} - -interface SVGComponentTransferFunctionElement extends SVGElement { - readonly amplitude: SVGAnimatedNumber; - readonly exponent: SVGAnimatedNumber; - readonly intercept: SVGAnimatedNumber; - readonly offset: SVGAnimatedNumber; - readonly slope: SVGAnimatedNumber; - readonly tableValues: SVGAnimatedNumberList; - readonly type: SVGAnimatedEnumeration; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -declare var SVGComponentTransferFunctionElement: { - prototype: SVGComponentTransferFunctionElement; - new(): SVGComponentTransferFunctionElement; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDefsElement: { - prototype: SVGDefsElement; - new(): SVGDefsElement; -} - -interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDescElement: { - prototype: SVGDescElement; - new(): SVGDescElement; -} - -interface SVGElement extends Element { - onclick: (this: this, ev: MouseEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - onfocusin: (this: this, ev: FocusEvent) => any; - onfocusout: (this: this, ev: FocusEvent) => any; - onload: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - readonly ownerSVGElement: SVGSVGElement; - readonly viewportElement: SVGElement; - xmlbase: string; - className: any; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var SVGElement: { - prototype: SVGElement; - new(): SVGElement; -} - -interface SVGElementInstance extends EventTarget { - readonly childNodes: SVGElementInstanceList; - readonly correspondingElement: SVGElement; - readonly correspondingUseElement: SVGUseElement; - readonly firstChild: SVGElementInstance; - readonly lastChild: SVGElementInstance; - readonly nextSibling: SVGElementInstance; - readonly parentNode: SVGElementInstance; - readonly previousSibling: SVGElementInstance; -} - -declare var SVGElementInstance: { - prototype: SVGElementInstance; - new(): SVGElementInstance; -} - -interface SVGElementInstanceList { - readonly length: number; - item(index: number): SVGElementInstance; -} - -declare var SVGElementInstanceList: { - prototype: SVGElementInstanceList; - new(): SVGElementInstanceList; -} - -interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGEllipseElement: { - prototype: SVGEllipseElement; - new(): SVGEllipseElement; -} - -interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly mode: SVGAnimatedEnumeration; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEBlendElement: { - prototype: SVGFEBlendElement; - new(): SVGFEBlendElement; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; -} - -interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly type: SVGAnimatedEnumeration; - readonly values: SVGAnimatedNumberList; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEColorMatrixElement: { - prototype: SVGFEColorMatrixElement; - new(): SVGFEColorMatrixElement; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; -} - -interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEComponentTransferElement: { - prototype: SVGFEComponentTransferElement; - new(): SVGFEComponentTransferElement; -} - -interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly k1: SVGAnimatedNumber; - readonly k2: SVGAnimatedNumber; - readonly k3: SVGAnimatedNumber; - readonly k4: SVGAnimatedNumber; - readonly operator: SVGAnimatedEnumeration; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFECompositeElement: { - prototype: SVGFECompositeElement; - new(): SVGFECompositeElement; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; -} - -interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly bias: SVGAnimatedNumber; - readonly divisor: SVGAnimatedNumber; - readonly edgeMode: SVGAnimatedEnumeration; - readonly in1: SVGAnimatedString; - readonly kernelMatrix: SVGAnimatedNumberList; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly orderX: SVGAnimatedInteger; - readonly orderY: SVGAnimatedInteger; - readonly preserveAlpha: SVGAnimatedBoolean; - readonly targetX: SVGAnimatedInteger; - readonly targetY: SVGAnimatedInteger; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEConvolveMatrixElement: { - prototype: SVGFEConvolveMatrixElement; - new(): SVGFEConvolveMatrixElement; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; -} - -interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly diffuseConstant: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDiffuseLightingElement: { - prototype: SVGFEDiffuseLightingElement; - new(): SVGFEDiffuseLightingElement; -} - -interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly scale: SVGAnimatedNumber; - readonly xChannelSelector: SVGAnimatedEnumeration; - readonly yChannelSelector: SVGAnimatedEnumeration; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDisplacementMapElement: { - prototype: SVGFEDisplacementMapElement; - new(): SVGFEDisplacementMapElement; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; -} - -interface SVGFEDistantLightElement extends SVGElement { - readonly azimuth: SVGAnimatedNumber; - readonly elevation: SVGAnimatedNumber; -} - -declare var SVGFEDistantLightElement: { - prototype: SVGFEDistantLightElement; - new(): SVGFEDistantLightElement; -} - -interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEFloodElement: { - prototype: SVGFEFloodElement; - new(): SVGFEFloodElement; -} - -interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncAElement: { - prototype: SVGFEFuncAElement; - new(): SVGFEFuncAElement; -} - -interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncBElement: { - prototype: SVGFEFuncBElement; - new(): SVGFEFuncBElement; -} - -interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncGElement: { - prototype: SVGFEFuncGElement; - new(): SVGFEFuncGElement; -} - -interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncRElement: { - prototype: SVGFEFuncRElement; - new(): SVGFEFuncRElement; -} - -interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly stdDeviationX: SVGAnimatedNumber; - readonly stdDeviationY: SVGAnimatedNumber; - setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEGaussianBlurElement: { - prototype: SVGFEGaussianBlurElement; - new(): SVGFEGaussianBlurElement; -} - -interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEImageElement: { - prototype: SVGFEImageElement; - new(): SVGFEImageElement; -} - -interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeElement: { - prototype: SVGFEMergeElement; - new(): SVGFEMergeElement; -} - -interface SVGFEMergeNodeElement extends SVGElement { - readonly in1: SVGAnimatedString; -} - -declare var SVGFEMergeNodeElement: { - prototype: SVGFEMergeNodeElement; - new(): SVGFEMergeNodeElement; -} - -interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly operator: SVGAnimatedEnumeration; - readonly radiusX: SVGAnimatedNumber; - readonly radiusY: SVGAnimatedNumber; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMorphologyElement: { - prototype: SVGFEMorphologyElement; - new(): SVGFEMorphologyElement; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; -} - -interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly dx: SVGAnimatedNumber; - readonly dy: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEOffsetElement: { - prototype: SVGFEOffsetElement; - new(): SVGFEOffsetElement; -} - -interface SVGFEPointLightElement extends SVGElement { - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; -} - -declare var SVGFEPointLightElement: { - prototype: SVGFEPointLightElement; - new(): SVGFEPointLightElement; -} - -interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly specularConstant: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpecularLightingElement: { - prototype: SVGFESpecularLightingElement; - new(): SVGFESpecularLightingElement; -} - -interface SVGFESpotLightElement extends SVGElement { - readonly limitingConeAngle: SVGAnimatedNumber; - readonly pointsAtX: SVGAnimatedNumber; - readonly pointsAtY: SVGAnimatedNumber; - readonly pointsAtZ: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; -} - -declare var SVGFESpotLightElement: { - prototype: SVGFESpotLightElement; - new(): SVGFESpotLightElement; -} - -interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETileElement: { - prototype: SVGFETileElement; - new(): SVGFETileElement; -} - -interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly baseFrequencyX: SVGAnimatedNumber; - readonly baseFrequencyY: SVGAnimatedNumber; - readonly numOctaves: SVGAnimatedInteger; - readonly seed: SVGAnimatedNumber; - readonly stitchTiles: SVGAnimatedEnumeration; - readonly type: SVGAnimatedEnumeration; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETurbulenceElement: { - prototype: SVGFETurbulenceElement; - new(): SVGFETurbulenceElement; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; -} - -interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly filterResX: SVGAnimatedInteger; - readonly filterResY: SVGAnimatedInteger; - readonly filterUnits: SVGAnimatedEnumeration; - readonly height: SVGAnimatedLength; - readonly primitiveUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - setFilterRes(filterResX: number, filterResY: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFilterElement: { - prototype: SVGFilterElement; - new(): SVGFilterElement; -} - -interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGForeignObjectElement: { - prototype: SVGForeignObjectElement; - new(): SVGForeignObjectElement; -} - -interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGElement: { - prototype: SVGGElement; - new(): SVGGElement; -} - -interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - readonly gradientTransform: SVGAnimatedTransformList; - readonly gradientUnits: SVGAnimatedEnumeration; - readonly spreadMethod: SVGAnimatedEnumeration; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGradientElement: { - prototype: SVGGradientElement; - new(): SVGGradientElement; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; -} - -interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly height: SVGAnimatedLength; - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGImageElement: { - prototype: SVGImageElement; - new(): SVGImageElement; -} - -interface SVGLength { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -declare var SVGLength: { - prototype: SVGLength; - new(): SVGLength; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -interface SVGLengthList { - readonly numberOfItems: number; - appendItem(newItem: SVGLength): SVGLength; - clear(): void; - getItem(index: number): SVGLength; - initialize(newItem: SVGLength): SVGLength; - insertItemBefore(newItem: SVGLength, index: number): SVGLength; - removeItem(index: number): SVGLength; - replaceItem(newItem: SVGLength, index: number): SVGLength; -} - -declare var SVGLengthList: { - prototype: SVGLengthList; - new(): SVGLengthList; -} - -interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGLineElement: { - prototype: SVGLineElement; - new(): SVGLineElement; -} - -interface SVGLinearGradientElement extends SVGGradientElement { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; -} - -declare var SVGLinearGradientElement: { - prototype: SVGLinearGradientElement; - new(): SVGLinearGradientElement; -} - -interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - readonly markerHeight: SVGAnimatedLength; - readonly markerUnits: SVGAnimatedEnumeration; - readonly markerWidth: SVGAnimatedLength; - readonly orientAngle: SVGAnimatedAngle; - readonly orientType: SVGAnimatedEnumeration; - readonly refX: SVGAnimatedLength; - readonly refY: SVGAnimatedLength; - setOrientToAngle(angle: SVGAngle): void; - setOrientToAuto(): void; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMarkerElement: { - prototype: SVGMarkerElement; - new(): SVGMarkerElement; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; -} - -interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly maskContentUnits: SVGAnimatedEnumeration; - readonly maskUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMaskElement: { - prototype: SVGMaskElement; - new(): SVGMaskElement; -} - -interface SVGMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - flipX(): SVGMatrix; - flipY(): SVGMatrix; - inverse(): SVGMatrix; - multiply(secondMatrix: SVGMatrix): SVGMatrix; - rotate(angle: number): SVGMatrix; - rotateFromVector(x: number, y: number): SVGMatrix; - scale(scaleFactor: number): SVGMatrix; - scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; - skewX(angle: number): SVGMatrix; - skewY(angle: number): SVGMatrix; - translate(x: number, y: number): SVGMatrix; -} - -declare var SVGMatrix: { - prototype: SVGMatrix; - new(): SVGMatrix; -} - -interface SVGMetadataElement extends SVGElement { -} - -declare var SVGMetadataElement: { - prototype: SVGMetadataElement; - new(): SVGMetadataElement; -} - -interface SVGNumber { - value: number; -} - -declare var SVGNumber: { - prototype: SVGNumber; - new(): SVGNumber; -} - -interface SVGNumberList { - readonly numberOfItems: number; - appendItem(newItem: SVGNumber): SVGNumber; - clear(): void; - getItem(index: number): SVGNumber; - initialize(newItem: SVGNumber): SVGNumber; - insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; - removeItem(index: number): SVGNumber; - replaceItem(newItem: SVGNumber, index: number): SVGNumber; -} - -declare var SVGNumberList: { - prototype: SVGNumberList; - new(): SVGNumberList; -} - -interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { - createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; - createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; - createSVGPathSegClosePath(): SVGPathSegClosePath; - createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; - createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; - createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; - createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; - createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; - createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; - createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; - createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; - createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; - createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; - createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; - createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; - createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; - createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; - createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; - createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; - getPathSegAtLength(distance: number): number; - getPointAtLength(distance: number): SVGPoint; - getTotalLength(): number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPathElement: { - prototype: SVGPathElement; - new(): SVGPathElement; -} - -interface SVGPathSeg { - readonly pathSegType: number; - readonly pathSegTypeAsLetter: string; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -declare var SVGPathSeg: { - prototype: SVGPathSeg; - new(): SVGPathSeg; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -interface SVGPathSegArcAbs extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcAbs: { - prototype: SVGPathSegArcAbs; - new(): SVGPathSegArcAbs; -} - -interface SVGPathSegArcRel extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcRel: { - prototype: SVGPathSegArcRel; - new(): SVGPathSegArcRel; -} - -interface SVGPathSegClosePath extends SVGPathSeg { -} - -declare var SVGPathSegClosePath: { - prototype: SVGPathSegClosePath; - new(): SVGPathSegClosePath; -} - -interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicAbs: { - prototype: SVGPathSegCurvetoCubicAbs; - new(): SVGPathSegCurvetoCubicAbs; -} - -interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicRel: { - prototype: SVGPathSegCurvetoCubicRel; - new(): SVGPathSegCurvetoCubicRel; -} - -interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothAbs: { - prototype: SVGPathSegCurvetoCubicSmoothAbs; - new(): SVGPathSegCurvetoCubicSmoothAbs; -} - -interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothRel: { - prototype: SVGPathSegCurvetoCubicSmoothRel; - new(): SVGPathSegCurvetoCubicSmoothRel; -} - -interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticAbs: { - prototype: SVGPathSegCurvetoQuadraticAbs; - new(): SVGPathSegCurvetoQuadraticAbs; -} - -interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticRel: { - prototype: SVGPathSegCurvetoQuadraticRel; - new(): SVGPathSegCurvetoQuadraticRel; -} - -interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothAbs: { - prototype: SVGPathSegCurvetoQuadraticSmoothAbs; - new(): SVGPathSegCurvetoQuadraticSmoothAbs; -} - -interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothRel: { - prototype: SVGPathSegCurvetoQuadraticSmoothRel; - new(): SVGPathSegCurvetoQuadraticSmoothRel; -} - -interface SVGPathSegLinetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoAbs: { - prototype: SVGPathSegLinetoAbs; - new(): SVGPathSegLinetoAbs; -} - -interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalAbs: { - prototype: SVGPathSegLinetoHorizontalAbs; - new(): SVGPathSegLinetoHorizontalAbs; -} - -interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalRel: { - prototype: SVGPathSegLinetoHorizontalRel; - new(): SVGPathSegLinetoHorizontalRel; -} - -interface SVGPathSegLinetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoRel: { - prototype: SVGPathSegLinetoRel; - new(): SVGPathSegLinetoRel; -} - -interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalAbs: { - prototype: SVGPathSegLinetoVerticalAbs; - new(): SVGPathSegLinetoVerticalAbs; -} - -interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalRel: { - prototype: SVGPathSegLinetoVerticalRel; - new(): SVGPathSegLinetoVerticalRel; -} - -interface SVGPathSegList { - readonly numberOfItems: number; - appendItem(newItem: SVGPathSeg): SVGPathSeg; - clear(): void; - getItem(index: number): SVGPathSeg; - initialize(newItem: SVGPathSeg): SVGPathSeg; - insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; - removeItem(index: number): SVGPathSeg; - replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; -} - -declare var SVGPathSegList: { - prototype: SVGPathSegList; - new(): SVGPathSegList; -} - -interface SVGPathSegMovetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoAbs: { - prototype: SVGPathSegMovetoAbs; - new(): SVGPathSegMovetoAbs; -} - -interface SVGPathSegMovetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoRel: { - prototype: SVGPathSegMovetoRel; - new(): SVGPathSegMovetoRel; -} - -interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly patternContentUnits: SVGAnimatedEnumeration; - readonly patternTransform: SVGAnimatedTransformList; - readonly patternUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPatternElement: { - prototype: SVGPatternElement; - new(): SVGPatternElement; -} - -interface SVGPoint { - x: number; - y: number; - matrixTransform(matrix: SVGMatrix): SVGPoint; -} - -declare var SVGPoint: { - prototype: SVGPoint; - new(): SVGPoint; -} - -interface SVGPointList { - readonly numberOfItems: number; - appendItem(newItem: SVGPoint): SVGPoint; - clear(): void; - getItem(index: number): SVGPoint; - initialize(newItem: SVGPoint): SVGPoint; - insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; - removeItem(index: number): SVGPoint; - replaceItem(newItem: SVGPoint, index: number): SVGPoint; -} - -declare var SVGPointList: { - prototype: SVGPointList; - new(): SVGPointList; -} - -interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolygonElement: { - prototype: SVGPolygonElement; - new(): SVGPolygonElement; -} - -interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolylineElement: { - prototype: SVGPolylineElement; - new(): SVGPolylineElement; -} - -interface SVGPreserveAspectRatio { - align: number; - meetOrSlice: number; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -declare var SVGPreserveAspectRatio: { - prototype: SVGPreserveAspectRatio; - new(): SVGPreserveAspectRatio; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -interface SVGRadialGradientElement extends SVGGradientElement { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly fx: SVGAnimatedLength; - readonly fy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; -} - -declare var SVGRadialGradientElement: { - prototype: SVGRadialGradientElement; - new(): SVGRadialGradientElement; -} - -interface SVGRect { - height: number; - width: number; - x: number; - y: number; -} - -declare var SVGRect: { - prototype: SVGRect; - new(): SVGRect; -} - -interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGRectElement: { - prototype: SVGRectElement; - new(): SVGRectElement; -} - -interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - contentScriptType: string; - contentStyleType: string; - currentScale: number; - readonly currentTranslate: SVGPoint; - readonly height: SVGAnimatedLength; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onunload: (this: this, ev: Event) => any; - onzoom: (this: this, ev: SVGZoomEvent) => any; - readonly pixelUnitToMillimeterX: number; - readonly pixelUnitToMillimeterY: number; - readonly screenPixelToMillimeterX: number; - readonly screenPixelToMillimeterY: number; - readonly viewport: SVGRect; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - checkEnclosure(element: SVGElement, rect: SVGRect): boolean; - checkIntersection(element: SVGElement, rect: SVGRect): boolean; - createSVGAngle(): SVGAngle; - createSVGLength(): SVGLength; - createSVGMatrix(): SVGMatrix; - createSVGNumber(): SVGNumber; - createSVGPoint(): SVGPoint; - createSVGRect(): SVGRect; - createSVGTransform(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - deselectAll(): void; - forceRedraw(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getCurrentTime(): number; - getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - pauseAnimations(): void; - setCurrentTime(seconds: number): void; - suspendRedraw(maxWaitMilliseconds: number): number; - unpauseAnimations(): void; - unsuspendRedraw(suspendHandleID: number): void; - unsuspendRedrawAll(): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var SVGSVGElement: { - prototype: SVGSVGElement; - new(): SVGSVGElement; -} - -interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGScriptElement: { - prototype: SVGScriptElement; - new(): SVGScriptElement; -} - -interface SVGStopElement extends SVGElement, SVGStylable { - readonly offset: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStopElement: { - prototype: SVGStopElement; - new(): SVGStopElement; -} - -interface SVGStringList { - readonly numberOfItems: number; - appendItem(newItem: string): string; - clear(): void; - getItem(index: number): string; - initialize(newItem: string): string; - insertItemBefore(newItem: string, index: number): string; - removeItem(index: number): string; - replaceItem(newItem: string, index: number): string; -} - -declare var SVGStringList: { - prototype: SVGStringList; - new(): SVGStringList; -} - -interface SVGStyleElement extends SVGElement, SVGLangSpace { - disabled: boolean; - media: string; - title: string; - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStyleElement: { - prototype: SVGStyleElement; - new(): SVGStyleElement; -} - -interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSwitchElement: { - prototype: SVGSwitchElement; - new(): SVGSwitchElement; -} - -interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSymbolElement: { - prototype: SVGSymbolElement; - new(): SVGSymbolElement; -} - -interface SVGTSpanElement extends SVGTextPositioningElement { -} - -declare var SVGTSpanElement: { - prototype: SVGTSpanElement; - new(): SVGTSpanElement; -} - -interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly lengthAdjust: SVGAnimatedEnumeration; - readonly textLength: SVGAnimatedLength; - getCharNumAtPosition(point: SVGPoint): number; - getComputedTextLength(): number; - getEndPositionOfChar(charnum: number): SVGPoint; - getExtentOfChar(charnum: number): SVGRect; - getNumberOfChars(): number; - getRotationOfChar(charnum: number): number; - getStartPositionOfChar(charnum: number): SVGPoint; - getSubStringLength(charnum: number, nchars: number): number; - selectSubString(charnum: number, nchars: number): void; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextContentElement: { - prototype: SVGTextContentElement; - new(): SVGTextContentElement; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; -} - -interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextElement: { - prototype: SVGTextElement; - new(): SVGTextElement; -} - -interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - readonly method: SVGAnimatedEnumeration; - readonly spacing: SVGAnimatedEnumeration; - readonly startOffset: SVGAnimatedLength; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextPathElement: { - prototype: SVGTextPathElement; - new(): SVGTextPathElement; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -interface SVGTextPositioningElement extends SVGTextContentElement { - readonly dx: SVGAnimatedLengthList; - readonly dy: SVGAnimatedLengthList; - readonly rotate: SVGAnimatedNumberList; - readonly x: SVGAnimatedLengthList; - readonly y: SVGAnimatedLengthList; -} - -declare var SVGTextPositioningElement: { - prototype: SVGTextPositioningElement; - new(): SVGTextPositioningElement; -} - -interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTitleElement: { - prototype: SVGTitleElement; - new(): SVGTitleElement; -} - -interface SVGTransform { - readonly angle: number; - readonly matrix: SVGMatrix; - readonly type: number; - setMatrix(matrix: SVGMatrix): void; - setRotate(angle: number, cx: number, cy: number): void; - setScale(sx: number, sy: number): void; - setSkewX(angle: number): void; - setSkewY(angle: number): void; - setTranslate(tx: number, ty: number): void; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -declare var SVGTransform: { - prototype: SVGTransform; - new(): SVGTransform; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -interface SVGTransformList { - readonly numberOfItems: number; - appendItem(newItem: SVGTransform): SVGTransform; - clear(): void; - consolidate(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - getItem(index: number): SVGTransform; - initialize(newItem: SVGTransform): SVGTransform; - insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; - removeItem(index: number): SVGTransform; - replaceItem(newItem: SVGTransform, index: number): SVGTransform; -} - -declare var SVGTransformList: { - prototype: SVGTransformList; - new(): SVGTransformList; -} - -interface SVGUnitTypes { - readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - readonly SVG_UNIT_TYPE_UNKNOWN: number; - readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; -} -declare var SVGUnitTypes: SVGUnitTypes; - -interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly animatedInstanceRoot: SVGElementInstance; - readonly height: SVGAnimatedLength; - readonly instanceRoot: SVGElementInstance; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGUseElement: { - prototype: SVGUseElement; - new(): SVGUseElement; -} - -interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - readonly viewTarget: SVGStringList; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGViewElement: { - prototype: SVGViewElement; - new(): SVGViewElement; -} - -interface SVGZoomAndPan { - readonly zoomAndPan: number; -} - -declare var SVGZoomAndPan: { - readonly SVG_ZOOMANDPAN_DISABLE: number; - readonly SVG_ZOOMANDPAN_MAGNIFY: number; - readonly SVG_ZOOMANDPAN_UNKNOWN: number; -} - -interface SVGZoomEvent extends UIEvent { - readonly newScale: number; - readonly newTranslate: SVGPoint; - readonly previousScale: number; - readonly previousTranslate: SVGPoint; - readonly zoomRectScreen: SVGRect; -} - -declare var SVGZoomEvent: { - prototype: SVGZoomEvent; - new(): SVGZoomEvent; -} - -interface Screen extends EventTarget { - readonly availHeight: number; - readonly availWidth: number; - bufferDepth: number; - readonly colorDepth: number; - readonly deviceXDPI: number; - readonly deviceYDPI: number; - readonly fontSmoothingEnabled: boolean; - readonly height: number; - readonly logicalXDPI: number; - readonly logicalYDPI: number; - readonly msOrientation: string; - onmsorientationchange: (this: this, ev: Event) => any; - readonly pixelDepth: number; - readonly systemXDPI: number; - readonly systemYDPI: number; - readonly width: number; - msLockOrientation(orientations: string | string[]): boolean; - msUnlockOrientation(): void; - addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Screen: { - prototype: Screen; - new(): Screen; -} - -interface ScriptNotifyEvent extends Event { - readonly callingUri: string; - readonly value: string; -} - -declare var ScriptNotifyEvent: { - prototype: ScriptNotifyEvent; - new(): ScriptNotifyEvent; -} - -interface ScriptProcessorNode extends AudioNode { - readonly bufferSize: number; - onaudioprocess: (this: this, ev: AudioProcessingEvent) => any; - addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ScriptProcessorNode: { - prototype: ScriptProcessorNode; - new(): ScriptProcessorNode; -} - -interface Selection { - readonly anchorNode: Node; - readonly anchorOffset: number; - readonly focusNode: Node; - readonly focusOffset: number; - readonly isCollapsed: boolean; - readonly rangeCount: number; - readonly type: string; - addRange(range: Range): void; - collapse(parentNode: Node, offset: number): void; - collapseToEnd(): void; - collapseToStart(): void; - containsNode(node: Node, partlyContained: boolean): boolean; - deleteFromDocument(): void; - empty(): void; - extend(newNode: Node, offset: number): void; - getRangeAt(index: number): Range; - removeAllRanges(): void; - removeRange(range: Range): void; - selectAllChildren(parentNode: Node): void; - setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; - toString(): string; -} - -declare var Selection: { - prototype: Selection; - new(): Selection; -} - -interface SourceBuffer extends EventTarget { - appendWindowEnd: number; - appendWindowStart: number; - readonly audioTracks: AudioTrackList; - readonly buffered: TimeRanges; - mode: string; - timestampOffset: number; - readonly updating: boolean; - readonly videoTracks: VideoTrackList; - abort(): void; - appendBuffer(data: ArrayBuffer | ArrayBufferView): void; - appendStream(stream: MSStream, maxSize?: number): void; - remove(start: number, end: number): void; -} - -declare var SourceBuffer: { - prototype: SourceBuffer; - new(): SourceBuffer; -} - -interface SourceBufferList extends EventTarget { - readonly length: number; - item(index: number): SourceBuffer; - [index: number]: SourceBuffer; -} - -declare var SourceBufferList: { - prototype: SourceBufferList; - new(): SourceBufferList; -} - -interface StereoPannerNode extends AudioNode { - readonly pan: AudioParam; -} - -declare var StereoPannerNode: { - prototype: StereoPannerNode; - new(): StereoPannerNode; -} - -interface Storage { - readonly length: number; - clear(): void; - getItem(key: string): string | null; - key(index: number): string | null; - removeItem(key: string): void; - setItem(key: string, data: string): void; - [key: string]: any; - [index: number]: string; -} - -declare var Storage: { - prototype: Storage; - new(): Storage; -} - -interface StorageEvent extends Event { - readonly url: string; - key?: string; - oldValue?: string; - newValue?: string; - storageArea?: Storage; -} - -declare var StorageEvent: { - prototype: StorageEvent; - new (type: string, eventInitDict?: StorageEventInit): StorageEvent; -} - -interface StyleMedia { - readonly type: string; - matchMedium(mediaquery: string): boolean; -} - -declare var StyleMedia: { - prototype: StyleMedia; - new(): StyleMedia; -} - -interface StyleSheet { - disabled: boolean; - readonly href: string; - readonly media: MediaList; - readonly ownerNode: Node; - readonly parentStyleSheet: StyleSheet; - readonly title: string; - readonly type: string; -} - -declare var StyleSheet: { - prototype: StyleSheet; - new(): StyleSheet; -} - -interface StyleSheetList { - readonly length: number; - item(index?: number): StyleSheet; - [index: number]: StyleSheet; -} - -declare var StyleSheetList: { - prototype: StyleSheetList; - new(): StyleSheetList; -} - -interface StyleSheetPageList { - readonly length: number; - item(index: number): CSSPageRule; - [index: number]: CSSPageRule; -} - -declare var StyleSheetPageList: { - prototype: StyleSheetPageList; - new(): StyleSheetPageList; -} - -interface SubtleCrypto { - decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; - deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; - encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - exportKey(format: "jwk", key: CryptoKey): PromiseLike; - exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; - exportKey(format: string, key: CryptoKey): PromiseLike; - generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; - unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; - verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; -} - -declare var SubtleCrypto: { - prototype: SubtleCrypto; - new(): SubtleCrypto; -} - -interface Text extends CharacterData { - readonly wholeText: string; - splitText(offset: number): Text; -} - -declare var Text: { - prototype: Text; - new(): Text; -} - -interface TextEvent extends UIEvent { - readonly data: string; - readonly inputMethod: number; - readonly locale: string; - initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -declare var TextEvent: { - prototype: TextEvent; - new(): TextEvent; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -interface TextMetrics { - readonly width: number; -} - -declare var TextMetrics: { - prototype: TextMetrics; - new(): TextMetrics; -} - -interface TextTrack extends EventTarget { - readonly activeCues: TextTrackCueList; - readonly cues: TextTrackCueList; - readonly inBandMetadataTrackDispatchType: string; - readonly kind: string; - readonly label: string; - readonly language: string; - mode: any; - oncuechange: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - readonly readyState: number; - addCue(cue: TextTrackCue): void; - removeCue(cue: TextTrackCue): void; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; - addEventListener(type: "cuechange", 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrack: { - prototype: TextTrack; - new(): TextTrack; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; -} - -interface TextTrackCue extends EventTarget { - endTime: number; - id: string; - onenter: (this: this, ev: Event) => any; - onexit: (this: this, ev: Event) => any; - pauseOnExit: boolean; - startTime: number; - text: string; - readonly track: TextTrack; - getCueAsHTML(): DocumentFragment; - addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrackCue: { - prototype: TextTrackCue; - new(startTime: number, endTime: number, text: string): TextTrackCue; -} - -interface TextTrackCueList { - readonly length: number; - getCueById(id: string): TextTrackCue; - item(index: number): TextTrackCue; - [index: number]: TextTrackCue; -} - -declare var TextTrackCueList: { - prototype: TextTrackCueList; - new(): TextTrackCueList; -} - -interface TextTrackList extends EventTarget { - readonly length: number; - onaddtrack: ((this: this, ev: TrackEvent) => any) | null; - item(index: number): TextTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: TextTrack; -} - -declare var TextTrackList: { - prototype: TextTrackList; - new(): TextTrackList; -} - -interface TimeRanges { - readonly length: number; - end(index: number): number; - start(index: number): number; -} - -declare var TimeRanges: { - prototype: TimeRanges; - new(): TimeRanges; -} - -interface Touch { - readonly clientX: number; - readonly clientY: number; - readonly identifier: number; - readonly pageX: number; - readonly pageY: number; - readonly screenX: number; - readonly screenY: number; - readonly target: EventTarget; -} - -declare var Touch: { - prototype: Touch; - new(): Touch; -} - -interface TouchEvent extends UIEvent { - readonly altKey: boolean; - readonly changedTouches: TouchList; - readonly ctrlKey: boolean; - readonly metaKey: boolean; - readonly shiftKey: boolean; - readonly targetTouches: TouchList; - readonly touches: TouchList; -} - -declare var TouchEvent: { - prototype: TouchEvent; - new(): TouchEvent; -} - -interface TouchList { - readonly length: number; - item(index: number): Touch | null; - [index: number]: Touch; -} - -declare var TouchList: { - prototype: TouchList; - new(): TouchList; -} - -interface TrackEvent extends Event { - readonly track: any; -} - -declare var TrackEvent: { - prototype: TrackEvent; - new(): TrackEvent; -} - -interface TransitionEvent extends Event { - readonly elapsedTime: number; - readonly propertyName: string; - initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; -} - -declare var TransitionEvent: { - prototype: TransitionEvent; - new(): TransitionEvent; -} - -interface TreeWalker { - currentNode: Node; - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - firstChild(): Node; - lastChild(): Node; - nextNode(): Node; - nextSibling(): Node; - parentNode(): Node; - previousNode(): Node; - previousSibling(): Node; -} - -declare var TreeWalker: { - prototype: TreeWalker; - new(): TreeWalker; -} - -interface UIEvent extends Event { - readonly detail: number; - readonly view: Window; - initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; -} - -declare var UIEvent: { - prototype: UIEvent; - new(type: string, eventInitDict?: UIEventInit): UIEvent; -} - -interface URL { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - username: string; - toString(): string; -} - -declare var URL: { - prototype: URL; - new(url: string, base?: string): URL; - createObjectURL(object: any, options?: ObjectURLOptions): string; - revokeObjectURL(url: string): void; -} - -interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - readonly mediaType: string; -} - -declare var UnviewableContentIdentifiedEvent: { - prototype: UnviewableContentIdentifiedEvent; - new(): UnviewableContentIdentifiedEvent; -} - -interface ValidityState { - readonly badInput: boolean; - readonly customError: boolean; - readonly patternMismatch: boolean; - readonly rangeOverflow: boolean; - readonly rangeUnderflow: boolean; - readonly stepMismatch: boolean; - readonly tooLong: boolean; - readonly typeMismatch: boolean; - readonly valid: boolean; - readonly valueMissing: boolean; -} - -declare var ValidityState: { - prototype: ValidityState; - new(): ValidityState; -} - -interface VideoPlaybackQuality { - readonly corruptedVideoFrames: number; - readonly creationTime: number; - readonly droppedVideoFrames: number; - readonly totalFrameDelay: number; - readonly totalVideoFrames: number; -} - -declare var VideoPlaybackQuality: { - prototype: VideoPlaybackQuality; - new(): VideoPlaybackQuality; -} - -interface VideoTrack { - readonly id: string; - kind: string; - readonly label: string; - language: string; - selected: boolean; - readonly sourceBuffer: SourceBuffer; -} - -declare var VideoTrack: { - prototype: VideoTrack; - new(): VideoTrack; -} - -interface VideoTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - readonly selectedIndex: number; - getTrackById(id: string): VideoTrack | null; - item(index: number): VideoTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: VideoTrack; -} - -declare var VideoTrackList: { - prototype: VideoTrackList; - new(): VideoTrackList; -} - -interface WEBGL_compressed_texture_s3tc { - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -declare var WEBGL_compressed_texture_s3tc: { - prototype: WEBGL_compressed_texture_s3tc; - new(): WEBGL_compressed_texture_s3tc; - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -interface WEBGL_debug_renderer_info { - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -declare var WEBGL_debug_renderer_info: { - prototype: WEBGL_debug_renderer_info; - new(): WEBGL_debug_renderer_info; - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -interface WEBGL_depth_texture { - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -declare var WEBGL_depth_texture: { - prototype: WEBGL_depth_texture; - new(): WEBGL_depth_texture; - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -interface WaveShaperNode extends AudioNode { - curve: Float32Array | null; - oversample: string; -} - -declare var WaveShaperNode: { - prototype: WaveShaperNode; - new(): WaveShaperNode; -} - -interface WebGLActiveInfo { - readonly name: string; - readonly size: number; - readonly type: number; -} - -declare var WebGLActiveInfo: { - prototype: WebGLActiveInfo; - new(): WebGLActiveInfo; -} - -interface WebGLBuffer extends WebGLObject { -} - -declare var WebGLBuffer: { - prototype: WebGLBuffer; - new(): WebGLBuffer; -} - -interface WebGLContextEvent extends Event { - readonly statusMessage: string; -} - -declare var WebGLContextEvent: { - prototype: WebGLContextEvent; - new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; -} - -interface WebGLFramebuffer extends WebGLObject { -} - -declare var WebGLFramebuffer: { - prototype: WebGLFramebuffer; - new(): WebGLFramebuffer; -} - -interface WebGLObject { -} - -declare var WebGLObject: { - prototype: WebGLObject; - new(): WebGLObject; -} - -interface WebGLProgram extends WebGLObject { -} - -declare var WebGLProgram: { - prototype: WebGLProgram; - new(): WebGLProgram; -} - -interface WebGLRenderbuffer extends WebGLObject { -} - -declare var WebGLRenderbuffer: { - prototype: WebGLRenderbuffer; - new(): WebGLRenderbuffer; -} - -interface WebGLRenderingContext { - readonly canvas: HTMLCanvasElement; - readonly drawingBufferHeight: number; - readonly drawingBufferWidth: number; - activeTexture(texture: number): void; - attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer | null): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; - bindTexture(target: number, texture: WebGLTexture | null): void; - blendColor(red: number, green: number, blue: number, alpha: number): void; - blendEquation(mode: number): void; - blendEquationSeparate(modeRGB: number, modeAlpha: number): void; - blendFunc(sfactor: number, dfactor: number): void; - blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; - bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; - bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; - checkFramebufferStatus(target: number): number; - clear(mask: number): void; - clearColor(red: number, green: number, blue: number, alpha: number): void; - clearDepth(depth: number): void; - clearStencil(s: number): void; - colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader | null): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; - copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; - copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer | null; - createFramebuffer(): WebGLFramebuffer | null; - createProgram(): WebGLProgram | null; - createRenderbuffer(): WebGLRenderbuffer | null; - createShader(type: number): WebGLShader | null; - createTexture(): WebGLTexture | null; - cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer | null): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; - deleteProgram(program: WebGLProgram | null): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; - deleteShader(shader: WebGLShader | null): void; - deleteTexture(texture: WebGLTexture | null): void; - depthFunc(func: number): void; - depthMask(flag: boolean): void; - depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - disable(cap: number): void; - disableVertexAttribArray(index: number): void; - drawArrays(mode: number, first: number, count: number): void; - drawElements(mode: number, count: number, type: number, offset: number): void; - enable(cap: number): void; - enableVertexAttribArray(index: number): void; - finish(): void; - flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; - frontFace(mode: number): void; - generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; - getAttribLocation(program: WebGLProgram | null, name: string): number; - getBufferParameter(target: number, pname: number): any; - getContextAttributes(): WebGLContextAttributes; - getError(): number; - getExtension(name: string): any; - getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; - getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram | null): string | null; - getProgramParameter(program: WebGLProgram | null, pname: number): any; - getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader | null): string | null; - getShaderParameter(shader: WebGLShader | null, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; - getShaderSource(shader: WebGLShader | null): string | null; - getSupportedExtensions(): string[] | null; - getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; - getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; - getVertexAttrib(index: number, pname: number): any; - getVertexAttribOffset(index: number, pname: number): number; - hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer | null): boolean; - isContextLost(): boolean; - isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; - isProgram(program: WebGLProgram | null): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; - isShader(shader: WebGLShader | null): boolean; - isTexture(texture: WebGLTexture | null): boolean; - lineWidth(width: number): void; - linkProgram(program: WebGLProgram | null): void; - pixelStorei(pname: number, param: number): void; - polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; - renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; - sampleCoverage(value: number, invert: boolean): void; - scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader | null, source: string): void; - stencilFunc(func: number, ref: number, mask: number): void; - stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; - stencilMask(mask: number): void; - stencilMaskSeparate(face: number, mask: number): void; - stencilOp(fail: number, zfail: number, zpass: number): void; - stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - texParameterf(target: number, pname: number, param: number): void; - texParameteri(target: number, pname: number, param: number): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - useProgram(program: WebGLProgram | null): void; - validateProgram(program: WebGLProgram | null): void; - vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; - vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; - viewport(x: number, y: number, width: number, height: number): void; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -declare var WebGLRenderingContext: { - prototype: WebGLRenderingContext; - new(): WebGLRenderingContext; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -interface WebGLShader extends WebGLObject { -} - -declare var WebGLShader: { - prototype: WebGLShader; - new(): WebGLShader; -} - -interface WebGLShaderPrecisionFormat { - readonly precision: number; - readonly rangeMax: number; - readonly rangeMin: number; -} - -declare var WebGLShaderPrecisionFormat: { - prototype: WebGLShaderPrecisionFormat; - new(): WebGLShaderPrecisionFormat; -} - -interface WebGLTexture extends WebGLObject { -} - -declare var WebGLTexture: { - prototype: WebGLTexture; - new(): WebGLTexture; -} - -interface WebGLUniformLocation { -} - -declare var WebGLUniformLocation: { - prototype: WebGLUniformLocation; - new(): WebGLUniformLocation; -} - -interface WebKitCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): WebKitCSSMatrix; - multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): WebKitCSSMatrix; - skewY(angle: number): WebKitCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): WebKitCSSMatrix; -} - -declare var WebKitCSSMatrix: { - prototype: WebKitCSSMatrix; - new(text?: string): WebKitCSSMatrix; -} - -interface WebKitPoint { - x: number; - y: number; -} - -declare var WebKitPoint: { - prototype: WebKitPoint; - new(x?: number, y?: number): WebKitPoint; -} - -interface WebSocket extends EventTarget { - binaryType: string; - readonly bufferedAmount: number; - readonly extensions: string; - onclose: (this: this, ev: CloseEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onopen: (this: this, ev: Event) => any; - readonly protocol: string; - readonly readyState: number; - readonly url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WebSocket: { - prototype: WebSocket; - new(url: string, protocols?: string | string[]): WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; -} - -interface WheelEvent extends MouseEvent { - readonly deltaMode: number; - readonly deltaX: number; - readonly deltaY: number; - readonly deltaZ: number; - readonly wheelDelta: number; - readonly wheelDeltaX: number; - readonly wheelDeltaY: number; - getCurrentPoint(element: Element): void; - initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -declare var WheelEvent: { - prototype: WheelEvent; - new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - readonly applicationCache: ApplicationCache; - readonly clientInformation: Navigator; - readonly closed: boolean; - readonly crypto: Crypto; - defaultStatus: string; - readonly devicePixelRatio: number; - readonly doNotTrack: string; - readonly document: Document; - event: Event | undefined; - readonly external: External; - readonly frameElement: Element; - readonly frames: Window; - readonly history: History; - readonly innerHeight: number; - readonly innerWidth: number; - readonly length: number; - readonly location: Location; - readonly locationbar: BarProp; - readonly menubar: BarProp; - readonly msCredentials: MSCredentials; - name: string; - readonly navigator: Navigator; - offscreenBuffering: string | boolean; - onabort: (this: this, ev: UIEvent) => any; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncompassneedscalibration: (this: this, ev: Event) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondevicelight: (this: this, ev: DeviceLightEvent) => any; - ondevicemotion: (this: this, ev: DeviceMotionEvent) => any; - ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: ErrorEventHandler; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreadystatechange: (this: this, ev: ProgressEvent) => any; - onreset: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onstalled: (this: this, ev: Event) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onunload: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; - opener: any; - orientation: string | number; - readonly outerHeight: number; - readonly outerWidth: number; - readonly pageXOffset: number; - readonly pageYOffset: number; - readonly parent: Window; - readonly performance: Performance; - readonly personalbar: BarProp; - readonly screen: Screen; - readonly screenLeft: number; - readonly screenTop: number; - readonly screenX: number; - readonly screenY: number; - readonly scrollX: number; - readonly scrollY: number; - readonly scrollbars: BarProp; - readonly self: Window; - status: string; - readonly statusbar: BarProp; - readonly styleMedia: StyleMedia; - readonly toolbar: BarProp; - readonly top: Window; - readonly window: Window; - URL: typeof URL; - Blob: typeof Blob; - alert(message?: any): void; - blur(): void; - cancelAnimationFrame(handle: number): void; - captureEvents(): void; - close(): void; - confirm(message?: string): boolean; - focus(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; - getSelection(): Selection; - matchMedia(mediaQuery: string): MediaQueryList; - moveBy(x?: number, y?: number): void; - moveTo(x?: number, y?: number): void; - msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, transfer?: any[]): void; - print(): void; - prompt(message?: string, _default?: string): string | null; - releaseEvents(): void; - requestAnimationFrame(callback: FrameRequestCallback): number; - resizeBy(x?: number, y?: number): void; - resizeTo(x?: number, y?: number): void; - scroll(x?: number, y?: number): void; - scrollBy(x?: number, y?: number): void; - scrollTo(x?: number, y?: number): void; - webkitCancelAnimationFrame(handle: number): void; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - 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; -} - -declare var Window: { - prototype: Window; - new(): Window; -} - -interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: this, ev: MessageEvent) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Worker: { - prototype: Worker; - new(stringUrl: string): Worker; -} - -interface XMLDocument extends Document { -} - -declare var XMLDocument: { - prototype: XMLDocument; - new(): XMLDocument; -} - -interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: this, ev: Event) => any; - readonly readyState: number; - readonly response: any; - readonly responseText: string; - responseType: string; - readonly responseXML: any; - readonly status: number; - readonly statusText: string; - timeout: number; - readonly upload: XMLHttpRequestUpload; - withCredentials: boolean; - msCaching?: string; - readonly responseURL: string; - abort(): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string | null; - msCachingEnabled(): boolean; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - overrideMimeType(mime: string): void; - send(data?: Document): void; - send(data?: string): void; - send(data?: any): void; - setRequestHeader(header: string, value: string): void; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - 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: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", 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; -} - -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new(): XMLHttpRequest; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - create(): XMLHttpRequest; -} - -interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequestUpload: { - prototype: XMLHttpRequestUpload; - new(): XMLHttpRequestUpload; -} - -interface XMLSerializer { - serializeToString(target: Node): string; -} - -declare var XMLSerializer: { - prototype: XMLSerializer; - new(): XMLSerializer; -} - -interface XPathEvaluator { - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; -} - -declare var XPathEvaluator: { - prototype: XPathEvaluator; - new(): XPathEvaluator; -} - -interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; -} - -declare var XPathExpression: { - prototype: XPathExpression; - new(): XPathExpression; -} - -interface XPathNSResolver { - lookupNamespaceURI(prefix: string): string; -} - -declare var XPathNSResolver: { - prototype: XPathNSResolver; - new(): XPathNSResolver; -} - -interface XPathResult { - readonly booleanValue: boolean; - readonly invalidIteratorState: boolean; - readonly numberValue: number; - readonly resultType: number; - readonly singleNodeValue: Node; - readonly snapshotLength: number; - readonly stringValue: string; - iterateNext(): Node; - snapshotItem(index: number): Node; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -declare var XPathResult: { - prototype: XPathResult; - new(): XPathResult; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -interface XSLTProcessor { - clearParameters(): void; - getParameter(namespaceURI: string, localName: string): any; - importStylesheet(style: Node): void; - removeParameter(namespaceURI: string, localName: string): void; - reset(): void; - setParameter(namespaceURI: string, localName: string, value: any): void; - transformToDocument(source: Node): Document; - transformToFragment(source: Node, document: Document): DocumentFragment; -} - -declare var XSLTProcessor: { - prototype: XSLTProcessor; - new(): XSLTProcessor; -} - -interface AbstractWorker { - onerror: (this: this, ev: ErrorEvent) => any; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface CanvasPathMethods { - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; - closePath(): void; - ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - lineTo(x: number, y: number): void; - moveTo(x: number, y: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; -} - -interface ChildNode { - remove(): void; -} - -interface DOML2DeprecatedColorProperty { - color: string; -} - -interface DOML2DeprecatedSizeProperty { - size: number; -} - -interface DocumentEvent { - createEvent(eventInterface:"AnimationEvent"): AnimationEvent; - createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; - createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; - createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; - createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; - createEvent(eventInterface:"CloseEvent"): CloseEvent; - createEvent(eventInterface:"CommandEvent"): CommandEvent; - createEvent(eventInterface:"CompositionEvent"): CompositionEvent; - createEvent(eventInterface:"CustomEvent"): CustomEvent; - createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; - createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; - createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; - createEvent(eventInterface:"DragEvent"): DragEvent; - createEvent(eventInterface:"ErrorEvent"): ErrorEvent; - createEvent(eventInterface:"Event"): Event; - createEvent(eventInterface:"Events"): Event; - createEvent(eventInterface:"FocusEvent"): FocusEvent; - createEvent(eventInterface:"GamepadEvent"): GamepadEvent; - createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; - createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; - createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; - createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; - createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; - createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; - createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; - createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; - createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; - createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; - createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; - createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; - createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; - createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; - createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; - createEvent(eventInterface:"MessageEvent"): MessageEvent; - createEvent(eventInterface:"MouseEvent"): MouseEvent; - createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MutationEvent"): MutationEvent; - createEvent(eventInterface:"MutationEvents"): MutationEvent; - createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; - createEvent(eventInterface:"NavigationEvent"): NavigationEvent; - createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; - createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; - createEvent(eventInterface:"OverflowEvent"): OverflowEvent; - createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; - createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; - createEvent(eventInterface:"PointerEvent"): PointerEvent; - createEvent(eventInterface:"PopStateEvent"): PopStateEvent; - createEvent(eventInterface:"ProgressEvent"): ProgressEvent; - createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; - createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; - createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; - createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; - createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; - createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; - createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; - createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; - createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; - createEvent(eventInterface:"StorageEvent"): StorageEvent; - createEvent(eventInterface:"TextEvent"): TextEvent; - createEvent(eventInterface:"TouchEvent"): TouchEvent; - createEvent(eventInterface:"TrackEvent"): TrackEvent; - createEvent(eventInterface:"TransitionEvent"): TransitionEvent; - createEvent(eventInterface:"UIEvent"): UIEvent; - createEvent(eventInterface:"UIEvents"): UIEvent; - createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; - createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; - createEvent(eventInterface:"WheelEvent"): WheelEvent; - createEvent(eventInterface: string): Event; -} - -interface ElementTraversal { - readonly childElementCount: number; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly nextElementSibling: Element; - readonly previousElementSibling: Element; -} - -interface GetSVGDocument { - getSVGDocument(): Document; -} - -interface GlobalEventHandlers { - onpointercancel: (this: this, ev: PointerEvent) => any; - onpointerdown: (this: this, ev: PointerEvent) => any; - onpointerenter: (this: this, ev: PointerEvent) => any; - onpointerleave: (this: this, ev: PointerEvent) => any; - onpointermove: (this: this, ev: PointerEvent) => any; - onpointerout: (this: this, ev: PointerEvent) => any; - onpointerover: (this: this, ev: PointerEvent) => any; - onpointerup: (this: this, ev: PointerEvent) => any; - onwheel: (this: this, ev: WheelEvent) => any; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface HTMLTableAlignment { - /** - * Sets or retrieves a value that you can use to implement your own ch functionality for the object. - */ - ch: string; - /** - * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. - */ - chOff: string; - /** - * Sets or retrieves how text and other content are vertically aligned within the object that contains them. - */ - vAlign: string; -} - -interface IDBEnvironment { - readonly indexedDB: IDBFactory; -} - -interface LinkStyle { - readonly sheet: StyleSheet; -} - -interface MSBaseReader { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - readonly readyState: number; - readonly result: any; - abort(): void; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface MSFileSaver { - msSaveBlob(blob: any, defaultName?: string): boolean; - msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; -} - -interface MSNavigatorDoNotTrack { - confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; - confirmWebWideTrackingException(args: ExceptionInformation): boolean; - removeSiteSpecificTrackingException(args: ExceptionInformation): void; - removeWebWideTrackingException(args: ExceptionInformation): void; - storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; - storeWebWideTrackingException(args: StoreExceptionsInformation): void; -} - -interface NavigatorContentUtils { -} - -interface NavigatorGeolocation { - readonly geolocation: Geolocation; -} - -interface NavigatorID { - readonly appName: string; - readonly appVersion: string; - readonly platform: string; - readonly product: string; - readonly productSub: string; - readonly userAgent: string; - readonly vendor: string; - readonly vendorSub: string; -} - -interface NavigatorOnLine { - readonly onLine: boolean; -} - -interface NavigatorStorageUtils { -} - -interface NavigatorUserMedia { - readonly mediaDevices: MediaDevices; - getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; -} - -interface NodeSelector { - 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; - querySelectorAll(selectors: "abbr"): NodeListOf; - querySelectorAll(selectors: "acronym"): NodeListOf; - querySelectorAll(selectors: "address"): NodeListOf; - querySelectorAll(selectors: "applet"): NodeListOf; - querySelectorAll(selectors: "area"): NodeListOf; - querySelectorAll(selectors: "article"): NodeListOf; - querySelectorAll(selectors: "aside"): NodeListOf; - querySelectorAll(selectors: "audio"): NodeListOf; - querySelectorAll(selectors: "b"): NodeListOf; - querySelectorAll(selectors: "base"): NodeListOf; - querySelectorAll(selectors: "basefont"): NodeListOf; - querySelectorAll(selectors: "bdo"): NodeListOf; - querySelectorAll(selectors: "big"): NodeListOf; - querySelectorAll(selectors: "blockquote"): NodeListOf; - querySelectorAll(selectors: "body"): NodeListOf; - querySelectorAll(selectors: "br"): NodeListOf; - querySelectorAll(selectors: "button"): NodeListOf; - querySelectorAll(selectors: "canvas"): NodeListOf; - querySelectorAll(selectors: "caption"): NodeListOf; - querySelectorAll(selectors: "center"): NodeListOf; - querySelectorAll(selectors: "circle"): NodeListOf; - querySelectorAll(selectors: "cite"): NodeListOf; - querySelectorAll(selectors: "clippath"): NodeListOf; - querySelectorAll(selectors: "code"): NodeListOf; - querySelectorAll(selectors: "col"): NodeListOf; - querySelectorAll(selectors: "colgroup"): NodeListOf; - querySelectorAll(selectors: "datalist"): NodeListOf; - querySelectorAll(selectors: "dd"): NodeListOf; - querySelectorAll(selectors: "defs"): NodeListOf; - querySelectorAll(selectors: "del"): NodeListOf; - querySelectorAll(selectors: "desc"): NodeListOf; - querySelectorAll(selectors: "dfn"): NodeListOf; - querySelectorAll(selectors: "dir"): NodeListOf; - querySelectorAll(selectors: "div"): NodeListOf; - querySelectorAll(selectors: "dl"): NodeListOf; - querySelectorAll(selectors: "dt"): NodeListOf; - querySelectorAll(selectors: "ellipse"): NodeListOf; - querySelectorAll(selectors: "em"): NodeListOf; - querySelectorAll(selectors: "embed"): NodeListOf; - querySelectorAll(selectors: "feblend"): NodeListOf; - querySelectorAll(selectors: "fecolormatrix"): NodeListOf; - querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf; - querySelectorAll(selectors: "fecomposite"): NodeListOf; - querySelectorAll(selectors: "feconvolvematrix"): NodeListOf; - querySelectorAll(selectors: "fediffuselighting"): NodeListOf; - querySelectorAll(selectors: "fedisplacementmap"): NodeListOf; - querySelectorAll(selectors: "fedistantlight"): NodeListOf; - querySelectorAll(selectors: "feflood"): NodeListOf; - querySelectorAll(selectors: "fefunca"): NodeListOf; - querySelectorAll(selectors: "fefuncb"): NodeListOf; - querySelectorAll(selectors: "fefuncg"): NodeListOf; - querySelectorAll(selectors: "fefuncr"): NodeListOf; - querySelectorAll(selectors: "fegaussianblur"): NodeListOf; - querySelectorAll(selectors: "feimage"): NodeListOf; - querySelectorAll(selectors: "femerge"): NodeListOf; - querySelectorAll(selectors: "femergenode"): NodeListOf; - querySelectorAll(selectors: "femorphology"): NodeListOf; - querySelectorAll(selectors: "feoffset"): NodeListOf; - querySelectorAll(selectors: "fepointlight"): NodeListOf; - querySelectorAll(selectors: "fespecularlighting"): NodeListOf; - querySelectorAll(selectors: "fespotlight"): NodeListOf; - querySelectorAll(selectors: "fetile"): NodeListOf; - querySelectorAll(selectors: "feturbulence"): NodeListOf; - querySelectorAll(selectors: "fieldset"): NodeListOf; - querySelectorAll(selectors: "figcaption"): NodeListOf; - querySelectorAll(selectors: "figure"): NodeListOf; - querySelectorAll(selectors: "filter"): NodeListOf; - querySelectorAll(selectors: "font"): NodeListOf; - querySelectorAll(selectors: "footer"): NodeListOf; - querySelectorAll(selectors: "foreignobject"): NodeListOf; - querySelectorAll(selectors: "form"): NodeListOf; - querySelectorAll(selectors: "frame"): NodeListOf; - querySelectorAll(selectors: "frameset"): NodeListOf; - querySelectorAll(selectors: "g"): NodeListOf; - querySelectorAll(selectors: "h1"): NodeListOf; - querySelectorAll(selectors: "h2"): NodeListOf; - querySelectorAll(selectors: "h3"): NodeListOf; - querySelectorAll(selectors: "h4"): NodeListOf; - querySelectorAll(selectors: "h5"): NodeListOf; - querySelectorAll(selectors: "h6"): NodeListOf; - querySelectorAll(selectors: "head"): NodeListOf; - querySelectorAll(selectors: "header"): NodeListOf; - querySelectorAll(selectors: "hgroup"): NodeListOf; - querySelectorAll(selectors: "hr"): NodeListOf; - querySelectorAll(selectors: "html"): NodeListOf; - querySelectorAll(selectors: "i"): NodeListOf; - querySelectorAll(selectors: "iframe"): NodeListOf; - querySelectorAll(selectors: "image"): NodeListOf; - querySelectorAll(selectors: "img"): NodeListOf; - querySelectorAll(selectors: "input"): NodeListOf; - querySelectorAll(selectors: "ins"): NodeListOf; - querySelectorAll(selectors: "isindex"): NodeListOf; - querySelectorAll(selectors: "kbd"): NodeListOf; - querySelectorAll(selectors: "keygen"): NodeListOf; - querySelectorAll(selectors: "label"): NodeListOf; - querySelectorAll(selectors: "legend"): NodeListOf; - querySelectorAll(selectors: "li"): NodeListOf; - querySelectorAll(selectors: "line"): NodeListOf; - querySelectorAll(selectors: "lineargradient"): NodeListOf; - querySelectorAll(selectors: "link"): NodeListOf; - querySelectorAll(selectors: "listing"): NodeListOf; - querySelectorAll(selectors: "map"): NodeListOf; - querySelectorAll(selectors: "mark"): NodeListOf; - querySelectorAll(selectors: "marker"): NodeListOf; - querySelectorAll(selectors: "marquee"): NodeListOf; - querySelectorAll(selectors: "mask"): NodeListOf; - querySelectorAll(selectors: "menu"): NodeListOf; - querySelectorAll(selectors: "meta"): NodeListOf; - querySelectorAll(selectors: "metadata"): NodeListOf; - querySelectorAll(selectors: "meter"): NodeListOf; - querySelectorAll(selectors: "nav"): NodeListOf; - querySelectorAll(selectors: "nextid"): NodeListOf; - querySelectorAll(selectors: "nobr"): NodeListOf; - querySelectorAll(selectors: "noframes"): NodeListOf; - querySelectorAll(selectors: "noscript"): NodeListOf; - querySelectorAll(selectors: "object"): NodeListOf; - querySelectorAll(selectors: "ol"): NodeListOf; - querySelectorAll(selectors: "optgroup"): NodeListOf; - querySelectorAll(selectors: "option"): NodeListOf; - querySelectorAll(selectors: "p"): NodeListOf; - querySelectorAll(selectors: "param"): NodeListOf; - querySelectorAll(selectors: "path"): NodeListOf; - querySelectorAll(selectors: "pattern"): NodeListOf; - querySelectorAll(selectors: "picture"): NodeListOf; - querySelectorAll(selectors: "plaintext"): NodeListOf; - querySelectorAll(selectors: "polygon"): NodeListOf; - querySelectorAll(selectors: "polyline"): NodeListOf; - querySelectorAll(selectors: "pre"): NodeListOf; - querySelectorAll(selectors: "progress"): NodeListOf; - querySelectorAll(selectors: "q"): NodeListOf; - querySelectorAll(selectors: "radialgradient"): NodeListOf; - querySelectorAll(selectors: "rect"): NodeListOf; - querySelectorAll(selectors: "rt"): NodeListOf; - querySelectorAll(selectors: "ruby"): NodeListOf; - querySelectorAll(selectors: "s"): NodeListOf; - querySelectorAll(selectors: "samp"): NodeListOf; - querySelectorAll(selectors: "script"): NodeListOf; - querySelectorAll(selectors: "section"): NodeListOf; - querySelectorAll(selectors: "select"): NodeListOf; - querySelectorAll(selectors: "small"): NodeListOf; - querySelectorAll(selectors: "source"): NodeListOf; - querySelectorAll(selectors: "span"): NodeListOf; - querySelectorAll(selectors: "stop"): NodeListOf; - querySelectorAll(selectors: "strike"): NodeListOf; - querySelectorAll(selectors: "strong"): NodeListOf; - querySelectorAll(selectors: "style"): NodeListOf; - querySelectorAll(selectors: "sub"): NodeListOf; - querySelectorAll(selectors: "sup"): NodeListOf; - querySelectorAll(selectors: "svg"): NodeListOf; - querySelectorAll(selectors: "switch"): NodeListOf; - querySelectorAll(selectors: "symbol"): NodeListOf; - querySelectorAll(selectors: "table"): NodeListOf; - querySelectorAll(selectors: "tbody"): NodeListOf; - querySelectorAll(selectors: "td"): NodeListOf; - querySelectorAll(selectors: "template"): NodeListOf; - querySelectorAll(selectors: "text"): NodeListOf; - querySelectorAll(selectors: "textpath"): NodeListOf; - querySelectorAll(selectors: "textarea"): NodeListOf; - querySelectorAll(selectors: "tfoot"): NodeListOf; - querySelectorAll(selectors: "th"): NodeListOf; - querySelectorAll(selectors: "thead"): NodeListOf; - querySelectorAll(selectors: "title"): NodeListOf; - querySelectorAll(selectors: "tr"): NodeListOf; - querySelectorAll(selectors: "track"): NodeListOf; - querySelectorAll(selectors: "tspan"): NodeListOf; - querySelectorAll(selectors: "tt"): NodeListOf; - querySelectorAll(selectors: "u"): NodeListOf; - querySelectorAll(selectors: "ul"): NodeListOf; - querySelectorAll(selectors: "use"): NodeListOf; - querySelectorAll(selectors: "var"): NodeListOf; - querySelectorAll(selectors: "video"): NodeListOf; - querySelectorAll(selectors: "view"): NodeListOf; - querySelectorAll(selectors: "wbr"): NodeListOf; - querySelectorAll(selectors: "x-ms-webview"): NodeListOf; - querySelectorAll(selectors: "xmp"): NodeListOf; - querySelectorAll(selectors: string): NodeListOf; -} - -interface RandomSource { - getRandomValues(array: ArrayBufferView): ArrayBufferView; -} - -interface SVGAnimatedPathData { - readonly pathSegList: SVGPathSegList; -} - -interface SVGAnimatedPoints { - readonly animatedPoints: SVGPointList; - readonly points: SVGPointList; -} - -interface SVGExternalResourcesRequired { - readonly externalResourcesRequired: SVGAnimatedBoolean; -} - -interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - readonly height: SVGAnimatedLength; - readonly result: SVGAnimatedString; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; -} - -interface SVGFitToViewBox { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly viewBox: SVGAnimatedRect; -} - -interface SVGLangSpace { - xmllang: string; - xmlspace: string; -} - -interface SVGLocatable { - readonly farthestViewportElement: SVGElement; - readonly nearestViewportElement: SVGElement; - getBBox(): SVGRect; - getCTM(): SVGMatrix; - getScreenCTM(): SVGMatrix; - getTransformToElement(element: SVGElement): SVGMatrix; -} - -interface SVGStylable { - className: any; - readonly style: CSSStyleDeclaration; -} - -interface SVGTests { - readonly requiredExtensions: SVGStringList; - readonly requiredFeatures: SVGStringList; - readonly systemLanguage: SVGStringList; - hasExtension(extension: string): boolean; -} - -interface SVGTransformable extends SVGLocatable { - readonly transform: SVGAnimatedTransformList; -} - -interface SVGURIReference { - readonly href: SVGAnimatedString; -} - -interface WindowBase64 { - atob(encodedString: string): string; - btoa(rawString: string): string; -} - -interface WindowConsole { - readonly console: Console; -} - -interface WindowLocalStorage { - readonly localStorage: Storage; -} - -interface WindowSessionStorage { - readonly sessionStorage: Storage; -} - -interface WindowTimers extends Object, WindowTimersExtension { - clearInterval(handle: number): void; - clearTimeout(handle: number): void; - setInterval(handler: (...args: any[]) => void, timeout: number): number; - setInterval(handler: any, timeout?: any, ...args: any[]): number; - setTimeout(handler: (...args: any[]) => void, timeout: number): number; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; -} - -interface WindowTimersExtension { - clearImmediate(handle: number): void; - setImmediate(handler: (...args: any[]) => void): number; - setImmediate(handler: any, ...args: any[]): number; -} - -interface XMLHttpRequestEventTarget { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - ontimeout: (this: this, ev: ProgressEvent) => any; - 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface StorageEventInit extends EventInit { - key?: string; - oldValue?: string; - newValue?: string; - url: string; - storageArea?: Storage; -} - -interface Canvas2DContextAttributes { - alpha?: boolean; - willReadFrequently?: boolean; - storage?: boolean; - [attribute: string]: boolean | string | undefined; -} - -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - -interface HTMLCollectionOf extends HTMLCollection { - item(index: number): T; - namedItem(name: string): T; - [index: number]: T; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface FilePropertyBag { - type?: string; - lastModified?: number; -} - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface MessageEventInit extends EventInit { - data?: any; - origin?: string; - lastEventId?: string; - channel?: string; - source?: any; - ports?: MessagePort[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - 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; -} - -interface IDBArrayKey extends Array { -} - -interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: AlgorithmIdentifier; -} - -interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: AlgorithmIdentifier; -} - -interface RsaHashedImportParams { - hash: AlgorithmIdentifier; -} - -interface RsaPssParams { - saltLength: number; -} - -interface RsaOaepParams extends Algorithm { - label?: BufferSource; -} - -interface EcdsaParams extends Algorithm { - hash: AlgorithmIdentifier; -} - -interface EcKeyGenParams extends Algorithm { - namedCurve: string; -} - -interface EcKeyAlgorithm extends KeyAlgorithm { - typedCurve: string; -} - -interface EcKeyImportParams { - namedCurve: string; -} - -interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; -} - -interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; -} - -interface AesKeyGenParams extends Algorithm { - length: number; -} - -interface AesDerivedKeyParams extends Algorithm { - length: number; -} - -interface AesCbcParams extends Algorithm { - iv: BufferSource; -} - -interface AesCmacParams extends Algorithm { - length: number; -} - -interface AesGcmParams extends Algorithm { - iv: BufferSource; - additionalData?: BufferSource; - tagLength?: number; -} - -interface AesCfbParams extends Algorithm { - iv: BufferSource; -} - -interface HmacImportParams extends Algorithm { - hash?: AlgorithmIdentifier; - length?: number; -} - -interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: AlgorithmIdentifier; - length: number; -} - -interface HmacKeyGenParams extends Algorithm { - hash: AlgorithmIdentifier; - length?: number; -} - -interface DhKeyGenParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyAlgorithm extends KeyAlgorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface DhImportKeyParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface ConcatParams extends Algorithm { - hash?: AlgorithmIdentifier; - algorithmId: Uint8Array; - partyUInfo: Uint8Array; - partyVInfo: Uint8Array; - publicInfo?: Uint8Array; - privateInfo?: Uint8Array; -} - -interface HkdfCtrParams extends Algorithm { - hash: AlgorithmIdentifier; - label: BufferSource; - context: BufferSource; -} - -interface Pbkdf2Params extends Algorithm { - salt: BufferSource; - iterations: number; - hash: AlgorithmIdentifier; -} - -interface RsaOtherPrimesInfo { - r: string; - d: string; - t: string; -} - -interface JsonWebKey { - kty: string; - use?: string; - key_ops?: string[]; - alg?: string; - kid?: string; - x5u?: string; - x5c?: string; - x5t?: string; - ext?: boolean; - crv?: string; - x?: string; - y?: string; - d?: string; - n?: string; - e?: string; - p?: string; - q?: string; - dp?: string; - dq?: string; - qi?: string; - oth?: RsaOtherPrimesInfo[]; - k?: string; -} - -interface ParentNode { - readonly children: HTMLCollection; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly childElementCount: number; -} - -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - -interface ErrorEventHandler { - (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; -} -interface PositionCallback { - (position: Position): void; -} -interface PositionErrorCallback { - (error: PositionError): void; -} -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} -interface MSLaunchUriCallback { - (): void; -} -interface FrameRequestCallback { - (time: number): void; -} -interface MSUnsafeFunctionCallback { - (): any; -} -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; -} -interface DecodeSuccessCallback { - (decodedData: AudioBuffer): void; -} -interface DecodeErrorCallback { - (error: DOMException): void; -} -interface FunctionStringCallback { - (data: string): void; -} -interface NavigatorUserMediaSuccessCallback { - (stream: MediaStream): void; -} -interface NavigatorUserMediaErrorCallback { - (error: MediaStreamError): void; -} -interface ForEachCallback { - (keyId: any, status: string): void; -} -declare var Audio: {new(src?: string): HTMLAudioElement; }; -declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; -declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var applicationCache: ApplicationCache; -declare var clientInformation: Navigator; -declare var closed: boolean; -declare var crypto: Crypto; -declare var defaultStatus: string; -declare var devicePixelRatio: number; -declare var doNotTrack: string; -declare var document: Document; -declare var event: Event | undefined; -declare var external: External; -declare var frameElement: Element; -declare var frames: Window; -declare var history: History; -declare var innerHeight: number; -declare var innerWidth: number; -declare var length: number; -declare var location: Location; -declare var locationbar: BarProp; -declare var menubar: BarProp; -declare var msCredentials: MSCredentials; -declare const name: never; -declare var navigator: Navigator; -declare var offscreenBuffering: string | boolean; -declare var onabort: (this: Window, ev: UIEvent) => any; -declare var onafterprint: (this: Window, ev: Event) => any; -declare var onbeforeprint: (this: Window, ev: Event) => any; -declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; -declare var onblur: (this: Window, ev: FocusEvent) => any; -declare var oncanplay: (this: Window, ev: Event) => any; -declare var oncanplaythrough: (this: Window, ev: Event) => any; -declare var onchange: (this: Window, ev: Event) => any; -declare var onclick: (this: Window, ev: MouseEvent) => any; -declare var oncompassneedscalibration: (this: Window, ev: Event) => any; -declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; -declare var ondblclick: (this: Window, ev: MouseEvent) => any; -declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; -declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; -declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; -declare var ondrag: (this: Window, ev: DragEvent) => any; -declare var ondragend: (this: Window, ev: DragEvent) => any; -declare var ondragenter: (this: Window, ev: DragEvent) => any; -declare var ondragleave: (this: Window, ev: DragEvent) => any; -declare var ondragover: (this: Window, ev: DragEvent) => any; -declare var ondragstart: (this: Window, ev: DragEvent) => any; -declare var ondrop: (this: Window, ev: DragEvent) => any; -declare var ondurationchange: (this: Window, ev: Event) => any; -declare var onemptied: (this: Window, ev: Event) => any; -declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; -declare var onerror: ErrorEventHandler; -declare var onfocus: (this: Window, ev: FocusEvent) => any; -declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; -declare var oninput: (this: Window, ev: Event) => any; -declare var oninvalid: (this: Window, ev: Event) => any; -declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; -declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; -declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; -declare var onload: (this: Window, ev: Event) => any; -declare var onloadeddata: (this: Window, ev: Event) => any; -declare var onloadedmetadata: (this: Window, ev: Event) => any; -declare var onloadstart: (this: Window, ev: Event) => any; -declare var onmessage: (this: Window, ev: MessageEvent) => any; -declare var onmousedown: (this: Window, ev: MouseEvent) => any; -declare var onmouseenter: (this: Window, ev: MouseEvent) => any; -declare var onmouseleave: (this: Window, ev: MouseEvent) => any; -declare var onmousemove: (this: Window, ev: MouseEvent) => any; -declare var onmouseout: (this: Window, ev: MouseEvent) => any; -declare var onmouseover: (this: Window, ev: MouseEvent) => any; -declare var onmouseup: (this: Window, ev: MouseEvent) => any; -declare var onmousewheel: (this: Window, ev: WheelEvent) => any; -declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; -declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; -declare var onoffline: (this: Window, ev: Event) => any; -declare var ononline: (this: Window, ev: Event) => any; -declare var onorientationchange: (this: Window, ev: Event) => any; -declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; -declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; -declare var onpause: (this: Window, ev: Event) => any; -declare var onplay: (this: Window, ev: Event) => any; -declare var onplaying: (this: Window, ev: Event) => any; -declare var onpopstate: (this: Window, ev: PopStateEvent) => any; -declare var onprogress: (this: Window, ev: ProgressEvent) => any; -declare var onratechange: (this: Window, ev: Event) => any; -declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; -declare var onreset: (this: Window, ev: Event) => any; -declare var onresize: (this: Window, ev: UIEvent) => any; -declare var onscroll: (this: Window, ev: UIEvent) => any; -declare var onseeked: (this: Window, ev: Event) => any; -declare var onseeking: (this: Window, ev: Event) => any; -declare var onselect: (this: Window, ev: UIEvent) => any; -declare var onstalled: (this: Window, ev: Event) => any; -declare var onstorage: (this: Window, ev: StorageEvent) => any; -declare var onsubmit: (this: Window, ev: Event) => any; -declare var onsuspend: (this: Window, ev: Event) => any; -declare var ontimeupdate: (this: Window, ev: Event) => any; -declare var ontouchcancel: (ev: TouchEvent) => any; -declare var ontouchend: (ev: TouchEvent) => any; -declare var ontouchmove: (ev: TouchEvent) => any; -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: any; -declare var orientation: string | number; -declare var outerHeight: number; -declare var outerWidth: number; -declare var pageXOffset: number; -declare var pageYOffset: number; -declare var parent: Window; -declare var performance: Performance; -declare var personalbar: BarProp; -declare var screen: Screen; -declare var screenLeft: number; -declare var screenTop: number; -declare var screenX: number; -declare var screenY: number; -declare var scrollX: number; -declare var scrollY: number; -declare var scrollbars: BarProp; -declare var self: Window; -declare var status: string; -declare var statusbar: BarProp; -declare var styleMedia: StyleMedia; -declare var toolbar: BarProp; -declare var top: Window; -declare var window: Window; -declare function alert(message?: any): void; -declare function blur(): void; -declare function cancelAnimationFrame(handle: number): void; -declare function captureEvents(): void; -declare function close(): void; -declare function confirm(message?: string): boolean; -declare function focus(): void; -declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; -declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; -declare function getSelection(): Selection; -declare function matchMedia(mediaQuery: string): MediaQueryList; -declare function moveBy(x?: number, y?: number): void; -declare function moveTo(x?: number, y?: number): void; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; -declare function print(): void; -declare function prompt(message?: string, _default?: string): string | null; -declare function releaseEvents(): void; -declare function requestAnimationFrame(callback: FrameRequestCallback): number; -declare function resizeBy(x?: number, y?: number): void; -declare function resizeTo(x?: number, y?: number): void; -declare function scroll(x?: number, y?: number): void; -declare function scrollBy(x?: number, y?: number): void; -declare function scrollTo(x?: number, y?: number): void; -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; -declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function clearInterval(handle: number): void; -declare function clearTimeout(handle: number): void; -declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; -declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function clearImmediate(handle: number): void; -declare function setImmediate(handler: (...args: any[]) => void): number; -declare function setImmediate(handler: any, ...args: any[]): number; -declare var sessionStorage: Storage; -declare var localStorage: Storage; -declare var console: Console; -declare var onpointercancel: (this: Window, ev: PointerEvent) => any; -declare var onpointerdown: (this: Window, ev: PointerEvent) => any; -declare var onpointerenter: (this: Window, ev: PointerEvent) => any; -declare var onpointerleave: (this: Window, ev: PointerEvent) => any; -declare var onpointermove: (this: Window, ev: PointerEvent) => any; -declare var onpointerout: (this: Window, ev: PointerEvent) => any; -declare var onpointerover: (this: Window, ev: PointerEvent) => any; -declare var onpointerup: (this: Window, ev: PointerEvent) => any; -declare var onwheel: (this: Window, ev: WheelEvent) => any; -declare var indexedDB: IDBFactory; -declare function atob(encodedString: string): string; -declare function btoa(rawString: string): string; -declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -type AAGUID = string; -type AlgorithmIdentifier = string | Algorithm; -type ConstrainBoolean = boolean | ConstrainBooleanParameters; -type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; -type ConstrainDouble = number | ConstrainDoubleRange; -type ConstrainLong = number | ConstrainLongRange; -type CryptoOperationData = ArrayBufferView; -type GLbitfield = number; -type GLboolean = boolean; -type GLbyte = number; -type GLclampf = number; -type GLenum = number; -type GLfloat = number; -type GLint = number; -type GLintptr = number; -type GLshort = number; -type GLsizei = number; -type GLsizeiptr = number; -type GLubyte = number; -type GLuint = number; -type GLushort = number; -type IDBKeyPath = string; -type KeyFormat = string; -type KeyType = string; -type KeyUsage = string; -type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; -type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; -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; +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat>(...items: U[]): T[]; + /** + * 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. + */ + 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. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * 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. + */ + 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. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T | undefined; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): this; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + */ + splice(start: number): T[]; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: T, index: number, array: 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(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is Array; + readonly prototype: Array; +} + +declare const Array: ArrayConstructor; + +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} + +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; + +declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +interface PromiseLike { + /** + * 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) | undefined | null, + onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; + + /** + * 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) | undefined | null, + onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; + + /** + * 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) => TResult | PromiseLike, + onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; + + /** + * 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) => TResult1 | PromiseLike, + onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; +} + +interface ArrayLike { + readonly length: number; + readonly [n: number]: T; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin:number, end?:number): ArrayBuffer; +} + +interface ArrayBufferConstructor { + readonly prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): arg is ArrayBufferView; +} +declare const ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare const DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + readonly prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + +} +declare const Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + readonly prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; + +} +declare const Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + readonly prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + readonly prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + +} +declare const Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + readonly prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + +} +declare const Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + readonly prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} +declare const Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + readonly prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} +declare const Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + readonly prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + +} +declare const Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + readonly prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} +declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare module Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string | string[], options?: CollatorOptions): Collator; + (locales?: string | string[], options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; + } + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; + } + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + 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 or specified locale. + * @param that String to compare to target string + * @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 | string[], options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @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 | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @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 | string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @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 | string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @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(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +} + + + +///////////////////////////// +/// IE DOM APIs +///////////////////////////// + +interface Algorithm { + name: string; +} + +interface AriaRequestEventInit extends EventInit { + attributeName?: string; + attributeValue?: string; +} + +interface CommandEventInit extends EventInit { + commandName?: string; + detail?: string; +} + +interface CompositionEventInit extends UIEventInit { + data?: string; +} + +interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { + arrayOfDomainStrings?: string[]; +} + +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface CustomEventInit extends EventInit { + detail?: any; +} + +interface DeviceAccelerationDict { + x?: number; + y?: number; + z?: number; +} + +interface DeviceLightEventInit extends EventInit { + value?: number; +} + +interface DeviceRotationRateDict { + alpha?: number; + beta?: number; + gamma?: number; +} + +interface DoubleRange { + max?: number; + min?: number; +} + +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; +} + +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + +interface ExceptionInformation { + domain?: string; +} + +interface FocusEventInit extends UIEventInit { + relatedTarget?: EventTarget; +} + +interface HashChangeEventInit extends EventInit { + newURL?: string; + oldURL?: string; +} + +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + +interface KeyAlgorithm { + name?: string; +} + +interface KeyboardEventInit extends EventModifierInit { + code?: string; + key?: string; + location?: number; + repeat?: boolean; +} + +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: string; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: string; +} + +interface MSCredentialSpec { + type?: string; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: string; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: string; + localInterface?: MSNetworkInterfaceType; + localAddrType?: string; + remoteAddrType?: string; + iceRole?: string; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resoluton?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: string; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: string; + persistentState?: string; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MouseEventInit extends EventModifierInit { + screenX?: number; + screenY?: number; + clientX?: number; + clientY?: number; + button?: number; + buttons?: number; + relatedTarget?: EventTarget; +} + +interface MsZoomToOptions { + contentX?: number; + contentY?: number; + viewportX?: string; + viewportY?: string; + scaleFactor?: number; + animate?: string; +} + +interface MutationObserverInit { + childList?: boolean; + attributes?: boolean; + characterData?: boolean; + subtree?: boolean; + attributeOldValue?: boolean; + characterDataOldValue?: boolean; + attributeFilter?: string[]; +} + +interface ObjectURLOptions { + oneTimeOnly?: boolean; +} + +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + +interface PointerEventInit extends MouseEventInit { + pointerId?: number; + width?: number; + height?: number; + pressure?: number; + tiltX?: number; + tiltY?: number; + pointerType?: string; + isPrimary?: boolean; +} + +interface PositionOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; +} + +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: string; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidate { + foundation?: string; + priority?: number; + ip?: string; + protocol?: string; + port?: number; + type?: string; + tcpType?: string; + relatedAddress?: string; + relatedPort?: number; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: string; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: string; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: string; + iceservers?: RTCIceServer[]; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + framerateBias?: number; + resolutionScale?: number; + framerateScale?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: string; + id?: string; + msType?: string; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; +} + +interface StoreExceptionsInformation extends ExceptionInformation { + siteName?: string; + explanationString?: string; + detailURI?: string; +} + +interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { + arrayOfDomainStrings?: string[]; +} + +interface UIEventInit extends EventInit { + view?: Window; + detail?: number; +} + +interface WebGLContextAttributes { + failIfMajorPerformanceCaveat?: boolean; + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; +} + +interface WebGLContextEventInit extends EventInit { + statusMessage?: string; +} + +interface WheelEventInit extends MouseEventInit { + deltaX?: number; + deltaY?: number; + deltaZ?: number; + deltaMode?: number; +} + +interface EventListener { + (evt: Event): void; +} + +interface ANGLE_instanced_arrays { + drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; + drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; + vertexAttribDivisorANGLE(index: number, divisor: number): void; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +declare var ANGLE_instanced_arrays: { + prototype: ANGLE_instanced_arrays; + new(): ANGLE_instanced_arrays; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +interface AnalyserNode extends AudioNode { + fftSize: number; + readonly frequencyBinCount: number; + maxDecibels: number; + minDecibels: number; + smoothingTimeConstant: number; + getByteFrequencyData(array: Uint8Array): void; + getByteTimeDomainData(array: Uint8Array): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; +} + +declare var AnalyserNode: { + prototype: AnalyserNode; + new(): AnalyserNode; +} + +interface AnimationEvent extends Event { + readonly animationName: string; + readonly elapsedTime: number; + initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; +} + +declare var AnimationEvent: { + prototype: AnimationEvent; + new(): AnimationEvent; +} + +interface ApplicationCache extends EventTarget { + oncached: (this: this, ev: Event) => any; + onchecking: (this: this, ev: Event) => any; + ondownloading: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onnoupdate: (this: this, ev: Event) => any; + onobsolete: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + onupdateready: (this: this, ev: Event) => any; + readonly status: number; + abort(): void; + swapCache(): void; + update(): void; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; + addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ApplicationCache: { + prototype: ApplicationCache; + new(): ApplicationCache; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; +} + +interface AriaRequestEvent extends Event { + readonly attributeName: string; + attributeValue: string | null; +} + +declare var AriaRequestEvent: { + prototype: AriaRequestEvent; + new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; +} + +interface Attr extends Node { + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string | null; + readonly specified: boolean; + value: string; +} + +declare var Attr: { + prototype: Attr; + new(): Attr; +} + +interface AudioBuffer { + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; + getChannelData(channel: number): Float32Array; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(): AudioBuffer; +} + +interface AudioBufferSourceNode extends AudioNode { + buffer: AudioBuffer | null; + readonly detune: AudioParam; + loop: boolean; + loopEnd: number; + loopStart: number; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; + start(when?: number, offset?: number, duration?: number): void; + stop(when?: number): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var AudioBufferSourceNode: { + prototype: AudioBufferSourceNode; + new(): AudioBufferSourceNode; +} + +interface AudioContext extends EventTarget { + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + readonly sampleRate: number; + state: string; + createAnalyser(): AnalyserNode; + createBiquadFilter(): BiquadFilterNode; + createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; + createBufferSource(): AudioBufferSourceNode; + createChannelMerger(numberOfInputs?: number): ChannelMergerNode; + createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; + createConvolver(): ConvolverNode; + createDelay(maxDelayTime?: number): DelayNode; + createDynamicsCompressor(): DynamicsCompressorNode; + createGain(): GainNode; + createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; + createOscillator(): OscillatorNode; + createPanner(): PannerNode; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; + createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; + createStereoPanner(): StereoPannerNode; + createWaveShaper(): WaveShaperNode; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; +} + +declare var AudioContext: { + prototype: AudioContext; + new(): AudioContext; +} + +interface AudioDestinationNode extends AudioNode { + readonly maxChannelCount: number; +} + +declare var AudioDestinationNode: { + prototype: AudioDestinationNode; + new(): AudioDestinationNode; +} + +interface AudioListener { + dopplerFactor: number; + speedOfSound: number; + setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var AudioListener: { + prototype: AudioListener; + new(): AudioListener; +} + +interface AudioNode extends EventTarget { + channelCount: number; + channelCountMode: string; + channelInterpretation: string; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; + connect(destination: AudioNode, output?: number, input?: number): void; + disconnect(output?: number): void; + disconnect(destination: AudioNode, output?: number, input?: number): void; + disconnect(destination: AudioParam, output?: number): void; +} + +declare var AudioNode: { + prototype: AudioNode; + new(): AudioNode; +} + +interface AudioParam { + readonly defaultValue: number; + value: number; + cancelScheduledValues(startTime: number): void; + exponentialRampToValueAtTime(value: number, endTime: number): void; + linearRampToValueAtTime(value: number, endTime: number): void; + setTargetAtTime(target: number, startTime: number, timeConstant: number): void; + setValueAtTime(value: number, startTime: number): void; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; +} + +declare var AudioParam: { + prototype: AudioParam; + new(): AudioParam; +} + +interface AudioProcessingEvent extends Event { + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; +} + +declare var AudioProcessingEvent: { + prototype: AudioProcessingEvent; + new(): AudioProcessingEvent; +} + +interface AudioTrack { + enabled: boolean; + readonly id: string; + kind: string; + readonly label: string; + language: string; + readonly sourceBuffer: SourceBuffer; +} + +declare var AudioTrack: { + prototype: AudioTrack; + new(): AudioTrack; +} + +interface AudioTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: this, ev: TrackEvent) => any; + onchange: (this: this, ev: Event) => any; + onremovetrack: (this: this, ev: TrackEvent) => any; + getTrackById(id: string): AudioTrack | null; + item(index: number): AudioTrack; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: AudioTrack; +} + +declare var AudioTrackList: { + prototype: AudioTrackList; + new(): AudioTrackList; +} + +interface BarProp { + readonly visible: boolean; +} + +declare var BarProp: { + prototype: BarProp; + new(): BarProp; +} + +interface BeforeUnloadEvent extends Event { + returnValue: any; +} + +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +} + +interface BiquadFilterNode extends AudioNode { + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; + type: string; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var BiquadFilterNode: { + prototype: BiquadFilterNode; + new(): BiquadFilterNode; +} + +interface Blob { + readonly size: number; + readonly type: string; + msClose(): void; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; +} + +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface CDATASection extends Text { +} + +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +} + +interface CSS { + supports(property: string, value?: string): boolean; +} +declare var CSS: CSS; + +interface CSSConditionRule extends CSSGroupingRule { + conditionText: string; +} + +declare var CSSConditionRule: { + prototype: CSSConditionRule; + new(): CSSConditionRule; +} + +interface CSSFontFaceRule extends CSSRule { + readonly style: CSSStyleDeclaration; +} + +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +} + +interface CSSGroupingRule extends CSSRule { + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; +} + +declare var CSSGroupingRule: { + prototype: CSSGroupingRule; + new(): CSSGroupingRule; +} + +interface CSSImportRule extends CSSRule { + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; +} + +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +} + +interface CSSKeyframeRule extends CSSRule { + keyText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +} + +interface CSSKeyframesRule extends CSSRule { + readonly cssRules: CSSRuleList; + name: string; + appendRule(rule: string): void; + deleteRule(rule: string): void; + findRule(rule: string): CSSKeyframeRule; +} + +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +} + +interface CSSMediaRule extends CSSConditionRule { + readonly media: MediaList; +} + +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +} + +interface CSSNamespaceRule extends CSSRule { + readonly namespaceURI: string; + readonly prefix: string; +} + +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +} + +interface CSSPageRule extends CSSRule { + readonly pseudoClass: string; + readonly selector: string; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +} + +interface CSSRule { + cssText: string; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +interface CSSRuleList { + readonly length: number; + item(index: number): CSSRule; + [index: number]: CSSRule; +} + +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +} + +interface CSSStyleDeclaration { + alignContent: string | null; + alignItems: string | null; + alignSelf: string | null; + alignmentBaseline: string | null; + animation: string | null; + animationDelay: string | null; + animationDirection: string | null; + animationDuration: string | null; + animationFillMode: string | null; + animationIterationCount: string | null; + animationName: string | null; + animationPlayState: string | null; + animationTimingFunction: string | null; + backfaceVisibility: string | null; + background: string | null; + backgroundAttachment: string | null; + backgroundClip: string | null; + backgroundColor: string | null; + backgroundImage: string | null; + backgroundOrigin: string | null; + backgroundPosition: string | null; + backgroundPositionX: string | null; + backgroundPositionY: string | null; + backgroundRepeat: string | null; + backgroundSize: string | null; + baselineShift: string | null; + border: string | null; + borderBottom: string | null; + borderBottomColor: string | null; + borderBottomLeftRadius: string | null; + borderBottomRightRadius: string | null; + borderBottomStyle: string | null; + borderBottomWidth: string | null; + borderCollapse: string | null; + borderColor: string | null; + borderImage: string | null; + borderImageOutset: string | null; + borderImageRepeat: string | null; + borderImageSlice: string | null; + borderImageSource: string | null; + borderImageWidth: string | null; + borderLeft: string | null; + borderLeftColor: string | null; + borderLeftStyle: string | null; + borderLeftWidth: string | null; + borderRadius: string | null; + borderRight: string | null; + borderRightColor: string | null; + borderRightStyle: string | null; + borderRightWidth: string | null; + borderSpacing: string | null; + borderStyle: string | null; + borderTop: string | null; + borderTopColor: string | null; + borderTopLeftRadius: string | null; + borderTopRightRadius: string | null; + borderTopStyle: string | null; + borderTopWidth: string | null; + borderWidth: string | null; + bottom: string | null; + boxShadow: string | null; + boxSizing: string | null; + breakAfter: string | null; + breakBefore: string | null; + breakInside: string | null; + captionSide: string | null; + clear: string | null; + clip: string | null; + clipPath: string | null; + clipRule: string | null; + color: string | null; + colorInterpolationFilters: string | null; + columnCount: any; + columnFill: string | null; + columnGap: any; + columnRule: string | null; + columnRuleColor: any; + columnRuleStyle: string | null; + columnRuleWidth: any; + columnSpan: string | null; + columnWidth: any; + columns: string | null; + content: string | null; + counterIncrement: string | null; + counterReset: string | null; + cssFloat: string | null; + cssText: string; + cursor: string | null; + direction: string | null; + display: string | null; + dominantBaseline: string | null; + emptyCells: string | null; + enableBackground: string | null; + fill: string | null; + fillOpacity: string | null; + fillRule: string | null; + filter: string | null; + flex: string | null; + flexBasis: string | null; + flexDirection: string | null; + flexFlow: string | null; + flexGrow: string | null; + flexShrink: string | null; + flexWrap: string | null; + floodColor: string | null; + floodOpacity: string | null; + font: string | null; + fontFamily: string | null; + fontFeatureSettings: string | null; + fontSize: string | null; + fontSizeAdjust: string | null; + fontStretch: string | null; + fontStyle: string | null; + fontVariant: string | null; + fontWeight: string | null; + glyphOrientationHorizontal: string | null; + glyphOrientationVertical: string | null; + height: string | null; + imeMode: string | null; + justifyContent: string | null; + kerning: string | null; + left: string | null; + readonly length: number; + letterSpacing: string | null; + lightingColor: string | null; + lineHeight: string | null; + listStyle: string | null; + listStyleImage: string | null; + listStylePosition: string | null; + listStyleType: string | null; + margin: string | null; + marginBottom: string | null; + marginLeft: string | null; + marginRight: string | null; + marginTop: string | null; + marker: string | null; + markerEnd: string | null; + markerMid: string | null; + markerStart: string | null; + mask: string | null; + maxHeight: string | null; + maxWidth: string | null; + minHeight: string | null; + minWidth: string | null; + msContentZoomChaining: string | null; + msContentZoomLimit: string | null; + msContentZoomLimitMax: any; + msContentZoomLimitMin: any; + msContentZoomSnap: string | null; + msContentZoomSnapPoints: string | null; + msContentZoomSnapType: string | null; + msContentZooming: string | null; + msFlowFrom: string | null; + msFlowInto: string | null; + msFontFeatureSettings: string | null; + msGridColumn: any; + msGridColumnAlign: string | null; + msGridColumnSpan: any; + msGridColumns: string | null; + msGridRow: any; + msGridRowAlign: string | null; + msGridRowSpan: any; + msGridRows: string | null; + msHighContrastAdjust: string | null; + msHyphenateLimitChars: string | null; + msHyphenateLimitLines: any; + msHyphenateLimitZone: any; + msHyphens: string | null; + msImeAlign: string | null; + msOverflowStyle: string | null; + msScrollChaining: string | null; + msScrollLimit: string | null; + msScrollLimitXMax: any; + msScrollLimitXMin: any; + msScrollLimitYMax: any; + msScrollLimitYMin: any; + msScrollRails: string | null; + msScrollSnapPointsX: string | null; + msScrollSnapPointsY: string | null; + msScrollSnapType: string | null; + msScrollSnapX: string | null; + msScrollSnapY: string | null; + msScrollTranslation: string | null; + msTextCombineHorizontal: string | null; + msTextSizeAdjust: any; + msTouchAction: string | null; + msTouchSelect: string | null; + msUserSelect: string | null; + msWrapFlow: string; + msWrapMargin: any; + msWrapThrough: string; + opacity: string | null; + order: string | null; + orphans: string | null; + outline: string | null; + outlineColor: string | null; + outlineStyle: string | null; + outlineWidth: string | null; + overflow: string | null; + overflowX: string | null; + overflowY: string | null; + padding: string | null; + paddingBottom: string | null; + paddingLeft: string | null; + paddingRight: string | null; + paddingTop: string | null; + pageBreakAfter: string | null; + pageBreakBefore: string | null; + pageBreakInside: string | null; + readonly parentRule: CSSRule; + perspective: string | null; + perspectiveOrigin: string | null; + pointerEvents: string | null; + position: string | null; + quotes: string | null; + right: string | null; + rubyAlign: string | null; + rubyOverhang: string | null; + rubyPosition: string | null; + stopColor: string | null; + stopOpacity: string | null; + stroke: string | null; + strokeDasharray: string | null; + strokeDashoffset: string | null; + strokeLinecap: string | null; + strokeLinejoin: string | null; + strokeMiterlimit: string | null; + strokeOpacity: string | null; + strokeWidth: string | null; + tableLayout: string | null; + textAlign: string | null; + textAlignLast: string | null; + textAnchor: string | null; + textDecoration: string | null; + textIndent: string | null; + textJustify: string | null; + textKashida: string | null; + textKashidaSpace: string | null; + textOverflow: string | null; + textShadow: string | null; + textTransform: string | null; + textUnderlinePosition: string | null; + top: string | null; + touchAction: string | null; + transform: string | null; + transformOrigin: string | null; + transformStyle: string | null; + transition: string | null; + transitionDelay: string | null; + transitionDuration: string | null; + transitionProperty: string | null; + transitionTimingFunction: string | null; + unicodeBidi: string | null; + verticalAlign: string | null; + visibility: string | null; + webkitAlignContent: string | null; + webkitAlignItems: string | null; + webkitAlignSelf: string | null; + webkitAnimation: string | null; + webkitAnimationDelay: string | null; + webkitAnimationDirection: string | null; + webkitAnimationDuration: string | null; + webkitAnimationFillMode: string | null; + webkitAnimationIterationCount: string | null; + webkitAnimationName: string | null; + webkitAnimationPlayState: string | null; + webkitAnimationTimingFunction: string | null; + webkitAppearance: string | null; + webkitBackfaceVisibility: string | null; + webkitBackgroundClip: string | null; + webkitBackgroundOrigin: string | null; + webkitBackgroundSize: string | null; + webkitBorderBottomLeftRadius: string | null; + webkitBorderBottomRightRadius: string | null; + webkitBorderImage: string | null; + webkitBorderRadius: string | null; + webkitBorderTopLeftRadius: string | null; + webkitBorderTopRightRadius: string | null; + webkitBoxAlign: string | null; + webkitBoxDirection: string | null; + webkitBoxFlex: string | null; + webkitBoxOrdinalGroup: string | null; + webkitBoxOrient: string | null; + webkitBoxPack: string | null; + webkitBoxSizing: string | null; + webkitColumnBreakAfter: string | null; + webkitColumnBreakBefore: string | null; + webkitColumnBreakInside: string | null; + webkitColumnCount: any; + webkitColumnGap: any; + webkitColumnRule: string | null; + webkitColumnRuleColor: any; + webkitColumnRuleStyle: string | null; + webkitColumnRuleWidth: any; + webkitColumnSpan: string | null; + webkitColumnWidth: any; + webkitColumns: string | null; + webkitFilter: string | null; + webkitFlex: string | null; + webkitFlexBasis: string | null; + webkitFlexDirection: string | null; + webkitFlexFlow: string | null; + webkitFlexGrow: string | null; + webkitFlexShrink: string | null; + webkitFlexWrap: string | null; + webkitJustifyContent: string | null; + webkitOrder: string | null; + webkitPerspective: string | null; + webkitPerspectiveOrigin: string | null; + webkitTapHighlightColor: string | null; + webkitTextFillColor: string | null; + webkitTextSizeAdjust: any; + webkitTransform: string | null; + webkitTransformOrigin: string | null; + webkitTransformStyle: string | null; + webkitTransition: string | null; + webkitTransitionDelay: string | null; + webkitTransitionDuration: string | null; + webkitTransitionProperty: string | null; + webkitTransitionTimingFunction: string | null; + webkitUserModify: string | null; + webkitUserSelect: string | null; + webkitWritingMode: string | null; + whiteSpace: string | null; + widows: string | null; + width: string | null; + wordBreak: string | null; + wordSpacing: string | null; + wordWrap: string | null; + writingMode: string | null; + zIndex: string | null; + zoom: string | null; + resize: string | null; + getPropertyPriority(propertyName: string): string; + getPropertyValue(propertyName: string): string; + item(index: number): string; + removeProperty(propertyName: string): string; + setProperty(propertyName: string, value: string | null, priority?: string): void; + [index: number]: string; +} + +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +} + +interface CSSStyleRule extends CSSRule { + readonly readOnly: boolean; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +} + +interface CSSStyleSheet extends StyleSheet { + readonly cssRules: CSSRuleList; + cssText: string; + readonly href: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; + addImport(bstrURL: string, lIndex?: number): number; + addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; + addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; + deleteRule(index?: number): void; + insertRule(rule: string, index?: number): number; + removeImport(lIndex: number): void; + removeRule(lIndex: number): void; +} + +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(): CSSStyleSheet; +} + +interface CSSSupportsRule extends CSSConditionRule { +} + +declare var CSSSupportsRule: { + prototype: CSSSupportsRule; + new(): CSSSupportsRule; +} + +interface CanvasGradient { + addColorStop(offset: number, color: string): void; +} + +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +} + +interface CanvasPattern { + setTransform(matrix: SVGMatrix): void; +} + +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +} + +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; + fillStyle: string | CanvasGradient | CanvasPattern; + font: string; + globalAlpha: number; + globalCompositeOperation: string; + lineCap: string; + lineDashOffset: number; + lineJoin: string; + lineWidth: number; + miterLimit: number; + msFillRule: string; + msImageSmoothingEnabled: boolean; + shadowBlur: number; + shadowColor: string; + shadowOffsetX: number; + shadowOffsetY: number; + strokeStyle: string | CanvasGradient | CanvasPattern; + textAlign: string; + textBaseline: string; + mozImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; + beginPath(): void; + clearRect(x: number, y: number, w: number, h: number): void; + clip(fillRule?: string): void; + createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; + createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; + fill(fillRule?: string): void; + fillRect(x: number, y: number, w: number, h: number): void; + fillText(text: string, x: number, y: number, maxWidth?: number): void; + getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; + getLineDash(): number[]; + isPointInPath(x: number, y: number, fillRule?: string): boolean; + measureText(text: string): TextMetrics; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; + restore(): void; + rotate(angle: number): void; + save(): void; + scale(x: number, y: number): void; + setLineDash(segments: number[]): void; + setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + stroke(): void; + strokeRect(x: number, y: number, w: number, h: number): void; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; + transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + translate(x: number, y: number): void; +} + +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +} + +interface ChannelMergerNode extends AudioNode { +} + +declare var ChannelMergerNode: { + prototype: ChannelMergerNode; + new(): ChannelMergerNode; +} + +interface ChannelSplitterNode extends AudioNode { +} + +declare var ChannelSplitterNode: { + prototype: ChannelSplitterNode; + new(): ChannelSplitterNode; +} + +interface CharacterData extends Node, ChildNode { + data: string; + readonly length: number; + appendData(arg: string): void; + deleteData(offset: number, count: number): void; + insertData(offset: number, arg: string): void; + replaceData(offset: number, count: number, arg: string): void; + substringData(offset: number, count: number): string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +} + +interface ClientRect { + bottom: number; + readonly height: number; + left: number; + right: number; + top: number; + readonly width: number; +} + +declare var ClientRect: { + prototype: ClientRect; + new(): ClientRect; +} + +interface ClientRectList { + readonly length: number; + item(index: number): ClientRect; + [index: number]: ClientRect; +} + +declare var ClientRectList: { + prototype: ClientRectList; + new(): ClientRectList; +} + +interface ClipboardEvent extends Event { + readonly clipboardData: DataTransfer; +} + +declare var ClipboardEvent: { + prototype: ClipboardEvent; + new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; +} + +interface CloseEvent extends Event { + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} + +declare var CloseEvent: { + prototype: CloseEvent; + new(): CloseEvent; +} + +interface CommandEvent extends Event { + readonly commandName: string; + readonly detail: string | null; +} + +declare var CommandEvent: { + prototype: CommandEvent; + new(type: string, eventInitDict?: CommandEventInit): CommandEvent; +} + +interface Comment extends CharacterData { + text: string; +} + +declare var Comment: { + prototype: Comment; + new(): Comment; +} + +interface CompositionEvent extends UIEvent { + readonly data: string; + readonly locale: string; + initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; +} + +declare var CompositionEvent: { + prototype: CompositionEvent; + new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; +} + +interface Console { + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + clear(): void; + count(countTitle?: string): void; + debug(message?: string, ...optionalParams: any[]): void; + dir(value?: any, ...optionalParams: any[]): void; + dirxml(value: any): void; + error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; + group(groupTitle?: string): void; + groupCollapsed(groupTitle?: string): void; + groupEnd(): void; + info(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: Element): boolean; + profile(reportName?: string): void; + profileEnd(): void; + select(element: Element): void; + table(...data: any[]): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; +} + +declare var Console: { + prototype: Console; + new(): Console; +} + +interface ConvolverNode extends AudioNode { + buffer: AudioBuffer | null; + normalize: boolean; +} + +declare var ConvolverNode: { + prototype: ConvolverNode; + new(): ConvolverNode; +} + +interface Coordinates { + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; +} + +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface Crypto extends Object, RandomSource { + readonly subtle: SubtleCrypto; +} + +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +} + +interface CryptoKey { + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; +} + +declare var CryptoKey: { + prototype: CryptoKey; + new(): CryptoKey; +} + +interface CryptoKeyPair { + privateKey: CryptoKey; + publicKey: CryptoKey; +} + +declare var CryptoKeyPair: { + prototype: CryptoKeyPair; + new(): CryptoKeyPair; +} + +interface CustomEvent extends Event { + readonly detail: any; + initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; +} + +declare var CustomEvent: { + prototype: CustomEvent; + new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; +} + +interface DOMError { + readonly name: string; + toString(): string; +} + +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface DOMException { + readonly code: number; + readonly message: string; + readonly name: string; + toString(): string; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +interface DOMImplementation { + createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; + createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; + createHTMLDocument(title: string): Document; + hasFeature(feature: string | null, version: string | null): boolean; +} + +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +} + +interface DOMParser { + parseFromString(source: string, mimeType: string): Document; +} + +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +} + +interface DOMSettableTokenList extends DOMTokenList { + value: string; +} + +declare var DOMSettableTokenList: { + prototype: DOMSettableTokenList; + new(): DOMSettableTokenList; +} + +interface DOMStringList { + readonly length: number; + contains(str: string): boolean; + item(index: number): string | null; + [index: number]: string; +} + +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface DOMStringMap { + [name: string]: string; +} + +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +} + +interface DOMTokenList { + readonly length: number; + add(...token: string[]): void; + contains(token: string): boolean; + item(index: number): string; + remove(...token: string[]): void; + toString(): string; + toggle(token: string, force?: boolean): boolean; + [index: number]: string; +} + +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +} + +interface DataCue extends TextTrackCue { + data: ArrayBuffer; +} + +declare var DataCue: { + prototype: DataCue; + new(): DataCue; +} + +interface DataTransfer { + dropEffect: string; + effectAllowed: string; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: string[]; + clearData(format?: string): boolean; + getData(format: string): string; + setData(format: string, data: string): boolean; +} + +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +} + +interface DataTransferItem { + readonly kind: string; + readonly type: string; + getAsFile(): File | null; + getAsString(_callback: FunctionStringCallback | null): void; +} + +declare var DataTransferItem: { + prototype: DataTransferItem; + new(): DataTransferItem; +} + +interface DataTransferItemList { + readonly length: number; + add(data: File): DataTransferItem | null; + clear(): void; + item(index: number): DataTransferItem; + remove(index: number): void; + [index: number]: DataTransferItem; +} + +declare var DataTransferItemList: { + prototype: DataTransferItemList; + new(): DataTransferItemList; +} + +interface DeferredPermissionRequest { + readonly id: number; + readonly type: string; + readonly uri: string; + allow(): void; + deny(): void; +} + +declare var DeferredPermissionRequest: { + prototype: DeferredPermissionRequest; + new(): DeferredPermissionRequest; +} + +interface DelayNode extends AudioNode { + readonly delayTime: AudioParam; +} + +declare var DelayNode: { + prototype: DelayNode; + new(): DelayNode; +} + +interface DeviceAcceleration { + readonly x: number | null; + readonly y: number | null; + readonly z: number | null; +} + +declare var DeviceAcceleration: { + prototype: DeviceAcceleration; + new(): DeviceAcceleration; +} + +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + +interface DeviceMotionEvent extends Event { + readonly acceleration: DeviceAcceleration | null; + readonly accelerationIncludingGravity: DeviceAcceleration | null; + readonly interval: number | null; + readonly rotationRate: DeviceRotationRate | null; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; +} + +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(): DeviceMotionEvent; +} + +interface DeviceOrientationEvent extends Event { + readonly absolute: boolean; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; +} + +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(): DeviceOrientationEvent; +} + +interface DeviceRotationRate { + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; +} + +declare var DeviceRotationRate: { + prototype: DeviceRotationRate; + new(): DeviceRotationRate; +} + +interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode { + /** + * Sets or gets the URL for the current document. + */ + readonly URL: string; + /** + * Gets the URL for the document, stripped of any character encoding. + */ + readonly URLUnencoded: string; + /** + * Gets the object that has the focus when the parent document has focus. + */ + readonly activeElement: Element; + /** + * Sets or gets the color of all active links in the document. + */ + alinkColor: string; + /** + * Returns a reference to the collection of elements contained by the object. + */ + readonly all: HTMLAllCollection; + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + */ + anchors: HTMLCollectionOf; + /** + * Retrieves a collection of all applet objects in the document. + */ + applets: HTMLCollectionOf; + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + */ + bgColor: string; + /** + * Specifies the beginning and end of the document body. + */ + body: HTMLElement; + readonly characterSet: string; + /** + * Gets or sets the character set used to encode the object. + */ + charset: string; + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. + */ + readonly compatMode: string; + cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; + /** + * Gets the default character set from the current regional language settings. + */ + readonly defaultCharset: string; + readonly defaultView: Window; + /** + * Sets or gets a value that indicates whether the document can be edited. + */ + designMode: string; + /** + * Sets or retrieves a value that indicates the reading order of the object. + */ + dir: string; + /** + * Gets an object representing the document type declaration associated with the current document. + */ + readonly doctype: DocumentType; + /** + * Gets a reference to the root node of the document. + */ + documentElement: HTMLElement; + /** + * Sets or gets the security domain of the document. + */ + domain: string; + /** + * Retrieves a collection of all embed objects in the document. + */ + embeds: HTMLCollectionOf; + /** + * Sets or gets the foreground (text) color of the document. + */ + fgColor: string; + /** + * Retrieves a collection, in source order, of all form objects in the document. + */ + forms: HTMLCollectionOf; + readonly fullscreenElement: Element | null; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; + /** + * Retrieves a collection, in source order, of img objects in the document. + */ + images: HTMLCollectionOf; + /** + * Gets the implementation object of the current document. + */ + readonly implementation: DOMImplementation; + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. + */ + readonly inputEncoding: string | null; + /** + * Gets the date that the page was last modified, if the page supplies one. + */ + readonly lastModified: string; + /** + * Sets or gets the color of the document links. + */ + linkColor: string; + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + */ + links: HTMLCollectionOf; + /** + * Contains information about the current URL. + */ + readonly location: Location; + msCSSOMElementFloatMetrics: boolean; + msCapsLockWarningOff: boolean; + /** + * Fires when the user aborts the download. + * @param ev The event. + */ + onabort: (this: this, ev: UIEvent) => any; + /** + * Fires when the object is set as the active element. + * @param ev The event. + */ + onactivate: (this: this, ev: UIEvent) => any; + /** + * Fires immediately before the object is set as the active element. + * @param ev The event. + */ + onbeforeactivate: (this: this, ev: UIEvent) => any; + /** + * Fires immediately before the activeElement is changed from the current object to another object in the parent document. + * @param ev The event. + */ + onbeforedeactivate: (this: this, ev: UIEvent) => any; + /** + * Fires when the object loses the input focus. + * @param ev The focus event. + */ + onblur: (this: this, ev: FocusEvent) => any; + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. + */ + oncanplay: (this: this, ev: Event) => any; + oncanplaythrough: (this: this, ev: Event) => any; + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. + */ + onchange: (this: this, ev: Event) => any; + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. + */ + onclick: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. + */ + oncontextmenu: (this: this, ev: PointerEvent) => any; + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. + */ + ondblclick: (this: this, ev: MouseEvent) => any; + /** + * Fires when the activeElement is changed from the current object to another object in the parent document. + * @param ev The UI Event + */ + ondeactivate: (this: this, ev: UIEvent) => any; + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. + */ + ondrag: (this: this, ev: DragEvent) => any; + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. + */ + ondragend: (this: this, ev: DragEvent) => any; + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. + */ + ondragenter: (this: this, ev: DragEvent) => any; + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. + */ + ondragleave: (this: this, ev: DragEvent) => any; + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. + */ + ondragover: (this: this, ev: DragEvent) => any; + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. + */ + ondragstart: (this: this, ev: DragEvent) => any; + ondrop: (this: this, ev: DragEvent) => any; + /** + * Occurs when the duration attribute is updated. + * @param ev The event. + */ + ondurationchange: (this: this, ev: Event) => any; + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. + */ + onemptied: (this: this, ev: Event) => any; + /** + * Occurs when the end of playback is reached. + * @param ev The event + */ + onended: (this: this, ev: MediaStreamErrorEvent) => any; + /** + * Fires when an error occurs during object loading. + * @param ev The event. + */ + onerror: (this: this, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + * @param ev The event. + */ + onfocus: (this: this, ev: FocusEvent) => any; + onfullscreenchange: (this: this, ev: Event) => any; + onfullscreenerror: (this: this, ev: Event) => any; + oninput: (this: this, ev: Event) => any; + oninvalid: (this: this, ev: Event) => any; + /** + * Fires when the user presses a key. + * @param ev The keyboard event + */ + onkeydown: (this: this, ev: KeyboardEvent) => any; + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. + */ + onkeypress: (this: this, ev: KeyboardEvent) => any; + /** + * Fires when the user releases a key. + * @param ev The keyboard event + */ + onkeyup: (this: this, ev: KeyboardEvent) => any; + /** + * Fires immediately after the browser loads the object. + * @param ev The event. + */ + onload: (this: this, ev: Event) => any; + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. + */ + onloadeddata: (this: this, ev: Event) => any; + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. + */ + onloadedmetadata: (this: this, ev: Event) => any; + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. + */ + onloadstart: (this: this, ev: Event) => any; + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. + */ + onmousedown: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. + */ + onmousemove: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. + */ + onmouseout: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. + */ + onmouseover: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. + */ + onmouseup: (this: this, ev: MouseEvent) => any; + /** + * Fires when the wheel button is rotated. + * @param ev The mouse event + */ + onmousewheel: (this: this, ev: WheelEvent) => any; + onmscontentzoom: (this: this, ev: UIEvent) => any; + onmsgesturechange: (this: this, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; + onmsgestureend: (this: this, ev: MSGestureEvent) => any; + onmsgesturehold: (this: this, ev: MSGestureEvent) => any; + onmsgesturestart: (this: this, ev: MSGestureEvent) => any; + onmsgesturetap: (this: this, ev: MSGestureEvent) => any; + onmsinertiastart: (this: this, ev: MSGestureEvent) => any; + onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; + onmspointercancel: (this: this, ev: MSPointerEvent) => any; + onmspointerdown: (this: this, ev: MSPointerEvent) => any; + onmspointerenter: (this: this, ev: MSPointerEvent) => any; + onmspointerleave: (this: this, ev: MSPointerEvent) => any; + onmspointermove: (this: this, ev: MSPointerEvent) => any; + onmspointerout: (this: this, ev: MSPointerEvent) => any; + onmspointerover: (this: this, ev: MSPointerEvent) => any; + onmspointerup: (this: this, ev: MSPointerEvent) => any; + /** + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * @param ev The event. + */ + onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any; + /** + * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. + * @param ev The event. + */ + onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any; + /** + * Occurs when playback is paused. + * @param ev The event. + */ + onpause: (this: this, ev: Event) => any; + /** + * Occurs when the play method is requested. + * @param ev The event. + */ + onplay: (this: this, ev: Event) => any; + /** + * Occurs when the audio or video has started playing. + * @param ev The event. + */ + onplaying: (this: this, ev: Event) => any; + onpointerlockchange: (this: this, ev: Event) => any; + onpointerlockerror: (this: this, ev: Event) => any; + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. + */ + onprogress: (this: this, ev: ProgressEvent) => any; + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. + */ + onratechange: (this: this, ev: Event) => any; + /** + * Fires when the state of the object has changed. + * @param ev The event + */ + onreadystatechange: (this: this, ev: ProgressEvent) => any; + /** + * Fires when the user resets a form. + * @param ev The event. + */ + onreset: (this: this, ev: Event) => any; + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. + */ + onscroll: (this: this, ev: UIEvent) => any; + /** + * Occurs when the seek operation ends. + * @param ev The event. + */ + onseeked: (this: this, ev: Event) => any; + /** + * Occurs when the current playback position is moved. + * @param ev The event. + */ + onseeking: (this: this, ev: Event) => any; + /** + * Fires when the current selection changes. + * @param ev The event. + */ + onselect: (this: this, ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (this: this, ev: Event) => any; + onselectstart: (this: this, ev: Event) => any; + /** + * Occurs when the download has stopped. + * @param ev The event. + */ + onstalled: (this: this, ev: Event) => any; + /** + * Fires when the user clicks the Stop button or leaves the Web page. + * @param ev The event. + */ + onstop: (this: this, ev: Event) => any; + onsubmit: (this: this, ev: Event) => any; + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. + */ + onsuspend: (this: this, ev: Event) => any; + /** + * Occurs to indicate the current playback position. + * @param ev The event. + */ + ontimeupdate: (this: this, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. + */ + onvolumechange: (this: this, ev: Event) => any; + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. + */ + onwaiting: (this: this, ev: Event) => any; + onwebkitfullscreenchange: (this: this, ev: Event) => any; + onwebkitfullscreenerror: (this: this, ev: Event) => any; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; + /** + * Retrieves a value that indicates the current state of the object. + */ + readonly readyState: string; + /** + * Gets the URL of the location that referred the user to the current page. + */ + readonly referrer: string; + /** + * Gets the root svg element in the document hierarchy. + */ + readonly rootElement: SVGSVGElement; + /** + * Retrieves a collection of all script objects in the document. + */ + scripts: HTMLCollectionOf; + readonly scrollingElement: Element | null; + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + */ + readonly styleSheets: StyleSheetList; + /** + * Contains the title of the document. + */ + title: string; + readonly visibilityState: string; + /** + * Sets or gets the color of the links that the user has visited. + */ + vlinkColor: string; + readonly webkitCurrentFullScreenElement: Element | null; + readonly webkitFullscreenElement: Element | null; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string | null; + xmlStandalone: boolean; + /** + * Gets or sets the version attribute specified in the declaration of an XML document. + */ + xmlVersion: string | null; + adoptNode(source: Node): Node; + captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; + clear(): void; + /** + * Closes an output stream and forces the sent data to display. + */ + close(): void; + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. + */ + createAttribute(name: string): Attr; + createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; + createCDATASection(data: string): CDATASection; + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. + */ + createComment(data: string): Comment; + /** + * Creates a new document. + */ + createDocumentFragment(): DocumentFragment; + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + */ + createElement(tagName: "a"): HTMLAnchorElement; + createElement(tagName: "applet"): HTMLAppletElement; + createElement(tagName: "area"): HTMLAreaElement; + createElement(tagName: "audio"): HTMLAudioElement; + createElement(tagName: "base"): HTMLBaseElement; + createElement(tagName: "basefont"): HTMLBaseFontElement; + createElement(tagName: "blockquote"): HTMLQuoteElement; + createElement(tagName: "body"): HTMLBodyElement; + createElement(tagName: "br"): HTMLBRElement; + createElement(tagName: "button"): HTMLButtonElement; + createElement(tagName: "canvas"): HTMLCanvasElement; + createElement(tagName: "caption"): HTMLTableCaptionElement; + createElement(tagName: "col"): HTMLTableColElement; + createElement(tagName: "colgroup"): HTMLTableColElement; + createElement(tagName: "datalist"): HTMLDataListElement; + createElement(tagName: "del"): HTMLModElement; + createElement(tagName: "dir"): HTMLDirectoryElement; + createElement(tagName: "div"): HTMLDivElement; + createElement(tagName: "dl"): HTMLDListElement; + createElement(tagName: "embed"): HTMLEmbedElement; + createElement(tagName: "fieldset"): HTMLFieldSetElement; + createElement(tagName: "font"): HTMLFontElement; + createElement(tagName: "form"): HTMLFormElement; + createElement(tagName: "frame"): HTMLFrameElement; + createElement(tagName: "frameset"): HTMLFrameSetElement; + createElement(tagName: "h1"): HTMLHeadingElement; + createElement(tagName: "h2"): HTMLHeadingElement; + createElement(tagName: "h3"): HTMLHeadingElement; + createElement(tagName: "h4"): HTMLHeadingElement; + createElement(tagName: "h5"): HTMLHeadingElement; + createElement(tagName: "h6"): HTMLHeadingElement; + createElement(tagName: "head"): HTMLHeadElement; + createElement(tagName: "hr"): HTMLHRElement; + createElement(tagName: "html"): HTMLHtmlElement; + createElement(tagName: "iframe"): HTMLIFrameElement; + createElement(tagName: "img"): HTMLImageElement; + createElement(tagName: "input"): HTMLInputElement; + createElement(tagName: "ins"): HTMLModElement; + createElement(tagName: "isindex"): HTMLUnknownElement; + createElement(tagName: "label"): HTMLLabelElement; + createElement(tagName: "legend"): HTMLLegendElement; + createElement(tagName: "li"): HTMLLIElement; + createElement(tagName: "link"): HTMLLinkElement; + createElement(tagName: "listing"): HTMLPreElement; + createElement(tagName: "map"): HTMLMapElement; + createElement(tagName: "marquee"): HTMLMarqueeElement; + createElement(tagName: "menu"): HTMLMenuElement; + createElement(tagName: "meta"): HTMLMetaElement; + createElement(tagName: "meter"): HTMLMeterElement; + createElement(tagName: "nextid"): HTMLUnknownElement; + createElement(tagName: "object"): HTMLObjectElement; + createElement(tagName: "ol"): HTMLOListElement; + createElement(tagName: "optgroup"): HTMLOptGroupElement; + createElement(tagName: "option"): HTMLOptionElement; + createElement(tagName: "p"): HTMLParagraphElement; + createElement(tagName: "param"): HTMLParamElement; + createElement(tagName: "picture"): HTMLPictureElement; + createElement(tagName: "pre"): HTMLPreElement; + createElement(tagName: "progress"): HTMLProgressElement; + createElement(tagName: "q"): HTMLQuoteElement; + createElement(tagName: "script"): HTMLScriptElement; + createElement(tagName: "select"): HTMLSelectElement; + createElement(tagName: "source"): HTMLSourceElement; + createElement(tagName: "span"): HTMLSpanElement; + createElement(tagName: "style"): HTMLStyleElement; + createElement(tagName: "table"): HTMLTableElement; + createElement(tagName: "tbody"): HTMLTableSectionElement; + createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "template"): HTMLTemplateElement; + createElement(tagName: "textarea"): HTMLTextAreaElement; + createElement(tagName: "tfoot"): HTMLTableSectionElement; + createElement(tagName: "th"): HTMLTableHeaderCellElement; + createElement(tagName: "thead"): HTMLTableSectionElement; + createElement(tagName: "title"): HTMLTitleElement; + createElement(tagName: "tr"): HTMLTableRowElement; + createElement(tagName: "track"): HTMLTrackElement; + createElement(tagName: "ul"): HTMLUListElement; + createElement(tagName: "video"): HTMLVideoElement; + createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; + createElement(tagName: "xmp"): HTMLPreElement; + createElement(tagName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement + createElementNS(namespaceURI: string | null, qualifiedName: string): Element; + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver: Node): XPathNSResolver; + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + */ + createRange(): Range; + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. + */ + createTextNode(data: string): Text; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouchList(...touches: Touch[]): TouchList; + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset + */ + elementFromPoint(x: number, y: number): Element; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. + */ + execCommand(commandId: string, showUI?: boolean, value?: any): boolean; + /** + * Displays help information for the given command identifier. + * @param commandId Displays help information for the given command identifier. + */ + execCommandShowHelp(commandId: string): boolean; + exitFullscreen(): void; + exitPointerLock(): void; + /** + * Causes the element to receive the focus and executes the code specified by the onfocus event. + */ + focus(): void; + /** + * Returns a reference to the first object with the specified value of the ID or NAME attribute. + * @param elementId String that specifies the ID value. Case-insensitive. + */ + getElementById(elementId: string): HTMLElement | null; + getElementsByClassName(classNames: string): HTMLCollectionOf; + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + */ + getElementsByName(elementName: string): NodeListOf; + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. + */ + getElementsByTagName(tagname: "a"): NodeListOf; + getElementsByTagName(tagname: "abbr"): NodeListOf; + getElementsByTagName(tagname: "acronym"): NodeListOf; + getElementsByTagName(tagname: "address"): NodeListOf; + getElementsByTagName(tagname: "applet"): NodeListOf; + getElementsByTagName(tagname: "area"): NodeListOf; + getElementsByTagName(tagname: "article"): NodeListOf; + getElementsByTagName(tagname: "aside"): NodeListOf; + getElementsByTagName(tagname: "audio"): NodeListOf; + getElementsByTagName(tagname: "b"): NodeListOf; + getElementsByTagName(tagname: "base"): NodeListOf; + getElementsByTagName(tagname: "basefont"): NodeListOf; + getElementsByTagName(tagname: "bdo"): NodeListOf; + getElementsByTagName(tagname: "big"): NodeListOf; + getElementsByTagName(tagname: "blockquote"): NodeListOf; + getElementsByTagName(tagname: "body"): NodeListOf; + getElementsByTagName(tagname: "br"): NodeListOf; + getElementsByTagName(tagname: "button"): NodeListOf; + getElementsByTagName(tagname: "canvas"): NodeListOf; + getElementsByTagName(tagname: "caption"): NodeListOf; + getElementsByTagName(tagname: "center"): NodeListOf; + getElementsByTagName(tagname: "circle"): NodeListOf; + getElementsByTagName(tagname: "cite"): NodeListOf; + getElementsByTagName(tagname: "clippath"): NodeListOf; + getElementsByTagName(tagname: "code"): NodeListOf; + getElementsByTagName(tagname: "col"): NodeListOf; + getElementsByTagName(tagname: "colgroup"): NodeListOf; + getElementsByTagName(tagname: "datalist"): NodeListOf; + getElementsByTagName(tagname: "dd"): NodeListOf; + getElementsByTagName(tagname: "defs"): NodeListOf; + getElementsByTagName(tagname: "del"): NodeListOf; + getElementsByTagName(tagname: "desc"): NodeListOf; + getElementsByTagName(tagname: "dfn"): NodeListOf; + getElementsByTagName(tagname: "dir"): NodeListOf; + getElementsByTagName(tagname: "div"): NodeListOf; + getElementsByTagName(tagname: "dl"): NodeListOf; + getElementsByTagName(tagname: "dt"): NodeListOf; + getElementsByTagName(tagname: "ellipse"): NodeListOf; + getElementsByTagName(tagname: "em"): NodeListOf; + getElementsByTagName(tagname: "embed"): NodeListOf; + getElementsByTagName(tagname: "feblend"): NodeListOf; + getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; + getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; + getElementsByTagName(tagname: "fecomposite"): NodeListOf; + getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; + getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; + getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; + getElementsByTagName(tagname: "fedistantlight"): NodeListOf; + getElementsByTagName(tagname: "feflood"): NodeListOf; + getElementsByTagName(tagname: "fefunca"): NodeListOf; + getElementsByTagName(tagname: "fefuncb"): NodeListOf; + getElementsByTagName(tagname: "fefuncg"): NodeListOf; + getElementsByTagName(tagname: "fefuncr"): NodeListOf; + getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; + getElementsByTagName(tagname: "feimage"): NodeListOf; + getElementsByTagName(tagname: "femerge"): NodeListOf; + getElementsByTagName(tagname: "femergenode"): NodeListOf; + getElementsByTagName(tagname: "femorphology"): NodeListOf; + getElementsByTagName(tagname: "feoffset"): NodeListOf; + getElementsByTagName(tagname: "fepointlight"): NodeListOf; + getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; + getElementsByTagName(tagname: "fespotlight"): NodeListOf; + getElementsByTagName(tagname: "fetile"): NodeListOf; + getElementsByTagName(tagname: "feturbulence"): NodeListOf; + getElementsByTagName(tagname: "fieldset"): NodeListOf; + getElementsByTagName(tagname: "figcaption"): NodeListOf; + getElementsByTagName(tagname: "figure"): NodeListOf; + getElementsByTagName(tagname: "filter"): NodeListOf; + getElementsByTagName(tagname: "font"): NodeListOf; + getElementsByTagName(tagname: "footer"): NodeListOf; + getElementsByTagName(tagname: "foreignobject"): NodeListOf; + getElementsByTagName(tagname: "form"): NodeListOf; + getElementsByTagName(tagname: "frame"): NodeListOf; + getElementsByTagName(tagname: "frameset"): NodeListOf; + getElementsByTagName(tagname: "g"): NodeListOf; + getElementsByTagName(tagname: "h1"): NodeListOf; + getElementsByTagName(tagname: "h2"): NodeListOf; + getElementsByTagName(tagname: "h3"): NodeListOf; + getElementsByTagName(tagname: "h4"): NodeListOf; + getElementsByTagName(tagname: "h5"): NodeListOf; + getElementsByTagName(tagname: "h6"): NodeListOf; + getElementsByTagName(tagname: "head"): NodeListOf; + getElementsByTagName(tagname: "header"): NodeListOf; + getElementsByTagName(tagname: "hgroup"): NodeListOf; + getElementsByTagName(tagname: "hr"): NodeListOf; + getElementsByTagName(tagname: "html"): NodeListOf; + getElementsByTagName(tagname: "i"): NodeListOf; + getElementsByTagName(tagname: "iframe"): NodeListOf; + getElementsByTagName(tagname: "image"): NodeListOf; + getElementsByTagName(tagname: "img"): NodeListOf; + getElementsByTagName(tagname: "input"): NodeListOf; + getElementsByTagName(tagname: "ins"): NodeListOf; + getElementsByTagName(tagname: "isindex"): NodeListOf; + getElementsByTagName(tagname: "kbd"): NodeListOf; + getElementsByTagName(tagname: "keygen"): NodeListOf; + getElementsByTagName(tagname: "label"): NodeListOf; + getElementsByTagName(tagname: "legend"): NodeListOf; + getElementsByTagName(tagname: "li"): NodeListOf; + getElementsByTagName(tagname: "line"): NodeListOf; + getElementsByTagName(tagname: "lineargradient"): NodeListOf; + getElementsByTagName(tagname: "link"): NodeListOf; + getElementsByTagName(tagname: "listing"): NodeListOf; + getElementsByTagName(tagname: "map"): NodeListOf; + getElementsByTagName(tagname: "mark"): NodeListOf; + getElementsByTagName(tagname: "marker"): NodeListOf; + getElementsByTagName(tagname: "marquee"): NodeListOf; + getElementsByTagName(tagname: "mask"): NodeListOf; + getElementsByTagName(tagname: "menu"): NodeListOf; + getElementsByTagName(tagname: "meta"): NodeListOf; + getElementsByTagName(tagname: "metadata"): NodeListOf; + getElementsByTagName(tagname: "meter"): NodeListOf; + getElementsByTagName(tagname: "nav"): NodeListOf; + getElementsByTagName(tagname: "nextid"): NodeListOf; + getElementsByTagName(tagname: "nobr"): NodeListOf; + getElementsByTagName(tagname: "noframes"): NodeListOf; + getElementsByTagName(tagname: "noscript"): NodeListOf; + getElementsByTagName(tagname: "object"): NodeListOf; + getElementsByTagName(tagname: "ol"): NodeListOf; + getElementsByTagName(tagname: "optgroup"): NodeListOf; + getElementsByTagName(tagname: "option"): NodeListOf; + getElementsByTagName(tagname: "p"): NodeListOf; + getElementsByTagName(tagname: "param"): NodeListOf; + getElementsByTagName(tagname: "path"): NodeListOf; + getElementsByTagName(tagname: "pattern"): NodeListOf; + getElementsByTagName(tagname: "picture"): NodeListOf; + getElementsByTagName(tagname: "plaintext"): NodeListOf; + getElementsByTagName(tagname: "polygon"): NodeListOf; + getElementsByTagName(tagname: "polyline"): NodeListOf; + getElementsByTagName(tagname: "pre"): NodeListOf; + getElementsByTagName(tagname: "progress"): NodeListOf; + getElementsByTagName(tagname: "q"): NodeListOf; + getElementsByTagName(tagname: "radialgradient"): NodeListOf; + getElementsByTagName(tagname: "rect"): NodeListOf; + getElementsByTagName(tagname: "rt"): NodeListOf; + getElementsByTagName(tagname: "ruby"): NodeListOf; + getElementsByTagName(tagname: "s"): NodeListOf; + getElementsByTagName(tagname: "samp"): NodeListOf; + getElementsByTagName(tagname: "script"): NodeListOf; + getElementsByTagName(tagname: "section"): NodeListOf; + getElementsByTagName(tagname: "select"): NodeListOf; + getElementsByTagName(tagname: "small"): NodeListOf; + getElementsByTagName(tagname: "source"): NodeListOf; + getElementsByTagName(tagname: "span"): NodeListOf; + getElementsByTagName(tagname: "stop"): NodeListOf; + getElementsByTagName(tagname: "strike"): NodeListOf; + getElementsByTagName(tagname: "strong"): NodeListOf; + getElementsByTagName(tagname: "style"): NodeListOf; + getElementsByTagName(tagname: "sub"): NodeListOf; + getElementsByTagName(tagname: "sup"): NodeListOf; + getElementsByTagName(tagname: "svg"): NodeListOf; + getElementsByTagName(tagname: "switch"): NodeListOf; + getElementsByTagName(tagname: "symbol"): NodeListOf; + getElementsByTagName(tagname: "table"): NodeListOf; + getElementsByTagName(tagname: "tbody"): NodeListOf; + getElementsByTagName(tagname: "td"): NodeListOf; + getElementsByTagName(tagname: "template"): NodeListOf; + getElementsByTagName(tagname: "text"): NodeListOf; + getElementsByTagName(tagname: "textpath"): NodeListOf; + getElementsByTagName(tagname: "textarea"): NodeListOf; + getElementsByTagName(tagname: "tfoot"): NodeListOf; + getElementsByTagName(tagname: "th"): NodeListOf; + getElementsByTagName(tagname: "thead"): NodeListOf; + getElementsByTagName(tagname: "title"): NodeListOf; + getElementsByTagName(tagname: "tr"): NodeListOf; + getElementsByTagName(tagname: "track"): NodeListOf; + getElementsByTagName(tagname: "tspan"): NodeListOf; + getElementsByTagName(tagname: "tt"): NodeListOf; + getElementsByTagName(tagname: "u"): NodeListOf; + getElementsByTagName(tagname: "ul"): NodeListOf; + getElementsByTagName(tagname: "use"): NodeListOf; + getElementsByTagName(tagname: "var"): NodeListOf; + getElementsByTagName(tagname: "video"): NodeListOf; + getElementsByTagName(tagname: "view"): NodeListOf; + getElementsByTagName(tagname: "wbr"): NodeListOf; + getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; + getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + */ + getSelection(): Selection; + /** + * Gets a value indicating whether the object currently has focus. + */ + hasFocus(): boolean; + importNode(importedNode: Node, deep: boolean): Node; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(url?: string, name?: string, features?: string, replace?: boolean): Document; + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. + */ + queryCommandEnabled(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. + */ + queryCommandIndeterm(commandId: string): boolean; + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. + */ + queryCommandState(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. + */ + queryCommandSupported(commandId: string): boolean; + /** + * Retrieves the string associated with a command. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + */ + queryCommandText(commandId: string): string; + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. + */ + queryCommandValue(commandId: string): string; + releaseEvents(): void; + /** + * Allows updating the print settings for the page. + */ + updateSettings(): void; + webkitCancelFullScreen(): void; + webkitExitFullscreen(): void; + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. + */ + write(...content: string[]): void; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...content: string[]): 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var Document: { + prototype: Document; + new(): Document; +} + +interface DocumentFragment extends Node, NodeSelector, ParentNode { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +} + +interface DocumentType extends Node, ChildNode { + readonly entities: NamedNodeMap; + readonly internalSubset: string | null; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string | null; + readonly systemId: string | null; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +} + +interface DragEvent extends MouseEvent { + readonly dataTransfer: DataTransfer; + initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; + msConvertURL(file: File, targetType: string, targetURL?: string): void; +} + +declare var DragEvent: { + prototype: DragEvent; + new(): DragEvent; +} + +interface DynamicsCompressorNode extends AudioNode { + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: AudioParam; + readonly release: AudioParam; + readonly threshold: AudioParam; +} + +declare var DynamicsCompressorNode: { + prototype: DynamicsCompressorNode; + new(): DynamicsCompressorNode; +} + +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + +interface EXT_texture_filter_anisotropic { + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +declare var EXT_texture_filter_anisotropic: { + prototype: EXT_texture_filter_anisotropic; + new(): EXT_texture_filter_anisotropic; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; + msContentZoomFactor: number; + readonly msRegionOverflow: string; + onariarequest: (this: this, ev: AriaRequestEvent) => any; + oncommand: (this: this, ev: CommandEvent) => any; + ongotpointercapture: (this: this, ev: PointerEvent) => any; + onlostpointercapture: (this: this, ev: PointerEvent) => any; + onmsgesturechange: (this: this, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; + onmsgestureend: (this: this, ev: MSGestureEvent) => any; + onmsgesturehold: (this: this, ev: MSGestureEvent) => any; + onmsgesturestart: (this: this, ev: MSGestureEvent) => any; + onmsgesturetap: (this: this, ev: MSGestureEvent) => any; + onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any; + onmsinertiastart: (this: this, ev: MSGestureEvent) => any; + onmslostpointercapture: (this: this, ev: MSPointerEvent) => any; + onmspointercancel: (this: this, ev: MSPointerEvent) => any; + onmspointerdown: (this: this, ev: MSPointerEvent) => any; + onmspointerenter: (this: this, ev: MSPointerEvent) => any; + onmspointerleave: (this: this, ev: MSPointerEvent) => any; + onmspointermove: (this: this, ev: MSPointerEvent) => any; + onmspointerout: (this: this, ev: MSPointerEvent) => any; + onmspointerover: (this: this, ev: MSPointerEvent) => any; + onmspointerup: (this: this, ev: MSPointerEvent) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onwebkitfullscreenchange: (this: this, ev: Event) => any; + onwebkitfullscreenerror: (this: this, ev: Event) => any; + readonly prefix: string | null; + readonly scrollHeight: number; + scrollLeft: number; + scrollTop: number; + readonly scrollWidth: number; + readonly tagName: string; + innerHTML: string; + getAttribute(name: string): string | null; + getAttributeNS(namespaceURI: string, localName: string): string; + getAttributeNode(name: string): Attr; + getAttributeNodeNS(namespaceURI: string, localName: string): Attr; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + getElementsByTagName(name: "a"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "applet"): NodeListOf; + getElementsByTagName(name: "area"): NodeListOf; + getElementsByTagName(name: "article"): NodeListOf; + getElementsByTagName(name: "aside"): NodeListOf; + getElementsByTagName(name: "audio"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "base"): NodeListOf; + getElementsByTagName(name: "basefont"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "body"): NodeListOf; + getElementsByTagName(name: "br"): NodeListOf; + getElementsByTagName(name: "button"): NodeListOf; + getElementsByTagName(name: "canvas"): NodeListOf; + getElementsByTagName(name: "caption"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "circle"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "clippath"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "col"): NodeListOf; + getElementsByTagName(name: "colgroup"): NodeListOf; + getElementsByTagName(name: "datalist"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "defs"): NodeListOf; + getElementsByTagName(name: "del"): NodeListOf; + getElementsByTagName(name: "desc"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dir"): NodeListOf; + getElementsByTagName(name: "div"): NodeListOf; + getElementsByTagName(name: "dl"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "ellipse"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "embed"): NodeListOf; + getElementsByTagName(name: "feblend"): NodeListOf; + getElementsByTagName(name: "fecolormatrix"): NodeListOf; + getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; + getElementsByTagName(name: "fecomposite"): NodeListOf; + getElementsByTagName(name: "feconvolvematrix"): NodeListOf; + getElementsByTagName(name: "fediffuselighting"): NodeListOf; + getElementsByTagName(name: "fedisplacementmap"): NodeListOf; + getElementsByTagName(name: "fedistantlight"): NodeListOf; + getElementsByTagName(name: "feflood"): NodeListOf; + getElementsByTagName(name: "fefunca"): NodeListOf; + getElementsByTagName(name: "fefuncb"): NodeListOf; + getElementsByTagName(name: "fefuncg"): NodeListOf; + getElementsByTagName(name: "fefuncr"): NodeListOf; + getElementsByTagName(name: "fegaussianblur"): NodeListOf; + getElementsByTagName(name: "feimage"): NodeListOf; + getElementsByTagName(name: "femerge"): NodeListOf; + getElementsByTagName(name: "femergenode"): NodeListOf; + getElementsByTagName(name: "femorphology"): NodeListOf; + getElementsByTagName(name: "feoffset"): NodeListOf; + getElementsByTagName(name: "fepointlight"): NodeListOf; + getElementsByTagName(name: "fespecularlighting"): NodeListOf; + getElementsByTagName(name: "fespotlight"): NodeListOf; + getElementsByTagName(name: "fetile"): NodeListOf; + getElementsByTagName(name: "feturbulence"): NodeListOf; + getElementsByTagName(name: "fieldset"): NodeListOf; + getElementsByTagName(name: "figcaption"): NodeListOf; + getElementsByTagName(name: "figure"): NodeListOf; + getElementsByTagName(name: "filter"): NodeListOf; + getElementsByTagName(name: "font"): NodeListOf; + getElementsByTagName(name: "footer"): NodeListOf; + getElementsByTagName(name: "foreignobject"): NodeListOf; + getElementsByTagName(name: "form"): NodeListOf; + getElementsByTagName(name: "frame"): NodeListOf; + getElementsByTagName(name: "frameset"): NodeListOf; + getElementsByTagName(name: "g"): NodeListOf; + getElementsByTagName(name: "h1"): NodeListOf; + getElementsByTagName(name: "h2"): NodeListOf; + getElementsByTagName(name: "h3"): NodeListOf; + getElementsByTagName(name: "h4"): NodeListOf; + getElementsByTagName(name: "h5"): NodeListOf; + getElementsByTagName(name: "h6"): NodeListOf; + getElementsByTagName(name: "head"): NodeListOf; + getElementsByTagName(name: "header"): NodeListOf; + getElementsByTagName(name: "hgroup"): NodeListOf; + getElementsByTagName(name: "hr"): NodeListOf; + getElementsByTagName(name: "html"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "iframe"): NodeListOf; + getElementsByTagName(name: "image"): NodeListOf; + getElementsByTagName(name: "img"): NodeListOf; + getElementsByTagName(name: "input"): NodeListOf; + getElementsByTagName(name: "ins"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "label"): NodeListOf; + getElementsByTagName(name: "legend"): NodeListOf; + getElementsByTagName(name: "li"): NodeListOf; + getElementsByTagName(name: "line"): NodeListOf; + getElementsByTagName(name: "lineargradient"): NodeListOf; + getElementsByTagName(name: "link"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "map"): NodeListOf; + getElementsByTagName(name: "mark"): NodeListOf; + getElementsByTagName(name: "marker"): NodeListOf; + getElementsByTagName(name: "marquee"): NodeListOf; + getElementsByTagName(name: "mask"): NodeListOf; + getElementsByTagName(name: "menu"): NodeListOf; + getElementsByTagName(name: "meta"): NodeListOf; + getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "meter"): NodeListOf; + getElementsByTagName(name: "nav"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "noframes"): NodeListOf; + getElementsByTagName(name: "noscript"): NodeListOf; + getElementsByTagName(name: "object"): NodeListOf; + getElementsByTagName(name: "ol"): NodeListOf; + getElementsByTagName(name: "optgroup"): NodeListOf; + getElementsByTagName(name: "option"): NodeListOf; + getElementsByTagName(name: "p"): NodeListOf; + getElementsByTagName(name: "param"): NodeListOf; + getElementsByTagName(name: "path"): NodeListOf; + getElementsByTagName(name: "pattern"): NodeListOf; + getElementsByTagName(name: "picture"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "polygon"): NodeListOf; + getElementsByTagName(name: "polyline"): NodeListOf; + getElementsByTagName(name: "pre"): NodeListOf; + getElementsByTagName(name: "progress"): NodeListOf; + getElementsByTagName(name: "q"): NodeListOf; + getElementsByTagName(name: "radialgradient"): NodeListOf; + getElementsByTagName(name: "rect"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "script"): NodeListOf; + getElementsByTagName(name: "section"): NodeListOf; + getElementsByTagName(name: "select"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "source"): NodeListOf; + getElementsByTagName(name: "span"): NodeListOf; + getElementsByTagName(name: "stop"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "style"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "svg"): NodeListOf; + getElementsByTagName(name: "switch"): NodeListOf; + getElementsByTagName(name: "symbol"): NodeListOf; + getElementsByTagName(name: "table"): NodeListOf; + getElementsByTagName(name: "tbody"): NodeListOf; + getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "template"): NodeListOf; + getElementsByTagName(name: "text"): NodeListOf; + getElementsByTagName(name: "textpath"): NodeListOf; + getElementsByTagName(name: "textarea"): NodeListOf; + getElementsByTagName(name: "tfoot"): NodeListOf; + getElementsByTagName(name: "th"): NodeListOf; + getElementsByTagName(name: "thead"): NodeListOf; + getElementsByTagName(name: "title"): NodeListOf; + getElementsByTagName(name: "tr"): NodeListOf; + getElementsByTagName(name: "track"): NodeListOf; + getElementsByTagName(name: "tspan"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "ul"): NodeListOf; + getElementsByTagName(name: "use"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "video"): NodeListOf; + getElementsByTagName(name: "view"): NodeListOf; + getElementsByTagName(name: "wbr"): NodeListOf; + getElementsByTagName(name: "x-ms-webview"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + hasAttribute(name: string): boolean; + hasAttributeNS(namespaceURI: string, localName: string): boolean; + msGetRegionContent(): MSRangeCollection; + msGetUntransformedBounds(): ClientRect; + msMatchesSelector(selectors: string): boolean; + msReleasePointerCapture(pointerId: number): void; + msSetPointerCapture(pointerId: number): void; + msZoomTo(args: MsZoomToOptions): void; + releasePointerCapture(pointerId: number): void; + removeAttribute(name?: string): void; + removeAttributeNS(namespaceURI: string, localName: string): void; + removeAttributeNode(oldAttr: Attr): Attr; + requestFullscreen(): void; + requestPointerLock(): void; + setAttribute(name: string, value: string): void; + setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; + setAttributeNode(newAttr: Attr): Attr; + setAttributeNodeNS(newAttr: Attr): Attr; + setPointerCapture(pointerId: number): void; + webkitMatchesSelector(selectors: string): boolean; + webkitRequestFullScreen(): void; + webkitRequestFullscreen(): void; + getElementsByClassName(classNames: string): NodeListOf; + 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var Element: { + prototype: Element; + new(): Element; +} + +interface ErrorEvent extends Event { + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} + +declare var ErrorEvent: { + prototype: ErrorEvent; + new(): ErrorEvent; +} + +interface Event { + readonly bubbles: boolean; + cancelBubble: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; + returnValue: boolean; + readonly srcElement: Element | null; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + preventDefault(): void; + stopImmediatePropagation(): void; + stopPropagation(): void; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +declare var Event: { + prototype: Event; + new(type: string, eventInitDict?: EventInit): Event; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +interface EventTarget { + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; + dispatchEvent(evt: Event): boolean; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var EventTarget: { + prototype: EventTarget; + new(): EventTarget; +} + +interface External { +} + +declare var External: { + prototype: External; + new(): External; +} + +interface File extends Blob { + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; +} + +declare var File: { + prototype: File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; +} + +interface FileList { + readonly length: number; + item(index: number): File; + [index: number]: File; +} + +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface FileReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface FocusEvent extends UIEvent { + readonly relatedTarget: EventTarget; + initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; +} + +declare var FocusEvent: { + prototype: FocusEvent; + new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; +} + +interface FormData { + append(name: any, value: any, blobName?: string): void; +} + +declare var FormData: { + prototype: FormData; + new (form?: HTMLFormElement): FormData; +} + +interface GainNode extends AudioNode { + readonly gain: AudioParam; +} + +declare var GainNode: { + prototype: GainNode; + new(): GainNode; +} + +interface Gamepad { + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; +} + +declare var Gamepad: { + prototype: Gamepad; + new(): Gamepad; +} + +interface GamepadButton { + readonly pressed: boolean; + readonly value: number; +} + +declare var GamepadButton: { + prototype: GamepadButton; + new(): GamepadButton; +} + +interface GamepadEvent extends Event { + readonly gamepad: Gamepad; +} + +declare var GamepadEvent: { + prototype: GamepadEvent; + new(): GamepadEvent; +} + +interface Geolocation { + clearWatch(watchId: number): void; + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; +} + +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +} + +interface HTMLAllCollection extends HTMLCollection { + namedItem(name: string): Element; +} + +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +} + +interface HTMLAnchorElement extends HTMLElement { + Methods: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Contains the anchor portion of the URL including the hash sign (#). + */ + hash: string; + /** + * Contains the hostname and port values of the URL. + */ + host: string; + /** + * Contains the hostname of a URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + readonly mimeType: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + readonly nameProp: string; + /** + * Contains the pathname of the URL. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Contains the protocol of the URL. + */ + protocol: string; + readonly protocolLong: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + type: string; + urn: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} + +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +} + +interface HTMLAppletElement extends HTMLElement { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. + */ + declare: boolean; + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + object: string | null; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + vspace: number; + width: number; +} + +declare var HTMLAppletElement: { + prototype: HTMLAppletElement; + new(): HTMLAppletElement; +} + +interface HTMLAreaElement extends HTMLElement { + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Sets or retrieves the subsection of the href property that follows the number sign (#). + */ + hash: string; + /** + * Sets or retrieves the hostname and port number of the location or URL. + */ + host: string; + /** + * Sets or retrieves the host name part of the location or URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or gets whether clicks in this region cause action. + */ + noHref: boolean; + /** + * Sets or retrieves the file name or path specified by the object. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Sets or retrieves the protocol portion of a URL. + */ + protocol: string; + rel: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} + +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +} + +interface HTMLAreasCollection extends HTMLCollection { + /** + * Adds an element to the areas, controlRange, or options collection. + */ + add(element: HTMLElement, before?: HTMLElement | number): void; + /** + * Removes an element from the collection. + */ + remove(index?: number): void; +} + +declare var HTMLAreasCollection: { + prototype: HTMLAreasCollection; + new(): HTMLAreasCollection; +} + +interface HTMLAudioElement extends HTMLMediaElement { +} + +declare var HTMLAudioElement: { + prototype: HTMLAudioElement; + new(): HTMLAudioElement; +} + +interface HTMLBRElement extends HTMLElement { + /** + * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. + */ + clear: string; +} + +declare var HTMLBRElement: { + prototype: HTMLBRElement; + new(): HTMLBRElement; +} + +interface HTMLBaseElement extends HTMLElement { + /** + * Gets or sets the baseline URL on which relative links are based. + */ + href: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; +} + +declare var HTMLBaseElement: { + prototype: HTMLBaseElement; + new(): HTMLBaseElement; +} + +interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + /** + * Sets or retrieves the font size of the object. + */ + size: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBaseFontElement: { + prototype: HTMLBaseFontElement; + new(): HTMLBaseFontElement; +} + +interface HTMLBodyElement extends HTMLElement { + aLink: any; + background: string; + bgColor: any; + bgProperties: string; + link: any; + noWrap: boolean; + onafterprint: (this: this, ev: Event) => any; + onbeforeprint: (this: this, ev: Event) => any; + onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + onblur: (this: this, ev: FocusEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onfocus: (this: this, ev: FocusEvent) => any; + onhashchange: (this: this, ev: HashChangeEvent) => any; + onload: (this: this, ev: Event) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onoffline: (this: this, ev: Event) => any; + ononline: (this: this, ev: Event) => any; + onorientationchange: (this: this, ev: Event) => any; + onpagehide: (this: this, ev: PageTransitionEvent) => any; + onpageshow: (this: this, ev: PageTransitionEvent) => any; + onpopstate: (this: this, ev: PopStateEvent) => any; + onresize: (this: this, ev: UIEvent) => any; + onstorage: (this: this, ev: StorageEvent) => any; + onunload: (this: this, ev: Event) => any; + text: any; + vLink: any; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLBodyElement: { + prototype: HTMLBodyElement; + new(): HTMLBodyElement; +} + +interface HTMLButtonElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + status: any; + /** + * Gets the classification and default behavior of the button. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the default or selected value of the control. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} + +declare var HTMLButtonElement: { + prototype: HTMLButtonElement; + new(): HTMLButtonElement; +} + +interface HTMLCanvasElement extends HTMLElement { + /** + * Gets or sets the height of a canvas element on a document. + */ + height: number; + /** + * Gets or sets the width of a canvas element on a document. + */ + width: number; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; + getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; + /** + * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. + */ + msToBlob(): Blob; + /** + * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. + * @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, type?: string, ...arguments: any[]): void; +} + +declare var HTMLCanvasElement: { + prototype: HTMLCanvasElement; + new(): HTMLCanvasElement; +} + +interface HTMLCollection { + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Retrieves an object from various collections. + */ + item(index: number): Element; + /** + * Retrieves a select object or an object from an options collection. + */ + namedItem(name: string): Element; + [index: number]: Element; +} + +declare var HTMLCollection: { + prototype: HTMLCollection; + new(): HTMLCollection; +} + +interface HTMLDListElement extends HTMLElement { + compact: boolean; +} + +declare var HTMLDListElement: { + prototype: HTMLDListElement; + new(): HTMLDListElement; +} + +interface HTMLDataListElement extends HTMLElement { + options: HTMLCollectionOf; +} + +declare var HTMLDataListElement: { + prototype: HTMLDataListElement; + new(): HTMLDataListElement; +} + +interface HTMLDirectoryElement extends HTMLElement { + compact: boolean; +} + +declare var HTMLDirectoryElement: { + prototype: HTMLDirectoryElement; + new(): HTMLDirectoryElement; +} + +interface HTMLDivElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} + +declare var HTMLDivElement: { + prototype: HTMLDivElement; + new(): HTMLDivElement; +} + +interface HTMLDocument extends Document { +} + +declare var HTMLDocument: { + prototype: HTMLDocument; + new(): HTMLDocument; +} + +interface HTMLElement extends Element { + accessKey: string; + readonly children: HTMLCollection; + contentEditable: string; + readonly dataset: DOMStringMap; + dir: string; + draggable: boolean; + hidden: boolean; + hideFocus: boolean; + innerHTML: string; + innerText: string; + readonly isContentEditable: boolean; + lang: string; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; + onabort: (this: this, ev: UIEvent) => any; + onactivate: (this: this, ev: UIEvent) => any; + onbeforeactivate: (this: this, ev: UIEvent) => any; + onbeforecopy: (this: this, ev: ClipboardEvent) => any; + onbeforecut: (this: this, ev: ClipboardEvent) => any; + onbeforedeactivate: (this: this, ev: UIEvent) => any; + onbeforepaste: (this: this, ev: ClipboardEvent) => any; + onblur: (this: this, ev: FocusEvent) => any; + oncanplay: (this: this, ev: Event) => any; + oncanplaythrough: (this: this, ev: Event) => any; + onchange: (this: this, ev: Event) => any; + onclick: (this: this, ev: MouseEvent) => any; + oncontextmenu: (this: this, ev: PointerEvent) => any; + oncopy: (this: this, ev: ClipboardEvent) => any; + oncuechange: (this: this, ev: Event) => any; + oncut: (this: this, ev: ClipboardEvent) => any; + ondblclick: (this: this, ev: MouseEvent) => any; + ondeactivate: (this: this, ev: UIEvent) => any; + ondrag: (this: this, ev: DragEvent) => any; + ondragend: (this: this, ev: DragEvent) => any; + ondragenter: (this: this, ev: DragEvent) => any; + ondragleave: (this: this, ev: DragEvent) => any; + ondragover: (this: this, ev: DragEvent) => any; + ondragstart: (this: this, ev: DragEvent) => any; + ondrop: (this: this, ev: DragEvent) => any; + ondurationchange: (this: this, ev: Event) => any; + onemptied: (this: this, ev: Event) => any; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onfocus: (this: this, ev: FocusEvent) => any; + oninput: (this: this, ev: Event) => any; + oninvalid: (this: this, ev: Event) => any; + onkeydown: (this: this, ev: KeyboardEvent) => any; + onkeypress: (this: this, ev: KeyboardEvent) => any; + onkeyup: (this: this, ev: KeyboardEvent) => any; + onload: (this: this, ev: Event) => any; + onloadeddata: (this: this, ev: Event) => any; + onloadedmetadata: (this: this, ev: Event) => any; + onloadstart: (this: this, ev: Event) => any; + onmousedown: (this: this, ev: MouseEvent) => any; + onmouseenter: (this: this, ev: MouseEvent) => any; + onmouseleave: (this: this, ev: MouseEvent) => any; + onmousemove: (this: this, ev: MouseEvent) => any; + onmouseout: (this: this, ev: MouseEvent) => any; + onmouseover: (this: this, ev: MouseEvent) => any; + onmouseup: (this: this, ev: MouseEvent) => any; + onmousewheel: (this: this, ev: WheelEvent) => any; + onmscontentzoom: (this: this, ev: UIEvent) => any; + onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; + onpaste: (this: this, ev: ClipboardEvent) => any; + onpause: (this: this, ev: Event) => any; + onplay: (this: this, ev: Event) => any; + onplaying: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + onratechange: (this: this, ev: Event) => any; + onreset: (this: this, ev: Event) => any; + onscroll: (this: this, ev: UIEvent) => any; + onseeked: (this: this, ev: Event) => any; + onseeking: (this: this, ev: Event) => any; + onselect: (this: this, ev: UIEvent) => any; + onselectstart: (this: this, ev: Event) => any; + onstalled: (this: this, ev: Event) => any; + onsubmit: (this: this, ev: Event) => any; + onsuspend: (this: this, ev: Event) => any; + ontimeupdate: (this: this, ev: Event) => any; + onvolumechange: (this: this, ev: Event) => any; + onwaiting: (this: this, ev: Event) => any; + outerHTML: string; + outerText: string; + spellcheck: boolean; + readonly style: CSSStyleDeclaration; + tabIndex: number; + title: string; + blur(): void; + click(): void; + dragDrop(): boolean; + focus(): void; + msGetInputContext(): MSInputMethodContext; + 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLElement: { + prototype: HTMLElement; + new(): HTMLElement; +} + +interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves the height of the object. + */ + height: string; + hidden: any; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves the palette used for the embedded document. + */ + readonly palette: string; + /** + * Retrieves the URL of the plug-in used to view an embedded document. + */ + readonly pluginspage: string; + readonly readyState: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the height and width units of the embed object. + */ + units: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLEmbedElement: { + prototype: HTMLEmbedElement; + new(): HTMLEmbedElement; +} + +interface HTMLFieldSetElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} + +declare var HTMLFieldSetElement: { + prototype: HTMLFieldSetElement; + new(): HTMLFieldSetElement; +} + +interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFontElement: { + prototype: HTMLFontElement; + new(): HTMLFontElement; +} + +interface HTMLFormElement extends HTMLElement { + /** + * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. + */ + acceptCharset: string; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Retrieves a collection, in source order, of all controls in a given form. + */ + readonly elements: HTMLCollection; + /** + * Sets or retrieves the MIME encoding for the form. + */ + encoding: string; + /** + * Sets or retrieves the encoding type for the form. + */ + enctype: string; + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Sets or retrieves how to send the form data to the server. + */ + method: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Designates a form that is not validated when submitted. + */ + noValidate: boolean; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a form object or an object from an elements collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a form object or an object from an elements collection. + */ + namedItem(name: string): any; + /** + * Fires when the user resets a form. + */ + reset(): void; + /** + * Fires when a FORM is about to be submitted. + */ + submit(): void; + [name: string]: any; +} + +declare var HTMLFormElement: { + prototype: HTMLFormElement; + new(): HTMLFormElement; +} + +interface HTMLFrameElement extends HTMLElement, GetSVGDocument { + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string | number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: this, ev: Event) => any; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the width of the object. + */ + width: string | number; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLFrameElement: { + prototype: HTMLFrameElement; + new(): HTMLFrameElement; +} + +interface HTMLFrameSetElement extends HTMLElement { + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the frame widths of the object. + */ + cols: string; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + name: string; + onafterprint: (this: this, ev: Event) => any; + onbeforeprint: (this: this, ev: Event) => any; + onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + /** + * Fires when the object loses the input focus. + */ + onblur: (this: this, ev: FocusEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + */ + onfocus: (this: this, ev: FocusEvent) => any; + onhashchange: (this: this, ev: HashChangeEvent) => any; + onload: (this: this, ev: Event) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onoffline: (this: this, ev: Event) => any; + ononline: (this: this, ev: Event) => any; + onorientationchange: (this: this, ev: Event) => any; + onpagehide: (this: this, ev: PageTransitionEvent) => any; + onpageshow: (this: this, ev: PageTransitionEvent) => any; + onresize: (this: this, ev: UIEvent) => any; + onstorage: (this: this, ev: StorageEvent) => any; + onunload: (this: this, ev: Event) => any; + /** + * Sets or retrieves the frame heights of the object. + */ + rows: string; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLFrameSetElement: { + prototype: HTMLFrameSetElement; + new(): HTMLFrameSetElement; +} + +interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. + */ + noShade: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHRElement: { + prototype: HTMLHRElement; + new(): HTMLHRElement; +} + +interface HTMLHeadElement extends HTMLElement { + profile: string; +} + +declare var HTMLHeadElement: { + prototype: HTMLHeadElement; + new(): HTMLHeadElement; +} + +interface HTMLHeadingElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; +} + +declare var HTMLHeadingElement: { + prototype: HTMLHeadingElement; + new(): HTMLHeadingElement; +} + +interface HTMLHtmlElement extends HTMLElement { + /** + * Sets or retrieves the DTD version that governs the current document. + */ + version: string; +} + +declare var HTMLHtmlElement: { + prototype: HTMLHtmlElement; + new(): HTMLHtmlElement; +} + +interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + allowFullscreen: boolean; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the horizontal margin for the object. + */ + hspace: number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: this, ev: Event) => any; + readonly sandbox: DOMSettableTokenList; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLIFrameElement: { + prototype: HTMLIFrameElement; + new(): HTMLIFrameElement; +} + +interface HTMLImageElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + crossOrigin: string; + readonly currentSrc: string; + /** + * Sets or retrieves the height of the object. + */ + height: number; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves whether the image is a server-side image map. + */ + isMap: boolean; + /** + * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. + */ + longDesc: string; + lowsrc: string; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * The original height of the image resource before sizing. + */ + readonly naturalHeight: number; + /** + * The original width of the image resource before sizing. + */ + readonly naturalWidth: number; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: number; + readonly x: number; + readonly y: number; + msGetAsCastingSource(): any; +} + +declare var HTMLImageElement: { + prototype: HTMLImageElement; + new(): HTMLImageElement; + create(): HTMLImageElement; +} + +interface HTMLInputElement extends HTMLElement { + /** + * Sets or retrieves a comma-separated list of content types. + */ + accept: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + checked: boolean; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + /** + * Sets or retrieves the state of the check box or radio button. + */ + defaultChecked: boolean; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Returns a FileList object on a file type input object. + */ + readonly files: FileList | null; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + indeterminate: boolean; + /** + * Specifies the ID of a pre-defined datalist of options for an input element. + */ + readonly list: HTMLElement; + /** + * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. + */ + max: string; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. + */ + min: string; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a string containing a regular expression that the user's input must match. + */ + pattern: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + selectionDirection: string; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + size: number; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + status: boolean; + /** + * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. + */ + step: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns the value of the data at the cursor's current position. + */ + value: string; + valueAsDate: Date; + /** + * Returns the input field value as a number. + */ + valueAsNumber: number; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + webkitdirectory: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Makes the selection equal to the current object. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start?: number, end?: number, direction?: string): void; + /** + * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. + * @param n Value to decrement the value by. + */ + stepDown(n?: number): void; + /** + * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. + * @param n Value to increment the value by. + */ + stepUp(n?: number): void; +} + +declare var HTMLInputElement: { + prototype: HTMLInputElement; + new(): HTMLInputElement; +} + +interface HTMLLIElement extends HTMLElement { + type: string; + /** + * Sets or retrieves the value of a list item. + */ + value: number; +} + +declare var HTMLLIElement: { + prototype: HTMLLIElement; + new(): HTMLLIElement; +} + +interface HTMLLabelElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the object to which the given label object is assigned. + */ + htmlFor: string; +} + +declare var HTMLLabelElement: { + prototype: HTMLLabelElement; + new(): HTMLLabelElement; +} + +interface HTMLLegendElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; +} + +declare var HTMLLegendElement: { + prototype: HTMLLegendElement; + new(): HTMLLegendElement; +} + +interface HTMLLinkElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + disabled: boolean; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + import?: Document; + integrity: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLinkElement: { + prototype: HTMLLinkElement; + new(): HTMLLinkElement; +} + +interface HTMLMapElement extends HTMLElement { + /** + * Retrieves a collection of the area objects defined for the given map object. + */ + readonly areas: HTMLAreasCollection; + /** + * Sets or retrieves the name of the object. + */ + name: string; +} + +declare var HTMLMapElement: { + prototype: HTMLMapElement; + new(): HTMLMapElement; +} + +interface HTMLMarqueeElement extends HTMLElement { + behavior: string; + bgColor: any; + direction: string; + height: string; + hspace: number; + loop: number; + onbounce: (this: this, ev: Event) => any; + onfinish: (this: this, ev: Event) => any; + onstart: (this: this, ev: Event) => any; + scrollAmount: number; + scrollDelay: number; + trueSpeed: boolean; + vspace: number; + width: string; + start(): void; + stop(): 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLMarqueeElement: { + prototype: HTMLMarqueeElement; + new(): HTMLMarqueeElement; +} + +interface HTMLMediaElement extends HTMLElement { + /** + * Returns an AudioTrackList object with the audio tracks for a given video element. + */ + readonly audioTracks: AudioTrackList; + /** + * Gets or sets a value that indicates whether to start playing the media automatically. + */ + autoplay: boolean; + /** + * Gets a collection of buffered time ranges. + */ + readonly buffered: TimeRanges; + /** + * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). + */ + controls: boolean; + crossOrigin: string; + /** + * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. + */ + readonly currentSrc: string; + /** + * Gets or sets the current playback position, in seconds. + */ + currentTime: number; + defaultMuted: boolean; + /** + * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. + */ + defaultPlaybackRate: number; + /** + * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. + */ + readonly duration: number; + /** + * Gets information about whether the playback has ended or not. + */ + readonly ended: boolean; + /** + * Returns an object representing the current error state of the audio or video element. + */ + readonly error: MediaError; + /** + * Gets or sets a flag to specify whether playback should restart after it completes. + */ + loop: boolean; + readonly mediaKeys: MediaKeys | null; + /** + * Specifies the purpose of the audio or video media, such as background audio or alerts. + */ + msAudioCategory: string; + /** + * Specifies the output device id that the audio will be sent to. + */ + msAudioDeviceType: string; + readonly msGraphicsTrustStatus: MSGraphicsTrust; + /** + * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. + */ + readonly msKeys: MSMediaKeys; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Specifies whether or not to enable low-latency playback on the media element. + */ + msRealTime: boolean; + /** + * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. + */ + muted: boolean; + /** + * Gets the current network activity for the element. + */ + readonly networkState: number; + onencrypted: (this: this, ev: MediaEncryptedEvent) => any; + onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any; + /** + * Gets a flag that specifies whether playback is paused. + */ + readonly paused: boolean; + /** + * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. + */ + playbackRate: number; + /** + * Gets TimeRanges for the current media resource that has been played. + */ + readonly played: TimeRanges; + /** + * Gets or sets the current playback position, in seconds. + */ + preload: string; + readyState: number; + /** + * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. + */ + readonly seekable: TimeRanges; + /** + * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. + */ + readonly seeking: boolean; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcObject: MediaStream | null; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; + /** + * Gets or sets the volume level for audio portions of the media element. + */ + volume: number; + addTextTrack(kind: string, label?: string, language?: string): TextTrack; + /** + * Returns a string that specifies whether the client can play a given media resource type. + */ + canPlayType(type: string): string; + /** + * Resets the audio or video object and loads a new media resource. + */ + load(): void; + /** + * Clears all effects from the media pipeline. + */ + msClearEffects(): void; + msGetAsCastingSource(): any; + /** + * Inserts the specified audio effect into media pipeline. + */ + msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetMediaKeys(mediaKeys: MSMediaKeys): void; + /** + * Specifies the media protection manager for a given media pipeline. + */ + msSetMediaProtectionManager(mediaProtectionManager?: any): void; + /** + * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. + */ + pause(): void; + /** + * Loads and starts playback of a media resource. + */ + play(): void; + setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLMediaElement: { + prototype: HTMLMediaElement; + new(): HTMLMediaElement; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; +} + +interface HTMLMenuElement extends HTMLElement { + compact: boolean; + type: string; +} + +declare var HTMLMenuElement: { + prototype: HTMLMenuElement; + new(): HTMLMenuElement; +} + +interface HTMLMetaElement extends HTMLElement { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Gets or sets meta-information to associate with httpEquiv or name. + */ + content: string; + /** + * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. + */ + httpEquiv: string; + /** + * Sets or retrieves the value specified in the content attribute of the meta object. + */ + name: string; + /** + * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. + */ + scheme: string; + /** + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + */ + url: string; +} + +declare var HTMLMetaElement: { + prototype: HTMLMetaElement; + new(): HTMLMetaElement; +} + +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + +interface HTMLModElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; +} + +declare var HTMLModElement: { + prototype: HTMLModElement; + new(): HTMLModElement; +} + +interface HTMLOListElement extends HTMLElement { + compact: boolean; + /** + * The starting number. + */ + start: number; + type: string; +} + +declare var HTMLOListElement: { + prototype: HTMLOListElement; + new(): HTMLOListElement; +} + +interface HTMLObjectElement extends HTMLElement, GetSVGDocument { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + /** + * Sets or retrieves the URL of the file containing the compiled Java class. + */ + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + declare: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves the contained object. + */ + readonly object: any; + readonly readyState: number; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLObjectElement: { + prototype: HTMLObjectElement; + new(): HTMLObjectElement; +} + +interface HTMLOptGroupElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + readonly text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; +} + +declare var HTMLOptGroupElement: { + prototype: HTMLOptGroupElement; + new(): HTMLOptGroupElement; +} + +interface HTMLOptionElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; +} + +declare var HTMLOptionElement: { + prototype: HTMLOptionElement; + new(): HTMLOptionElement; + create(): HTMLOptionElement; +} + +interface HTMLOptionsCollection extends HTMLCollectionOf { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + +interface HTMLParagraphElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + clear: string; +} + +declare var HTMLParagraphElement: { + prototype: HTMLParagraphElement; + new(): HTMLParagraphElement; +} + +interface HTMLParamElement extends HTMLElement { + /** + * Sets or retrieves the name of an input parameter for an element. + */ + name: string; + /** + * Sets or retrieves the content type of the resource designated by the value attribute. + */ + type: string; + /** + * Sets or retrieves the value of an input parameter for an element. + */ + value: string; + /** + * Sets or retrieves the data type of the value attribute. + */ + valueType: string; +} + +declare var HTMLParamElement: { + prototype: HTMLParamElement; + new(): HTMLParamElement; +} + +interface HTMLPictureElement extends HTMLElement { +} + +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; +} + +interface HTMLPreElement extends HTMLElement { + /** + * Sets or gets a value that you can use to implement your own width functionality for the object. + */ + width: number; +} + +declare var HTMLPreElement: { + prototype: HTMLPreElement; + new(): HTMLPreElement; +} + +interface HTMLProgressElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Defines the maximum, or "done" value for a progress element. + */ + max: number; + /** + * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). + */ + readonly position: number; + /** + * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. + */ + value: number; +} + +declare var HTMLProgressElement: { + prototype: HTMLProgressElement; + new(): HTMLProgressElement; +} + +interface HTMLQuoteElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} + +declare var HTMLQuoteElement: { + prototype: HTMLQuoteElement; + new(): HTMLQuoteElement; +} + +interface HTMLScriptElement extends HTMLElement { + async: boolean; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the status of the script. + */ + defer: boolean; + /** + * Sets or retrieves the event for which the script is written. + */ + event: string; + /** + * Sets or retrieves the object that is bound to the event script. + */ + htmlFor: string; + /** + * Retrieves the URL to an external file that contains the source code or data. + */ + src: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Sets or retrieves the MIME type for the associated scripting engine. + */ + type: string; + integrity: string; +} + +declare var HTMLScriptElement: { + prototype: HTMLScriptElement; + new(): HTMLScriptElement; +} + +interface HTMLSelectElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + readonly options: HTMLOptionsCollection; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the index of the selected option in a select object. + */ + selectedIndex: number; + selectedOptions: HTMLCollectionOf; + /** + * Sets or retrieves the number of rows in the list box. + */ + size: number; + /** + * Retrieves the type of select control based on the value of the MULTIPLE attribute. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Adds an element to the areas, controlRange, or options collection. + * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + */ + add(element: HTMLElement, before?: HTMLElement | number): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a select object or an object from an options collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a select object or an object from an options collection. + * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. + */ + namedItem(name: string): any; + /** + * Removes an element from the collection. + * @param index Number that specifies the zero-based index of the element to remove from the collection. + */ + remove(index?: number): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + [name: string]: any; +} + +declare var HTMLSelectElement: { + prototype: HTMLSelectElement; + new(): HTMLSelectElement; +} + +interface HTMLSourceElement extends HTMLElement { + /** + * Gets or sets the intended media type of the media source. + */ + media: string; + msKeySystem: string; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Gets or sets the MIME type of a media resource. + */ + type: string; +} + +declare var HTMLSourceElement: { + prototype: HTMLSourceElement; + new(): HTMLSourceElement; +} + +interface HTMLSpanElement extends HTMLElement { +} + +declare var HTMLSpanElement: { + prototype: HTMLSpanElement; + new(): HTMLSpanElement; +} + +interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Retrieves the CSS language in which the style sheet is written. + */ + type: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLStyleElement: { + prototype: HTMLStyleElement; + new(): HTMLStyleElement; +} + +interface HTMLTableCaptionElement extends HTMLElement { + /** + * Sets or retrieves the alignment of the caption or legend. + */ + align: string; + /** + * Sets or retrieves whether the caption appears at the top or bottom of the table. + */ + vAlign: string; +} + +declare var HTMLTableCaptionElement: { + prototype: HTMLTableCaptionElement; + new(): HTMLTableCaptionElement; +} + +interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves abbreviated text for the object. + */ + abbr: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. + */ + axis: string; + bgColor: any; + /** + * Retrieves the position of the object in the cells collection of a row. + */ + readonly cellIndex: number; + /** + * Sets or retrieves the number columns in the table that the object should span. + */ + colSpan: number; + /** + * Sets or retrieves a list of header cells that provide information for the object. + */ + headers: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + /** + * Sets or retrieves how many rows in a table the cell should span. + */ + rowSpan: number; + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableCellElement: { + prototype: HTMLTableCellElement; + new(): HTMLTableCellElement; +} + +interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves the alignment of the object relative to the display or table. + */ + align: string; + /** + * Sets or retrieves the number of columns in the group. + */ + span: number; + /** + * Sets or retrieves the width of the object. + */ + width: any; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableColElement: { + prototype: HTMLTableColElement; + new(): HTMLTableColElement; +} + +interface HTMLTableDataCellElement extends HTMLTableCellElement { +} + +declare var HTMLTableDataCellElement: { + prototype: HTMLTableDataCellElement; + new(): HTMLTableDataCellElement; +} + +interface HTMLTableElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + bgColor: any; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the caption object of a table. + */ + caption: HTMLTableCaptionElement; + /** + * Sets or retrieves the amount of space between the border of the cell and the content of the cell. + */ + cellPadding: string; + /** + * Sets or retrieves the amount of space between cells in a table. + */ + cellSpacing: string; + /** + * Sets or retrieves the number of columns in the table. + */ + cols: number; + /** + * Sets or retrieves the way the border frame around the table is displayed. + */ + frame: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Sets or retrieves which dividing lines (inner borders) are displayed. + */ + rules: string; + /** + * Sets or retrieves a description and/or structure of the object. + */ + summary: string; + /** + * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. + */ + tBodies: HTMLCollectionOf; + /** + * Retrieves the tFoot object of the table. + */ + tFoot: HTMLTableSectionElement; + /** + * Retrieves the tHead object of the table. + */ + tHead: HTMLTableSectionElement; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Creates an empty caption element in the table. + */ + createCaption(): HTMLTableCaptionElement; + /** + * Creates an empty tBody element in the table. + */ + createTBody(): HTMLTableSectionElement; + /** + * Creates an empty tFoot element in the table. + */ + createTFoot(): HTMLTableSectionElement; + /** + * Returns the tHead element object if successful, or null otherwise. + */ + createTHead(): HTMLTableSectionElement; + /** + * Deletes the caption element and its contents from the table. + */ + deleteCaption(): void; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Deletes the tFoot element and its contents from the table. + */ + deleteTFoot(): void; + /** + * Deletes the tHead element and its contents from the table. + */ + deleteTHead(): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; +} + +declare var HTMLTableElement: { + prototype: HTMLTableElement; + new(): HTMLTableElement; +} + +interface HTMLTableHeaderCellElement extends HTMLTableCellElement { + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; +} + +declare var HTMLTableHeaderCellElement: { + prototype: HTMLTableHeaderCellElement; + new(): HTMLTableHeaderCellElement; +} + +interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + bgColor: any; + /** + * Retrieves a collection of all cells in the table row. + */ + cells: HTMLCollectionOf; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Retrieves the position of the object in the rows collection for the table. + */ + readonly rowIndex: number; + /** + * Retrieves the position of the object in the collection. + */ + readonly sectionRowIndex: number; + /** + * Removes the specified cell from the table row, as well as from the cells collection. + * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. + */ + deleteCell(index?: number): void; + /** + * Creates a new cell in the table row, and adds the cell to the cells collection. + * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. + */ + insertCell(index?: number): HTMLTableDataCellElement; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableRowElement: { + prototype: HTMLTableRowElement; + new(): HTMLTableRowElement; +} + +interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableSectionElement: { + prototype: HTMLTableSectionElement; + new(): HTMLTableSectionElement; +} + +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + +interface HTMLTextAreaElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the object. + */ + cols: number; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Sets or retrieves the value indicated whether the content of the object is read-only. + */ + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: number; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + /** + * Sets or retrieves the value indicating whether the control is selected. + */ + status: any; + /** + * Retrieves the type of control. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Retrieves or sets the text in the entry field of the textArea element. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Sets or retrieves how to handle wordwrapping in the object. + */ + wrap: string; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Highlights the input area of a form element. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; +} + +declare var HTMLTextAreaElement: { + prototype: HTMLTextAreaElement; + new(): HTMLTextAreaElement; +} + +interface HTMLTitleElement extends HTMLElement { + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; +} + +declare var HTMLTitleElement: { + prototype: HTMLTitleElement; + new(): HTMLTitleElement; +} + +interface HTMLTrackElement extends HTMLElement { + default: boolean; + kind: string; + label: string; + readonly readyState: number; + src: string; + srclang: string; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; +} + +declare var HTMLTrackElement: { + prototype: HTMLTrackElement; + new(): HTMLTrackElement; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; +} + +interface HTMLUListElement extends HTMLElement { + compact: boolean; + type: string; +} + +declare var HTMLUListElement: { + prototype: HTMLUListElement; + new(): HTMLUListElement; +} + +interface HTMLUnknownElement extends HTMLElement { +} + +declare var HTMLUnknownElement: { + prototype: HTMLUnknownElement; + new(): HTMLUnknownElement; +} + +interface HTMLVideoElement extends HTMLMediaElement { + /** + * Gets or sets the height of the video element. + */ + height: number; + msHorizontalMirror: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; + msStereo3DPackingMode: string; + msStereo3DRenderMode: string; + msZoom: boolean; + onMSVideoFormatChanged: (this: this, ev: Event) => any; + onMSVideoFrameStepCompleted: (this: this, ev: Event) => any; + onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any; + /** + * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. + */ + poster: string; + /** + * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoHeight: number; + /** + * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; + /** + * Gets or sets the width of the video element. + */ + width: number; + getVideoPlaybackQuality(): VideoPlaybackQuality; + msFrameStep(forward: boolean): void; + msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; + webkitEnterFullScreen(): void; + webkitEnterFullscreen(): void; + webkitExitFullScreen(): void; + webkitExitFullscreen(): 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLVideoElement: { + prototype: HTMLVideoElement; + new(): HTMLVideoElement; +} + +interface HashChangeEvent extends Event { + readonly newURL: string | null; + readonly oldURL: string | null; +} + +declare var HashChangeEvent: { + prototype: HashChangeEvent; + new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; +} + +interface History { + readonly length: number; + readonly state: any; + 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: { + prototype: History; + new(): History; +} + +interface IDBCursor { + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; + advance(count: number): void; + continue(key?: IDBKeyRange | IDBValidKey): void; + delete(): IDBRequest; + update(value: any): IDBRequest; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +interface IDBCursorWithValue extends IDBCursor { + readonly value: any; +} + +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface IDBDatabase extends EventTarget { + readonly name: string; + readonly objectStoreNames: DOMStringList; + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; + close(): void; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; + deleteObjectStore(name: string): void; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface IDBFactory { + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; + open(name: string, version?: number): IDBOpenDBRequest; +} + +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface IDBIndex { + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; +} + +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface IDBKeyRange { + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; +} + +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; +} + +interface IDBObjectStore { + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; + clear(): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; + deleteIndex(indexName: string): void; + get(key: any): IDBRequest; + index(name: string): IDBIndex; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; +} + +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface IDBOpenDBRequest extends IDBRequest { + onblocked: (this: this, ev: Event) => any; + onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; + addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface IDBRequest extends EventTarget { + readonly error: DOMError; + onerror: (this: this, ev: ErrorEvent) => any; + onsuccess: (this: this, ev: Event) => any; + readonly readyState: string; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface IDBTransaction extends EventTarget { + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; + onabort: (this: this, ev: Event) => any; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; + addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; +} + +interface IDBVersionChangeEvent extends Event { + readonly newVersion: number | null; + readonly oldVersion: number; +} + +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface ImageData { + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; +} + +declare var ImageData: { + prototype: ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; +} + +interface KeyboardEvent extends UIEvent { + readonly altKey: boolean; + readonly char: string | null; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + 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; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +declare var KeyboardEvent: { + prototype: KeyboardEvent; + new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: string; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; +} + +interface Location { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + pathname: string; + port: string; + protocol: string; + search: string; + assign(url: string): void; + reload(forcedReload?: boolean): void; + replace(url: string): void; + toString(): string; +} + +declare var Location: { + prototype: Location; + new(): Location; +} + +interface LongRunningScriptDetectedEvent extends Event { + readonly executionTime: number; + stopPageScriptExecution: boolean; +} + +declare var LongRunningScriptDetectedEvent: { + prototype: LongRunningScriptDetectedEvent; + new(): LongRunningScriptDetectedEvent; +} + +interface MSApp { + clearTemporaryWebDataAsync(): MSAppAsyncOperation; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createDataPackage(object: any): any; + createDataPackageFromSelection(): any; + createFileFromStorageFile(storageFile: any): File; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + getCurrentPriority(): string; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; + getViewId(view: any): any; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + pageHandlesAllApplicationActivations(enabled: boolean): void; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + terminateApp(exceptionObject: any): void; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; +} +declare var MSApp: MSApp; + +interface MSAppAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + readonly readyState: number; + readonly result: any; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSAppAsyncOperation: { + prototype: MSAppAsyncOperation; + new(): MSAppAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: string; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} + +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; +} + +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: string[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; +} + +interface MSGesture { + target: Element; + addPointer(pointerId: number): void; + stop(): void; +} + +declare var MSGesture: { + prototype: MSGesture; + new(): MSGesture; +} + +interface MSGestureEvent extends UIEvent { + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; + initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +declare var MSGestureEvent: { + prototype: MSGestureEvent; + new(): MSGestureEvent; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +interface MSGraphicsTrust { + readonly constrictionActive: boolean; + readonly status: string; +} + +declare var MSGraphicsTrust: { + prototype: MSGraphicsTrust; + new(): MSGraphicsTrust; +} + +interface MSHTMLWebViewElement extends HTMLElement { + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; + height: number; + readonly settings: MSWebViewSettings; + src: string; + width: number; + addWebAllowedObject(name: string, applicationObject: any): void; + buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; + capturePreviewToBlobAsync(): MSWebViewAsyncOperation; + captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; + getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; + getDeferredPermissionRequests(): DeferredPermissionRequest[]; + goBack(): void; + goForward(): void; + invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; + navigate(uri: string): void; + navigateToLocalStreamUri(source: string, streamResolver: any): void; + navigateToString(contents: string): void; + navigateWithHttpRequestMessage(requestMessage: any): void; + refresh(): void; + stop(): void; +} + +declare var MSHTMLWebViewElement: { + prototype: MSHTMLWebViewElement; + new(): MSHTMLWebViewElement; +} + +interface MSInputMethodContext extends EventTarget { + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; + oncandidatewindowhide: (this: this, ev: Event) => any; + oncandidatewindowshow: (this: this, ev: Event) => any; + oncandidatewindowupdate: (this: this, ev: Event) => any; + readonly target: HTMLElement; + getCandidateWindowClientRect(): ClientRect; + getCompositionAlternatives(): string[]; + hasComposition(): boolean; + isCandidateWindowVisible(): boolean; + addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSInputMethodContext: { + prototype: MSInputMethodContext; + new(): MSInputMethodContext; +} + +interface MSManipulationEvent extends UIEvent { + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; + initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +declare var MSManipulationEvent: { + prototype: MSManipulationEvent; + new(): MSManipulationEvent; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +interface MSMediaKeyError { + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +declare var MSMediaKeyError: { + prototype: MSMediaKeyError; + new(): MSMediaKeyError; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +interface MSMediaKeyMessageEvent extends Event { + readonly destinationURL: string | null; + readonly message: Uint8Array; +} + +declare var MSMediaKeyMessageEvent: { + prototype: MSMediaKeyMessageEvent; + new(): MSMediaKeyMessageEvent; +} + +interface MSMediaKeyNeededEvent extends Event { + readonly initData: Uint8Array | null; +} + +declare var MSMediaKeyNeededEvent: { + prototype: MSMediaKeyNeededEvent; + new(): MSMediaKeyNeededEvent; +} + +interface MSMediaKeySession extends EventTarget { + readonly error: MSMediaKeyError | null; + readonly keySystem: string; + readonly sessionId: string; + close(): void; + update(key: Uint8Array): void; +} + +declare var MSMediaKeySession: { + prototype: MSMediaKeySession; + new(): MSMediaKeySession; +} + +interface MSMediaKeys { + readonly keySystem: string; + createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; +} + +declare var MSMediaKeys: { + prototype: MSMediaKeys; + new(keySystem: string): MSMediaKeys; + isTypeSupported(keySystem: string, type?: string): boolean; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; +} + +interface MSPointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var MSPointerEvent: { + prototype: MSPointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; +} + +interface MSRangeCollection { + readonly length: number; + item(index: number): Range; + [index: number]: Range; +} + +declare var MSRangeCollection: { + prototype: MSRangeCollection; + new(): MSRangeCollection; +} + +interface MSSiteModeEvent extends Event { + readonly actionURL: string; + readonly buttonID: number; +} + +declare var MSSiteModeEvent: { + prototype: MSSiteModeEvent; + new(): MSSiteModeEvent; +} + +interface MSStream { + readonly type: string; + msClose(): void; + msDetachStream(): any; +} + +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSStreamReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBinaryString(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface MSWebViewAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSWebViewAsyncOperation: { + prototype: MSWebViewAsyncOperation; + new(): MSWebViewAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; +} + +interface MSWebViewSettings { + isIndexedDBEnabled: boolean; + isJavaScriptEnabled: boolean; +} + +declare var MSWebViewSettings: { + prototype: MSWebViewSettings; + new(): MSWebViewSettings; +} + +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: string; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (this: this, ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + +interface MediaElementAudioSourceNode extends AudioNode { +} + +declare var MediaElementAudioSourceNode: { + prototype: MediaElementAudioSourceNode; + new(): MediaElementAudioSourceNode; +} + +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer | null; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + +interface MediaError { + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +declare var MediaError: { + prototype: MediaError; + new(): MediaError; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: string; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: PromiseLike; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): PromiseLike; + generateRequest(initDataType: string, initData: any): PromiseLike; + load(sessionId: string): PromiseLike; + remove(): PromiseLike; + update(response: any): PromiseLike; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): string; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): PromiseLike; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: string): MediaKeySession; + setServerCertificate(serverCertificate: any): PromiseLike; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; +} + +interface MediaList { + readonly length: number; + mediaText: string; + appendMedium(newMedium: string): void; + deleteMedium(oldMedium: string): void; + item(index: number): string; + toString(): string; + [index: number]: string; +} + +declare var MediaList: { + prototype: MediaList; + new(): MediaList; +} + +interface MediaQueryList { + readonly matches: boolean; + readonly media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} + +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + +interface MediaSource extends EventTarget { + readonly activeSourceBuffers: SourceBufferList; + duration: number; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; + addSourceBuffer(type: string): SourceBuffer; + endOfStream(error?: number): void; + removeSourceBuffer(sourceBuffer: SourceBuffer): void; +} + +declare var MediaSource: { + prototype: MediaSource; + new(): MediaSource; + isTypeSupported(type: string): boolean; +} + +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (this: this, ev: Event) => any; + onaddtrack: (this: this, ev: TrackEvent) => any; + oninactive: (this: this, ev: Event) => any; + onremovetrack: (this: this, ev: TrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack | null; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string | null; + readonly message: string | null; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError | null; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + onmute: (this: this, ev: Event) => any; + onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any; + onunmute: (this: this, ev: Event) => any; + readonly readonly: boolean; + readonly readyState: string; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + +interface MessageChannel { + readonly port1: MessagePort; + readonly port2: MessagePort; +} + +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface MessageEvent extends Event { + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; +} + +declare var MessageEvent: { + prototype: MessageEvent; + new(type: string, eventInitDict?: MessageEventInit): MessageEvent; +} + +interface MessagePort extends EventTarget { + onmessage: (this: this, ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, ports?: any): void; + start(): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface MimeType { + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; +} + +declare var MimeType: { + prototype: MimeType; + new(): MimeType; +} + +interface MimeTypeArray { + readonly length: number; + item(index: number): Plugin; + namedItem(type: string): Plugin; + [index: number]: Plugin; +} + +declare var MimeTypeArray: { + prototype: MimeTypeArray; + new(): MimeTypeArray; +} + +interface MouseEvent extends UIEvent { + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; + getModifierState(keyArg: string): boolean; + initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; +} + +declare var MouseEvent: { + prototype: MouseEvent; + new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; +} + +interface MutationEvent extends Event { + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; + initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +declare var MutationEvent: { + prototype: MutationEvent; + new(): MutationEvent; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +interface MutationObserver { + disconnect(): void; + observe(target: Node, options: MutationObserverInit): void; + takeRecords(): MutationRecord[]; +} + +declare var MutationObserver: { + prototype: MutationObserver; + new(callback: MutationCallback): MutationObserver; +} + +interface MutationRecord { + readonly addedNodes: NodeList; + readonly attributeName: string | null; + readonly attributeNamespace: string | null; + readonly nextSibling: Node | null; + readonly oldValue: string | null; + readonly previousSibling: Node | null; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; +} + +declare var MutationRecord: { + prototype: MutationRecord; + new(): MutationRecord; +} + +interface NamedNodeMap { + readonly length: number; + getNamedItem(name: string): Attr; + getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + item(index: number): Attr; + removeNamedItem(name: string): Attr; + removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + setNamedItem(arg: Attr): Attr; + setNamedItemNS(arg: Attr): Attr; + [index: number]: Attr; +} + +declare var NamedNodeMap: { + prototype: NamedNodeMap; + new(): NamedNodeMap; +} + +interface NavigationCompletedEvent extends NavigationEvent { + readonly isSuccess: boolean; + readonly webErrorStatus: number; +} + +declare var NavigationCompletedEvent: { + prototype: NavigationCompletedEvent; + new(): NavigationCompletedEvent; +} + +interface NavigationEvent extends Event { + readonly uri: string; +} + +declare var NavigationEvent: { + prototype: NavigationEvent; + new(): NavigationEvent; +} + +interface NavigationEventWithReferrer extends NavigationEvent { + readonly referer: string; +} + +declare var NavigationEventWithReferrer: { + prototype: NavigationEventWithReferrer; + new(): NavigationEventWithReferrer; +} + +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { + readonly appCodeName: string; + readonly cookieEnabled: boolean; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly webdriver: boolean; + readonly hardwareConcurrency: number; + getGamepads(): Gamepad[]; + javaEnabled(): boolean; + msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; + vibrate(pattern: number | number[]): boolean; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Navigator: { + prototype: Navigator; + new(): Navigator; +} + +interface Node extends EventTarget { + readonly attributes: NamedNodeMap; + readonly baseURI: string | null; + readonly childNodes: NodeList; + readonly firstChild: Node | null; + readonly lastChild: Node | null; + readonly localName: string | null; + readonly namespaceURI: string | null; + readonly nextSibling: Node | null; + readonly nodeName: string; + readonly nodeType: number; + nodeValue: string | null; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement | null; + readonly parentNode: Node | null; + readonly previousSibling: Node | null; + textContent: string | null; + appendChild(newChild: Node): Node; + cloneNode(deep?: boolean): Node; + compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; + hasAttributes(): boolean; + hasChildNodes(): boolean; + insertBefore(newChild: Node, refChild: Node | null): Node; + isDefaultNamespace(namespaceURI: string | null): boolean; + isEqualNode(arg: Node): boolean; + isSameNode(other: Node): boolean; + lookupNamespaceURI(prefix: string | null): string | null; + lookupPrefix(namespaceURI: string | null): string | null; + normalize(): void; + removeChild(oldChild: Node): Node; + replaceChild(newChild: Node, oldChild: Node): Node; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +declare var Node: { + prototype: Node; + new(): Node; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; +} + +interface NodeIterator { + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + detach(): void; + nextNode(): Node; + previousNode(): Node; +} + +declare var NodeIterator: { + prototype: NodeIterator; + new(): NodeIterator; +} + +interface NodeList { + readonly length: number; + item(index: number): Node; + [index: number]: Node; +} + +declare var NodeList: { + prototype: NodeList; + new(): NodeList; +} + +interface OES_element_index_uint { +} + +declare var OES_element_index_uint: { + prototype: OES_element_index_uint; + new(): OES_element_index_uint; +} + +interface OES_standard_derivatives { + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +declare var OES_standard_derivatives: { + prototype: OES_standard_derivatives; + new(): OES_standard_derivatives; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +interface OES_texture_float { +} + +declare var OES_texture_float: { + prototype: OES_texture_float; + new(): OES_texture_float; +} + +interface OES_texture_float_linear { +} + +declare var OES_texture_float_linear: { + prototype: OES_texture_float_linear; + new(): OES_texture_float_linear; +} + +interface OfflineAudioCompletionEvent extends Event { + readonly renderedBuffer: AudioBuffer; +} + +declare var OfflineAudioCompletionEvent: { + prototype: OfflineAudioCompletionEvent; + new(): OfflineAudioCompletionEvent; +} + +interface OfflineAudioContext extends AudioContext { + oncomplete: (this: this, ev: Event) => any; + startRendering(): PromiseLike; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OfflineAudioContext: { + prototype: OfflineAudioContext; + new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; +} + +interface OscillatorNode extends AudioNode { + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + type: string; + setPeriodicWave(periodicWave: PeriodicWave): void; + start(when?: number): void; + stop(when?: number): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OscillatorNode: { + prototype: OscillatorNode; + new(): OscillatorNode; +} + +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +interface PageTransitionEvent extends Event { + readonly persisted: boolean; +} + +declare var PageTransitionEvent: { + prototype: PageTransitionEvent; + new(): PageTransitionEvent; +} + +interface PannerNode extends AudioNode { + coneInnerAngle: number; + coneOuterAngle: number; + coneOuterGain: number; + distanceModel: string; + maxDistance: number; + panningModel: string; + refDistance: number; + rolloffFactor: number; + setOrientation(x: number, y: number, z: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var PannerNode: { + prototype: PannerNode; + new(): PannerNode; +} + +interface PerfWidgetExternal { + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; + addEventListener(eventType: string, callback: Function): void; + getMemoryUsage(): number; + getProcessCpuUsage(): number; + getRecentCpuUsage(last: number | null): any; + getRecentFrames(last: number | null): any; + getRecentMemoryUsage(last: number | null): any; + getRecentPaintRequests(last: number | null): any; + removeEventListener(eventType: string, callback: Function): void; + repositionWindow(x: number, y: number): void; + resizeWindow(width: number, height: number): void; +} + +declare var PerfWidgetExternal: { + prototype: PerfWidgetExternal; + new(): PerfWidgetExternal; +} + +interface Performance { + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; + clearMarks(markName?: string): void; + clearMeasures(measureName?: string): void; + clearResourceTimings(): void; + getEntries(): any; + getEntriesByName(name: string, entryType?: string): any; + getEntriesByType(entryType: string): any; + getMarks(markName?: string): any; + getMeasures(measureName?: string): any; + mark(markName: string): void; + measure(measureName: string, startMarkName?: string, endMarkName?: string): void; + now(): number; + setResourceTimingBufferSize(maxSize: number): void; + toJSON(): any; +} + +declare var Performance: { + prototype: Performance; + new(): Performance; +} + +interface PerformanceEntry { + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; +} + +declare var PerformanceEntry: { + prototype: PerformanceEntry; + new(): PerformanceEntry; +} + +interface PerformanceMark extends PerformanceEntry { +} + +declare var PerformanceMark: { + prototype: PerformanceMark; + new(): PerformanceMark; +} + +interface PerformanceMeasure extends PerformanceEntry { +} + +declare var PerformanceMeasure: { + prototype: PerformanceMeasure; + new(): PerformanceMeasure; +} + +interface PerformanceNavigation { + readonly redirectCount: number; + readonly type: number; + toJSON(): any; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +declare var PerformanceNavigation: { + prototype: PerformanceNavigation; + new(): PerformanceNavigation; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +interface PerformanceNavigationTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: string; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; +} + +declare var PerformanceNavigationTiming: { + prototype: PerformanceNavigationTiming; + new(): PerformanceNavigationTiming; +} + +interface PerformanceResourceTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; +} + +declare var PerformanceResourceTiming: { + prototype: PerformanceResourceTiming; + new(): PerformanceResourceTiming; +} + +interface PerformanceTiming { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; + readonly secureConnectionStart: number; + toJSON(): any; +} + +declare var PerformanceTiming: { + prototype: PerformanceTiming; + new(): PerformanceTiming; +} + +interface PeriodicWave { +} + +declare var PeriodicWave: { + prototype: PeriodicWave; + new(): PeriodicWave; +} + +interface PermissionRequest extends DeferredPermissionRequest { + readonly state: string; + defer(): void; +} + +declare var PermissionRequest: { + prototype: PermissionRequest; + new(): PermissionRequest; +} + +interface PermissionRequestedEvent extends Event { + readonly permissionRequest: PermissionRequest; +} + +declare var PermissionRequestedEvent: { + prototype: PermissionRequestedEvent; + new(): PermissionRequestedEvent; +} + +interface Plugin { + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; + item(index: number): MimeType; + namedItem(type: string): MimeType; + [index: number]: MimeType; +} + +declare var Plugin: { + prototype: Plugin; + new(): Plugin; +} + +interface PluginArray { + readonly length: number; + item(index: number): Plugin; + namedItem(name: string): Plugin; + refresh(reload?: boolean): void; + [index: number]: Plugin; +} + +declare var PluginArray: { + prototype: PluginArray; + new(): PluginArray; +} + +interface PointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var PointerEvent: { + prototype: PointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; +} + +interface PopStateEvent extends Event { + readonly state: any; + initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; +} + +declare var PopStateEvent: { + prototype: PopStateEvent; + new(): PopStateEvent; +} + +interface Position { + readonly coords: Coordinates; + readonly timestamp: number; +} + +declare var Position: { + prototype: Position; + new(): Position; +} + +interface PositionError { + readonly code: number; + readonly message: string; + toString(): string; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +interface ProcessingInstruction extends CharacterData { + readonly target: string; +} + +declare var ProcessingInstruction: { + prototype: ProcessingInstruction; + new(): ProcessingInstruction; +} + +interface ProgressEvent extends Event { + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} + +declare var ProgressEvent: { + prototype: ProgressEvent; + new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; +} + +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((this: this, ev: ErrorEvent) => any) | null; + readonly state: string; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters | null; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: string; + onerror: ((this: this, ev: ErrorEvent) => any) | null; + onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: string; + readonly iceGatherer: RTCIceGatherer | null; + oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null; + readonly role: string; + readonly state: string; + addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair | null; + getRemoteCandidates(): RTCIceCandidate[]; + getRemoteParameters(): RTCIceParameters | null; + setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; + stop(): void; + addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: ((this: this, ev: ErrorEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack | null; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: ((this: this, ev: ErrorEvent) => any) | null; + onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: ((this: this, ev: ErrorEvent) => any) | null; + readonly transport: RTCIceTransport; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): PromiseLike; + msGetStats(): PromiseLike; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + +interface Range { + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; + cloneContents(): DocumentFragment; + cloneRange(): Range; + collapse(toStart: boolean): void; + compareBoundaryPoints(how: number, sourceRange: Range): number; + createContextualFragment(fragment: string): DocumentFragment; + deleteContents(): void; + detach(): void; + expand(Unit: string): boolean; + extractContents(): DocumentFragment; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + insertNode(newNode: Node): void; + selectNode(refNode: Node): void; + selectNodeContents(refNode: Node): void; + setEnd(refNode: Node, offset: number): void; + setEndAfter(refNode: Node): void; + setEndBefore(refNode: Node): void; + setStart(refNode: Node, offset: number): void; + setStartAfter(refNode: Node): void; + setStartBefore(refNode: Node): void; + surroundContents(newParent: Node): void; + toString(): string; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +declare var Range: { + prototype: Range; + new(): Range; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { + readonly target: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGAElement: { + prototype: SVGAElement; + new(): SVGAElement; +} + +interface SVGAngle { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +declare var SVGAngle: { + prototype: SVGAngle; + new(): SVGAngle; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +interface SVGAnimatedAngle { + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; +} + +declare var SVGAnimatedAngle: { + prototype: SVGAnimatedAngle; + new(): SVGAnimatedAngle; +} + +interface SVGAnimatedBoolean { + readonly animVal: boolean; + baseVal: boolean; +} + +declare var SVGAnimatedBoolean: { + prototype: SVGAnimatedBoolean; + new(): SVGAnimatedBoolean; +} + +interface SVGAnimatedEnumeration { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedEnumeration: { + prototype: SVGAnimatedEnumeration; + new(): SVGAnimatedEnumeration; +} + +interface SVGAnimatedInteger { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedInteger: { + prototype: SVGAnimatedInteger; + new(): SVGAnimatedInteger; +} + +interface SVGAnimatedLength { + readonly animVal: SVGLength; + readonly baseVal: SVGLength; +} + +declare var SVGAnimatedLength: { + prototype: SVGAnimatedLength; + new(): SVGAnimatedLength; +} + +interface SVGAnimatedLengthList { + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; +} + +declare var SVGAnimatedLengthList: { + prototype: SVGAnimatedLengthList; + new(): SVGAnimatedLengthList; +} + +interface SVGAnimatedNumber { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedNumber: { + prototype: SVGAnimatedNumber; + new(): SVGAnimatedNumber; +} + +interface SVGAnimatedNumberList { + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; +} + +declare var SVGAnimatedNumberList: { + prototype: SVGAnimatedNumberList; + new(): SVGAnimatedNumberList; +} + +interface SVGAnimatedPreserveAspectRatio { + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; +} + +declare var SVGAnimatedPreserveAspectRatio: { + prototype: SVGAnimatedPreserveAspectRatio; + new(): SVGAnimatedPreserveAspectRatio; +} + +interface SVGAnimatedRect { + readonly animVal: SVGRect; + readonly baseVal: SVGRect; +} + +declare var SVGAnimatedRect: { + prototype: SVGAnimatedRect; + new(): SVGAnimatedRect; +} + +interface SVGAnimatedString { + readonly animVal: string; + baseVal: string; +} + +declare var SVGAnimatedString: { + prototype: SVGAnimatedString; + new(): SVGAnimatedString; +} + +interface SVGAnimatedTransformList { + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; +} + +declare var SVGAnimatedTransformList: { + prototype: SVGAnimatedTransformList; + new(): SVGAnimatedTransformList; +} + +interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGCircleElement: { + prototype: SVGCircleElement; + new(): SVGCircleElement; +} + +interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { + readonly clipPathUnits: SVGAnimatedEnumeration; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGClipPathElement: { + prototype: SVGClipPathElement; + new(): SVGClipPathElement; +} + +interface SVGComponentTransferFunctionElement extends SVGElement { + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; +} + +declare var SVGComponentTransferFunctionElement: { + prototype: SVGComponentTransferFunctionElement; + new(): SVGComponentTransferFunctionElement; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; +} + +interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDefsElement: { + prototype: SVGDefsElement; + new(): SVGDefsElement; +} + +interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDescElement: { + prototype: SVGDescElement; + new(): SVGDescElement; +} + +interface SVGElement extends Element { + onclick: (this: this, ev: MouseEvent) => any; + ondblclick: (this: this, ev: MouseEvent) => any; + onfocusin: (this: this, ev: FocusEvent) => any; + onfocusout: (this: this, ev: FocusEvent) => any; + onload: (this: this, ev: Event) => any; + onmousedown: (this: this, ev: MouseEvent) => any; + onmousemove: (this: this, ev: MouseEvent) => any; + onmouseout: (this: this, ev: MouseEvent) => any; + onmouseover: (this: this, ev: MouseEvent) => any; + onmouseup: (this: this, ev: MouseEvent) => any; + readonly ownerSVGElement: SVGSVGElement; + readonly viewportElement: SVGElement; + xmlbase: string; + className: any; + 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var SVGElement: { + prototype: SVGElement; + new(): SVGElement; +} + +interface SVGElementInstance extends EventTarget { + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; +} + +declare var SVGElementInstance: { + prototype: SVGElementInstance; + new(): SVGElementInstance; +} + +interface SVGElementInstanceList { + readonly length: number; + item(index: number): SVGElementInstance; +} + +declare var SVGElementInstanceList: { + prototype: SVGElementInstanceList; + new(): SVGElementInstanceList; +} + +interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGEllipseElement: { + prototype: SVGEllipseElement; + new(): SVGEllipseElement; +} + +interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEBlendElement: { + prototype: SVGFEBlendElement; + new(): SVGFEBlendElement; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; +} + +interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEColorMatrixElement: { + prototype: SVGFEColorMatrixElement; + new(): SVGFEColorMatrixElement; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; +} + +interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEComponentTransferElement: { + prototype: SVGFEComponentTransferElement; + new(): SVGFEComponentTransferElement; +} + +interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFECompositeElement: { + prototype: SVGFECompositeElement; + new(): SVGFECompositeElement; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; +} + +interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEConvolveMatrixElement: { + prototype: SVGFEConvolveMatrixElement; + new(): SVGFEConvolveMatrixElement; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; +} + +interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDiffuseLightingElement: { + prototype: SVGFEDiffuseLightingElement; + new(): SVGFEDiffuseLightingElement; +} + +interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDisplacementMapElement: { + prototype: SVGFEDisplacementMapElement; + new(): SVGFEDisplacementMapElement; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; +} + +interface SVGFEDistantLightElement extends SVGElement { + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; +} + +declare var SVGFEDistantLightElement: { + prototype: SVGFEDistantLightElement; + new(): SVGFEDistantLightElement; +} + +interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFloodElement: { + prototype: SVGFEFloodElement; + new(): SVGFEFloodElement; +} + +interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncAElement: { + prototype: SVGFEFuncAElement; + new(): SVGFEFuncAElement; +} + +interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncBElement: { + prototype: SVGFEFuncBElement; + new(): SVGFEFuncBElement; +} + +interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncGElement: { + prototype: SVGFEFuncGElement; + new(): SVGFEFuncGElement; +} + +interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncRElement: { + prototype: SVGFEFuncRElement; + new(): SVGFEFuncRElement; +} + +interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEGaussianBlurElement: { + prototype: SVGFEGaussianBlurElement; + new(): SVGFEGaussianBlurElement; +} + +interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEImageElement: { + prototype: SVGFEImageElement; + new(): SVGFEImageElement; +} + +interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMergeElement: { + prototype: SVGFEMergeElement; + new(): SVGFEMergeElement; +} + +interface SVGFEMergeNodeElement extends SVGElement { + readonly in1: SVGAnimatedString; +} + +declare var SVGFEMergeNodeElement: { + prototype: SVGFEMergeNodeElement; + new(): SVGFEMergeNodeElement; +} + +interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMorphologyElement: { + prototype: SVGFEMorphologyElement; + new(): SVGFEMorphologyElement; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; +} + +interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEOffsetElement: { + prototype: SVGFEOffsetElement; + new(): SVGFEOffsetElement; +} + +interface SVGFEPointLightElement extends SVGElement { + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; +} + +declare var SVGFEPointLightElement: { + prototype: SVGFEPointLightElement; + new(): SVGFEPointLightElement; +} + +interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFESpecularLightingElement: { + prototype: SVGFESpecularLightingElement; + new(): SVGFESpecularLightingElement; +} + +interface SVGFESpotLightElement extends SVGElement { + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; +} + +declare var SVGFESpotLightElement: { + prototype: SVGFESpotLightElement; + new(): SVGFESpotLightElement; +} + +interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETileElement: { + prototype: SVGFETileElement; + new(): SVGFETileElement; +} + +interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETurbulenceElement: { + prototype: SVGFETurbulenceElement; + new(): SVGFETurbulenceElement; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; +} + +interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + setFilterRes(filterResX: number, filterResY: number): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFilterElement: { + prototype: SVGFilterElement; + new(): SVGFilterElement; +} + +interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGForeignObjectElement: { + prototype: SVGForeignObjectElement; + new(): SVGForeignObjectElement; +} + +interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGElement: { + prototype: SVGGElement; + new(): SVGGElement; +} + +interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGradientElement: { + prototype: SVGGradientElement; + new(): SVGGradientElement; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; +} + +interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGImageElement: { + prototype: SVGImageElement; + new(): SVGImageElement; +} + +interface SVGLength { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +declare var SVGLength: { + prototype: SVGLength; + new(): SVGLength; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +interface SVGLengthList { + readonly numberOfItems: number; + appendItem(newItem: SVGLength): SVGLength; + clear(): void; + getItem(index: number): SVGLength; + initialize(newItem: SVGLength): SVGLength; + insertItemBefore(newItem: SVGLength, index: number): SVGLength; + removeItem(index: number): SVGLength; + replaceItem(newItem: SVGLength, index: number): SVGLength; +} + +declare var SVGLengthList: { + prototype: SVGLengthList; + new(): SVGLengthList; +} + +interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGLineElement: { + prototype: SVGLineElement; + new(): SVGLineElement; +} + +interface SVGLinearGradientElement extends SVGGradientElement { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; +} + +declare var SVGLinearGradientElement: { + prototype: SVGLinearGradientElement; + new(): SVGLinearGradientElement; +} + +interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; + setOrientToAngle(angle: SVGAngle): void; + setOrientToAuto(): void; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMarkerElement: { + prototype: SVGMarkerElement; + new(): SVGMarkerElement; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; +} + +interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMaskElement: { + prototype: SVGMaskElement; + new(): SVGMaskElement; +} + +interface SVGMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + flipX(): SVGMatrix; + flipY(): SVGMatrix; + inverse(): SVGMatrix; + multiply(secondMatrix: SVGMatrix): SVGMatrix; + rotate(angle: number): SVGMatrix; + rotateFromVector(x: number, y: number): SVGMatrix; + scale(scaleFactor: number): SVGMatrix; + scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; + skewX(angle: number): SVGMatrix; + skewY(angle: number): SVGMatrix; + translate(x: number, y: number): SVGMatrix; +} + +declare var SVGMatrix: { + prototype: SVGMatrix; + new(): SVGMatrix; +} + +interface SVGMetadataElement extends SVGElement { +} + +declare var SVGMetadataElement: { + prototype: SVGMetadataElement; + new(): SVGMetadataElement; +} + +interface SVGNumber { + value: number; +} + +declare var SVGNumber: { + prototype: SVGNumber; + new(): SVGNumber; +} + +interface SVGNumberList { + readonly numberOfItems: number; + appendItem(newItem: SVGNumber): SVGNumber; + clear(): void; + getItem(index: number): SVGNumber; + initialize(newItem: SVGNumber): SVGNumber; + insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; + removeItem(index: number): SVGNumber; + replaceItem(newItem: SVGNumber, index: number): SVGNumber; +} + +declare var SVGNumberList: { + prototype: SVGNumberList; + new(): SVGNumberList; +} + +interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { + createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; + createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; + createSVGPathSegClosePath(): SVGPathSegClosePath; + createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; + createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; + createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; + createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; + createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; + createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; + createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; + createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; + createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; + createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; + createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; + createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; + createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; + createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; + createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; + createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; + getPathSegAtLength(distance: number): number; + getPointAtLength(distance: number): SVGPoint; + getTotalLength(): number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPathElement: { + prototype: SVGPathElement; + new(): SVGPathElement; +} + +interface SVGPathSeg { + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +declare var SVGPathSeg: { + prototype: SVGPathSeg; + new(): SVGPathSeg; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +interface SVGPathSegArcAbs extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcAbs: { + prototype: SVGPathSegArcAbs; + new(): SVGPathSegArcAbs; +} + +interface SVGPathSegArcRel extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcRel: { + prototype: SVGPathSegArcRel; + new(): SVGPathSegArcRel; +} + +interface SVGPathSegClosePath extends SVGPathSeg { +} + +declare var SVGPathSegClosePath: { + prototype: SVGPathSegClosePath; + new(): SVGPathSegClosePath; +} + +interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicAbs: { + prototype: SVGPathSegCurvetoCubicAbs; + new(): SVGPathSegCurvetoCubicAbs; +} + +interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicRel: { + prototype: SVGPathSegCurvetoCubicRel; + new(): SVGPathSegCurvetoCubicRel; +} + +interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothAbs: { + prototype: SVGPathSegCurvetoCubicSmoothAbs; + new(): SVGPathSegCurvetoCubicSmoothAbs; +} + +interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothRel: { + prototype: SVGPathSegCurvetoCubicSmoothRel; + new(): SVGPathSegCurvetoCubicSmoothRel; +} + +interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticAbs: { + prototype: SVGPathSegCurvetoQuadraticAbs; + new(): SVGPathSegCurvetoQuadraticAbs; +} + +interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticRel: { + prototype: SVGPathSegCurvetoQuadraticRel; + new(): SVGPathSegCurvetoQuadraticRel; +} + +interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothAbs: { + prototype: SVGPathSegCurvetoQuadraticSmoothAbs; + new(): SVGPathSegCurvetoQuadraticSmoothAbs; +} + +interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothRel: { + prototype: SVGPathSegCurvetoQuadraticSmoothRel; + new(): SVGPathSegCurvetoQuadraticSmoothRel; +} + +interface SVGPathSegLinetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoAbs: { + prototype: SVGPathSegLinetoAbs; + new(): SVGPathSegLinetoAbs; +} + +interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalAbs: { + prototype: SVGPathSegLinetoHorizontalAbs; + new(): SVGPathSegLinetoHorizontalAbs; +} + +interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalRel: { + prototype: SVGPathSegLinetoHorizontalRel; + new(): SVGPathSegLinetoHorizontalRel; +} + +interface SVGPathSegLinetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoRel: { + prototype: SVGPathSegLinetoRel; + new(): SVGPathSegLinetoRel; +} + +interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalAbs: { + prototype: SVGPathSegLinetoVerticalAbs; + new(): SVGPathSegLinetoVerticalAbs; +} + +interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalRel: { + prototype: SVGPathSegLinetoVerticalRel; + new(): SVGPathSegLinetoVerticalRel; +} + +interface SVGPathSegList { + readonly numberOfItems: number; + appendItem(newItem: SVGPathSeg): SVGPathSeg; + clear(): void; + getItem(index: number): SVGPathSeg; + initialize(newItem: SVGPathSeg): SVGPathSeg; + insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; + removeItem(index: number): SVGPathSeg; + replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; +} + +declare var SVGPathSegList: { + prototype: SVGPathSegList; + new(): SVGPathSegList; +} + +interface SVGPathSegMovetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoAbs: { + prototype: SVGPathSegMovetoAbs; + new(): SVGPathSegMovetoAbs; +} + +interface SVGPathSegMovetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoRel: { + prototype: SVGPathSegMovetoRel; + new(): SVGPathSegMovetoRel; +} + +interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPatternElement: { + prototype: SVGPatternElement; + new(): SVGPatternElement; +} + +interface SVGPoint { + x: number; + y: number; + matrixTransform(matrix: SVGMatrix): SVGPoint; +} + +declare var SVGPoint: { + prototype: SVGPoint; + new(): SVGPoint; +} + +interface SVGPointList { + readonly numberOfItems: number; + appendItem(newItem: SVGPoint): SVGPoint; + clear(): void; + getItem(index: number): SVGPoint; + initialize(newItem: SVGPoint): SVGPoint; + insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; + removeItem(index: number): SVGPoint; + replaceItem(newItem: SVGPoint, index: number): SVGPoint; +} + +declare var SVGPointList: { + prototype: SVGPointList; + new(): SVGPointList; +} + +interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolygonElement: { + prototype: SVGPolygonElement; + new(): SVGPolygonElement; +} + +interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolylineElement: { + prototype: SVGPolylineElement; + new(): SVGPolylineElement; +} + +interface SVGPreserveAspectRatio { + align: number; + meetOrSlice: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +declare var SVGPreserveAspectRatio: { + prototype: SVGPreserveAspectRatio; + new(): SVGPreserveAspectRatio; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +interface SVGRadialGradientElement extends SVGGradientElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; +} + +declare var SVGRadialGradientElement: { + prototype: SVGRadialGradientElement; + new(): SVGRadialGradientElement; +} + +interface SVGRect { + height: number; + width: number; + x: number; + y: number; +} + +declare var SVGRect: { + prototype: SVGRect; + new(): SVGRect; +} + +interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGRectElement: { + prototype: SVGRectElement; + new(): SVGRectElement; +} + +interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { + contentScriptType: string; + contentStyleType: string; + currentScale: number; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: Event) => any; + onresize: (this: this, ev: UIEvent) => any; + onscroll: (this: this, ev: UIEvent) => any; + onunload: (this: this, ev: Event) => any; + onzoom: (this: this, ev: SVGZoomEvent) => any; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + checkEnclosure(element: SVGElement, rect: SVGRect): boolean; + checkIntersection(element: SVGElement, rect: SVGRect): boolean; + createSVGAngle(): SVGAngle; + createSVGLength(): SVGLength; + createSVGMatrix(): SVGMatrix; + createSVGNumber(): SVGNumber; + createSVGPoint(): SVGPoint; + createSVGRect(): SVGRect; + createSVGTransform(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + deselectAll(): void; + forceRedraw(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getCurrentTime(): number; + getElementById(elementId: string): Element; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + pauseAnimations(): void; + setCurrentTime(seconds: number): void; + suspendRedraw(maxWaitMilliseconds: number): number; + unpauseAnimations(): void; + unsuspendRedraw(suspendHandleID: number): void; + unsuspendRedrawAll(): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var SVGSVGElement: { + prototype: SVGSVGElement; + new(): SVGSVGElement; +} + +interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { + type: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGScriptElement: { + prototype: SVGScriptElement; + new(): SVGScriptElement; +} + +interface SVGStopElement extends SVGElement, SVGStylable { + readonly offset: SVGAnimatedNumber; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStopElement: { + prototype: SVGStopElement; + new(): SVGStopElement; +} + +interface SVGStringList { + readonly numberOfItems: number; + appendItem(newItem: string): string; + clear(): void; + getItem(index: number): string; + initialize(newItem: string): string; + insertItemBefore(newItem: string, index: number): string; + removeItem(index: number): string; + replaceItem(newItem: string, index: number): string; +} + +declare var SVGStringList: { + prototype: SVGStringList; + new(): SVGStringList; +} + +interface SVGStyleElement extends SVGElement, SVGLangSpace { + disabled: boolean; + media: string; + title: string; + type: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStyleElement: { + prototype: SVGStyleElement; + new(): SVGStyleElement; +} + +interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSwitchElement: { + prototype: SVGSwitchElement; + new(): SVGSwitchElement; +} + +interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSymbolElement: { + prototype: SVGSymbolElement; + new(): SVGSymbolElement; +} + +interface SVGTSpanElement extends SVGTextPositioningElement { +} + +declare var SVGTSpanElement: { + prototype: SVGTSpanElement; + new(): SVGTSpanElement; +} + +interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; + getCharNumAtPosition(point: SVGPoint): number; + getComputedTextLength(): number; + getEndPositionOfChar(charnum: number): SVGPoint; + getExtentOfChar(charnum: number): SVGRect; + getNumberOfChars(): number; + getRotationOfChar(charnum: number): number; + getStartPositionOfChar(charnum: number): SVGPoint; + getSubStringLength(charnum: number, nchars: number): number; + selectSubString(charnum: number, nchars: number): void; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextContentElement: { + prototype: SVGTextContentElement; + new(): SVGTextContentElement; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; +} + +interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextElement: { + prototype: SVGTextElement; + new(): SVGTextElement; +} + +interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextPathElement: { + prototype: SVGTextPathElement; + new(): SVGTextPathElement; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; +} + +interface SVGTextPositioningElement extends SVGTextContentElement { + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; +} + +declare var SVGTextPositioningElement: { + prototype: SVGTextPositioningElement; + new(): SVGTextPositioningElement; +} + +interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTitleElement: { + prototype: SVGTitleElement; + new(): SVGTitleElement; +} + +interface SVGTransform { + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; + setMatrix(matrix: SVGMatrix): void; + setRotate(angle: number, cx: number, cy: number): void; + setScale(sx: number, sy: number): void; + setSkewX(angle: number): void; + setSkewY(angle: number): void; + setTranslate(tx: number, ty: number): void; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +declare var SVGTransform: { + prototype: SVGTransform; + new(): SVGTransform; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +interface SVGTransformList { + readonly numberOfItems: number; + appendItem(newItem: SVGTransform): SVGTransform; + clear(): void; + consolidate(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + getItem(index: number): SVGTransform; + initialize(newItem: SVGTransform): SVGTransform; + insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; + removeItem(index: number): SVGTransform; + replaceItem(newItem: SVGTransform, index: number): SVGTransform; +} + +declare var SVGTransformList: { + prototype: SVGTransformList; + new(): SVGTransformList; +} + +interface SVGUnitTypes { + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; +} +declare var SVGUnitTypes: SVGUnitTypes; + +interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGUseElement: { + prototype: SVGUseElement; + new(): SVGUseElement; +} + +interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { + readonly viewTarget: SVGStringList; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGViewElement: { + prototype: SVGViewElement; + new(): SVGViewElement; +} + +interface SVGZoomAndPan { + readonly zoomAndPan: number; +} + +declare var SVGZoomAndPan: { + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; +} + +interface SVGZoomEvent extends UIEvent { + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; +} + +declare var SVGZoomEvent: { + prototype: SVGZoomEvent; + new(): SVGZoomEvent; +} + +interface Screen extends EventTarget { + readonly availHeight: number; + readonly availWidth: number; + bufferDepth: number; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; + onmsorientationchange: (this: this, ev: Event) => any; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; + msLockOrientation(orientations: string | string[]): boolean; + msUnlockOrientation(): void; + addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Screen: { + prototype: Screen; + new(): Screen; +} + +interface ScriptNotifyEvent extends Event { + readonly callingUri: string; + readonly value: string; +} + +declare var ScriptNotifyEvent: { + prototype: ScriptNotifyEvent; + new(): ScriptNotifyEvent; +} + +interface ScriptProcessorNode extends AudioNode { + readonly bufferSize: number; + onaudioprocess: (this: this, ev: AudioProcessingEvent) => any; + addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ScriptProcessorNode: { + prototype: ScriptProcessorNode; + new(): ScriptProcessorNode; +} + +interface Selection { + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; + addRange(range: Range): void; + collapse(parentNode: Node, offset: number): void; + collapseToEnd(): void; + collapseToStart(): void; + containsNode(node: Node, partlyContained: boolean): boolean; + deleteFromDocument(): void; + empty(): void; + extend(newNode: Node, offset: number): void; + getRangeAt(index: number): Range; + removeAllRanges(): void; + removeRange(range: Range): void; + selectAllChildren(parentNode: Node): void; + setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; + toString(): string; +} + +declare var Selection: { + prototype: Selection; + new(): Selection; +} + +interface SourceBuffer extends EventTarget { + appendWindowEnd: number; + appendWindowStart: number; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; + mode: string; + timestampOffset: number; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; + abort(): void; + appendBuffer(data: ArrayBuffer | ArrayBufferView): void; + appendStream(stream: MSStream, maxSize?: number): void; + remove(start: number, end: number): void; +} + +declare var SourceBuffer: { + prototype: SourceBuffer; + new(): SourceBuffer; +} + +interface SourceBufferList extends EventTarget { + readonly length: number; + item(index: number): SourceBuffer; + [index: number]: SourceBuffer; +} + +declare var SourceBufferList: { + prototype: SourceBufferList; + new(): SourceBufferList; +} + +interface StereoPannerNode extends AudioNode { + readonly pan: AudioParam; +} + +declare var StereoPannerNode: { + prototype: StereoPannerNode; + new(): StereoPannerNode; +} + +interface Storage { + readonly length: number; + clear(): void; + getItem(key: string): string | null; + key(index: number): string | null; + removeItem(key: string): void; + setItem(key: string, data: string): void; + [key: string]: any; + [index: number]: string; +} + +declare var Storage: { + prototype: Storage; + new(): Storage; +} + +interface StorageEvent extends Event { + readonly url: string; + key?: string; + oldValue?: string; + newValue?: string; + storageArea?: Storage; +} + +declare var StorageEvent: { + prototype: StorageEvent; + new (type: string, eventInitDict?: StorageEventInit): StorageEvent; +} + +interface StyleMedia { + readonly type: string; + matchMedium(mediaquery: string): boolean; +} + +declare var StyleMedia: { + prototype: StyleMedia; + new(): StyleMedia; +} + +interface StyleSheet { + disabled: boolean; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; +} + +declare var StyleSheet: { + prototype: StyleSheet; + new(): StyleSheet; +} + +interface StyleSheetList { + readonly length: number; + item(index?: number): StyleSheet; + [index: number]: StyleSheet; +} + +declare var StyleSheetList: { + prototype: StyleSheetList; + new(): StyleSheetList; +} + +interface StyleSheetPageList { + readonly length: number; + item(index: number): CSSPageRule; + [index: number]: CSSPageRule; +} + +declare var StyleSheetPageList: { + prototype: StyleSheetPageList; + new(): StyleSheetPageList; +} + +interface SubtleCrypto { + decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; + encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + exportKey(format: "jwk", key: CryptoKey): PromiseLike; + exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; + unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; +} + +declare var SubtleCrypto: { + prototype: SubtleCrypto; + new(): SubtleCrypto; +} + +interface Text extends CharacterData { + readonly wholeText: string; + splitText(offset: number): Text; +} + +declare var Text: { + prototype: Text; + new(): Text; +} + +interface TextEvent extends UIEvent { + readonly data: string; + readonly inputMethod: number; + readonly locale: string; + initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +declare var TextEvent: { + prototype: TextEvent; + new(): TextEvent; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +interface TextMetrics { + readonly width: number; +} + +declare var TextMetrics: { + prototype: TextMetrics; + new(): TextMetrics; +} + +interface TextTrack extends EventTarget { + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; + mode: any; + oncuechange: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + readonly readyState: number; + addCue(cue: TextTrackCue): void; + removeCue(cue: TextTrackCue): void; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; + addEventListener(type: "cuechange", 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrack: { + prototype: TextTrack; + new(): TextTrack; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; +} + +interface TextTrackCue extends EventTarget { + endTime: number; + id: string; + onenter: (this: this, ev: Event) => any; + onexit: (this: this, ev: Event) => any; + pauseOnExit: boolean; + startTime: number; + text: string; + readonly track: TextTrack; + getCueAsHTML(): DocumentFragment; + addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrackCue: { + prototype: TextTrackCue; + new(startTime: number, endTime: number, text: string): TextTrackCue; +} + +interface TextTrackCueList { + readonly length: number; + getCueById(id: string): TextTrackCue; + item(index: number): TextTrackCue; + [index: number]: TextTrackCue; +} + +declare var TextTrackCueList: { + prototype: TextTrackCueList; + new(): TextTrackCueList; +} + +interface TextTrackList extends EventTarget { + readonly length: number; + onaddtrack: ((this: this, ev: TrackEvent) => any) | null; + item(index: number): TextTrack; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: TextTrack; +} + +declare var TextTrackList: { + prototype: TextTrackList; + new(): TextTrackList; +} + +interface TimeRanges { + readonly length: number; + end(index: number): number; + start(index: number): number; +} + +declare var TimeRanges: { + prototype: TimeRanges; + new(): TimeRanges; +} + +interface Touch { + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; +} + +declare var Touch: { + prototype: Touch; + new(): Touch; +} + +interface TouchEvent extends UIEvent { + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly ctrlKey: boolean; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; +} + +declare var TouchEvent: { + prototype: TouchEvent; + new(): TouchEvent; +} + +interface TouchList { + readonly length: number; + item(index: number): Touch | null; + [index: number]: Touch; +} + +declare var TouchList: { + prototype: TouchList; + new(): TouchList; +} + +interface TrackEvent extends Event { + readonly track: any; +} + +declare var TrackEvent: { + prototype: TrackEvent; + new(): TrackEvent; +} + +interface TransitionEvent extends Event { + readonly elapsedTime: number; + readonly propertyName: string; + initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; +} + +declare var TransitionEvent: { + prototype: TransitionEvent; + new(): TransitionEvent; +} + +interface TreeWalker { + currentNode: Node; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + firstChild(): Node; + lastChild(): Node; + nextNode(): Node; + nextSibling(): Node; + parentNode(): Node; + previousNode(): Node; + previousSibling(): Node; +} + +declare var TreeWalker: { + prototype: TreeWalker; + new(): TreeWalker; +} + +interface UIEvent extends Event { + readonly detail: number; + readonly view: Window; + initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; +} + +declare var UIEvent: { + prototype: UIEvent; + new(type: string, eventInitDict?: UIEventInit): UIEvent; +} + +interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; + createObjectURL(object: any, options?: ObjectURLOptions): string; + revokeObjectURL(url: string): void; +} + +interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { + readonly mediaType: string; +} + +declare var UnviewableContentIdentifiedEvent: { + prototype: UnviewableContentIdentifiedEvent; + new(): UnviewableContentIdentifiedEvent; +} + +interface ValidityState { + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; +} + +declare var ValidityState: { + prototype: ValidityState; + new(): ValidityState; +} + +interface VideoPlaybackQuality { + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; +} + +declare var VideoPlaybackQuality: { + prototype: VideoPlaybackQuality; + new(): VideoPlaybackQuality; +} + +interface VideoTrack { + readonly id: string; + kind: string; + readonly label: string; + language: string; + selected: boolean; + readonly sourceBuffer: SourceBuffer; +} + +declare var VideoTrack: { + prototype: VideoTrack; + new(): VideoTrack; +} + +interface VideoTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: this, ev: TrackEvent) => any; + onchange: (this: this, ev: Event) => any; + onremovetrack: (this: this, ev: TrackEvent) => any; + readonly selectedIndex: number; + getTrackById(id: string): VideoTrack | null; + item(index: number): VideoTrack; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: VideoTrack; +} + +declare var VideoTrackList: { + prototype: VideoTrackList; + new(): VideoTrackList; +} + +interface WEBGL_compressed_texture_s3tc { + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +declare var WEBGL_compressed_texture_s3tc: { + prototype: WEBGL_compressed_texture_s3tc; + new(): WEBGL_compressed_texture_s3tc; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +interface WEBGL_debug_renderer_info { + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +declare var WEBGL_debug_renderer_info: { + prototype: WEBGL_debug_renderer_info; + new(): WEBGL_debug_renderer_info; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +interface WEBGL_depth_texture { + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +declare var WEBGL_depth_texture: { + prototype: WEBGL_depth_texture; + new(): WEBGL_depth_texture; + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +interface WaveShaperNode extends AudioNode { + curve: Float32Array | null; + oversample: string; +} + +declare var WaveShaperNode: { + prototype: WaveShaperNode; + new(): WaveShaperNode; +} + +interface WebGLActiveInfo { + readonly name: string; + readonly size: number; + readonly type: number; +} + +declare var WebGLActiveInfo: { + prototype: WebGLActiveInfo; + new(): WebGLActiveInfo; +} + +interface WebGLBuffer extends WebGLObject { +} + +declare var WebGLBuffer: { + prototype: WebGLBuffer; + new(): WebGLBuffer; +} + +interface WebGLContextEvent extends Event { + readonly statusMessage: string; +} + +declare var WebGLContextEvent: { + prototype: WebGLContextEvent; + new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; +} + +interface WebGLFramebuffer extends WebGLObject { +} + +declare var WebGLFramebuffer: { + prototype: WebGLFramebuffer; + new(): WebGLFramebuffer; +} + +interface WebGLObject { +} + +declare var WebGLObject: { + prototype: WebGLObject; + new(): WebGLObject; +} + +interface WebGLProgram extends WebGLObject { +} + +declare var WebGLProgram: { + prototype: WebGLProgram; + new(): WebGLProgram; +} + +interface WebGLRenderbuffer extends WebGLObject { +} + +declare var WebGLRenderbuffer: { + prototype: WebGLRenderbuffer; + new(): WebGLRenderbuffer; +} + +interface WebGLRenderingContext { + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; + activeTexture(texture: number): void; + attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; + bindBuffer(target: number, buffer: WebGLBuffer | null): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; + bindTexture(target: number, texture: WebGLTexture | null): void; + blendColor(red: number, green: number, blue: number, alpha: number): void; + blendEquation(mode: number): void; + blendEquationSeparate(modeRGB: number, modeAlpha: number): void; + blendFunc(sfactor: number, dfactor: number): void; + blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; + bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; + checkFramebufferStatus(target: number): number; + clear(mask: number): void; + clearColor(red: number, green: number, blue: number, alpha: number): void; + clearDepth(depth: number): void; + clearStencil(s: number): void; + colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; + compileShader(shader: WebGLShader | null): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; + copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; + copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; + createBuffer(): WebGLBuffer | null; + createFramebuffer(): WebGLFramebuffer | null; + createProgram(): WebGLProgram | null; + createRenderbuffer(): WebGLRenderbuffer | null; + createShader(type: number): WebGLShader | null; + createTexture(): WebGLTexture | null; + cullFace(mode: number): void; + deleteBuffer(buffer: WebGLBuffer | null): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; + deleteProgram(program: WebGLProgram | null): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; + deleteShader(shader: WebGLShader | null): void; + deleteTexture(texture: WebGLTexture | null): void; + depthFunc(func: number): void; + depthMask(flag: boolean): void; + depthRange(zNear: number, zFar: number): void; + detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + disable(cap: number): void; + disableVertexAttribArray(index: number): void; + drawArrays(mode: number, first: number, count: number): void; + drawElements(mode: number, count: number, type: number, offset: number): void; + enable(cap: number): void; + enableVertexAttribArray(index: number): void; + finish(): void; + flush(): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; + frontFace(mode: number): void; + generateMipmap(target: number): void; + getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; + getAttribLocation(program: WebGLProgram | null, name: string): number; + getBufferParameter(target: number, pname: number): any; + getContextAttributes(): WebGLContextAttributes; + getError(): number; + getExtension(name: string): any; + getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; + getParameter(pname: number): any; + getProgramInfoLog(program: WebGLProgram | null): string | null; + getProgramParameter(program: WebGLProgram | null, pname: number): any; + getRenderbufferParameter(target: number, pname: number): any; + getShaderInfoLog(shader: WebGLShader | null): string | null; + getShaderParameter(shader: WebGLShader | null, pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; + getShaderSource(shader: WebGLShader | null): string | null; + getSupportedExtensions(): string[] | null; + getTexParameter(target: number, pname: number): any; + getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; + getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; + getVertexAttrib(index: number, pname: number): any; + getVertexAttribOffset(index: number, pname: number): number; + hint(target: number, mode: number): void; + isBuffer(buffer: WebGLBuffer | null): boolean; + isContextLost(): boolean; + isEnabled(cap: number): boolean; + isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; + isProgram(program: WebGLProgram | null): boolean; + isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; + isShader(shader: WebGLShader | null): boolean; + isTexture(texture: WebGLTexture | null): boolean; + lineWidth(width: number): void; + linkProgram(program: WebGLProgram | null): void; + pixelStorei(pname: number, param: number): void; + polygonOffset(factor: number, units: number): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; + renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; + sampleCoverage(value: number, invert: boolean): void; + scissor(x: number, y: number, width: number, height: number): void; + shaderSource(shader: WebGLShader | null, source: string): void; + stencilFunc(func: number, ref: number, mask: number): void; + stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; + stencilMask(mask: number): void; + stencilMaskSeparate(face: number, mask: number): void; + stencilOp(fail: number, zfail: number, zpass: number): void; + stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; + texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + texParameterf(target: number, pname: number, param: number): void; + texParameteri(target: number, pname: number, param: number): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + uniform1f(location: WebGLUniformLocation | null, x: number): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform1i(location: WebGLUniformLocation | null, x: number): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + useProgram(program: WebGLProgram | null): void; + validateProgram(program: WebGLProgram | null): void; + vertexAttrib1f(indx: number, x: number): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib2f(indx: number, x: number, y: number): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib3f(indx: number, x: number, y: number, z: number): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; + vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; + viewport(x: number, y: number, width: number, height: number): void; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +declare var WebGLRenderingContext: { + prototype: WebGLRenderingContext; + new(): WebGLRenderingContext; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +interface WebGLShader extends WebGLObject { +} + +declare var WebGLShader: { + prototype: WebGLShader; + new(): WebGLShader; +} + +interface WebGLShaderPrecisionFormat { + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; +} + +declare var WebGLShaderPrecisionFormat: { + prototype: WebGLShaderPrecisionFormat; + new(): WebGLShaderPrecisionFormat; +} + +interface WebGLTexture extends WebGLObject { +} + +declare var WebGLTexture: { + prototype: WebGLTexture; + new(): WebGLTexture; +} + +interface WebGLUniformLocation { +} + +declare var WebGLUniformLocation: { + prototype: WebGLUniformLocation; + new(): WebGLUniformLocation; +} + +interface WebKitCSSMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + m11: number; + m12: number; + m13: number; + m14: number; + m21: number; + m22: number; + m23: number; + m24: number; + m31: number; + m32: number; + m33: number; + m34: number; + m41: number; + m42: number; + m43: number; + m44: number; + inverse(): WebKitCSSMatrix; + multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; + rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; + rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; + scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; + setMatrixValue(value: string): void; + skewX(angle: number): WebKitCSSMatrix; + skewY(angle: number): WebKitCSSMatrix; + toString(): string; + translate(x: number, y: number, z?: number): WebKitCSSMatrix; +} + +declare var WebKitCSSMatrix: { + prototype: WebKitCSSMatrix; + new(text?: string): WebKitCSSMatrix; +} + +interface WebKitPoint { + x: number; + y: number; +} + +declare var WebKitPoint: { + prototype: WebKitPoint; + new(x?: number, y?: number): WebKitPoint; +} + +interface WebSocket extends EventTarget { + binaryType: string; + readonly bufferedAmount: number; + readonly extensions: string; + onclose: (this: this, ev: CloseEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onopen: (this: this, ev: Event) => any; + readonly protocol: string; + readonly readyState: number; + readonly url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; + addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string | string[]): WebSocket; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; +} + +interface WheelEvent extends MouseEvent { + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; + getCurrentPoint(element: Element): void; + initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +declare var WheelEvent: { + prototype: WheelEvent; + new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { + readonly applicationCache: ApplicationCache; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; + defaultStatus: string; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; + event: Event | undefined; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msCredentials: MSCredentials; + name: string; + readonly navigator: Navigator; + offscreenBuffering: string | boolean; + onabort: (this: this, ev: UIEvent) => any; + onafterprint: (this: this, ev: Event) => any; + onbeforeprint: (this: this, ev: Event) => any; + onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + onblur: (this: this, ev: FocusEvent) => any; + oncanplay: (this: this, ev: Event) => any; + oncanplaythrough: (this: this, ev: Event) => any; + onchange: (this: this, ev: Event) => any; + onclick: (this: this, ev: MouseEvent) => any; + oncompassneedscalibration: (this: this, ev: Event) => any; + oncontextmenu: (this: this, ev: PointerEvent) => any; + ondblclick: (this: this, ev: MouseEvent) => any; + ondevicelight: (this: this, ev: DeviceLightEvent) => any; + ondevicemotion: (this: this, ev: DeviceMotionEvent) => any; + ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any; + ondrag: (this: this, ev: DragEvent) => any; + ondragend: (this: this, ev: DragEvent) => any; + ondragenter: (this: this, ev: DragEvent) => any; + ondragleave: (this: this, ev: DragEvent) => any; + ondragover: (this: this, ev: DragEvent) => any; + ondragstart: (this: this, ev: DragEvent) => any; + ondrop: (this: this, ev: DragEvent) => any; + ondurationchange: (this: this, ev: Event) => any; + onemptied: (this: this, ev: Event) => any; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + onerror: ErrorEventHandler; + onfocus: (this: this, ev: FocusEvent) => any; + onhashchange: (this: this, ev: HashChangeEvent) => any; + oninput: (this: this, ev: Event) => any; + oninvalid: (this: this, ev: Event) => any; + onkeydown: (this: this, ev: KeyboardEvent) => any; + onkeypress: (this: this, ev: KeyboardEvent) => any; + onkeyup: (this: this, ev: KeyboardEvent) => any; + onload: (this: this, ev: Event) => any; + onloadeddata: (this: this, ev: Event) => any; + onloadedmetadata: (this: this, ev: Event) => any; + onloadstart: (this: this, ev: Event) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onmousedown: (this: this, ev: MouseEvent) => any; + onmouseenter: (this: this, ev: MouseEvent) => any; + onmouseleave: (this: this, ev: MouseEvent) => any; + onmousemove: (this: this, ev: MouseEvent) => any; + onmouseout: (this: this, ev: MouseEvent) => any; + onmouseover: (this: this, ev: MouseEvent) => any; + onmouseup: (this: this, ev: MouseEvent) => any; + onmousewheel: (this: this, ev: WheelEvent) => any; + onmsgesturechange: (this: this, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; + onmsgestureend: (this: this, ev: MSGestureEvent) => any; + onmsgesturehold: (this: this, ev: MSGestureEvent) => any; + onmsgesturestart: (this: this, ev: MSGestureEvent) => any; + onmsgesturetap: (this: this, ev: MSGestureEvent) => any; + onmsinertiastart: (this: this, ev: MSGestureEvent) => any; + onmspointercancel: (this: this, ev: MSPointerEvent) => any; + onmspointerdown: (this: this, ev: MSPointerEvent) => any; + onmspointerenter: (this: this, ev: MSPointerEvent) => any; + onmspointerleave: (this: this, ev: MSPointerEvent) => any; + onmspointermove: (this: this, ev: MSPointerEvent) => any; + onmspointerout: (this: this, ev: MSPointerEvent) => any; + onmspointerover: (this: this, ev: MSPointerEvent) => any; + onmspointerup: (this: this, ev: MSPointerEvent) => any; + onoffline: (this: this, ev: Event) => any; + ononline: (this: this, ev: Event) => any; + onorientationchange: (this: this, ev: Event) => any; + onpagehide: (this: this, ev: PageTransitionEvent) => any; + onpageshow: (this: this, ev: PageTransitionEvent) => any; + onpause: (this: this, ev: Event) => any; + onplay: (this: this, ev: Event) => any; + onplaying: (this: this, ev: Event) => any; + onpopstate: (this: this, ev: PopStateEvent) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + onratechange: (this: this, ev: Event) => any; + onreadystatechange: (this: this, ev: ProgressEvent) => any; + onreset: (this: this, ev: Event) => any; + onresize: (this: this, ev: UIEvent) => any; + onscroll: (this: this, ev: UIEvent) => any; + onseeked: (this: this, ev: Event) => any; + onseeking: (this: this, ev: Event) => any; + onselect: (this: this, ev: UIEvent) => any; + onstalled: (this: this, ev: Event) => any; + onstorage: (this: this, ev: StorageEvent) => any; + onsubmit: (this: this, ev: Event) => any; + onsuspend: (this: this, ev: Event) => any; + ontimeupdate: (this: this, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onunload: (this: this, ev: Event) => any; + onvolumechange: (this: this, ev: Event) => any; + onwaiting: (this: this, ev: Event) => any; + opener: any; + orientation: string | number; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; + status: string; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; + Blob: typeof Blob; + alert(message?: any): void; + blur(): void; + cancelAnimationFrame(handle: number): void; + captureEvents(): void; + close(): void; + confirm(message?: string): boolean; + focus(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; + getSelection(): Selection; + matchMedia(mediaQuery: string): MediaQueryList; + moveBy(x?: number, y?: number): void; + moveTo(x?: number, y?: number): void; + msWriteProfilerMark(profilerMarkName: string): void; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; + print(): void; + prompt(message?: string, _default?: string): string | null; + releaseEvents(): void; + requestAnimationFrame(callback: FrameRequestCallback): number; + resizeBy(x?: number, y?: number): void; + resizeTo(x?: number, y?: number): void; + scroll(x?: number, y?: number): void; + scrollBy(x?: number, y?: number): void; + scrollTo(x?: number, y?: number): void; + webkitCancelAnimationFrame(handle: number): void; + 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + 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; +} + +declare var Window: { + prototype: Window; + new(): Window; +} + +interface Worker extends EventTarget, AbstractWorker { + onmessage: (this: this, ev: MessageEvent) => any; + postMessage(message: any, ports?: any): void; + terminate(): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface XMLDocument extends Document { +} + +declare var XMLDocument: { + prototype: XMLDocument; + new(): XMLDocument; +} + +interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { + onreadystatechange: (this: this, ev: Event) => any; + readonly readyState: number; + readonly response: any; + readonly responseText: string; + responseType: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; + timeout: number; + readonly upload: XMLHttpRequestUpload; + withCredentials: boolean; + msCaching?: string; + readonly responseURL: string; + abort(): void; + getAllResponseHeaders(): string; + getResponseHeader(header: string): string | null; + msCachingEnabled(): boolean; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + overrideMimeType(mime: string): void; + send(data?: Document): void; + send(data?: string): void; + send(data?: any): void; + setRequestHeader(header: string, value: string): void; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + 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: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", 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; +} + +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + create(): XMLHttpRequest; +} + +interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequestUpload: { + prototype: XMLHttpRequestUpload; + new(): XMLHttpRequestUpload; +} + +interface XMLSerializer { + serializeToString(target: Node): string; +} + +declare var XMLSerializer: { + prototype: XMLSerializer; + new(): XMLSerializer; +} + +interface XPathEvaluator { + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver?: Node): XPathNSResolver; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; +} + +declare var XPathEvaluator: { + prototype: XPathEvaluator; + new(): XPathEvaluator; +} + +interface XPathExpression { + evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; +} + +declare var XPathExpression: { + prototype: XPathExpression; + new(): XPathExpression; +} + +interface XPathNSResolver { + lookupNamespaceURI(prefix: string): string; +} + +declare var XPathNSResolver: { + prototype: XPathNSResolver; + new(): XPathNSResolver; +} + +interface XPathResult { + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; + iterateNext(): Node; + snapshotItem(index: number): Node; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +declare var XPathResult: { + prototype: XPathResult; + new(): XPathResult; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +interface XSLTProcessor { + clearParameters(): void; + getParameter(namespaceURI: string, localName: string): any; + importStylesheet(style: Node): void; + removeParameter(namespaceURI: string, localName: string): void; + reset(): void; + setParameter(namespaceURI: string, localName: string, value: any): void; + transformToDocument(source: Node): Document; + transformToFragment(source: Node, document: Document): DocumentFragment; +} + +declare var XSLTProcessor: { + prototype: XSLTProcessor; + new(): XSLTProcessor; +} + +interface AbstractWorker { + onerror: (this: this, ev: ErrorEvent) => any; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + +interface ChildNode { + remove(): void; +} + +interface DOML2DeprecatedColorProperty { + color: string; +} + +interface DOML2DeprecatedSizeProperty { + size: number; +} + +interface DocumentEvent { + createEvent(eventInterface:"AnimationEvent"): AnimationEvent; + createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; + createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; + createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; + createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; + createEvent(eventInterface:"CloseEvent"): CloseEvent; + createEvent(eventInterface:"CommandEvent"): CommandEvent; + createEvent(eventInterface:"CompositionEvent"): CompositionEvent; + createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; + createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface:"DragEvent"): DragEvent; + createEvent(eventInterface:"ErrorEvent"): ErrorEvent; + createEvent(eventInterface:"Event"): Event; + createEvent(eventInterface:"Events"): Event; + createEvent(eventInterface:"FocusEvent"): FocusEvent; + createEvent(eventInterface:"GamepadEvent"): GamepadEvent; + createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; + createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; + createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; + createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; + createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; + createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; + createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; + createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; + createEvent(eventInterface:"MessageEvent"): MessageEvent; + createEvent(eventInterface:"MouseEvent"): MouseEvent; + createEvent(eventInterface:"MouseEvents"): MouseEvent; + createEvent(eventInterface:"MutationEvent"): MutationEvent; + createEvent(eventInterface:"MutationEvents"): MutationEvent; + createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; + createEvent(eventInterface:"NavigationEvent"): NavigationEvent; + createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; + createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; + createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; + createEvent(eventInterface:"PointerEvent"): PointerEvent; + createEvent(eventInterface:"PopStateEvent"): PopStateEvent; + createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; + createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; + createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; + createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; + createEvent(eventInterface:"StorageEvent"): StorageEvent; + createEvent(eventInterface:"TextEvent"): TextEvent; + createEvent(eventInterface:"TouchEvent"): TouchEvent; + createEvent(eventInterface:"TrackEvent"): TrackEvent; + createEvent(eventInterface:"TransitionEvent"): TransitionEvent; + createEvent(eventInterface:"UIEvent"): UIEvent; + createEvent(eventInterface:"UIEvents"): UIEvent; + createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; + createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface:"WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; +} + +interface ElementTraversal { + readonly childElementCount: number; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly nextElementSibling: Element; + readonly previousElementSibling: Element; +} + +interface GetSVGDocument { + getSVGDocument(): Document; +} + +interface GlobalEventHandlers { + onpointercancel: (this: this, ev: PointerEvent) => any; + onpointerdown: (this: this, ev: PointerEvent) => any; + onpointerenter: (this: this, ev: PointerEvent) => any; + onpointerleave: (this: this, ev: PointerEvent) => any; + onpointermove: (this: this, ev: PointerEvent) => any; + onpointerout: (this: this, ev: PointerEvent) => any; + onpointerover: (this: this, ev: PointerEvent) => any; + onpointerup: (this: this, ev: PointerEvent) => any; + onwheel: (this: this, ev: WheelEvent) => any; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface HTMLTableAlignment { + /** + * Sets or retrieves a value that you can use to implement your own ch functionality for the object. + */ + ch: string; + /** + * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. + */ + chOff: string; + /** + * Sets or retrieves how text and other content are vertically aligned within the object that contains them. + */ + vAlign: string; +} + +interface IDBEnvironment { + readonly indexedDB: IDBFactory; +} + +interface LinkStyle { + readonly sheet: StyleSheet; +} + +interface MSBaseReader { + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + onloadend: (this: this, ev: ProgressEvent) => any; + onloadstart: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + readonly readyState: number; + readonly result: any; + abort(): void; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface MSFileSaver { + msSaveBlob(blob: any, defaultName?: string): boolean; + msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; +} + +interface MSNavigatorDoNotTrack { + confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; + confirmWebWideTrackingException(args: ExceptionInformation): boolean; + removeSiteSpecificTrackingException(args: ExceptionInformation): void; + removeWebWideTrackingException(args: ExceptionInformation): void; + storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; + storeWebWideTrackingException(args: StoreExceptionsInformation): void; +} + +interface NavigatorContentUtils { +} + +interface NavigatorGeolocation { + readonly geolocation: Geolocation; +} + +interface NavigatorID { + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; +} + +interface NavigatorOnLine { + readonly onLine: boolean; +} + +interface NavigatorStorageUtils { +} + +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + +interface NodeSelector { + 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; + querySelectorAll(selectors: "abbr"): NodeListOf; + querySelectorAll(selectors: "acronym"): NodeListOf; + querySelectorAll(selectors: "address"): NodeListOf; + querySelectorAll(selectors: "applet"): NodeListOf; + querySelectorAll(selectors: "area"): NodeListOf; + querySelectorAll(selectors: "article"): NodeListOf; + querySelectorAll(selectors: "aside"): NodeListOf; + querySelectorAll(selectors: "audio"): NodeListOf; + querySelectorAll(selectors: "b"): NodeListOf; + querySelectorAll(selectors: "base"): NodeListOf; + querySelectorAll(selectors: "basefont"): NodeListOf; + querySelectorAll(selectors: "bdo"): NodeListOf; + querySelectorAll(selectors: "big"): NodeListOf; + querySelectorAll(selectors: "blockquote"): NodeListOf; + querySelectorAll(selectors: "body"): NodeListOf; + querySelectorAll(selectors: "br"): NodeListOf; + querySelectorAll(selectors: "button"): NodeListOf; + querySelectorAll(selectors: "canvas"): NodeListOf; + querySelectorAll(selectors: "caption"): NodeListOf; + querySelectorAll(selectors: "center"): NodeListOf; + querySelectorAll(selectors: "circle"): NodeListOf; + querySelectorAll(selectors: "cite"): NodeListOf; + querySelectorAll(selectors: "clippath"): NodeListOf; + querySelectorAll(selectors: "code"): NodeListOf; + querySelectorAll(selectors: "col"): NodeListOf; + querySelectorAll(selectors: "colgroup"): NodeListOf; + querySelectorAll(selectors: "datalist"): NodeListOf; + querySelectorAll(selectors: "dd"): NodeListOf; + querySelectorAll(selectors: "defs"): NodeListOf; + querySelectorAll(selectors: "del"): NodeListOf; + querySelectorAll(selectors: "desc"): NodeListOf; + querySelectorAll(selectors: "dfn"): NodeListOf; + querySelectorAll(selectors: "dir"): NodeListOf; + querySelectorAll(selectors: "div"): NodeListOf; + querySelectorAll(selectors: "dl"): NodeListOf; + querySelectorAll(selectors: "dt"): NodeListOf; + querySelectorAll(selectors: "ellipse"): NodeListOf; + querySelectorAll(selectors: "em"): NodeListOf; + querySelectorAll(selectors: "embed"): NodeListOf; + querySelectorAll(selectors: "feblend"): NodeListOf; + querySelectorAll(selectors: "fecolormatrix"): NodeListOf; + querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf; + querySelectorAll(selectors: "fecomposite"): NodeListOf; + querySelectorAll(selectors: "feconvolvematrix"): NodeListOf; + querySelectorAll(selectors: "fediffuselighting"): NodeListOf; + querySelectorAll(selectors: "fedisplacementmap"): NodeListOf; + querySelectorAll(selectors: "fedistantlight"): NodeListOf; + querySelectorAll(selectors: "feflood"): NodeListOf; + querySelectorAll(selectors: "fefunca"): NodeListOf; + querySelectorAll(selectors: "fefuncb"): NodeListOf; + querySelectorAll(selectors: "fefuncg"): NodeListOf; + querySelectorAll(selectors: "fefuncr"): NodeListOf; + querySelectorAll(selectors: "fegaussianblur"): NodeListOf; + querySelectorAll(selectors: "feimage"): NodeListOf; + querySelectorAll(selectors: "femerge"): NodeListOf; + querySelectorAll(selectors: "femergenode"): NodeListOf; + querySelectorAll(selectors: "femorphology"): NodeListOf; + querySelectorAll(selectors: "feoffset"): NodeListOf; + querySelectorAll(selectors: "fepointlight"): NodeListOf; + querySelectorAll(selectors: "fespecularlighting"): NodeListOf; + querySelectorAll(selectors: "fespotlight"): NodeListOf; + querySelectorAll(selectors: "fetile"): NodeListOf; + querySelectorAll(selectors: "feturbulence"): NodeListOf; + querySelectorAll(selectors: "fieldset"): NodeListOf; + querySelectorAll(selectors: "figcaption"): NodeListOf; + querySelectorAll(selectors: "figure"): NodeListOf; + querySelectorAll(selectors: "filter"): NodeListOf; + querySelectorAll(selectors: "font"): NodeListOf; + querySelectorAll(selectors: "footer"): NodeListOf; + querySelectorAll(selectors: "foreignobject"): NodeListOf; + querySelectorAll(selectors: "form"): NodeListOf; + querySelectorAll(selectors: "frame"): NodeListOf; + querySelectorAll(selectors: "frameset"): NodeListOf; + querySelectorAll(selectors: "g"): NodeListOf; + querySelectorAll(selectors: "h1"): NodeListOf; + querySelectorAll(selectors: "h2"): NodeListOf; + querySelectorAll(selectors: "h3"): NodeListOf; + querySelectorAll(selectors: "h4"): NodeListOf; + querySelectorAll(selectors: "h5"): NodeListOf; + querySelectorAll(selectors: "h6"): NodeListOf; + querySelectorAll(selectors: "head"): NodeListOf; + querySelectorAll(selectors: "header"): NodeListOf; + querySelectorAll(selectors: "hgroup"): NodeListOf; + querySelectorAll(selectors: "hr"): NodeListOf; + querySelectorAll(selectors: "html"): NodeListOf; + querySelectorAll(selectors: "i"): NodeListOf; + querySelectorAll(selectors: "iframe"): NodeListOf; + querySelectorAll(selectors: "image"): NodeListOf; + querySelectorAll(selectors: "img"): NodeListOf; + querySelectorAll(selectors: "input"): NodeListOf; + querySelectorAll(selectors: "ins"): NodeListOf; + querySelectorAll(selectors: "isindex"): NodeListOf; + querySelectorAll(selectors: "kbd"): NodeListOf; + querySelectorAll(selectors: "keygen"): NodeListOf; + querySelectorAll(selectors: "label"): NodeListOf; + querySelectorAll(selectors: "legend"): NodeListOf; + querySelectorAll(selectors: "li"): NodeListOf; + querySelectorAll(selectors: "line"): NodeListOf; + querySelectorAll(selectors: "lineargradient"): NodeListOf; + querySelectorAll(selectors: "link"): NodeListOf; + querySelectorAll(selectors: "listing"): NodeListOf; + querySelectorAll(selectors: "map"): NodeListOf; + querySelectorAll(selectors: "mark"): NodeListOf; + querySelectorAll(selectors: "marker"): NodeListOf; + querySelectorAll(selectors: "marquee"): NodeListOf; + querySelectorAll(selectors: "mask"): NodeListOf; + querySelectorAll(selectors: "menu"): NodeListOf; + querySelectorAll(selectors: "meta"): NodeListOf; + querySelectorAll(selectors: "metadata"): NodeListOf; + querySelectorAll(selectors: "meter"): NodeListOf; + querySelectorAll(selectors: "nav"): NodeListOf; + querySelectorAll(selectors: "nextid"): NodeListOf; + querySelectorAll(selectors: "nobr"): NodeListOf; + querySelectorAll(selectors: "noframes"): NodeListOf; + querySelectorAll(selectors: "noscript"): NodeListOf; + querySelectorAll(selectors: "object"): NodeListOf; + querySelectorAll(selectors: "ol"): NodeListOf; + querySelectorAll(selectors: "optgroup"): NodeListOf; + querySelectorAll(selectors: "option"): NodeListOf; + querySelectorAll(selectors: "p"): NodeListOf; + querySelectorAll(selectors: "param"): NodeListOf; + querySelectorAll(selectors: "path"): NodeListOf; + querySelectorAll(selectors: "pattern"): NodeListOf; + querySelectorAll(selectors: "picture"): NodeListOf; + querySelectorAll(selectors: "plaintext"): NodeListOf; + querySelectorAll(selectors: "polygon"): NodeListOf; + querySelectorAll(selectors: "polyline"): NodeListOf; + querySelectorAll(selectors: "pre"): NodeListOf; + querySelectorAll(selectors: "progress"): NodeListOf; + querySelectorAll(selectors: "q"): NodeListOf; + querySelectorAll(selectors: "radialgradient"): NodeListOf; + querySelectorAll(selectors: "rect"): NodeListOf; + querySelectorAll(selectors: "rt"): NodeListOf; + querySelectorAll(selectors: "ruby"): NodeListOf; + querySelectorAll(selectors: "s"): NodeListOf; + querySelectorAll(selectors: "samp"): NodeListOf; + querySelectorAll(selectors: "script"): NodeListOf; + querySelectorAll(selectors: "section"): NodeListOf; + querySelectorAll(selectors: "select"): NodeListOf; + querySelectorAll(selectors: "small"): NodeListOf; + querySelectorAll(selectors: "source"): NodeListOf; + querySelectorAll(selectors: "span"): NodeListOf; + querySelectorAll(selectors: "stop"): NodeListOf; + querySelectorAll(selectors: "strike"): NodeListOf; + querySelectorAll(selectors: "strong"): NodeListOf; + querySelectorAll(selectors: "style"): NodeListOf; + querySelectorAll(selectors: "sub"): NodeListOf; + querySelectorAll(selectors: "sup"): NodeListOf; + querySelectorAll(selectors: "svg"): NodeListOf; + querySelectorAll(selectors: "switch"): NodeListOf; + querySelectorAll(selectors: "symbol"): NodeListOf; + querySelectorAll(selectors: "table"): NodeListOf; + querySelectorAll(selectors: "tbody"): NodeListOf; + querySelectorAll(selectors: "td"): NodeListOf; + querySelectorAll(selectors: "template"): NodeListOf; + querySelectorAll(selectors: "text"): NodeListOf; + querySelectorAll(selectors: "textpath"): NodeListOf; + querySelectorAll(selectors: "textarea"): NodeListOf; + querySelectorAll(selectors: "tfoot"): NodeListOf; + querySelectorAll(selectors: "th"): NodeListOf; + querySelectorAll(selectors: "thead"): NodeListOf; + querySelectorAll(selectors: "title"): NodeListOf; + querySelectorAll(selectors: "tr"): NodeListOf; + querySelectorAll(selectors: "track"): NodeListOf; + querySelectorAll(selectors: "tspan"): NodeListOf; + querySelectorAll(selectors: "tt"): NodeListOf; + querySelectorAll(selectors: "u"): NodeListOf; + querySelectorAll(selectors: "ul"): NodeListOf; + querySelectorAll(selectors: "use"): NodeListOf; + querySelectorAll(selectors: "var"): NodeListOf; + querySelectorAll(selectors: "video"): NodeListOf; + querySelectorAll(selectors: "view"): NodeListOf; + querySelectorAll(selectors: "wbr"): NodeListOf; + querySelectorAll(selectors: "x-ms-webview"): NodeListOf; + querySelectorAll(selectors: "xmp"): NodeListOf; + querySelectorAll(selectors: string): NodeListOf; +} + +interface RandomSource { + getRandomValues(array: ArrayBufferView): ArrayBufferView; +} + +interface SVGAnimatedPathData { + readonly pathSegList: SVGPathSegList; +} + +interface SVGAnimatedPoints { + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; +} + +interface SVGExternalResourcesRequired { + readonly externalResourcesRequired: SVGAnimatedBoolean; +} + +interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; +} + +interface SVGFitToViewBox { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; +} + +interface SVGLangSpace { + xmllang: string; + xmlspace: string; +} + +interface SVGLocatable { + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; + getBBox(): SVGRect; + getCTM(): SVGMatrix; + getScreenCTM(): SVGMatrix; + getTransformToElement(element: SVGElement): SVGMatrix; +} + +interface SVGStylable { + className: any; + readonly style: CSSStyleDeclaration; +} + +interface SVGTests { + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; + hasExtension(extension: string): boolean; +} + +interface SVGTransformable extends SVGLocatable { + readonly transform: SVGAnimatedTransformList; +} + +interface SVGURIReference { + readonly href: SVGAnimatedString; +} + +interface WindowBase64 { + atob(encodedString: string): string; + btoa(rawString: string): string; +} + +interface WindowConsole { + readonly console: Console; +} + +interface WindowLocalStorage { + readonly localStorage: Storage; +} + +interface WindowSessionStorage { + readonly sessionStorage: Storage; +} + +interface WindowTimers extends Object, WindowTimersExtension { + clearInterval(handle: number): void; + clearTimeout(handle: number): void; + setInterval(handler: (...args: any[]) => void, timeout: number): number; + setInterval(handler: any, timeout?: any, ...args: any[]): number; + setTimeout(handler: (...args: any[]) => void, timeout: number): number; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; +} + +interface WindowTimersExtension { + clearImmediate(handle: number): void; + setImmediate(handler: (...args: any[]) => void): number; + setImmediate(handler: any, ...args: any[]): number; +} + +interface XMLHttpRequestEventTarget { + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + onloadend: (this: this, ev: ProgressEvent) => any; + onloadstart: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + ontimeout: (this: this, ev: ProgressEvent) => any; + 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface StorageEventInit extends EventInit { + key?: string; + oldValue?: string; + newValue?: string; + url: string; + storageArea?: Storage; +} + +interface Canvas2DContextAttributes { + alpha?: boolean; + willReadFrequently?: boolean; + storage?: boolean; + [attribute: string]: boolean | string | undefined; +} + +interface NodeListOf extends NodeList { + length: number; + item(index: number): TNode; + [index: number]: TNode; +} + +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + +interface EventListenerObject { + handleEvent(evt: Event): void; +} + +interface MessageEventInit extends EventInit { + data?: any; + origin?: string; + lastEventId?: string; + channel?: string; + source?: any; + ports?: MessagePort[]; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + 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; +} + +interface IDBArrayKey extends Array { +} + +interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: AlgorithmIdentifier; +} + +interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: AlgorithmIdentifier; +} + +interface RsaHashedImportParams { + hash: AlgorithmIdentifier; +} + +interface RsaPssParams { + saltLength: number; +} + +interface RsaOaepParams extends Algorithm { + label?: BufferSource; +} + +interface EcdsaParams extends Algorithm { + hash: AlgorithmIdentifier; +} + +interface EcKeyGenParams extends Algorithm { + namedCurve: string; +} + +interface EcKeyAlgorithm extends KeyAlgorithm { + typedCurve: string; +} + +interface EcKeyImportParams { + namedCurve: string; +} + +interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; +} + +interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +interface AesKeyGenParams extends Algorithm { + length: number; +} + +interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +interface AesCbcParams extends Algorithm { + iv: BufferSource; +} + +interface AesCmacParams extends Algorithm { + length: number; +} + +interface AesGcmParams extends Algorithm { + iv: BufferSource; + additionalData?: BufferSource; + tagLength?: number; +} + +interface AesCfbParams extends Algorithm { + iv: BufferSource; +} + +interface HmacImportParams extends Algorithm { + hash?: AlgorithmIdentifier; + length?: number; +} + +interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: AlgorithmIdentifier; + length: number; +} + +interface HmacKeyGenParams extends Algorithm { + hash: AlgorithmIdentifier; + length?: number; +} + +interface DhKeyGenParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyAlgorithm extends KeyAlgorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface DhImportKeyParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface ConcatParams extends Algorithm { + hash?: AlgorithmIdentifier; + algorithmId: Uint8Array; + partyUInfo: Uint8Array; + partyVInfo: Uint8Array; + publicInfo?: Uint8Array; + privateInfo?: Uint8Array; +} + +interface HkdfCtrParams extends Algorithm { + hash: AlgorithmIdentifier; + label: BufferSource; + context: BufferSource; +} + +interface Pbkdf2Params extends Algorithm { + salt: BufferSource; + iterations: number; + hash: AlgorithmIdentifier; +} + +interface RsaOtherPrimesInfo { + r: string; + d: string; + t: string; +} + +interface JsonWebKey { + kty: string; + use?: string; + key_ops?: string[]; + alg?: string; + kid?: string; + x5u?: string; + x5c?: string; + x5t?: string; + ext?: boolean; + crv?: string; + x?: string; + y?: string; + d?: string; + n?: string; + e?: string; + p?: string; + q?: string; + dp?: string; + dq?: string; + qi?: string; + oth?: RsaOtherPrimesInfo[]; + k?: string; +} + +interface ParentNode { + readonly children: HTMLCollection; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly childElementCount: number; +} + +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + +interface ErrorEventHandler { + (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; +} +interface PositionCallback { + (position: Position): void; +} +interface PositionErrorCallback { + (error: PositionError): void; +} +interface MediaQueryListListener { + (mql: MediaQueryList): void; +} +interface MSLaunchUriCallback { + (): void; +} +interface FrameRequestCallback { + (time: number): void; +} +interface MSUnsafeFunctionCallback { + (): any; +} +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} +interface MutationCallback { + (mutations: MutationRecord[], observer: MutationObserver): void; +} +interface DecodeSuccessCallback { + (decodedData: AudioBuffer): void; +} +interface DecodeErrorCallback { + (error: DOMException): void; +} +interface FunctionStringCallback { + (data: string): void; +} +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: string): void; +} +declare var Audio: {new(src?: string): HTMLAudioElement; }; +declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; +declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; +declare var applicationCache: ApplicationCache; +declare var clientInformation: Navigator; +declare var closed: boolean; +declare var crypto: Crypto; +declare var defaultStatus: string; +declare var devicePixelRatio: number; +declare var doNotTrack: string; +declare var document: Document; +declare var event: Event | undefined; +declare var external: External; +declare var frameElement: Element; +declare var frames: Window; +declare var history: History; +declare var innerHeight: number; +declare var innerWidth: number; +declare var length: number; +declare var location: Location; +declare var locationbar: BarProp; +declare var menubar: BarProp; +declare var msCredentials: MSCredentials; +declare const name: never; +declare var navigator: Navigator; +declare var offscreenBuffering: string | boolean; +declare var onabort: (this: Window, ev: UIEvent) => any; +declare var onafterprint: (this: Window, ev: Event) => any; +declare var onbeforeprint: (this: Window, ev: Event) => any; +declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; +declare var onblur: (this: Window, ev: FocusEvent) => any; +declare var oncanplay: (this: Window, ev: Event) => any; +declare var oncanplaythrough: (this: Window, ev: Event) => any; +declare var onchange: (this: Window, ev: Event) => any; +declare var onclick: (this: Window, ev: MouseEvent) => any; +declare var oncompassneedscalibration: (this: Window, ev: Event) => any; +declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; +declare var ondblclick: (this: Window, ev: MouseEvent) => any; +declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; +declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; +declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; +declare var ondrag: (this: Window, ev: DragEvent) => any; +declare var ondragend: (this: Window, ev: DragEvent) => any; +declare var ondragenter: (this: Window, ev: DragEvent) => any; +declare var ondragleave: (this: Window, ev: DragEvent) => any; +declare var ondragover: (this: Window, ev: DragEvent) => any; +declare var ondragstart: (this: Window, ev: DragEvent) => any; +declare var ondrop: (this: Window, ev: DragEvent) => any; +declare var ondurationchange: (this: Window, ev: Event) => any; +declare var onemptied: (this: Window, ev: Event) => any; +declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; +declare var onerror: ErrorEventHandler; +declare var onfocus: (this: Window, ev: FocusEvent) => any; +declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; +declare var oninput: (this: Window, ev: Event) => any; +declare var oninvalid: (this: Window, ev: Event) => any; +declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; +declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; +declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; +declare var onload: (this: Window, ev: Event) => any; +declare var onloadeddata: (this: Window, ev: Event) => any; +declare var onloadedmetadata: (this: Window, ev: Event) => any; +declare var onloadstart: (this: Window, ev: Event) => any; +declare var onmessage: (this: Window, ev: MessageEvent) => any; +declare var onmousedown: (this: Window, ev: MouseEvent) => any; +declare var onmouseenter: (this: Window, ev: MouseEvent) => any; +declare var onmouseleave: (this: Window, ev: MouseEvent) => any; +declare var onmousemove: (this: Window, ev: MouseEvent) => any; +declare var onmouseout: (this: Window, ev: MouseEvent) => any; +declare var onmouseover: (this: Window, ev: MouseEvent) => any; +declare var onmouseup: (this: Window, ev: MouseEvent) => any; +declare var onmousewheel: (this: Window, ev: WheelEvent) => any; +declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; +declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; +declare var onoffline: (this: Window, ev: Event) => any; +declare var ononline: (this: Window, ev: Event) => any; +declare var onorientationchange: (this: Window, ev: Event) => any; +declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; +declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; +declare var onpause: (this: Window, ev: Event) => any; +declare var onplay: (this: Window, ev: Event) => any; +declare var onplaying: (this: Window, ev: Event) => any; +declare var onpopstate: (this: Window, ev: PopStateEvent) => any; +declare var onprogress: (this: Window, ev: ProgressEvent) => any; +declare var onratechange: (this: Window, ev: Event) => any; +declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; +declare var onreset: (this: Window, ev: Event) => any; +declare var onresize: (this: Window, ev: UIEvent) => any; +declare var onscroll: (this: Window, ev: UIEvent) => any; +declare var onseeked: (this: Window, ev: Event) => any; +declare var onseeking: (this: Window, ev: Event) => any; +declare var onselect: (this: Window, ev: UIEvent) => any; +declare var onstalled: (this: Window, ev: Event) => any; +declare var onstorage: (this: Window, ev: StorageEvent) => any; +declare var onsubmit: (this: Window, ev: Event) => any; +declare var onsuspend: (this: Window, ev: Event) => any; +declare var ontimeupdate: (this: Window, ev: Event) => any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +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: any; +declare var orientation: string | number; +declare var outerHeight: number; +declare var outerWidth: number; +declare var pageXOffset: number; +declare var pageYOffset: number; +declare var parent: Window; +declare var performance: Performance; +declare var personalbar: BarProp; +declare var screen: Screen; +declare var screenLeft: number; +declare var screenTop: number; +declare var screenX: number; +declare var screenY: number; +declare var scrollX: number; +declare var scrollY: number; +declare var scrollbars: BarProp; +declare var self: Window; +declare var status: string; +declare var statusbar: BarProp; +declare var styleMedia: StyleMedia; +declare var toolbar: BarProp; +declare var top: Window; +declare var window: Window; +declare function alert(message?: any): void; +declare function blur(): void; +declare function cancelAnimationFrame(handle: number): void; +declare function captureEvents(): void; +declare function close(): void; +declare function confirm(message?: string): boolean; +declare function focus(): void; +declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; +declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; +declare function getSelection(): Selection; +declare function matchMedia(mediaQuery: string): MediaQueryList; +declare function moveBy(x?: number, y?: number): void; +declare function moveTo(x?: number, y?: number): void; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; +declare function print(): void; +declare function prompt(message?: string, _default?: string): string | null; +declare function releaseEvents(): void; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; +declare function resizeBy(x?: number, y?: number): void; +declare function resizeTo(x?: number, y?: number): void; +declare function scroll(x?: number, y?: number): void; +declare function scrollBy(x?: number, y?: number): void; +declare function scrollTo(x?: number, y?: number): void; +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; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function clearInterval(handle: number): void; +declare function clearTimeout(handle: number): void; +declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function clearImmediate(handle: number): void; +declare function setImmediate(handler: (...args: any[]) => void): number; +declare function setImmediate(handler: any, ...args: any[]): number; +declare var sessionStorage: Storage; +declare var localStorage: Storage; +declare var console: Console; +declare var onpointercancel: (this: Window, ev: PointerEvent) => any; +declare var onpointerdown: (this: Window, ev: PointerEvent) => any; +declare var onpointerenter: (this: Window, ev: PointerEvent) => any; +declare var onpointerleave: (this: Window, ev: PointerEvent) => any; +declare var onpointermove: (this: Window, ev: PointerEvent) => any; +declare var onpointerout: (this: Window, ev: PointerEvent) => any; +declare var onpointerover: (this: Window, ev: PointerEvent) => any; +declare var onpointerup: (this: Window, ev: PointerEvent) => any; +declare var onwheel: (this: Window, ev: WheelEvent) => any; +declare var indexedDB: IDBFactory; +declare function atob(encodedString: string): string; +declare function btoa(rawString: string): string; +declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +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; type ScrollRestoration = "auto" | "manual"; - -///////////////////////////// -/// WorkerGlobalScope APIs -///////////////////////////// -// These are only available in a Web Worker -declare function importScripts(...urls: string[]): void; + +///////////////////////////// +/// WorkerGlobalScope APIs +///////////////////////////// +// These are only available in a Web Worker +declare function importScripts(...urls: string[]): void; - - -///////////////////////////// -/// Windows Script Host APIS -///////////////////////////// - - -interface ActiveXObject { - new (s: string): any; -} -declare var ActiveXObject: ActiveXObject; - -interface ITextWriter { - Write(s: string): void; - WriteLine(s: string): void; - Close(): void; -} - -interface TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; - - /** - * The current line number in an input stream. - */ - Line: number; - - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; -} - -interface TextStreamWriter extends TextStreamBase { - /** - * Sends a string to an output stream. - */ - Write(s: string): void; - - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; - - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; -} - -interface TextStreamReader extends TextStreamBase { - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; - - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; - - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; - - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; - - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; - - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; - - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; -} - -declare var WScript: { - /** - * Outputs text to either a message box (under WScript.exe) or the command console window followed by - * a newline (under CScript.exe). - */ - Echo(s: any): void; - - /** - * Exposes the write-only error output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdErr: TextStreamWriter; - - /** - * Exposes the write-only output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdOut: TextStreamWriter; - Arguments: { length: number; Item(n: number): string; }; - - /** - * The full path of the currently running script. - */ - ScriptFullName: string; - - /** - * Forces the script to stop immediately, with an optional exit code. - */ - Quit(exitCode?: number): number; - - /** - * The Windows Script Host build version number. - */ - BuildVersion: number; - - /** - * Fully qualified path of the host executable. - */ - FullName: string; - - /** - * Gets/sets the script mode - interactive(true) or batch(false). - */ - Interactive: boolean; - - /** - * The name of the host executable (WScript.exe or CScript.exe). - */ - Name: string; - - /** - * Path of the directory containing the host executable. - */ - Path: string; - - /** - * The filename of the currently running script. - */ - ScriptName: string; - - /** - * Exposes the read-only input stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdIn: TextStreamReader; - - /** - * Windows Script Host version - */ - Version: string; - - /** - * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. - */ - ConnectObject(objEventSource: any, strPrefix: string): void; - - /** - * Creates a COM object. - * @param strProgiID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - CreateObject(strProgID: string, strPrefix?: string): any; - - /** - * Disconnects a COM object from its event sources. - */ - DisconnectObject(obj: any): void; - - /** - * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. - * @param strPathname Fully qualified path to the file containing the object persisted to disk. - * For objects in memory, pass a zero-length string. - * @param strProgID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; - - /** - * Suspends script execution for a specified length of time, then continues execution. - * @param intTime Interval (in milliseconds) to suspend script execution. - */ - Sleep(intTime: number): void; -}; - -/** - * Allows enumerating over a COM collection, which may not have indexed item access. - */ -interface Enumerator { - /** - * Returns true if the current item is the last one in the collection, or the collection is empty, - * or the current item is undefined. - */ - atEnd(): boolean; - - /** - * Returns the current item in the collection - */ - item(): T; - - /** - * Resets the current item in the collection to the first item. If there are no items in the collection, - * the current item is set to undefined. - */ - moveFirst(): void; - - /** - * Moves the current item to the next item in the collection. If the enumerator is at the end of - * the collection or the collection is empty, the current item is set to undefined. - */ - moveNext(): void; -} - -interface EnumeratorConstructor { - new (collection: any): Enumerator; - new (collection: any): Enumerator; -} - -declare var Enumerator: EnumeratorConstructor; - -/** - * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. - */ -interface VBArray { - /** - * Returns the number of dimensions (1-based). - */ - dimensions(): number; - - /** - * Takes an index for each dimension in the array, and returns the item at the corresponding location. - */ - getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; - - /** - * Returns the smallest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - lbound(dimension?: number): number; - - /** - * Returns the largest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - ubound(dimension?: number): number; - - /** - * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, - * each successive dimension is appended to the end of the array. - * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] - */ - toArray(): T[]; -} - -interface VBArrayConstructor { - new (safeArray: any): VBArray; - new (safeArray: any): VBArray; -} - -declare var VBArray: VBArrayConstructor; - -/** - * Automation date (VT_DATE) - */ -interface VarDate { } - -interface DateConstructor { - new (vd: VarDate): Date; -} - -interface Date { - getVarDate: () => VarDate; -} + + +///////////////////////////// +/// Windows Script Host APIS +///////////////////////////// + + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; + +interface ITextWriter { + Write(s: string): void; + WriteLine(s: string): void; + Close(): void; +} + +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + + /** + * The current line number in an input stream. + */ + Line: number; + + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; +} + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by + * a newline (under CScript.exe). + */ + Echo(s: any): void; + + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + + /** + * Fully qualified path of the host executable. + */ + FullName: string; + + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + + /** + * Path of the directory containing the host executable. + */ + Path: string; + + /** + * The filename of the currently running script. + */ + ScriptName: string; + + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + + /** + * Windows Script Host version + */ + Version: string; + + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. + * For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; + +/** + * Allows enumerating over a COM collection, which may not have indexed item access. + */ +interface Enumerator { + /** + * Returns true if the current item is the last one in the collection, or the collection is empty, + * or the current item is undefined. + */ + atEnd(): boolean; + + /** + * Returns the current item in the collection + */ + item(): T; + + /** + * Resets the current item in the collection to the first item. If there are no items in the collection, + * the current item is set to undefined. + */ + moveFirst(): void; + + /** + * Moves the current item to the next item in the collection. If the enumerator is at the end of + * the collection or the collection is empty, the current item is set to undefined. + */ + moveNext(): void; +} + +interface EnumeratorConstructor { + new (collection: any): Enumerator; + new (collection: any): Enumerator; +} + +declare var Enumerator: EnumeratorConstructor; + +/** + * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. + */ +interface VBArray { + /** + * Returns the number of dimensions (1-based). + */ + dimensions(): number; + + /** + * Takes an index for each dimension in the array, and returns the item at the corresponding location. + */ + getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; + + /** + * Returns the smallest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + lbound(dimension?: number): number; + + /** + * Returns the largest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + ubound(dimension?: number): number; + + /** + * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, + * each successive dimension is appended to the end of the array. + * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] + */ + toArray(): T[]; +} + +interface VBArrayConstructor { + new (safeArray: any): VBArray; + new (safeArray: any): VBArray; +} + +declare var VBArray: VBArrayConstructor; + +/** + * Automation date (VT_DATE) + */ +interface VarDate { } + +interface DateConstructor { + new (vd: VarDate): Date; +} + +interface Date { + getVarDate: () => VarDate; +} diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 217c7bf64d2..a4e8ca398d9 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -1,14650 +1,14650 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// - -///////////////////////////// -/// IE DOM APIs -///////////////////////////// - -interface Algorithm { - name: string; -} - -interface AriaRequestEventInit extends EventInit { - attributeName?: string; - attributeValue?: string; -} - -interface CommandEventInit extends EventInit { - commandName?: string; - detail?: string; -} - -interface CompositionEventInit extends UIEventInit { - data?: string; -} - -interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { - arrayOfDomainStrings?: string[]; -} - -interface ConstrainBooleanParameters { - exact?: boolean; - ideal?: boolean; -} - -interface ConstrainDOMStringParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface ConstrainDoubleRange extends DoubleRange { - exact?: number; - ideal?: number; -} - -interface ConstrainLongRange extends LongRange { - exact?: number; - ideal?: number; -} - -interface ConstrainVideoFacingModeParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface CustomEventInit extends EventInit { - detail?: any; -} - -interface DeviceAccelerationDict { - x?: number; - y?: number; - z?: number; -} - -interface DeviceLightEventInit extends EventInit { - value?: number; -} - -interface DeviceRotationRateDict { - alpha?: number; - beta?: number; - gamma?: number; -} - -interface DoubleRange { - max?: number; - min?: number; -} - -interface EventInit { - bubbles?: boolean; - cancelable?: boolean; -} - -interface EventModifierInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - modifierAltGraph?: boolean; - modifierCapsLock?: boolean; - modifierFn?: boolean; - modifierFnLock?: boolean; - modifierHyper?: boolean; - modifierNumLock?: boolean; - modifierOS?: boolean; - modifierScrollLock?: boolean; - modifierSuper?: boolean; - modifierSymbol?: boolean; - modifierSymbolLock?: boolean; -} - -interface ExceptionInformation { - domain?: string; -} - -interface FocusEventInit extends UIEventInit { - relatedTarget?: EventTarget; -} - -interface HashChangeEventInit extends EventInit { - newURL?: string; - oldURL?: string; -} - -interface IDBIndexParameters { - multiEntry?: boolean; - unique?: boolean; -} - -interface IDBObjectStoreParameters { - autoIncrement?: boolean; - keyPath?: IDBKeyPath; -} - -interface KeyAlgorithm { - name?: string; -} - -interface KeyboardEventInit extends EventModifierInit { - code?: string; - key?: string; - location?: number; - repeat?: boolean; -} - -interface LongRange { - max?: number; - min?: number; -} - -interface MSAccountInfo { - rpDisplayName?: string; - userDisplayName?: string; - accountName?: string; - userId?: string; - accountImageUri?: string; -} - -interface MSAudioLocalClientEvent extends MSLocalClientEventBase { - networkSendQualityEventRatio?: number; - networkDelayEventRatio?: number; - cpuInsufficientEventRatio?: number; - deviceHalfDuplexAECEventRatio?: number; - deviceRenderNotFunctioningEventRatio?: number; - deviceCaptureNotFunctioningEventRatio?: number; - deviceGlitchesEventRatio?: number; - deviceLowSNREventRatio?: number; - deviceLowSpeechLevelEventRatio?: number; - deviceClippingEventRatio?: number; - deviceEchoEventRatio?: number; - deviceNearEndToEchoRatioEventRatio?: number; - deviceRenderZeroVolumeEventRatio?: number; - deviceRenderMuteEventRatio?: number; - deviceMultipleEndpointsEventCount?: number; - deviceHowlingEventCount?: number; -} - -interface MSAudioRecvPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioRecvSignal; - packetReorderRatio?: number; - packetReorderDepthAvg?: number; - packetReorderDepthMax?: number; - burstLossLength1?: number; - burstLossLength2?: number; - burstLossLength3?: number; - burstLossLength4?: number; - burstLossLength5?: number; - burstLossLength6?: number; - burstLossLength7?: number; - burstLossLength8OrHigher?: number; - fecRecvDistance1?: number; - fecRecvDistance2?: number; - fecRecvDistance3?: number; - ratioConcealedSamplesAvg?: number; - ratioStretchedSamplesAvg?: number; - ratioCompressedSamplesAvg?: number; -} - -interface MSAudioRecvSignal { - initialSignalLevelRMS?: number; - recvSignalLevelCh1?: number; - recvNoiseLevelCh1?: number; - renderSignalLevel?: number; - renderNoiseLevel?: number; - renderLoopbackSignalLevel?: number; -} - -interface MSAudioSendPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioSendSignal; - audioFECUsed?: boolean; - sendMutePercent?: number; -} - -interface MSAudioSendSignal { - noiseLevel?: number; - sendSignalLevelCh1?: number; - sendNoiseLevelCh1?: number; -} - -interface MSConnectivity { - iceType?: string; - iceWarningFlags?: MSIceWarningFlags; - relayAddress?: MSRelayAddress; -} - -interface MSCredentialFilter { - accept?: MSCredentialSpec[]; -} - -interface MSCredentialParameters { - type?: string; -} - -interface MSCredentialSpec { - type?: string; - id?: string; -} - -interface MSDelay { - roundTrip?: number; - roundTripMax?: number; -} - -interface MSDescription extends RTCStats { - connectivity?: MSConnectivity; - transport?: string; - networkconnectivity?: MSNetworkConnectivityInfo; - localAddr?: MSIPAddressInfo; - remoteAddr?: MSIPAddressInfo; - deviceDevName?: string; - reflexiveLocalIPAddr?: MSIPAddressInfo; -} - -interface MSFIDOCredentialParameters extends MSCredentialParameters { - algorithm?: string | Algorithm; - authenticators?: AAGUID[]; -} - -interface MSIPAddressInfo { - ipAddr?: string; - port?: number; - manufacturerMacAddrMask?: string; -} - -interface MSIceWarningFlags { - turnTcpTimedOut?: boolean; - turnUdpAllocateFailed?: boolean; - turnUdpSendFailed?: boolean; - turnTcpAllocateFailed?: boolean; - turnTcpSendFailed?: boolean; - udpLocalConnectivityFailed?: boolean; - udpNatConnectivityFailed?: boolean; - udpRelayConnectivityFailed?: boolean; - tcpNatConnectivityFailed?: boolean; - tcpRelayConnectivityFailed?: boolean; - connCheckMessageIntegrityFailed?: boolean; - allocationMessageIntegrityFailed?: boolean; - connCheckOtherError?: boolean; - turnAuthUnknownUsernameError?: boolean; - noRelayServersConfigured?: boolean; - multipleRelayServersAttempted?: boolean; - portRangeExhausted?: boolean; - alternateServerReceived?: boolean; - pseudoTLSFailure?: boolean; - turnTurnTcpConnectivityFailed?: boolean; - useCandidateChecksFailed?: boolean; - fipsAllocationFailure?: boolean; -} - -interface MSJitter { - interArrival?: number; - interArrivalMax?: number; - interArrivalSD?: number; -} - -interface MSLocalClientEventBase extends RTCStats { - networkReceiveQualityEventRatio?: number; - networkBandwidthLowEventRatio?: number; -} - -interface MSNetwork extends RTCStats { - jitter?: MSJitter; - delay?: MSDelay; - packetLoss?: MSPacketLoss; - utilization?: MSUtilization; -} - -interface MSNetworkConnectivityInfo { - vpn?: boolean; - linkspeed?: number; - networkConnectionDetails?: string; -} - -interface MSNetworkInterfaceType { - interfaceTypeEthernet?: boolean; - interfaceTypeWireless?: boolean; - interfaceTypePPP?: boolean; - interfaceTypeTunnel?: boolean; - interfaceTypeWWAN?: boolean; -} - -interface MSOutboundNetwork extends MSNetwork { - appliedBandwidthLimit?: number; -} - -interface MSPacketLoss { - lossRate?: number; - lossRateMax?: number; -} - -interface MSPayloadBase extends RTCStats { - payloadDescription?: string; -} - -interface MSRelayAddress { - relayAddress?: string; - port?: number; -} - -interface MSSignatureParameters { - userPrompt?: string; -} - -interface MSTransportDiagnosticsStats extends RTCStats { - baseAddress?: string; - localAddress?: string; - localSite?: string; - networkName?: string; - remoteAddress?: string; - remoteSite?: string; - localMR?: string; - remoteMR?: string; - iceWarningFlags?: MSIceWarningFlags; - portRangeMin?: number; - portRangeMax?: number; - localMRTCPPort?: number; - remoteMRTCPPort?: number; - stunVer?: number; - numConsentReqSent?: number; - numConsentReqReceived?: number; - numConsentRespSent?: number; - numConsentRespReceived?: number; - interfaces?: MSNetworkInterfaceType; - baseInterface?: MSNetworkInterfaceType; - protocol?: string; - localInterface?: MSNetworkInterfaceType; - localAddrType?: string; - remoteAddrType?: string; - iceRole?: string; - rtpRtcpMux?: boolean; - allocationTimeInMs?: number; - msRtcEngineVersion?: string; -} - -interface MSUtilization { - packets?: number; - bandwidthEstimation?: number; - bandwidthEstimationMin?: number; - bandwidthEstimationMax?: number; - bandwidthEstimationStdDev?: number; - bandwidthEstimationAvg?: number; -} - -interface MSVideoPayload extends MSPayloadBase { - resoluton?: string; - videoBitRateAvg?: number; - videoBitRateMax?: number; - videoFrameRateAvg?: number; - videoPacketLossRate?: number; - durationSeconds?: number; -} - -interface MSVideoRecvPayload extends MSVideoPayload { - videoFrameLossRate?: number; - recvCodecType?: string; - recvResolutionWidth?: number; - recvResolutionHeight?: number; - videoResolutions?: MSVideoResolutionDistribution; - recvFrameRateAverage?: number; - recvBitRateMaximum?: number; - recvBitRateAverage?: number; - recvVideoStreamsMax?: number; - recvVideoStreamsMin?: number; - recvVideoStreamsMode?: number; - videoPostFECPLR?: number; - lowBitRateCallPercent?: number; - lowFrameRateCallPercent?: number; - reorderBufferTotalPackets?: number; - recvReorderBufferReorderedPackets?: number; - recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; - recvReorderBufferMaxSuccessfullyOrderedExtent?: number; - recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; - recvReorderBufferPacketsDroppedDueToTimeout?: number; - recvFpsHarmonicAverage?: number; - recvNumResSwitches?: number; -} - -interface MSVideoResolutionDistribution { - cifQuality?: number; - vgaQuality?: number; - h720Quality?: number; - h1080Quality?: number; - h1440Quality?: number; - h2160Quality?: number; -} - -interface MSVideoSendPayload extends MSVideoPayload { - sendFrameRateAverage?: number; - sendBitRateMaximum?: number; - sendBitRateAverage?: number; - sendVideoStreamsMax?: number; - sendResolutionWidth?: number; - sendResolutionHeight?: number; -} - -interface MediaEncryptedEventInit extends EventInit { - initDataType?: string; - initData?: ArrayBuffer; -} - -interface MediaKeyMessageEventInit extends EventInit { - messageType?: string; - message?: ArrayBuffer; -} - -interface MediaKeySystemConfiguration { - initDataTypes?: string[]; - audioCapabilities?: MediaKeySystemMediaCapability[]; - videoCapabilities?: MediaKeySystemMediaCapability[]; - distinctiveIdentifier?: string; - persistentState?: string; -} - -interface MediaKeySystemMediaCapability { - contentType?: string; - robustness?: string; -} - -interface MediaStreamConstraints { - video?: boolean | MediaTrackConstraints; - audio?: boolean | MediaTrackConstraints; -} - -interface MediaStreamErrorEventInit extends EventInit { - error?: MediaStreamError; -} - -interface MediaStreamTrackEventInit extends EventInit { - track?: MediaStreamTrack; -} - -interface MediaTrackCapabilities { - width?: number | LongRange; - height?: number | LongRange; - aspectRatio?: number | DoubleRange; - frameRate?: number | DoubleRange; - facingMode?: string; - volume?: number | DoubleRange; - sampleRate?: number | LongRange; - sampleSize?: number | LongRange; - echoCancellation?: boolean[]; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackConstraintSet { - width?: number | ConstrainLongRange; - height?: number | ConstrainLongRange; - aspectRatio?: number | ConstrainDoubleRange; - frameRate?: number | ConstrainDoubleRange; - facingMode?: string | string[] | ConstrainDOMStringParameters; - volume?: number | ConstrainDoubleRange; - sampleRate?: number | ConstrainLongRange; - sampleSize?: number | ConstrainLongRange; - echoCancelation?: boolean | ConstrainBooleanParameters; - deviceId?: string | string[] | ConstrainDOMStringParameters; - groupId?: string | string[] | ConstrainDOMStringParameters; -} - -interface MediaTrackConstraints extends MediaTrackConstraintSet { - advanced?: MediaTrackConstraintSet[]; -} - -interface MediaTrackSettings { - width?: number; - height?: number; - aspectRatio?: number; - frameRate?: number; - facingMode?: string; - volume?: number; - sampleRate?: number; - sampleSize?: number; - echoCancellation?: boolean; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackSupportedConstraints { - width?: boolean; - height?: boolean; - aspectRatio?: boolean; - frameRate?: boolean; - facingMode?: boolean; - volume?: boolean; - sampleRate?: boolean; - sampleSize?: boolean; - echoCancellation?: boolean; - deviceId?: boolean; - groupId?: boolean; -} - -interface MouseEventInit extends EventModifierInit { - screenX?: number; - screenY?: number; - clientX?: number; - clientY?: number; - button?: number; - buttons?: number; - relatedTarget?: EventTarget; -} - -interface MsZoomToOptions { - contentX?: number; - contentY?: number; - viewportX?: string; - viewportY?: string; - scaleFactor?: number; - animate?: string; -} - -interface MutationObserverInit { - childList?: boolean; - attributes?: boolean; - characterData?: boolean; - subtree?: boolean; - attributeOldValue?: boolean; - characterDataOldValue?: boolean; - attributeFilter?: string[]; -} - -interface ObjectURLOptions { - oneTimeOnly?: boolean; -} - -interface PeriodicWaveConstraints { - disableNormalization?: boolean; -} - -interface PointerEventInit extends MouseEventInit { - pointerId?: number; - width?: number; - height?: number; - pressure?: number; - tiltX?: number; - tiltY?: number; - pointerType?: string; - isPrimary?: boolean; -} - -interface PositionOptions { - enableHighAccuracy?: boolean; - timeout?: number; - maximumAge?: number; -} - -interface RTCDTMFToneChangeEventInit extends EventInit { - tone?: string; -} - -interface RTCDtlsFingerprint { - algorithm?: string; - value?: string; -} - -interface RTCDtlsParameters { - role?: string; - fingerprints?: RTCDtlsFingerprint[]; -} - -interface RTCIceCandidate { - foundation?: string; - priority?: number; - ip?: string; - protocol?: string; - port?: number; - type?: string; - tcpType?: string; - relatedAddress?: string; - relatedPort?: number; -} - -interface RTCIceCandidateAttributes extends RTCStats { - ipAddress?: string; - portNumber?: number; - transport?: string; - candidateType?: string; - priority?: number; - addressSourceUrl?: string; -} - -interface RTCIceCandidateComplete { -} - -interface RTCIceCandidatePair { - local?: RTCIceCandidate; - remote?: RTCIceCandidate; -} - -interface RTCIceCandidatePairStats extends RTCStats { - transportId?: string; - localCandidateId?: string; - remoteCandidateId?: string; - state?: string; - priority?: number; - nominated?: boolean; - writable?: boolean; - readable?: boolean; - bytesSent?: number; - bytesReceived?: number; - roundTripTime?: number; - availableOutgoingBitrate?: number; - availableIncomingBitrate?: number; -} - -interface RTCIceGatherOptions { - gatherPolicy?: string; - iceservers?: RTCIceServer[]; -} - -interface RTCIceParameters { - usernameFragment?: string; - password?: string; -} - -interface RTCIceServer { - urls?: any; - username?: string; - credential?: string; -} - -interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { - packetsReceived?: number; - bytesReceived?: number; - packetsLost?: number; - jitter?: number; - fractionLost?: number; -} - -interface RTCMediaStreamTrackStats extends RTCStats { - trackIdentifier?: string; - remoteSource?: boolean; - ssrcIds?: string[]; - frameWidth?: number; - frameHeight?: number; - framesPerSecond?: number; - framesSent?: number; - framesReceived?: number; - framesDecoded?: number; - framesDropped?: number; - framesCorrupted?: number; - audioLevel?: number; - echoReturnLoss?: number; - echoReturnLossEnhancement?: number; -} - -interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { - packetsSent?: number; - bytesSent?: number; - targetBitrate?: number; - roundTripTime?: number; -} - -interface RTCRTPStreamStats extends RTCStats { - ssrc?: string; - associateStatsId?: string; - isRemote?: boolean; - mediaTrackId?: string; - transportId?: string; - codecId?: string; - firCount?: number; - pliCount?: number; - nackCount?: number; - sliCount?: number; -} - -interface RTCRtcpFeedback { - type?: string; - parameter?: string; -} - -interface RTCRtcpParameters { - ssrc?: number; - cname?: string; - reducedSize?: boolean; - mux?: boolean; -} - -interface RTCRtpCapabilities { - codecs?: RTCRtpCodecCapability[]; - headerExtensions?: RTCRtpHeaderExtension[]; - fecMechanisms?: string[]; -} - -interface RTCRtpCodecCapability { - name?: string; - kind?: string; - clockRate?: number; - preferredPayloadType?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; - options?: any; - maxTemporalLayers?: number; - maxSpatialLayers?: number; - svcMultiStreamSupport?: boolean; -} - -interface RTCRtpCodecParameters { - name?: string; - payloadType?: any; - clockRate?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; -} - -interface RTCRtpContributingSource { - timestamp?: number; - csrc?: number; - audioLevel?: number; -} - -interface RTCRtpEncodingParameters { - ssrc?: number; - codecPayloadType?: number; - fec?: RTCRtpFecParameters; - rtx?: RTCRtpRtxParameters; - priority?: number; - maxBitrate?: number; - minQuality?: number; - framerateBias?: number; - resolutionScale?: number; - framerateScale?: number; - active?: boolean; - encodingId?: string; - dependencyEncodingIds?: string[]; - ssrcRange?: RTCSsrcRange; -} - -interface RTCRtpFecParameters { - ssrc?: number; - mechanism?: string; -} - -interface RTCRtpHeaderExtension { - kind?: string; - uri?: string; - preferredId?: number; - preferredEncrypt?: boolean; -} - -interface RTCRtpHeaderExtensionParameters { - uri?: string; - id?: number; - encrypt?: boolean; -} - -interface RTCRtpParameters { - muxId?: string; - codecs?: RTCRtpCodecParameters[]; - headerExtensions?: RTCRtpHeaderExtensionParameters[]; - encodings?: RTCRtpEncodingParameters[]; - rtcp?: RTCRtcpParameters; -} - -interface RTCRtpRtxParameters { - ssrc?: number; -} - -interface RTCRtpUnhandled { - ssrc?: number; - payloadType?: number; - muxId?: string; -} - -interface RTCSrtpKeyParam { - keyMethod?: string; - keySalt?: string; - lifetime?: string; - mkiValue?: number; - mkiLength?: number; -} - -interface RTCSrtpSdesParameters { - tag?: number; - cryptoSuite?: string; - keyParams?: RTCSrtpKeyParam[]; - sessionParams?: string[]; -} - -interface RTCSsrcRange { - min?: number; - max?: number; -} - -interface RTCStats { - timestamp?: number; - type?: string; - id?: string; - msType?: string; -} - -interface RTCStatsReport { -} - -interface RTCTransportStats extends RTCStats { - bytesSent?: number; - bytesReceived?: number; - rtcpTransportStatsId?: string; - activeConnection?: boolean; - selectedCandidatePairId?: string; - localCertificateId?: string; - remoteCertificateId?: string; -} - -interface StoreExceptionsInformation extends ExceptionInformation { - siteName?: string; - explanationString?: string; - detailURI?: string; -} - -interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { - arrayOfDomainStrings?: string[]; -} - -interface UIEventInit extends EventInit { - view?: Window; - detail?: number; -} - -interface WebGLContextAttributes { - failIfMajorPerformanceCaveat?: boolean; - alpha?: boolean; - depth?: boolean; - stencil?: boolean; - antialias?: boolean; - premultipliedAlpha?: boolean; - preserveDrawingBuffer?: boolean; -} - -interface WebGLContextEventInit extends EventInit { - statusMessage?: string; -} - -interface WheelEventInit extends MouseEventInit { - deltaX?: number; - deltaY?: number; - deltaZ?: number; - deltaMode?: number; -} - -interface EventListener { - (evt: Event): void; -} - -interface ANGLE_instanced_arrays { - drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; - drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; - vertexAttribDivisorANGLE(index: number, divisor: number): void; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -declare var ANGLE_instanced_arrays: { - prototype: ANGLE_instanced_arrays; - new(): ANGLE_instanced_arrays; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -interface AnalyserNode extends AudioNode { - fftSize: number; - readonly frequencyBinCount: number; - maxDecibels: number; - minDecibels: number; - smoothingTimeConstant: number; - getByteFrequencyData(array: Uint8Array): void; - getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: Float32Array): void; - getFloatTimeDomainData(array: Float32Array): void; -} - -declare var AnalyserNode: { - prototype: AnalyserNode; - new(): AnalyserNode; -} - -interface AnimationEvent extends Event { - readonly animationName: string; - readonly elapsedTime: number; - initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; -} - -declare var AnimationEvent: { - prototype: AnimationEvent; - new(): AnimationEvent; -} - -interface ApplicationCache extends EventTarget { - oncached: (this: this, ev: Event) => any; - onchecking: (this: this, ev: Event) => any; - ondownloading: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onnoupdate: (this: this, ev: Event) => any; - onobsolete: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onupdateready: (this: this, ev: Event) => any; - readonly status: number; - abort(): void; - swapCache(): void; - update(): void; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; - addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ApplicationCache: { - prototype: ApplicationCache; - new(): ApplicationCache; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; -} - -interface AriaRequestEvent extends Event { - readonly attributeName: string; - attributeValue: string | null; -} - -declare var AriaRequestEvent: { - prototype: AriaRequestEvent; - new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; -} - -interface Attr extends Node { - readonly name: string; - readonly ownerElement: Element; - readonly prefix: string | null; - readonly specified: boolean; - value: string; -} - -declare var Attr: { - prototype: Attr; - new(): Attr; -} - -interface AudioBuffer { - readonly duration: number; - readonly length: number; - readonly numberOfChannels: number; - readonly sampleRate: number; - copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; - copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(): AudioBuffer; -} - -interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer | null; - readonly detune: AudioParam; - loop: boolean; - loopEnd: number; - loopStart: number; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - readonly playbackRate: AudioParam; - start(when?: number, offset?: number, duration?: number): void; - stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var AudioBufferSourceNode: { - prototype: AudioBufferSourceNode; - new(): AudioBufferSourceNode; -} - -interface AudioContext extends EventTarget { - readonly currentTime: number; - readonly destination: AudioDestinationNode; - readonly listener: AudioListener; - readonly sampleRate: number; - state: string; - createAnalyser(): AnalyserNode; - createBiquadFilter(): BiquadFilterNode; - createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; - createBufferSource(): AudioBufferSourceNode; - createChannelMerger(numberOfInputs?: number): ChannelMergerNode; - createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; - createConvolver(): ConvolverNode; - createDelay(maxDelayTime?: number): DelayNode; - createDynamicsCompressor(): DynamicsCompressorNode; - createGain(): GainNode; - createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; - createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; - createOscillator(): OscillatorNode; - createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; - createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; - createStereoPanner(): StereoPannerNode; - createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; -} - -declare var AudioContext: { - prototype: AudioContext; - new(): AudioContext; -} - -interface AudioDestinationNode extends AudioNode { - readonly maxChannelCount: number; -} - -declare var AudioDestinationNode: { - prototype: AudioDestinationNode; - new(): AudioDestinationNode; -} - -interface AudioListener { - dopplerFactor: number; - speedOfSound: number; - setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var AudioListener: { - prototype: AudioListener; - new(): AudioListener; -} - -interface AudioNode extends EventTarget { - channelCount: number; - channelCountMode: string; - channelInterpretation: string; - readonly context: AudioContext; - readonly numberOfInputs: number; - readonly numberOfOutputs: number; - connect(destination: AudioNode, output?: number, input?: number): void; - disconnect(output?: number): void; - disconnect(destination: AudioNode, output?: number, input?: number): void; - disconnect(destination: AudioParam, output?: number): void; -} - -declare var AudioNode: { - prototype: AudioNode; - new(): AudioNode; -} - -interface AudioParam { - readonly defaultValue: number; - value: number; - cancelScheduledValues(startTime: number): void; - exponentialRampToValueAtTime(value: number, endTime: number): void; - linearRampToValueAtTime(value: number, endTime: number): void; - setTargetAtTime(target: number, startTime: number, timeConstant: number): void; - setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; -} - -declare var AudioParam: { - prototype: AudioParam; - new(): AudioParam; -} - -interface AudioProcessingEvent extends Event { - readonly inputBuffer: AudioBuffer; - readonly outputBuffer: AudioBuffer; - readonly playbackTime: number; -} - -declare var AudioProcessingEvent: { - prototype: AudioProcessingEvent; - new(): AudioProcessingEvent; -} - -interface AudioTrack { - enabled: boolean; - readonly id: string; - kind: string; - readonly label: string; - language: string; - readonly sourceBuffer: SourceBuffer; -} - -declare var AudioTrack: { - prototype: AudioTrack; - new(): AudioTrack; -} - -interface AudioTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack | null; - item(index: number): AudioTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: AudioTrack; -} - -declare var AudioTrackList: { - prototype: AudioTrackList; - new(): AudioTrackList; -} - -interface BarProp { - readonly visible: boolean; -} - -declare var BarProp: { - prototype: BarProp; - new(): BarProp; -} - -interface BeforeUnloadEvent extends Event { - returnValue: any; -} - -declare var BeforeUnloadEvent: { - prototype: BeforeUnloadEvent; - new(): BeforeUnloadEvent; -} - -interface BiquadFilterNode extends AudioNode { - readonly Q: AudioParam; - readonly detune: AudioParam; - readonly frequency: AudioParam; - readonly gain: AudioParam; - type: string; - getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; -} - -declare var BiquadFilterNode: { - prototype: BiquadFilterNode; - new(): BiquadFilterNode; -} - -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface CDATASection extends Text { -} - -declare var CDATASection: { - prototype: CDATASection; - new(): CDATASection; -} - -interface CSS { - supports(property: string, value?: string): boolean; -} -declare var CSS: CSS; - -interface CSSConditionRule extends CSSGroupingRule { - conditionText: string; -} - -declare var CSSConditionRule: { - prototype: CSSConditionRule; - new(): CSSConditionRule; -} - -interface CSSFontFaceRule extends CSSRule { - readonly style: CSSStyleDeclaration; -} - -declare var CSSFontFaceRule: { - prototype: CSSFontFaceRule; - new(): CSSFontFaceRule; -} - -interface CSSGroupingRule extends CSSRule { - readonly cssRules: CSSRuleList; - deleteRule(index: number): void; - insertRule(rule: string, index: number): number; -} - -declare var CSSGroupingRule: { - prototype: CSSGroupingRule; - new(): CSSGroupingRule; -} - -interface CSSImportRule extends CSSRule { - readonly href: string; - readonly media: MediaList; - readonly styleSheet: CSSStyleSheet; -} - -declare var CSSImportRule: { - prototype: CSSImportRule; - new(): CSSImportRule; -} - -interface CSSKeyframeRule extends CSSRule { - keyText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSKeyframeRule: { - prototype: CSSKeyframeRule; - new(): CSSKeyframeRule; -} - -interface CSSKeyframesRule extends CSSRule { - readonly cssRules: CSSRuleList; - name: string; - appendRule(rule: string): void; - deleteRule(rule: string): void; - findRule(rule: string): CSSKeyframeRule; -} - -declare var CSSKeyframesRule: { - prototype: CSSKeyframesRule; - new(): CSSKeyframesRule; -} - -interface CSSMediaRule extends CSSConditionRule { - readonly media: MediaList; -} - -declare var CSSMediaRule: { - prototype: CSSMediaRule; - new(): CSSMediaRule; -} - -interface CSSNamespaceRule extends CSSRule { - readonly namespaceURI: string; - readonly prefix: string; -} - -declare var CSSNamespaceRule: { - prototype: CSSNamespaceRule; - new(): CSSNamespaceRule; -} - -interface CSSPageRule extends CSSRule { - readonly pseudoClass: string; - readonly selector: string; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSPageRule: { - prototype: CSSPageRule; - new(): CSSPageRule; -} - -interface CSSRule { - cssText: string; - readonly parentRule: CSSRule; - readonly parentStyleSheet: CSSStyleSheet; - readonly type: number; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -declare var CSSRule: { - prototype: CSSRule; - new(): CSSRule; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -interface CSSRuleList { - readonly length: number; - item(index: number): CSSRule; - [index: number]: CSSRule; -} - -declare var CSSRuleList: { - prototype: CSSRuleList; - new(): CSSRuleList; -} - -interface CSSStyleDeclaration { - alignContent: string | null; - alignItems: string | null; - alignSelf: string | null; - alignmentBaseline: string | null; - animation: string | null; - animationDelay: string | null; - animationDirection: string | null; - animationDuration: string | null; - animationFillMode: string | null; - animationIterationCount: string | null; - animationName: string | null; - animationPlayState: string | null; - animationTimingFunction: string | null; - backfaceVisibility: string | null; - background: string | null; - backgroundAttachment: string | null; - backgroundClip: string | null; - backgroundColor: string | null; - backgroundImage: string | null; - backgroundOrigin: string | null; - backgroundPosition: string | null; - backgroundPositionX: string | null; - backgroundPositionY: string | null; - backgroundRepeat: string | null; - backgroundSize: string | null; - baselineShift: string | null; - border: string | null; - borderBottom: string | null; - borderBottomColor: string | null; - borderBottomLeftRadius: string | null; - borderBottomRightRadius: string | null; - borderBottomStyle: string | null; - borderBottomWidth: string | null; - borderCollapse: string | null; - borderColor: string | null; - borderImage: string | null; - borderImageOutset: string | null; - borderImageRepeat: string | null; - borderImageSlice: string | null; - borderImageSource: string | null; - borderImageWidth: string | null; - borderLeft: string | null; - borderLeftColor: string | null; - borderLeftStyle: string | null; - borderLeftWidth: string | null; - borderRadius: string | null; - borderRight: string | null; - borderRightColor: string | null; - borderRightStyle: string | null; - borderRightWidth: string | null; - borderSpacing: string | null; - borderStyle: string | null; - borderTop: string | null; - borderTopColor: string | null; - borderTopLeftRadius: string | null; - borderTopRightRadius: string | null; - borderTopStyle: string | null; - borderTopWidth: string | null; - borderWidth: string | null; - bottom: string | null; - boxShadow: string | null; - boxSizing: string | null; - breakAfter: string | null; - breakBefore: string | null; - breakInside: string | null; - captionSide: string | null; - clear: string | null; - clip: string | null; - clipPath: string | null; - clipRule: string | null; - color: string | null; - colorInterpolationFilters: string | null; - columnCount: any; - columnFill: string | null; - columnGap: any; - columnRule: string | null; - columnRuleColor: any; - columnRuleStyle: string | null; - columnRuleWidth: any; - columnSpan: string | null; - columnWidth: any; - columns: string | null; - content: string | null; - counterIncrement: string | null; - counterReset: string | null; - cssFloat: string | null; - cssText: string; - cursor: string | null; - direction: string | null; - display: string | null; - dominantBaseline: string | null; - emptyCells: string | null; - enableBackground: string | null; - fill: string | null; - fillOpacity: string | null; - fillRule: string | null; - filter: string | null; - flex: string | null; - flexBasis: string | null; - flexDirection: string | null; - flexFlow: string | null; - flexGrow: string | null; - flexShrink: string | null; - flexWrap: string | null; - floodColor: string | null; - floodOpacity: string | null; - font: string | null; - fontFamily: string | null; - fontFeatureSettings: string | null; - fontSize: string | null; - fontSizeAdjust: string | null; - fontStretch: string | null; - fontStyle: string | null; - fontVariant: string | null; - fontWeight: string | null; - glyphOrientationHorizontal: string | null; - glyphOrientationVertical: string | null; - height: string | null; - imeMode: string | null; - justifyContent: string | null; - kerning: string | null; - left: string | null; - readonly length: number; - letterSpacing: string | null; - lightingColor: string | null; - lineHeight: string | null; - listStyle: string | null; - listStyleImage: string | null; - listStylePosition: string | null; - listStyleType: string | null; - margin: string | null; - marginBottom: string | null; - marginLeft: string | null; - marginRight: string | null; - marginTop: string | null; - marker: string | null; - markerEnd: string | null; - markerMid: string | null; - markerStart: string | null; - mask: string | null; - maxHeight: string | null; - maxWidth: string | null; - minHeight: string | null; - minWidth: string | null; - msContentZoomChaining: string | null; - msContentZoomLimit: string | null; - msContentZoomLimitMax: any; - msContentZoomLimitMin: any; - msContentZoomSnap: string | null; - msContentZoomSnapPoints: string | null; - msContentZoomSnapType: string | null; - msContentZooming: string | null; - msFlowFrom: string | null; - msFlowInto: string | null; - msFontFeatureSettings: string | null; - msGridColumn: any; - msGridColumnAlign: string | null; - msGridColumnSpan: any; - msGridColumns: string | null; - msGridRow: any; - msGridRowAlign: string | null; - msGridRowSpan: any; - msGridRows: string | null; - msHighContrastAdjust: string | null; - msHyphenateLimitChars: string | null; - msHyphenateLimitLines: any; - msHyphenateLimitZone: any; - msHyphens: string | null; - msImeAlign: string | null; - msOverflowStyle: string | null; - msScrollChaining: string | null; - msScrollLimit: string | null; - msScrollLimitXMax: any; - msScrollLimitXMin: any; - msScrollLimitYMax: any; - msScrollLimitYMin: any; - msScrollRails: string | null; - msScrollSnapPointsX: string | null; - msScrollSnapPointsY: string | null; - msScrollSnapType: string | null; - msScrollSnapX: string | null; - msScrollSnapY: string | null; - msScrollTranslation: string | null; - msTextCombineHorizontal: string | null; - msTextSizeAdjust: any; - msTouchAction: string | null; - msTouchSelect: string | null; - msUserSelect: string | null; - msWrapFlow: string; - msWrapMargin: any; - msWrapThrough: string; - opacity: string | null; - order: string | null; - orphans: string | null; - outline: string | null; - outlineColor: string | null; - outlineStyle: string | null; - outlineWidth: string | null; - overflow: string | null; - overflowX: string | null; - overflowY: string | null; - padding: string | null; - paddingBottom: string | null; - paddingLeft: string | null; - paddingRight: string | null; - paddingTop: string | null; - pageBreakAfter: string | null; - pageBreakBefore: string | null; - pageBreakInside: string | null; - readonly parentRule: CSSRule; - perspective: string | null; - perspectiveOrigin: string | null; - pointerEvents: string | null; - position: string | null; - quotes: string | null; - right: string | null; - rubyAlign: string | null; - rubyOverhang: string | null; - rubyPosition: string | null; - stopColor: string | null; - stopOpacity: string | null; - stroke: string | null; - strokeDasharray: string | null; - strokeDashoffset: string | null; - strokeLinecap: string | null; - strokeLinejoin: string | null; - strokeMiterlimit: string | null; - strokeOpacity: string | null; - strokeWidth: string | null; - tableLayout: string | null; - textAlign: string | null; - textAlignLast: string | null; - textAnchor: string | null; - textDecoration: string | null; - textIndent: string | null; - textJustify: string | null; - textKashida: string | null; - textKashidaSpace: string | null; - textOverflow: string | null; - textShadow: string | null; - textTransform: string | null; - textUnderlinePosition: string | null; - top: string | null; - touchAction: string | null; - transform: string | null; - transformOrigin: string | null; - transformStyle: string | null; - transition: string | null; - transitionDelay: string | null; - transitionDuration: string | null; - transitionProperty: string | null; - transitionTimingFunction: string | null; - unicodeBidi: string | null; - verticalAlign: string | null; - visibility: string | null; - webkitAlignContent: string | null; - webkitAlignItems: string | null; - webkitAlignSelf: string | null; - webkitAnimation: string | null; - webkitAnimationDelay: string | null; - webkitAnimationDirection: string | null; - webkitAnimationDuration: string | null; - webkitAnimationFillMode: string | null; - webkitAnimationIterationCount: string | null; - webkitAnimationName: string | null; - webkitAnimationPlayState: string | null; - webkitAnimationTimingFunction: string | null; - webkitAppearance: string | null; - webkitBackfaceVisibility: string | null; - webkitBackgroundClip: string | null; - webkitBackgroundOrigin: string | null; - webkitBackgroundSize: string | null; - webkitBorderBottomLeftRadius: string | null; - webkitBorderBottomRightRadius: string | null; - webkitBorderImage: string | null; - webkitBorderRadius: string | null; - webkitBorderTopLeftRadius: string | null; - webkitBorderTopRightRadius: string | null; - webkitBoxAlign: string | null; - webkitBoxDirection: string | null; - webkitBoxFlex: string | null; - webkitBoxOrdinalGroup: string | null; - webkitBoxOrient: string | null; - webkitBoxPack: string | null; - webkitBoxSizing: string | null; - webkitColumnBreakAfter: string | null; - webkitColumnBreakBefore: string | null; - webkitColumnBreakInside: string | null; - webkitColumnCount: any; - webkitColumnGap: any; - webkitColumnRule: string | null; - webkitColumnRuleColor: any; - webkitColumnRuleStyle: string | null; - webkitColumnRuleWidth: any; - webkitColumnSpan: string | null; - webkitColumnWidth: any; - webkitColumns: string | null; - webkitFilter: string | null; - webkitFlex: string | null; - webkitFlexBasis: string | null; - webkitFlexDirection: string | null; - webkitFlexFlow: string | null; - webkitFlexGrow: string | null; - webkitFlexShrink: string | null; - webkitFlexWrap: string | null; - webkitJustifyContent: string | null; - webkitOrder: string | null; - webkitPerspective: string | null; - webkitPerspectiveOrigin: string | null; - webkitTapHighlightColor: string | null; - webkitTextFillColor: string | null; - webkitTextSizeAdjust: any; - webkitTransform: string | null; - webkitTransformOrigin: string | null; - webkitTransformStyle: string | null; - webkitTransition: string | null; - webkitTransitionDelay: string | null; - webkitTransitionDuration: string | null; - webkitTransitionProperty: string | null; - webkitTransitionTimingFunction: string | null; - webkitUserModify: string | null; - webkitUserSelect: string | null; - webkitWritingMode: string | null; - whiteSpace: string | null; - widows: string | null; - width: string | null; - wordBreak: string | null; - wordSpacing: string | null; - wordWrap: string | null; - writingMode: string | null; - zIndex: string | null; - zoom: string | null; - resize: string | null; - getPropertyPriority(propertyName: string): string; - getPropertyValue(propertyName: string): string; - item(index: number): string; - removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string | null, priority?: string): void; - [index: number]: string; -} - -declare var CSSStyleDeclaration: { - prototype: CSSStyleDeclaration; - new(): CSSStyleDeclaration; -} - -interface CSSStyleRule extends CSSRule { - readonly readOnly: boolean; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSStyleRule: { - prototype: CSSStyleRule; - new(): CSSStyleRule; -} - -interface CSSStyleSheet extends StyleSheet { - readonly cssRules: CSSRuleList; - cssText: string; - readonly href: string; - readonly id: string; - readonly imports: StyleSheetList; - readonly isAlternate: boolean; - readonly isPrefAlternate: boolean; - readonly ownerRule: CSSRule; - readonly owningElement: Element; - readonly pages: StyleSheetPageList; - readonly readOnly: boolean; - readonly rules: CSSRuleList; - addImport(bstrURL: string, lIndex?: number): number; - addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; - addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; - removeImport(lIndex: number): void; - removeRule(lIndex: number): void; -} - -declare var CSSStyleSheet: { - prototype: CSSStyleSheet; - new(): CSSStyleSheet; -} - -interface CSSSupportsRule extends CSSConditionRule { -} - -declare var CSSSupportsRule: { - prototype: CSSSupportsRule; - new(): CSSSupportsRule; -} - -interface CanvasGradient { - addColorStop(offset: number, color: string): void; -} - -declare var CanvasGradient: { - prototype: CanvasGradient; - new(): CanvasGradient; -} - -interface CanvasPattern { - setTransform(matrix: SVGMatrix): void; -} - -declare var CanvasPattern: { - prototype: CanvasPattern; - new(): CanvasPattern; -} - -interface CanvasRenderingContext2D extends Object, CanvasPathMethods { - readonly canvas: HTMLCanvasElement; - fillStyle: string | CanvasGradient | CanvasPattern; - font: string; - globalAlpha: number; - globalCompositeOperation: string; - lineCap: string; - lineDashOffset: number; - lineJoin: string; - lineWidth: number; - miterLimit: number; - msFillRule: string; - msImageSmoothingEnabled: boolean; - shadowBlur: number; - shadowColor: string; - shadowOffsetX: number; - shadowOffsetY: number; - strokeStyle: string | CanvasGradient | CanvasPattern; - textAlign: string; - textBaseline: string; - mozImageSmoothingEnabled: boolean; - webkitImageSmoothingEnabled: boolean; - oImageSmoothingEnabled: boolean; - beginPath(): void; - clearRect(x: number, y: number, w: number, h: number): void; - clip(fillRule?: string): void; - createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; - createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; - createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; - drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; - fill(fillRule?: string): void; - fillRect(x: number, y: number, w: number, h: number): void; - fillText(text: string, x: number, y: number, maxWidth?: number): void; - getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; - getLineDash(): number[]; - isPointInPath(x: number, y: number, fillRule?: string): boolean; - measureText(text: string): TextMetrics; - putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - restore(): void; - rotate(angle: number): void; - save(): void; - scale(x: number, y: number): void; - setLineDash(segments: number[]): void; - setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - stroke(): void; - strokeRect(x: number, y: number, w: number, h: number): void; - strokeText(text: string, x: number, y: number, maxWidth?: number): void; - transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - translate(x: number, y: number): void; -} - -declare var CanvasRenderingContext2D: { - prototype: CanvasRenderingContext2D; - new(): CanvasRenderingContext2D; -} - -interface ChannelMergerNode extends AudioNode { -} - -declare var ChannelMergerNode: { - prototype: ChannelMergerNode; - new(): ChannelMergerNode; -} - -interface ChannelSplitterNode extends AudioNode { -} - -declare var ChannelSplitterNode: { - prototype: ChannelSplitterNode; - new(): ChannelSplitterNode; -} - -interface CharacterData extends Node, ChildNode { - data: string; - readonly length: number; - appendData(arg: string): void; - deleteData(offset: number, count: number): void; - insertData(offset: number, arg: string): void; - replaceData(offset: number, count: number, arg: string): void; - substringData(offset: number, count: number): string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var CharacterData: { - prototype: CharacterData; - new(): CharacterData; -} - -interface ClientRect { - bottom: number; - readonly height: number; - left: number; - right: number; - top: number; - readonly width: number; -} - -declare var ClientRect: { - prototype: ClientRect; - new(): ClientRect; -} - -interface ClientRectList { - readonly length: number; - item(index: number): ClientRect; - [index: number]: ClientRect; -} - -declare var ClientRectList: { - prototype: ClientRectList; - new(): ClientRectList; -} - -interface ClipboardEvent extends Event { - readonly clipboardData: DataTransfer; -} - -declare var ClipboardEvent: { - prototype: ClipboardEvent; - new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; -} - -interface CloseEvent extends Event { - readonly code: number; - readonly reason: string; - readonly wasClean: boolean; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(): CloseEvent; -} - -interface CommandEvent extends Event { - readonly commandName: string; - readonly detail: string | null; -} - -declare var CommandEvent: { - prototype: CommandEvent; - new(type: string, eventInitDict?: CommandEventInit): CommandEvent; -} - -interface Comment extends CharacterData { - text: string; -} - -declare var Comment: { - prototype: Comment; - new(): Comment; -} - -interface CompositionEvent extends UIEvent { - readonly data: string; - readonly locale: string; - initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; -} - -declare var CompositionEvent: { - prototype: CompositionEvent; - new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; -} - -interface Console { - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - clear(): void; - count(countTitle?: string): void; - debug(message?: string, ...optionalParams: any[]): void; - dir(value?: any, ...optionalParams: any[]): void; - dirxml(value: any): void; - error(message?: any, ...optionalParams: any[]): void; - exception(message?: string, ...optionalParams: any[]): void; - group(groupTitle?: string): void; - groupCollapsed(groupTitle?: string): void; - groupEnd(): void; - info(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: Element): boolean; - profile(reportName?: string): void; - profileEnd(): void; - select(element: Element): void; - table(...data: any[]): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(message?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; -} - -declare var Console: { - prototype: Console; - new(): Console; -} - -interface ConvolverNode extends AudioNode { - buffer: AudioBuffer | null; - normalize: boolean; -} - -declare var ConvolverNode: { - prototype: ConvolverNode; - new(): ConvolverNode; -} - -interface Coordinates { - readonly accuracy: number; - readonly altitude: number | null; - readonly altitudeAccuracy: number | null; - readonly heading: number | null; - readonly latitude: number; - readonly longitude: number; - readonly speed: number | null; -} - -declare var Coordinates: { - prototype: Coordinates; - new(): Coordinates; -} - -interface Crypto extends Object, RandomSource { - readonly subtle: SubtleCrypto; -} - -declare var Crypto: { - prototype: Crypto; - new(): Crypto; -} - -interface CryptoKey { - readonly algorithm: KeyAlgorithm; - readonly extractable: boolean; - readonly type: string; - readonly usages: string[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -} - -interface CryptoKeyPair { - privateKey: CryptoKey; - publicKey: CryptoKey; -} - -declare var CryptoKeyPair: { - prototype: CryptoKeyPair; - new(): CryptoKeyPair; -} - -interface CustomEvent extends Event { - readonly detail: any; - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; -} - -declare var CustomEvent: { - prototype: CustomEvent; - new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; -} - -interface DOMError { - readonly name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -} - -interface DOMException { - readonly code: number; - readonly message: string; - readonly name: string; - toString(): string; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(): DOMException; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -interface DOMImplementation { - createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; - createHTMLDocument(title: string): Document; - hasFeature(feature: string | null, version: string | null): boolean; -} - -declare var DOMImplementation: { - prototype: DOMImplementation; - new(): DOMImplementation; -} - -interface DOMParser { - parseFromString(source: string, mimeType: string): Document; -} - -declare var DOMParser: { - prototype: DOMParser; - new(): DOMParser; -} - -interface DOMSettableTokenList extends DOMTokenList { - value: string; -} - -declare var DOMSettableTokenList: { - prototype: DOMSettableTokenList; - new(): DOMSettableTokenList; -} - -interface DOMStringList { - readonly length: number; - contains(str: string): boolean; - item(index: number): string | null; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -} - -interface DOMStringMap { - [name: string]: string; -} - -declare var DOMStringMap: { - prototype: DOMStringMap; - new(): DOMStringMap; -} - -interface DOMTokenList { - readonly length: number; - add(...token: string[]): void; - contains(token: string): boolean; - item(index: number): string; - remove(...token: string[]): void; - toString(): string; - toggle(token: string, force?: boolean): boolean; - [index: number]: string; -} - -declare var DOMTokenList: { - prototype: DOMTokenList; - new(): DOMTokenList; -} - -interface DataCue extends TextTrackCue { - data: ArrayBuffer; -} - -declare var DataCue: { - prototype: DataCue; - new(): DataCue; -} - -interface DataTransfer { - dropEffect: string; - effectAllowed: string; - readonly files: FileList; - readonly items: DataTransferItemList; - readonly types: string[]; - clearData(format?: string): boolean; - getData(format: string): string; - setData(format: string, data: string): boolean; -} - -declare var DataTransfer: { - prototype: DataTransfer; - new(): DataTransfer; -} - -interface DataTransferItem { - readonly kind: string; - readonly type: string; - getAsFile(): File | null; - getAsString(_callback: FunctionStringCallback | null): void; -} - -declare var DataTransferItem: { - prototype: DataTransferItem; - new(): DataTransferItem; -} - -interface DataTransferItemList { - readonly length: number; - add(data: File): DataTransferItem | null; - clear(): void; - item(index: number): DataTransferItem; - remove(index: number): void; - [index: number]: DataTransferItem; -} - -declare var DataTransferItemList: { - prototype: DataTransferItemList; - new(): DataTransferItemList; -} - -interface DeferredPermissionRequest { - readonly id: number; - readonly type: string; - readonly uri: string; - allow(): void; - deny(): void; -} - -declare var DeferredPermissionRequest: { - prototype: DeferredPermissionRequest; - new(): DeferredPermissionRequest; -} - -interface DelayNode extends AudioNode { - readonly delayTime: AudioParam; -} - -declare var DelayNode: { - prototype: DelayNode; - new(): DelayNode; -} - -interface DeviceAcceleration { - readonly x: number | null; - readonly y: number | null; - readonly z: number | null; -} - -declare var DeviceAcceleration: { - prototype: DeviceAcceleration; - new(): DeviceAcceleration; -} - -interface DeviceLightEvent extends Event { - readonly value: number; -} - -declare var DeviceLightEvent: { - prototype: DeviceLightEvent; - new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; -} - -interface DeviceMotionEvent extends Event { - readonly acceleration: DeviceAcceleration | null; - readonly accelerationIncludingGravity: DeviceAcceleration | null; - readonly interval: number | null; - readonly rotationRate: DeviceRotationRate | null; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; -} - -declare var DeviceMotionEvent: { - prototype: DeviceMotionEvent; - new(): DeviceMotionEvent; -} - -interface DeviceOrientationEvent extends Event { - readonly absolute: boolean; - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; -} - -declare var DeviceOrientationEvent: { - prototype: DeviceOrientationEvent; - new(): DeviceOrientationEvent; -} - -interface DeviceRotationRate { - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; -} - -declare var DeviceRotationRate: { - prototype: DeviceRotationRate; - new(): DeviceRotationRate; -} - -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode { - /** - * Sets or gets the URL for the current document. - */ - readonly URL: string; - /** - * Gets the URL for the document, stripped of any character encoding. - */ - readonly URLUnencoded: string; - /** - * Gets the object that has the focus when the parent document has focus. - */ - readonly activeElement: Element; - /** - * Sets or gets the color of all active links in the document. - */ - alinkColor: string; - /** - * Returns a reference to the collection of elements contained by the object. - */ - readonly all: HTMLAllCollection; - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. - */ - anchors: HTMLCollectionOf; - /** - * Retrieves a collection of all applet objects in the document. - */ - applets: HTMLCollectionOf; - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. - */ - bgColor: string; - /** - * Specifies the beginning and end of the document body. - */ - body: HTMLElement; - readonly characterSet: string; - /** - * Gets or sets the character set used to encode the object. - */ - charset: string; - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. - */ - readonly compatMode: string; - cookie: string; - readonly currentScript: HTMLScriptElement | SVGScriptElement; - /** - * Gets the default character set from the current regional language settings. - */ - readonly defaultCharset: string; - readonly defaultView: Window; - /** - * Sets or gets a value that indicates whether the document can be edited. - */ - designMode: string; - /** - * Sets or retrieves a value that indicates the reading order of the object. - */ - dir: string; - /** - * Gets an object representing the document type declaration associated with the current document. - */ - readonly doctype: DocumentType; - /** - * Gets a reference to the root node of the document. - */ - documentElement: HTMLElement; - /** - * Sets or gets the security domain of the document. - */ - domain: string; - /** - * Retrieves a collection of all embed objects in the document. - */ - embeds: HTMLCollectionOf; - /** - * Sets or gets the foreground (text) color of the document. - */ - fgColor: string; - /** - * Retrieves a collection, in source order, of all form objects in the document. - */ - forms: HTMLCollectionOf; - readonly fullscreenElement: Element | null; - readonly fullscreenEnabled: boolean; - readonly head: HTMLHeadElement; - readonly hidden: boolean; - /** - * Retrieves a collection, in source order, of img objects in the document. - */ - images: HTMLCollectionOf; - /** - * Gets the implementation object of the current document. - */ - readonly implementation: DOMImplementation; - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. - */ - readonly inputEncoding: string | null; - /** - * Gets the date that the page was last modified, if the page supplies one. - */ - readonly lastModified: string; - /** - * Sets or gets the color of the document links. - */ - linkColor: string; - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. - */ - links: HTMLCollectionOf; - /** - * Contains information about the current URL. - */ - readonly location: Location; - msCSSOMElementFloatMetrics: boolean; - msCapsLockWarningOff: boolean; - /** - * Fires when the user aborts the download. - * @param ev The event. - */ - onabort: (this: this, ev: UIEvent) => any; - /** - * Fires when the object is set as the active element. - * @param ev The event. - */ - onactivate: (this: this, ev: UIEvent) => any; - /** - * Fires immediately before the object is set as the active element. - * @param ev The event. - */ - onbeforeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires immediately before the activeElement is changed from the current object to another object in the parent document. - * @param ev The event. - */ - onbeforedeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. - * @param ev The focus event. - */ - onblur: (this: this, ev: FocusEvent) => any; - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. - */ - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. - */ - onchange: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. - */ - onclick: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. - */ - oncontextmenu: (this: this, ev: PointerEvent) => any; - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. - */ - ondblclick: (this: this, ev: MouseEvent) => any; - /** - * Fires when the activeElement is changed from the current object to another object in the parent document. - * @param ev The UI Event - */ - ondeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. - */ - ondrag: (this: this, ev: DragEvent) => any; - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. - */ - ondragend: (this: this, ev: DragEvent) => any; - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. - */ - ondragenter: (this: this, ev: DragEvent) => any; - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. - */ - ondragleave: (this: this, ev: DragEvent) => any; - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. - */ - ondragover: (this: this, ev: DragEvent) => any; - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. - */ - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - /** - * Occurs when the duration attribute is updated. - * @param ev The event. - */ - ondurationchange: (this: this, ev: Event) => any; - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. - */ - onemptied: (this: this, ev: Event) => any; - /** - * Occurs when the end of playback is reached. - * @param ev The event - */ - onended: (this: this, ev: MediaStreamErrorEvent) => any; - /** - * Fires when an error occurs during object loading. - * @param ev The event. - */ - onerror: (this: this, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - * @param ev The event. - */ - onfocus: (this: this, ev: FocusEvent) => any; - onfullscreenchange: (this: this, ev: Event) => any; - onfullscreenerror: (this: this, ev: Event) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - /** - * Fires when the user presses a key. - * @param ev The keyboard event - */ - onkeydown: (this: this, ev: KeyboardEvent) => any; - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. - */ - onkeypress: (this: this, ev: KeyboardEvent) => any; - /** - * Fires when the user releases a key. - * @param ev The keyboard event - */ - onkeyup: (this: this, ev: KeyboardEvent) => any; - /** - * Fires immediately after the browser loads the object. - * @param ev The event. - */ - onload: (this: this, ev: Event) => any; - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. - */ - onloadeddata: (this: this, ev: Event) => any; - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. - */ - onloadedmetadata: (this: this, ev: Event) => any; - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. - */ - onloadstart: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. - */ - onmousedown: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. - */ - onmousemove: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. - */ - onmouseout: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. - */ - onmouseover: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. - */ - onmouseup: (this: this, ev: MouseEvent) => any; - /** - * Fires when the wheel button is rotated. - * @param ev The mouse event - */ - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. - * @param ev The event. - */ - onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any; - /** - * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. - * @param ev The event. - */ - onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any; - /** - * Occurs when playback is paused. - * @param ev The event. - */ - onpause: (this: this, ev: Event) => any; - /** - * Occurs when the play method is requested. - * @param ev The event. - */ - onplay: (this: this, ev: Event) => any; - /** - * Occurs when the audio or video has started playing. - * @param ev The event. - */ - onplaying: (this: this, ev: Event) => any; - onpointerlockchange: (this: this, ev: Event) => any; - onpointerlockerror: (this: this, ev: Event) => any; - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. - */ - onprogress: (this: this, ev: ProgressEvent) => any; - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. - */ - onratechange: (this: this, ev: Event) => any; - /** - * Fires when the state of the object has changed. - * @param ev The event - */ - onreadystatechange: (this: this, ev: ProgressEvent) => any; - /** - * Fires when the user resets a form. - * @param ev The event. - */ - onreset: (this: this, ev: Event) => any; - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. - */ - onscroll: (this: this, ev: UIEvent) => any; - /** - * Occurs when the seek operation ends. - * @param ev The event. - */ - onseeked: (this: this, ev: Event) => any; - /** - * Occurs when the current playback position is moved. - * @param ev The event. - */ - onseeking: (this: this, ev: Event) => any; - /** - * Fires when the current selection changes. - * @param ev The event. - */ - onselect: (this: this, ev: UIEvent) => any; - /** - * Fires when the selection state of a document changes. - * @param ev The event. - */ - onselectionchange: (this: this, ev: Event) => any; - onselectstart: (this: this, ev: Event) => any; - /** - * Occurs when the download has stopped. - * @param ev The event. - */ - onstalled: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the Stop button or leaves the Web page. - * @param ev The event. - */ - onstop: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. - */ - onsuspend: (this: this, ev: Event) => any; - /** - * Occurs to indicate the current playback position. - * @param ev The event. - */ - ontimeupdate: (this: this, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. - */ - onvolumechange: (this: this, ev: Event) => any; - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. - */ - onwaiting: (this: this, ev: Event) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; - plugins: HTMLCollectionOf; - readonly pointerLockElement: Element; - /** - * Retrieves a value that indicates the current state of the object. - */ - readonly readyState: string; - /** - * Gets the URL of the location that referred the user to the current page. - */ - readonly referrer: string; - /** - * Gets the root svg element in the document hierarchy. - */ - readonly rootElement: SVGSVGElement; - /** - * Retrieves a collection of all script objects in the document. - */ - scripts: HTMLCollectionOf; - readonly scrollingElement: Element | null; - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. - */ - readonly styleSheets: StyleSheetList; - /** - * Contains the title of the document. - */ - title: string; - readonly visibilityState: string; - /** - * Sets or gets the color of the links that the user has visited. - */ - vlinkColor: string; - readonly webkitCurrentFullScreenElement: Element | null; - readonly webkitFullscreenElement: Element | null; - readonly webkitFullscreenEnabled: boolean; - readonly webkitIsFullScreen: boolean; - readonly xmlEncoding: string | null; - xmlStandalone: boolean; - /** - * Gets or sets the version attribute specified in the declaration of an XML document. - */ - xmlVersion: string | null; - adoptNode(source: Node): Node; - captureEvents(): void; - caretRangeFromPoint(x: number, y: number): Range; - clear(): void; - /** - * Closes an output stream and forces the sent data to display. - */ - close(): void; - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. - */ - createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; - createCDATASection(data: string): CDATASection; - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. - */ - createComment(data: string): Comment; - /** - * Creates a new document. - */ - createDocumentFragment(): DocumentFragment; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "applet"): HTMLAppletElement; - createElement(tagName: "area"): HTMLAreaElement; - createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "base"): HTMLBaseElement; - createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "blockquote"): HTMLQuoteElement; - createElement(tagName: "body"): HTMLBodyElement; - createElement(tagName: "br"): HTMLBRElement; - createElement(tagName: "button"): HTMLButtonElement; - createElement(tagName: "canvas"): HTMLCanvasElement; - createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "col"): HTMLTableColElement; - createElement(tagName: "colgroup"): HTMLTableColElement; - createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dir"): HTMLDirectoryElement; - createElement(tagName: "div"): HTMLDivElement; - createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "embed"): HTMLEmbedElement; - createElement(tagName: "fieldset"): HTMLFieldSetElement; - createElement(tagName: "font"): HTMLFontElement; - createElement(tagName: "form"): HTMLFormElement; - createElement(tagName: "frame"): HTMLFrameElement; - createElement(tagName: "frameset"): HTMLFrameSetElement; - createElement(tagName: "h1"): HTMLHeadingElement; - createElement(tagName: "h2"): HTMLHeadingElement; - createElement(tagName: "h3"): HTMLHeadingElement; - createElement(tagName: "h4"): HTMLHeadingElement; - createElement(tagName: "h5"): HTMLHeadingElement; - createElement(tagName: "h6"): HTMLHeadingElement; - createElement(tagName: "head"): HTMLHeadElement; - createElement(tagName: "hr"): HTMLHRElement; - createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "iframe"): HTMLIFrameElement; - createElement(tagName: "img"): HTMLImageElement; - createElement(tagName: "input"): HTMLInputElement; - createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLUnknownElement; - createElement(tagName: "label"): HTMLLabelElement; - createElement(tagName: "legend"): HTMLLegendElement; - createElement(tagName: "li"): HTMLLIElement; - createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLPreElement; - createElement(tagName: "map"): HTMLMapElement; - createElement(tagName: "marquee"): HTMLMarqueeElement; - createElement(tagName: "menu"): HTMLMenuElement; - createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "meter"): HTMLMeterElement; - createElement(tagName: "nextid"): HTMLUnknownElement; - createElement(tagName: "object"): HTMLObjectElement; - createElement(tagName: "ol"): HTMLOListElement; - createElement(tagName: "optgroup"): HTMLOptGroupElement; - createElement(tagName: "option"): HTMLOptionElement; - createElement(tagName: "p"): HTMLParagraphElement; - createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "picture"): HTMLPictureElement; - createElement(tagName: "pre"): HTMLPreElement; - createElement(tagName: "progress"): HTMLProgressElement; - createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "script"): HTMLScriptElement; - createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "source"): HTMLSourceElement; - createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "table"): HTMLTableElement; - createElement(tagName: "tbody"): HTMLTableSectionElement; - createElement(tagName: "td"): HTMLTableDataCellElement; - createElement(tagName: "template"): HTMLTemplateElement; - createElement(tagName: "textarea"): HTMLTextAreaElement; - createElement(tagName: "tfoot"): HTMLTableSectionElement; - createElement(tagName: "th"): HTMLTableHeaderCellElement; - createElement(tagName: "thead"): HTMLTableSectionElement; - createElement(tagName: "title"): HTMLTitleElement; - createElement(tagName: "tr"): HTMLTableRowElement; - createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "video"): HTMLVideoElement; - createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLPreElement; - createElement(tagName: string): HTMLElement; - createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string | null, qualifiedName: string): Element; - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver: Node): XPathNSResolver; - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; - createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. - */ - createRange(): Range; - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. - */ - createTextNode(data: string): Text; - createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; - createTouchList(...touches: Touch[]): TouchList; - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset - */ - elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. - */ - execCommand(commandId: string, showUI?: boolean, value?: any): boolean; - /** - * Displays help information for the given command identifier. - * @param commandId Displays help information for the given command identifier. - */ - execCommandShowHelp(commandId: string): boolean; - exitFullscreen(): void; - exitPointerLock(): void; - /** - * Causes the element to receive the focus and executes the code specified by the onfocus event. - */ - focus(): void; - /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. - */ - getElementById(elementId: string): HTMLElement | null; - getElementsByClassName(classNames: string): HTMLCollectionOf; - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. - */ - getElementsByName(elementName: string): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; - getElementsByTagName(tagname: "applet"): NodeListOf; - getElementsByTagName(tagname: "area"): NodeListOf; - getElementsByTagName(tagname: "article"): NodeListOf; - getElementsByTagName(tagname: "aside"): NodeListOf; - getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; - getElementsByTagName(tagname: "base"): NodeListOf; - getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; - getElementsByTagName(tagname: "body"): NodeListOf; - getElementsByTagName(tagname: "br"): NodeListOf; - getElementsByTagName(tagname: "button"): NodeListOf; - getElementsByTagName(tagname: "canvas"): NodeListOf; - getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; - getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; - getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; - getElementsByTagName(tagname: "col"): NodeListOf; - getElementsByTagName(tagname: "colgroup"): NodeListOf; - getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; - getElementsByTagName(tagname: "defs"): NodeListOf; - getElementsByTagName(tagname: "del"): NodeListOf; - getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; - getElementsByTagName(tagname: "dir"): NodeListOf; - getElementsByTagName(tagname: "div"): NodeListOf; - getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; - getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; - getElementsByTagName(tagname: "embed"): NodeListOf; - getElementsByTagName(tagname: "feblend"): NodeListOf; - getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; - getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(tagname: "fecomposite"): NodeListOf; - getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; - getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; - getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; - getElementsByTagName(tagname: "fedistantlight"): NodeListOf; - getElementsByTagName(tagname: "feflood"): NodeListOf; - getElementsByTagName(tagname: "fefunca"): NodeListOf; - getElementsByTagName(tagname: "fefuncb"): NodeListOf; - getElementsByTagName(tagname: "fefuncg"): NodeListOf; - getElementsByTagName(tagname: "fefuncr"): NodeListOf; - getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; - getElementsByTagName(tagname: "feimage"): NodeListOf; - getElementsByTagName(tagname: "femerge"): NodeListOf; - getElementsByTagName(tagname: "femergenode"): NodeListOf; - getElementsByTagName(tagname: "femorphology"): NodeListOf; - getElementsByTagName(tagname: "feoffset"): NodeListOf; - getElementsByTagName(tagname: "fepointlight"): NodeListOf; - getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; - getElementsByTagName(tagname: "fespotlight"): NodeListOf; - getElementsByTagName(tagname: "fetile"): NodeListOf; - getElementsByTagName(tagname: "feturbulence"): NodeListOf; - getElementsByTagName(tagname: "fieldset"): NodeListOf; - getElementsByTagName(tagname: "figcaption"): NodeListOf; - getElementsByTagName(tagname: "figure"): NodeListOf; - getElementsByTagName(tagname: "filter"): NodeListOf; - getElementsByTagName(tagname: "font"): NodeListOf; - getElementsByTagName(tagname: "footer"): NodeListOf; - getElementsByTagName(tagname: "foreignobject"): NodeListOf; - getElementsByTagName(tagname: "form"): NodeListOf; - getElementsByTagName(tagname: "frame"): NodeListOf; - getElementsByTagName(tagname: "frameset"): NodeListOf; - getElementsByTagName(tagname: "g"): NodeListOf; - getElementsByTagName(tagname: "h1"): NodeListOf; - getElementsByTagName(tagname: "h2"): NodeListOf; - getElementsByTagName(tagname: "h3"): NodeListOf; - getElementsByTagName(tagname: "h4"): NodeListOf; - getElementsByTagName(tagname: "h5"): NodeListOf; - getElementsByTagName(tagname: "h6"): NodeListOf; - getElementsByTagName(tagname: "head"): NodeListOf; - getElementsByTagName(tagname: "header"): NodeListOf; - getElementsByTagName(tagname: "hgroup"): NodeListOf; - getElementsByTagName(tagname: "hr"): NodeListOf; - getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; - getElementsByTagName(tagname: "iframe"): NodeListOf; - getElementsByTagName(tagname: "image"): NodeListOf; - getElementsByTagName(tagname: "img"): NodeListOf; - getElementsByTagName(tagname: "input"): NodeListOf; - getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; - getElementsByTagName(tagname: "label"): NodeListOf; - getElementsByTagName(tagname: "legend"): NodeListOf; - getElementsByTagName(tagname: "li"): NodeListOf; - getElementsByTagName(tagname: "line"): NodeListOf; - getElementsByTagName(tagname: "lineargradient"): NodeListOf; - getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; - getElementsByTagName(tagname: "map"): NodeListOf; - getElementsByTagName(tagname: "mark"): NodeListOf; - getElementsByTagName(tagname: "marker"): NodeListOf; - getElementsByTagName(tagname: "marquee"): NodeListOf; - getElementsByTagName(tagname: "mask"): NodeListOf; - getElementsByTagName(tagname: "menu"): NodeListOf; - getElementsByTagName(tagname: "meta"): NodeListOf; - getElementsByTagName(tagname: "metadata"): NodeListOf; - getElementsByTagName(tagname: "meter"): NodeListOf; - getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; - getElementsByTagName(tagname: "noframes"): NodeListOf; - getElementsByTagName(tagname: "noscript"): NodeListOf; - getElementsByTagName(tagname: "object"): NodeListOf; - getElementsByTagName(tagname: "ol"): NodeListOf; - getElementsByTagName(tagname: "optgroup"): NodeListOf; - getElementsByTagName(tagname: "option"): NodeListOf; - getElementsByTagName(tagname: "p"): NodeListOf; - getElementsByTagName(tagname: "param"): NodeListOf; - getElementsByTagName(tagname: "path"): NodeListOf; - getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "picture"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; - getElementsByTagName(tagname: "polygon"): NodeListOf; - getElementsByTagName(tagname: "polyline"): NodeListOf; - getElementsByTagName(tagname: "pre"): NodeListOf; - getElementsByTagName(tagname: "progress"): NodeListOf; - getElementsByTagName(tagname: "q"): NodeListOf; - getElementsByTagName(tagname: "radialgradient"): NodeListOf; - getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; - getElementsByTagName(tagname: "script"): NodeListOf; - getElementsByTagName(tagname: "section"): NodeListOf; - getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; - getElementsByTagName(tagname: "source"): NodeListOf; - getElementsByTagName(tagname: "span"): NodeListOf; - getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; - getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; - getElementsByTagName(tagname: "svg"): NodeListOf; - getElementsByTagName(tagname: "switch"): NodeListOf; - getElementsByTagName(tagname: "symbol"): NodeListOf; - getElementsByTagName(tagname: "table"): NodeListOf; - getElementsByTagName(tagname: "tbody"): NodeListOf; - getElementsByTagName(tagname: "td"): NodeListOf; - getElementsByTagName(tagname: "template"): NodeListOf; - getElementsByTagName(tagname: "text"): NodeListOf; - getElementsByTagName(tagname: "textpath"): NodeListOf; - getElementsByTagName(tagname: "textarea"): NodeListOf; - getElementsByTagName(tagname: "tfoot"): NodeListOf; - getElementsByTagName(tagname: "th"): NodeListOf; - getElementsByTagName(tagname: "thead"): NodeListOf; - getElementsByTagName(tagname: "title"): NodeListOf; - getElementsByTagName(tagname: "tr"): NodeListOf; - getElementsByTagName(tagname: "track"): NodeListOf; - getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; - getElementsByTagName(tagname: "ul"): NodeListOf; - getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; - getElementsByTagName(tagname: "video"): NodeListOf; - getElementsByTagName(tagname: "view"): NodeListOf; - getElementsByTagName(tagname: "wbr"): NodeListOf; - getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; - getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. - */ - getSelection(): Selection; - /** - * Gets a value indicating whether the object currently has focus. - */ - hasFocus(): boolean; - importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeListOf; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. - */ - queryCommandEnabled(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. - */ - queryCommandIndeterm(commandId: string): boolean; - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. - */ - queryCommandState(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. - */ - queryCommandSupported(commandId: string): boolean; - /** - * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. - */ - queryCommandText(commandId: string): string; - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. - */ - queryCommandValue(commandId: string): string; - releaseEvents(): void; - /** - * Allows updating the print settings for the page. - */ - updateSettings(): void; - webkitCancelFullScreen(): void; - webkitExitFullscreen(): void; - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. - */ - write(...content: string[]): void; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...content: string[]): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var Document: { - prototype: Document; - new(): Document; -} - -interface DocumentFragment extends Node, NodeSelector, ParentNode { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DocumentFragment: { - prototype: DocumentFragment; - new(): DocumentFragment; -} - -interface DocumentType extends Node, ChildNode { - readonly entities: NamedNodeMap; - readonly internalSubset: string | null; - readonly name: string; - readonly notations: NamedNodeMap; - readonly publicId: string | null; - readonly systemId: string | null; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DocumentType: { - prototype: DocumentType; - new(): DocumentType; -} - -interface DragEvent extends MouseEvent { - readonly dataTransfer: DataTransfer; - initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; - msConvertURL(file: File, targetType: string, targetURL?: string): void; -} - -declare var DragEvent: { - prototype: DragEvent; - new(): DragEvent; -} - -interface DynamicsCompressorNode extends AudioNode { - readonly attack: AudioParam; - readonly knee: AudioParam; - readonly ratio: AudioParam; - readonly reduction: AudioParam; - readonly release: AudioParam; - readonly threshold: AudioParam; -} - -declare var DynamicsCompressorNode: { - prototype: DynamicsCompressorNode; - new(): DynamicsCompressorNode; -} - -interface EXT_frag_depth { -} - -declare var EXT_frag_depth: { - prototype: EXT_frag_depth; - new(): EXT_frag_depth; -} - -interface EXT_texture_filter_anisotropic { - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -declare var EXT_texture_filter_anisotropic: { - prototype: EXT_texture_filter_anisotropic; - new(): EXT_texture_filter_anisotropic; - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { - readonly classList: DOMTokenList; - className: string; - readonly clientHeight: number; - readonly clientLeft: number; - readonly clientTop: number; - readonly clientWidth: number; - id: string; - msContentZoomFactor: number; - readonly msRegionOverflow: string; - onariarequest: (this: this, ev: AriaRequestEvent) => any; - oncommand: (this: this, ev: CommandEvent) => any; - ongotpointercapture: (this: this, ev: PointerEvent) => any; - onlostpointercapture: (this: this, ev: PointerEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmslostpointercapture: (this: this, ev: MSPointerEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; - readonly prefix: string | null; - readonly scrollHeight: number; - scrollLeft: number; - scrollTop: number; - readonly scrollWidth: number; - readonly tagName: string; - innerHTML: string; - getAttribute(name: string): string | null; - getAttributeNS(namespaceURI: string, localName: string): string; - getAttributeNode(name: string): Attr; - getAttributeNodeNS(namespaceURI: string, localName: string): Attr; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; - getElementsByTagName(name: "applet"): NodeListOf; - getElementsByTagName(name: "area"): NodeListOf; - getElementsByTagName(name: "article"): NodeListOf; - getElementsByTagName(name: "aside"): NodeListOf; - getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; - getElementsByTagName(name: "base"): NodeListOf; - getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; - getElementsByTagName(name: "body"): NodeListOf; - getElementsByTagName(name: "br"): NodeListOf; - getElementsByTagName(name: "button"): NodeListOf; - getElementsByTagName(name: "canvas"): NodeListOf; - getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; - getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; - getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; - getElementsByTagName(name: "col"): NodeListOf; - getElementsByTagName(name: "colgroup"): NodeListOf; - getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; - getElementsByTagName(name: "defs"): NodeListOf; - getElementsByTagName(name: "del"): NodeListOf; - getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; - getElementsByTagName(name: "dir"): NodeListOf; - getElementsByTagName(name: "div"): NodeListOf; - getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; - getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; - getElementsByTagName(name: "embed"): NodeListOf; - getElementsByTagName(name: "feblend"): NodeListOf; - getElementsByTagName(name: "fecolormatrix"): NodeListOf; - getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(name: "fecomposite"): NodeListOf; - getElementsByTagName(name: "feconvolvematrix"): NodeListOf; - getElementsByTagName(name: "fediffuselighting"): NodeListOf; - getElementsByTagName(name: "fedisplacementmap"): NodeListOf; - getElementsByTagName(name: "fedistantlight"): NodeListOf; - getElementsByTagName(name: "feflood"): NodeListOf; - getElementsByTagName(name: "fefunca"): NodeListOf; - getElementsByTagName(name: "fefuncb"): NodeListOf; - getElementsByTagName(name: "fefuncg"): NodeListOf; - getElementsByTagName(name: "fefuncr"): NodeListOf; - getElementsByTagName(name: "fegaussianblur"): NodeListOf; - getElementsByTagName(name: "feimage"): NodeListOf; - getElementsByTagName(name: "femerge"): NodeListOf; - getElementsByTagName(name: "femergenode"): NodeListOf; - getElementsByTagName(name: "femorphology"): NodeListOf; - getElementsByTagName(name: "feoffset"): NodeListOf; - getElementsByTagName(name: "fepointlight"): NodeListOf; - getElementsByTagName(name: "fespecularlighting"): NodeListOf; - getElementsByTagName(name: "fespotlight"): NodeListOf; - getElementsByTagName(name: "fetile"): NodeListOf; - getElementsByTagName(name: "feturbulence"): NodeListOf; - getElementsByTagName(name: "fieldset"): NodeListOf; - getElementsByTagName(name: "figcaption"): NodeListOf; - getElementsByTagName(name: "figure"): NodeListOf; - getElementsByTagName(name: "filter"): NodeListOf; - getElementsByTagName(name: "font"): NodeListOf; - getElementsByTagName(name: "footer"): NodeListOf; - getElementsByTagName(name: "foreignobject"): NodeListOf; - getElementsByTagName(name: "form"): NodeListOf; - getElementsByTagName(name: "frame"): NodeListOf; - getElementsByTagName(name: "frameset"): NodeListOf; - getElementsByTagName(name: "g"): NodeListOf; - getElementsByTagName(name: "h1"): NodeListOf; - getElementsByTagName(name: "h2"): NodeListOf; - getElementsByTagName(name: "h3"): NodeListOf; - getElementsByTagName(name: "h4"): NodeListOf; - getElementsByTagName(name: "h5"): NodeListOf; - getElementsByTagName(name: "h6"): NodeListOf; - getElementsByTagName(name: "head"): NodeListOf; - getElementsByTagName(name: "header"): NodeListOf; - getElementsByTagName(name: "hgroup"): NodeListOf; - getElementsByTagName(name: "hr"): NodeListOf; - getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; - getElementsByTagName(name: "iframe"): NodeListOf; - getElementsByTagName(name: "image"): NodeListOf; - getElementsByTagName(name: "img"): NodeListOf; - getElementsByTagName(name: "input"): NodeListOf; - getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; - getElementsByTagName(name: "label"): NodeListOf; - getElementsByTagName(name: "legend"): NodeListOf; - getElementsByTagName(name: "li"): NodeListOf; - getElementsByTagName(name: "line"): NodeListOf; - getElementsByTagName(name: "lineargradient"): NodeListOf; - getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; - getElementsByTagName(name: "map"): NodeListOf; - getElementsByTagName(name: "mark"): NodeListOf; - getElementsByTagName(name: "marker"): NodeListOf; - getElementsByTagName(name: "marquee"): NodeListOf; - getElementsByTagName(name: "mask"): NodeListOf; - getElementsByTagName(name: "menu"): NodeListOf; - getElementsByTagName(name: "meta"): NodeListOf; - getElementsByTagName(name: "metadata"): NodeListOf; - getElementsByTagName(name: "meter"): NodeListOf; - getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; - getElementsByTagName(name: "noframes"): NodeListOf; - getElementsByTagName(name: "noscript"): NodeListOf; - getElementsByTagName(name: "object"): NodeListOf; - getElementsByTagName(name: "ol"): NodeListOf; - getElementsByTagName(name: "optgroup"): NodeListOf; - getElementsByTagName(name: "option"): NodeListOf; - getElementsByTagName(name: "p"): NodeListOf; - getElementsByTagName(name: "param"): NodeListOf; - getElementsByTagName(name: "path"): NodeListOf; - getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "picture"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; - getElementsByTagName(name: "polygon"): NodeListOf; - getElementsByTagName(name: "polyline"): NodeListOf; - getElementsByTagName(name: "pre"): NodeListOf; - getElementsByTagName(name: "progress"): NodeListOf; - getElementsByTagName(name: "q"): NodeListOf; - getElementsByTagName(name: "radialgradient"): NodeListOf; - getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; - getElementsByTagName(name: "script"): NodeListOf; - getElementsByTagName(name: "section"): NodeListOf; - getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; - getElementsByTagName(name: "source"): NodeListOf; - getElementsByTagName(name: "span"): NodeListOf; - getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; - getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; - getElementsByTagName(name: "svg"): NodeListOf; - getElementsByTagName(name: "switch"): NodeListOf; - getElementsByTagName(name: "symbol"): NodeListOf; - getElementsByTagName(name: "table"): NodeListOf; - getElementsByTagName(name: "tbody"): NodeListOf; - getElementsByTagName(name: "td"): NodeListOf; - getElementsByTagName(name: "template"): NodeListOf; - getElementsByTagName(name: "text"): NodeListOf; - getElementsByTagName(name: "textpath"): NodeListOf; - getElementsByTagName(name: "textarea"): NodeListOf; - getElementsByTagName(name: "tfoot"): NodeListOf; - getElementsByTagName(name: "th"): NodeListOf; - getElementsByTagName(name: "thead"): NodeListOf; - getElementsByTagName(name: "title"): NodeListOf; - getElementsByTagName(name: "tr"): NodeListOf; - getElementsByTagName(name: "track"): NodeListOf; - getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; - getElementsByTagName(name: "ul"): NodeListOf; - getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; - getElementsByTagName(name: "video"): NodeListOf; - getElementsByTagName(name: "view"): NodeListOf; - getElementsByTagName(name: "wbr"): NodeListOf; - getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; - getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - hasAttribute(name: string): boolean; - hasAttributeNS(namespaceURI: string, localName: string): boolean; - msGetRegionContent(): MSRangeCollection; - msGetUntransformedBounds(): ClientRect; - msMatchesSelector(selectors: string): boolean; - msReleasePointerCapture(pointerId: number): void; - msSetPointerCapture(pointerId: number): void; - msZoomTo(args: MsZoomToOptions): void; - releasePointerCapture(pointerId: number): void; - removeAttribute(name?: string): void; - removeAttributeNS(namespaceURI: string, localName: string): void; - removeAttributeNode(oldAttr: Attr): Attr; - requestFullscreen(): void; - requestPointerLock(): void; - setAttribute(name: string, value: string): void; - setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; - setAttributeNode(newAttr: Attr): Attr; - setAttributeNodeNS(newAttr: Attr): Attr; - setPointerCapture(pointerId: number): void; - webkitMatchesSelector(selectors: string): boolean; - webkitRequestFullScreen(): void; - webkitRequestFullscreen(): void; - getElementsByClassName(classNames: string): NodeListOf; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var Element: { - prototype: Element; - new(): Element; -} - -interface ErrorEvent extends Event { - readonly colno: number; - readonly error: any; - readonly filename: string; - readonly lineno: number; - readonly message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(): ErrorEvent; -} - -interface Event { - readonly bubbles: boolean; - cancelBubble: boolean; - readonly cancelable: boolean; - readonly currentTarget: EventTarget; - readonly defaultPrevented: boolean; - readonly eventPhase: number; - readonly isTrusted: boolean; - returnValue: boolean; - readonly srcElement: Element | null; - readonly target: EventTarget; - readonly timeStamp: number; - readonly type: string; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - preventDefault(): void; - stopImmediatePropagation(): void; - stopPropagation(): void; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -interface EventTarget { - addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -} - -interface External { -} - -declare var External: { - prototype: External; - new(): External; -} - -interface File extends Blob { - readonly lastModifiedDate: any; - readonly name: string; - readonly webkitRelativePath: string; -} - -declare var File: { - prototype: File; - new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; -} - -interface FileList { - readonly length: number; - item(index: number): File; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -} - -interface FileReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; -} - -interface FocusEvent extends UIEvent { - readonly relatedTarget: EventTarget; - initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; -} - -declare var FocusEvent: { - prototype: FocusEvent; - new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; -} - -interface FormData { - append(name: any, value: any, blobName?: string): void; -} - -declare var FormData: { - prototype: FormData; - new (form?: HTMLFormElement): FormData; -} - -interface GainNode extends AudioNode { - readonly gain: AudioParam; -} - -declare var GainNode: { - prototype: GainNode; - new(): GainNode; -} - -interface Gamepad { - readonly axes: number[]; - readonly buttons: GamepadButton[]; - readonly connected: boolean; - readonly id: string; - readonly index: number; - readonly mapping: string; - readonly timestamp: number; -} - -declare var Gamepad: { - prototype: Gamepad; - new(): Gamepad; -} - -interface GamepadButton { - readonly pressed: boolean; - readonly value: number; -} - -declare var GamepadButton: { - prototype: GamepadButton; - new(): GamepadButton; -} - -interface GamepadEvent extends Event { - readonly gamepad: Gamepad; -} - -declare var GamepadEvent: { - prototype: GamepadEvent; - new(): GamepadEvent; -} - -interface Geolocation { - clearWatch(watchId: number): void; - getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; - watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; -} - -declare var Geolocation: { - prototype: Geolocation; - new(): Geolocation; -} - -interface HTMLAllCollection extends HTMLCollection { - namedItem(name: string): Element; -} - -declare var HTMLAllCollection: { - prototype: HTMLAllCollection; - new(): HTMLAllCollection; -} - -interface HTMLAnchorElement extends HTMLElement { - Methods: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Contains the anchor portion of the URL including the hash sign (#). - */ - hash: string; - /** - * Contains the hostname and port values of the URL. - */ - host: string; - /** - * Contains the hostname of a URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - readonly mimeType: string; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - readonly nameProp: string; - /** - * Contains the pathname of the URL. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Contains the protocol of the URL. - */ - protocol: string; - readonly protocolLong: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - type: string; - urn: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} - -declare var HTMLAnchorElement: { - prototype: HTMLAnchorElement; - new(): HTMLAnchorElement; -} - -interface HTMLAppletElement extends HTMLElement { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - /** - * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. - */ - declare: boolean; - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - object: string | null; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - vspace: number; - width: number; -} - -declare var HTMLAppletElement: { - prototype: HTMLAppletElement; - new(): HTMLAppletElement; -} - -interface HTMLAreaElement extends HTMLElement { - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Sets or retrieves the subsection of the href property that follows the number sign (#). - */ - hash: string; - /** - * Sets or retrieves the hostname and port number of the location or URL. - */ - host: string; - /** - * Sets or retrieves the host name part of the location or URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or gets whether clicks in this region cause action. - */ - noHref: boolean; - /** - * Sets or retrieves the file name or path specified by the object. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Sets or retrieves the protocol portion of a URL. - */ - protocol: string; - rel: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} - -declare var HTMLAreaElement: { - prototype: HTMLAreaElement; - new(): HTMLAreaElement; -} - -interface HTMLAreasCollection extends HTMLCollection { - /** - * Adds an element to the areas, controlRange, or options collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Removes an element from the collection. - */ - remove(index?: number): void; -} - -declare var HTMLAreasCollection: { - prototype: HTMLAreasCollection; - new(): HTMLAreasCollection; -} - -interface HTMLAudioElement extends HTMLMediaElement { -} - -declare var HTMLAudioElement: { - prototype: HTMLAudioElement; - new(): HTMLAudioElement; -} - -interface HTMLBRElement extends HTMLElement { - /** - * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. - */ - clear: string; -} - -declare var HTMLBRElement: { - prototype: HTMLBRElement; - new(): HTMLBRElement; -} - -interface HTMLBaseElement extends HTMLElement { - /** - * Gets or sets the baseline URL on which relative links are based. - */ - href: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; -} - -declare var HTMLBaseElement: { - prototype: HTMLBaseElement; - new(): HTMLBaseElement; -} - -interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - /** - * Sets or retrieves the font size of the object. - */ - size: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseFontElement: { - prototype: HTMLBaseFontElement; - new(): HTMLBaseFontElement; -} - -interface HTMLBodyElement extends HTMLElement { - aLink: any; - background: string; - bgColor: any; - bgProperties: string; - link: any; - noWrap: boolean; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; - text: any; - vLink: any; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLBodyElement: { - prototype: HTMLBodyElement; - new(): HTMLBodyElement; -} - -interface HTMLButtonElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - status: any; - /** - * Gets the classification and default behavior of the button. - */ - type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the default or selected value of the control. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -declare var HTMLButtonElement: { - prototype: HTMLButtonElement; - new(): HTMLButtonElement; -} - -interface HTMLCanvasElement extends HTMLElement { - /** - * Gets or sets the height of a canvas element on a document. - */ - height: number; - /** - * Gets or sets the width of a canvas element on a document. - */ - width: number; - /** - * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. - * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); - */ - getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; - getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; - getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; - /** - * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. - */ - msToBlob(): Blob; - /** - * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. - * @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, type?: string, ...arguments: any[]): void; -} - -declare var HTMLCanvasElement: { - prototype: HTMLCanvasElement; - new(): HTMLCanvasElement; -} - -interface HTMLCollection { - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Retrieves an object from various collections. - */ - item(index: number): Element; - /** - * Retrieves a select object or an object from an options collection. - */ - namedItem(name: string): Element; - [index: number]: Element; -} - -declare var HTMLCollection: { - prototype: HTMLCollection; - new(): HTMLCollection; -} - -interface HTMLDListElement extends HTMLElement { - compact: boolean; -} - -declare var HTMLDListElement: { - prototype: HTMLDListElement; - new(): HTMLDListElement; -} - -interface HTMLDataListElement extends HTMLElement { - options: HTMLCollectionOf; -} - -declare var HTMLDataListElement: { - prototype: HTMLDataListElement; - new(): HTMLDataListElement; -} - -interface HTMLDirectoryElement extends HTMLElement { - compact: boolean; -} - -declare var HTMLDirectoryElement: { - prototype: HTMLDirectoryElement; - new(): HTMLDirectoryElement; -} - -interface HTMLDivElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDivElement: { - prototype: HTMLDivElement; - new(): HTMLDivElement; -} - -interface HTMLDocument extends Document { -} - -declare var HTMLDocument: { - prototype: HTMLDocument; - new(): HTMLDocument; -} - -interface HTMLElement extends Element { - accessKey: string; - readonly children: HTMLCollection; - contentEditable: string; - readonly dataset: DOMStringMap; - dir: string; - draggable: boolean; - hidden: boolean; - hideFocus: boolean; - innerHTML: string; - innerText: string; - readonly isContentEditable: boolean; - lang: string; - readonly offsetHeight: number; - readonly offsetLeft: number; - readonly offsetParent: Element; - readonly offsetTop: number; - readonly offsetWidth: number; - onabort: (this: this, ev: UIEvent) => any; - onactivate: (this: this, ev: UIEvent) => any; - onbeforeactivate: (this: this, ev: UIEvent) => any; - onbeforecopy: (this: this, ev: ClipboardEvent) => any; - onbeforecut: (this: this, ev: ClipboardEvent) => any; - onbeforedeactivate: (this: this, ev: UIEvent) => any; - onbeforepaste: (this: this, ev: ClipboardEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - oncopy: (this: this, ev: ClipboardEvent) => any; - oncuechange: (this: this, ev: Event) => any; - oncut: (this: this, ev: ClipboardEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondeactivate: (this: this, ev: UIEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onpaste: (this: this, ev: ClipboardEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreset: (this: this, ev: Event) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onselectstart: (this: this, ev: Event) => any; - onstalled: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; - outerHTML: string; - outerText: string; - spellcheck: boolean; - readonly style: CSSStyleDeclaration; - tabIndex: number; - title: string; - blur(): void; - click(): void; - dragDrop(): boolean; - focus(): void; - msGetInputContext(): MSInputMethodContext; - 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLElement: { - prototype: HTMLElement; - new(): HTMLElement; -} - -interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves the height of the object. - */ - height: string; - hidden: any; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the palette used for the embedded document. - */ - readonly palette: string; - /** - * Retrieves the URL of the plug-in used to view an embedded document. - */ - readonly pluginspage: string; - readonly readyState: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the height and width units of the embed object. - */ - units: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLEmbedElement: { - prototype: HTMLEmbedElement; - new(): HTMLEmbedElement; -} - -interface HTMLFieldSetElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -declare var HTMLFieldSetElement: { - prototype: HTMLFieldSetElement; - new(): HTMLFieldSetElement; -} - -interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFontElement: { - prototype: HTMLFontElement; - new(): HTMLFontElement; -} - -interface HTMLFormElement extends HTMLElement { - /** - * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. - */ - acceptCharset: string; - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Retrieves a collection, in source order, of all controls in a given form. - */ - readonly elements: HTMLCollection; - /** - * Sets or retrieves the MIME encoding for the form. - */ - encoding: string; - /** - * Sets or retrieves the encoding type for the form. - */ - enctype: string; - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Sets or retrieves how to send the form data to the server. - */ - method: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Designates a form that is not validated when submitted. - */ - noValidate: boolean; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a form object or an object from an elements collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a form object or an object from an elements collection. - */ - namedItem(name: string): any; - /** - * Fires when the user resets a form. - */ - reset(): void; - /** - * Fires when a FORM is about to be submitted. - */ - submit(): void; - [name: string]: any; -} - -declare var HTMLFormElement: { - prototype: HTMLFormElement; - new(): HTMLFormElement; -} - -interface HTMLFrameElement extends HTMLElement, GetSVGDocument { - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string | number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: this, ev: Event) => any; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the width of the object. - */ - width: string | number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLFrameElement: { - prototype: HTMLFrameElement; - new(): HTMLFrameElement; -} - -interface HTMLFrameSetElement extends HTMLElement { - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the frame widths of the object. - */ - cols: string; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - name: string; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object loses the input focus. - */ - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - */ - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; - /** - * Sets or retrieves the frame heights of the object. - */ - rows: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLFrameSetElement: { - prototype: HTMLFrameSetElement; - new(): HTMLFrameSetElement; -} - -interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. - */ - noShade: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHRElement: { - prototype: HTMLHRElement; - new(): HTMLHRElement; -} - -interface HTMLHeadElement extends HTMLElement { - profile: string; -} - -declare var HTMLHeadElement: { - prototype: HTMLHeadElement; - new(): HTMLHeadElement; -} - -interface HTMLHeadingElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; -} - -declare var HTMLHeadingElement: { - prototype: HTMLHeadingElement; - new(): HTMLHeadingElement; -} - -interface HTMLHtmlElement extends HTMLElement { - /** - * Sets or retrieves the DTD version that governs the current document. - */ - version: string; -} - -declare var HTMLHtmlElement: { - prototype: HTMLHtmlElement; - new(): HTMLHtmlElement; -} - -interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - allowFullscreen: boolean; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the horizontal margin for the object. - */ - hspace: number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: this, ev: Event) => any; - readonly sandbox: DOMSettableTokenList; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLIFrameElement: { - prototype: HTMLIFrameElement; - new(): HTMLIFrameElement; -} - -interface HTMLImageElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - crossOrigin: string; - readonly currentSrc: string; - /** - * Sets or retrieves the height of the object. - */ - height: number; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - /** - * Sets or retrieves whether the image is a server-side image map. - */ - isMap: boolean; - /** - * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. - */ - longDesc: string; - lowsrc: string; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * The original height of the image resource before sizing. - */ - readonly naturalHeight: number; - /** - * The original width of the image resource before sizing. - */ - readonly naturalWidth: number; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: number; - readonly x: number; - readonly y: number; - msGetAsCastingSource(): any; -} - -declare var HTMLImageElement: { - prototype: HTMLImageElement; - new(): HTMLImageElement; - create(): HTMLImageElement; -} - -interface HTMLInputElement extends HTMLElement { - /** - * Sets or retrieves a comma-separated list of content types. - */ - accept: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the state of the check box or radio button. - */ - checked: boolean; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - /** - * Sets or retrieves the state of the check box or radio button. - */ - defaultChecked: boolean; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Returns a FileList object on a file type input object. - */ - readonly files: FileList | null; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - indeterminate: boolean; - /** - * Specifies the ID of a pre-defined datalist of options for an input element. - */ - readonly list: HTMLElement; - /** - * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. - */ - max: string; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. - */ - min: string; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a string containing a regular expression that the user's input must match. - */ - pattern: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - selectionDirection: string; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - size: number; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - status: boolean; - /** - * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. - */ - step: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns the value of the data at the cursor's current position. - */ - value: string; - valueAsDate: Date; - /** - * Returns the input field value as a number. - */ - valueAsNumber: number; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - webkitdirectory: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Makes the selection equal to the current object. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start?: number, end?: number, direction?: string): void; - /** - * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. - * @param n Value to decrement the value by. - */ - stepDown(n?: number): void; - /** - * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. - * @param n Value to increment the value by. - */ - stepUp(n?: number): void; -} - -declare var HTMLInputElement: { - prototype: HTMLInputElement; - new(): HTMLInputElement; -} - -interface HTMLLIElement extends HTMLElement { - type: string; - /** - * Sets or retrieves the value of a list item. - */ - value: number; -} - -declare var HTMLLIElement: { - prototype: HTMLLIElement; - new(): HTMLLIElement; -} - -interface HTMLLabelElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the object to which the given label object is assigned. - */ - htmlFor: string; -} - -declare var HTMLLabelElement: { - prototype: HTMLLabelElement; - new(): HTMLLabelElement; -} - -interface HTMLLegendElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - align: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; -} - -declare var HTMLLegendElement: { - prototype: HTMLLegendElement; - new(): HTMLLegendElement; -} - -interface HTMLLinkElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - disabled: boolean; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - import?: Document; - integrity: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLinkElement: { - prototype: HTMLLinkElement; - new(): HTMLLinkElement; -} - -interface HTMLMapElement extends HTMLElement { - /** - * Retrieves a collection of the area objects defined for the given map object. - */ - readonly areas: HTMLAreasCollection; - /** - * Sets or retrieves the name of the object. - */ - name: string; -} - -declare var HTMLMapElement: { - prototype: HTMLMapElement; - new(): HTMLMapElement; -} - -interface HTMLMarqueeElement extends HTMLElement { - behavior: string; - bgColor: any; - direction: string; - height: string; - hspace: number; - loop: number; - onbounce: (this: this, ev: Event) => any; - onfinish: (this: this, ev: Event) => any; - onstart: (this: this, ev: Event) => any; - scrollAmount: number; - scrollDelay: number; - trueSpeed: boolean; - vspace: number; - width: string; - start(): void; - stop(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLMarqueeElement: { - prototype: HTMLMarqueeElement; - new(): HTMLMarqueeElement; -} - -interface HTMLMediaElement extends HTMLElement { - /** - * Returns an AudioTrackList object with the audio tracks for a given video element. - */ - readonly audioTracks: AudioTrackList; - /** - * Gets or sets a value that indicates whether to start playing the media automatically. - */ - autoplay: boolean; - /** - * Gets a collection of buffered time ranges. - */ - readonly buffered: TimeRanges; - /** - * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). - */ - controls: boolean; - crossOrigin: string; - /** - * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. - */ - readonly currentSrc: string; - /** - * Gets or sets the current playback position, in seconds. - */ - currentTime: number; - defaultMuted: boolean; - /** - * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. - */ - defaultPlaybackRate: number; - /** - * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. - */ - readonly duration: number; - /** - * Gets information about whether the playback has ended or not. - */ - readonly ended: boolean; - /** - * Returns an object representing the current error state of the audio or video element. - */ - readonly error: MediaError; - /** - * Gets or sets a flag to specify whether playback should restart after it completes. - */ - loop: boolean; - readonly mediaKeys: MediaKeys | null; - /** - * Specifies the purpose of the audio or video media, such as background audio or alerts. - */ - msAudioCategory: string; - /** - * Specifies the output device id that the audio will be sent to. - */ - msAudioDeviceType: string; - readonly msGraphicsTrustStatus: MSGraphicsTrust; - /** - * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. - */ - readonly msKeys: MSMediaKeys; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Specifies whether or not to enable low-latency playback on the media element. - */ - msRealTime: boolean; - /** - * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. - */ - muted: boolean; - /** - * Gets the current network activity for the element. - */ - readonly networkState: number; - onencrypted: (this: this, ev: MediaEncryptedEvent) => any; - onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any; - /** - * Gets a flag that specifies whether playback is paused. - */ - readonly paused: boolean; - /** - * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. - */ - playbackRate: number; - /** - * Gets TimeRanges for the current media resource that has been played. - */ - readonly played: TimeRanges; - /** - * Gets or sets the current playback position, in seconds. - */ - preload: string; - readyState: number; - /** - * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. - */ - readonly seekable: TimeRanges; - /** - * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. - */ - readonly seeking: boolean; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcObject: MediaStream | null; - readonly textTracks: TextTrackList; - readonly videoTracks: VideoTrackList; - /** - * Gets or sets the volume level for audio portions of the media element. - */ - volume: number; - addTextTrack(kind: string, label?: string, language?: string): TextTrack; - /** - * Returns a string that specifies whether the client can play a given media resource type. - */ - canPlayType(type: string): string; - /** - * Resets the audio or video object and loads a new media resource. - */ - load(): void; - /** - * Clears all effects from the media pipeline. - */ - msClearEffects(): void; - msGetAsCastingSource(): any; - /** - * Inserts the specified audio effect into media pipeline. - */ - msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetMediaKeys(mediaKeys: MSMediaKeys): void; - /** - * Specifies the media protection manager for a given media pipeline. - */ - msSetMediaProtectionManager(mediaProtectionManager?: any): void; - /** - * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. - */ - pause(): void; - /** - * Loads and starts playback of a media resource. - */ - play(): void; - setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLMediaElement: { - prototype: HTMLMediaElement; - new(): HTMLMediaElement; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; -} - -interface HTMLMenuElement extends HTMLElement { - compact: boolean; - type: string; -} - -declare var HTMLMenuElement: { - prototype: HTMLMenuElement; - new(): HTMLMenuElement; -} - -interface HTMLMetaElement extends HTMLElement { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Gets or sets meta-information to associate with httpEquiv or name. - */ - content: string; - /** - * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. - */ - httpEquiv: string; - /** - * Sets or retrieves the value specified in the content attribute of the meta object. - */ - name: string; - /** - * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. - */ - scheme: string; - /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. - */ - url: string; -} - -declare var HTMLMetaElement: { - prototype: HTMLMetaElement; - new(): HTMLMetaElement; -} - -interface HTMLMeterElement extends HTMLElement { - high: number; - low: number; - max: number; - min: number; - optimum: number; - value: number; -} - -declare var HTMLMeterElement: { - prototype: HTMLMeterElement; - new(): HTMLMeterElement; -} - -interface HTMLModElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; -} - -declare var HTMLModElement: { - prototype: HTMLModElement; - new(): HTMLModElement; -} - -interface HTMLOListElement extends HTMLElement { - compact: boolean; - /** - * The starting number. - */ - start: number; - type: string; -} - -declare var HTMLOListElement: { - prototype: HTMLOListElement; - new(): HTMLOListElement; -} - -interface HTMLObjectElement extends HTMLElement, GetSVGDocument { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - /** - * Sets or retrieves the URL of the file containing the compiled Java class. - */ - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - declare: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the contained object. - */ - readonly object: any; - readonly readyState: number; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLObjectElement: { - prototype: HTMLObjectElement; - new(): HTMLObjectElement; -} - -interface HTMLOptGroupElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - readonly text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; -} - -declare var HTMLOptGroupElement: { - prototype: HTMLOptGroupElement; - new(): HTMLOptGroupElement; -} - -interface HTMLOptionElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; -} - -declare var HTMLOptionElement: { - prototype: HTMLOptionElement; - new(): HTMLOptionElement; - create(): HTMLOptionElement; -} - -interface HTMLOptionsCollection extends HTMLCollectionOf { - length: number; - selectedIndex: number; - add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; - remove(index: number): void; -} - -declare var HTMLOptionsCollection: { - prototype: HTMLOptionsCollection; - new(): HTMLOptionsCollection; -} - -interface HTMLParagraphElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - clear: string; -} - -declare var HTMLParagraphElement: { - prototype: HTMLParagraphElement; - new(): HTMLParagraphElement; -} - -interface HTMLParamElement extends HTMLElement { - /** - * Sets or retrieves the name of an input parameter for an element. - */ - name: string; - /** - * Sets or retrieves the content type of the resource designated by the value attribute. - */ - type: string; - /** - * Sets or retrieves the value of an input parameter for an element. - */ - value: string; - /** - * Sets or retrieves the data type of the value attribute. - */ - valueType: string; -} - -declare var HTMLParamElement: { - prototype: HTMLParamElement; - new(): HTMLParamElement; -} - -interface HTMLPictureElement extends HTMLElement { -} - -declare var HTMLPictureElement: { - prototype: HTMLPictureElement; - new(): HTMLPictureElement; -} - -interface HTMLPreElement extends HTMLElement { - /** - * Sets or gets a value that you can use to implement your own width functionality for the object. - */ - width: number; -} - -declare var HTMLPreElement: { - prototype: HTMLPreElement; - new(): HTMLPreElement; -} - -interface HTMLProgressElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Defines the maximum, or "done" value for a progress element. - */ - max: number; - /** - * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). - */ - readonly position: number; - /** - * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. - */ - value: number; -} - -declare var HTMLProgressElement: { - prototype: HTMLProgressElement; - new(): HTMLProgressElement; -} - -interface HTMLQuoteElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; -} - -declare var HTMLQuoteElement: { - prototype: HTMLQuoteElement; - new(): HTMLQuoteElement; -} - -interface HTMLScriptElement extends HTMLElement { - async: boolean; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the status of the script. - */ - defer: boolean; - /** - * Sets or retrieves the event for which the script is written. - */ - event: string; - /** - * Sets or retrieves the object that is bound to the event script. - */ - htmlFor: string; - /** - * Retrieves the URL to an external file that contains the source code or data. - */ - src: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - /** - * Sets or retrieves the MIME type for the associated scripting engine. - */ - type: string; - integrity: string; -} - -declare var HTMLScriptElement: { - prototype: HTMLScriptElement; - new(): HTMLScriptElement; -} - -interface HTMLSelectElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - readonly options: HTMLOptionsCollection; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the index of the selected option in a select object. - */ - selectedIndex: number; - selectedOptions: HTMLCollectionOf; - /** - * Sets or retrieves the number of rows in the list box. - */ - size: number; - /** - * Retrieves the type of select control based on the value of the MULTIPLE attribute. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Adds an element to the areas, controlRange, or options collection. - * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a select object or an object from an options collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a select object or an object from an options collection. - * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. - */ - namedItem(name: string): any; - /** - * Removes an element from the collection. - * @param index Number that specifies the zero-based index of the element to remove from the collection. - */ - remove(index?: number): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - [name: string]: any; -} - -declare var HTMLSelectElement: { - prototype: HTMLSelectElement; - new(): HTMLSelectElement; -} - -interface HTMLSourceElement extends HTMLElement { - /** - * Gets or sets the intended media type of the media source. - */ - media: string; - msKeySystem: string; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Gets or sets the MIME type of a media resource. - */ - type: string; -} - -declare var HTMLSourceElement: { - prototype: HTMLSourceElement; - new(): HTMLSourceElement; -} - -interface HTMLSpanElement extends HTMLElement { -} - -declare var HTMLSpanElement: { - prototype: HTMLSpanElement; - new(): HTMLSpanElement; -} - -interface HTMLStyleElement extends HTMLElement, LinkStyle { - disabled: boolean; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Retrieves the CSS language in which the style sheet is written. - */ - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLStyleElement: { - prototype: HTMLStyleElement; - new(): HTMLStyleElement; -} - -interface HTMLTableCaptionElement extends HTMLElement { - /** - * Sets or retrieves the alignment of the caption or legend. - */ - align: string; - /** - * Sets or retrieves whether the caption appears at the top or bottom of the table. - */ - vAlign: string; -} - -declare var HTMLTableCaptionElement: { - prototype: HTMLTableCaptionElement; - new(): HTMLTableCaptionElement; -} - -interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves abbreviated text for the object. - */ - abbr: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. - */ - axis: string; - bgColor: any; - /** - * Retrieves the position of the object in the cells collection of a row. - */ - readonly cellIndex: number; - /** - * Sets or retrieves the number columns in the table that the object should span. - */ - colSpan: number; - /** - * Sets or retrieves a list of header cells that provide information for the object. - */ - headers: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - /** - * Sets or retrieves how many rows in a table the cell should span. - */ - rowSpan: number; - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCellElement: { - prototype: HTMLTableCellElement; - new(): HTMLTableCellElement; -} - -interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves the alignment of the object relative to the display or table. - */ - align: string; - /** - * Sets or retrieves the number of columns in the group. - */ - span: number; - /** - * Sets or retrieves the width of the object. - */ - width: any; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableColElement: { - prototype: HTMLTableColElement; - new(): HTMLTableColElement; -} - -interface HTMLTableDataCellElement extends HTMLTableCellElement { -} - -declare var HTMLTableDataCellElement: { - prototype: HTMLTableDataCellElement; - new(): HTMLTableDataCellElement; -} - -interface HTMLTableElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - bgColor: any; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the caption object of a table. - */ - caption: HTMLTableCaptionElement; - /** - * Sets or retrieves the amount of space between the border of the cell and the content of the cell. - */ - cellPadding: string; - /** - * Sets or retrieves the amount of space between cells in a table. - */ - cellSpacing: string; - /** - * Sets or retrieves the number of columns in the table. - */ - cols: number; - /** - * Sets or retrieves the way the border frame around the table is displayed. - */ - frame: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Sets or retrieves which dividing lines (inner borders) are displayed. - */ - rules: string; - /** - * Sets or retrieves a description and/or structure of the object. - */ - summary: string; - /** - * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. - */ - tBodies: HTMLCollectionOf; - /** - * Retrieves the tFoot object of the table. - */ - tFoot: HTMLTableSectionElement; - /** - * Retrieves the tHead object of the table. - */ - tHead: HTMLTableSectionElement; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Creates an empty caption element in the table. - */ - createCaption(): HTMLTableCaptionElement; - /** - * Creates an empty tBody element in the table. - */ - createTBody(): HTMLTableSectionElement; - /** - * Creates an empty tFoot element in the table. - */ - createTFoot(): HTMLTableSectionElement; - /** - * Returns the tHead element object if successful, or null otherwise. - */ - createTHead(): HTMLTableSectionElement; - /** - * Deletes the caption element and its contents from the table. - */ - deleteCaption(): void; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Deletes the tFoot element and its contents from the table. - */ - deleteTFoot(): void; - /** - * Deletes the tHead element and its contents from the table. - */ - deleteTHead(): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; -} - -declare var HTMLTableElement: { - prototype: HTMLTableElement; - new(): HTMLTableElement; -} - -interface HTMLTableHeaderCellElement extends HTMLTableCellElement { - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; -} - -declare var HTMLTableHeaderCellElement: { - prototype: HTMLTableHeaderCellElement; - new(): HTMLTableHeaderCellElement; -} - -interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - bgColor: any; - /** - * Retrieves a collection of all cells in the table row. - */ - cells: HTMLCollectionOf; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Retrieves the position of the object in the rows collection for the table. - */ - readonly rowIndex: number; - /** - * Retrieves the position of the object in the collection. - */ - readonly sectionRowIndex: number; - /** - * Removes the specified cell from the table row, as well as from the cells collection. - * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. - */ - deleteCell(index?: number): void; - /** - * Creates a new cell in the table row, and adds the cell to the cells collection. - * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. - */ - insertCell(index?: number): HTMLTableDataCellElement; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableRowElement: { - prototype: HTMLTableRowElement; - new(): HTMLTableRowElement; -} - -interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableSectionElement: { - prototype: HTMLTableSectionElement; - new(): HTMLTableSectionElement; -} - -interface HTMLTemplateElement extends HTMLElement { - readonly content: DocumentFragment; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - -interface HTMLTextAreaElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the object. - */ - cols: number; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - /** - * Sets or retrieves the value indicated whether the content of the object is read-only. - */ - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: number; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - /** - * Sets or retrieves the value indicating whether the control is selected. - */ - status: any; - /** - * Retrieves the type of control. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Retrieves or sets the text in the entry field of the textArea element. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Sets or retrieves how to handle wordwrapping in the object. - */ - wrap: string; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Highlights the input area of a form element. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; -} - -declare var HTMLTextAreaElement: { - prototype: HTMLTextAreaElement; - new(): HTMLTextAreaElement; -} - -interface HTMLTitleElement extends HTMLElement { - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; -} - -declare var HTMLTitleElement: { - prototype: HTMLTitleElement; - new(): HTMLTitleElement; -} - -interface HTMLTrackElement extends HTMLElement { - default: boolean; - kind: string; - label: string; - readonly readyState: number; - src: string; - srclang: string; - readonly track: TextTrack; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -declare var HTMLTrackElement: { - prototype: HTMLTrackElement; - new(): HTMLTrackElement; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -interface HTMLUListElement extends HTMLElement { - compact: boolean; - type: string; -} - -declare var HTMLUListElement: { - prototype: HTMLUListElement; - new(): HTMLUListElement; -} - -interface HTMLUnknownElement extends HTMLElement { -} - -declare var HTMLUnknownElement: { - prototype: HTMLUnknownElement; - new(): HTMLUnknownElement; -} - -interface HTMLVideoElement extends HTMLMediaElement { - /** - * Gets or sets the height of the video element. - */ - height: number; - msHorizontalMirror: boolean; - readonly msIsLayoutOptimalForPlayback: boolean; - readonly msIsStereo3D: boolean; - msStereo3DPackingMode: string; - msStereo3DRenderMode: string; - msZoom: boolean; - onMSVideoFormatChanged: (this: this, ev: Event) => any; - onMSVideoFrameStepCompleted: (this: this, ev: Event) => any; - onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any; - /** - * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. - */ - poster: string; - /** - * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoHeight: number; - /** - * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoWidth: number; - readonly webkitDisplayingFullscreen: boolean; - readonly webkitSupportsFullscreen: boolean; - /** - * Gets or sets the width of the video element. - */ - width: number; - getVideoPlaybackQuality(): VideoPlaybackQuality; - msFrameStep(forward: boolean): void; - msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; - webkitEnterFullScreen(): void; - webkitEnterFullscreen(): void; - webkitExitFullScreen(): void; - webkitExitFullscreen(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLVideoElement: { - prototype: HTMLVideoElement; - new(): HTMLVideoElement; -} - -interface HashChangeEvent extends Event { - readonly newURL: string | null; - readonly oldURL: string | null; -} - -declare var HashChangeEvent: { - prototype: HashChangeEvent; - new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; -} - -interface History { - readonly length: number; - readonly state: any; - 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: { - prototype: History; - new(): History; -} - -interface IDBCursor { - readonly direction: string; - key: IDBKeyRange | IDBValidKey; - readonly primaryKey: any; - source: IDBObjectStore | IDBIndex; - advance(count: number): void; - continue(key?: IDBKeyRange | IDBValidKey): void; - delete(): IDBRequest; - update(value: any): IDBRequest; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -declare var IDBCursor: { - prototype: IDBCursor; - new(): IDBCursor; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -interface IDBCursorWithValue extends IDBCursor { - readonly value: any; -} - -declare var IDBCursorWithValue: { - prototype: IDBCursorWithValue; - new(): IDBCursorWithValue; -} - -interface IDBDatabase extends EventTarget { - readonly name: string; - readonly objectStoreNames: DOMStringList; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - version: number; - onversionchange: (ev: IDBVersionChangeEvent) => any; - close(): void; - createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; - deleteObjectStore(name: string): void; - transaction(storeNames: string | string[], mode?: string): IDBTransaction; - addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBDatabase: { - prototype: IDBDatabase; - new(): IDBDatabase; -} - -interface IDBFactory { - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; - open(name: string, version?: number): IDBOpenDBRequest; -} - -declare var IDBFactory: { - prototype: IDBFactory; - new(): IDBFactory; -} - -interface IDBIndex { - keyPath: string | string[]; - readonly name: string; - readonly objectStore: IDBObjectStore; - readonly unique: boolean; - multiEntry: boolean; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - get(key: IDBKeyRange | IDBValidKey): IDBRequest; - getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; -} - -declare var IDBIndex: { - prototype: IDBIndex; - new(): IDBIndex; -} - -interface IDBKeyRange { - readonly lower: any; - readonly lowerOpen: boolean; - readonly upper: any; - readonly upperOpen: boolean; -} - -declare var IDBKeyRange: { - prototype: IDBKeyRange; - new(): IDBKeyRange; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(lower: any, open?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - upperBound(upper: any, open?: boolean): IDBKeyRange; -} - -interface IDBObjectStore { - readonly indexNames: DOMStringList; - keyPath: string | string[]; - readonly name: string; - readonly transaction: IDBTransaction; - autoIncrement: boolean; - add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; - clear(): IDBRequest; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: IDBKeyRange | IDBValidKey): IDBRequest; - deleteIndex(indexName: string): void; - get(key: any): IDBRequest; - index(name: string): IDBIndex; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; -} - -declare var IDBObjectStore: { - prototype: IDBObjectStore; - new(): IDBObjectStore; -} - -interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: this, ev: Event) => any; - onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; - addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBOpenDBRequest: { - prototype: IDBOpenDBRequest; - new(): IDBOpenDBRequest; -} - -interface IDBRequest extends EventTarget { - readonly error: DOMError; - onerror: (this: this, ev: ErrorEvent) => any; - onsuccess: (this: this, ev: Event) => any; - readonly readyState: string; - readonly result: any; - source: IDBObjectStore | IDBIndex | IDBCursor; - readonly transaction: IDBTransaction; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBRequest: { - prototype: IDBRequest; - new(): IDBRequest; -} - -interface IDBTransaction extends EventTarget { - readonly db: IDBDatabase; - readonly error: DOMError; - readonly mode: string; - onabort: (this: this, ev: Event) => any; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBTransaction: { - prototype: IDBTransaction; - new(): IDBTransaction; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; -} - -interface IDBVersionChangeEvent extends Event { - readonly newVersion: number | null; - readonly oldVersion: number; -} - -declare var IDBVersionChangeEvent: { - prototype: IDBVersionChangeEvent; - new(): IDBVersionChangeEvent; -} - -interface ImageData { - data: Uint8ClampedArray; - readonly height: number; - readonly width: number; -} - -declare var ImageData: { - prototype: ImageData; - new(width: number, height: number): ImageData; - new(array: Uint8ClampedArray, width: number, height: number): ImageData; -} - -interface KeyboardEvent extends UIEvent { - readonly altKey: boolean; - readonly char: string | null; - readonly charCode: number; - readonly ctrlKey: boolean; - readonly key: string; - readonly keyCode: number; - readonly locale: string; - readonly location: number; - readonly metaKey: boolean; - 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; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -declare var KeyboardEvent: { - prototype: KeyboardEvent; - new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -interface ListeningStateChangedEvent extends Event { - readonly label: string; - readonly state: string; -} - -declare var ListeningStateChangedEvent: { - prototype: ListeningStateChangedEvent; - new(): ListeningStateChangedEvent; -} - -interface Location { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - pathname: string; - port: string; - protocol: string; - search: string; - assign(url: string): void; - reload(forcedReload?: boolean): void; - replace(url: string): void; - toString(): string; -} - -declare var Location: { - prototype: Location; - new(): Location; -} - -interface LongRunningScriptDetectedEvent extends Event { - readonly executionTime: number; - stopPageScriptExecution: boolean; -} - -declare var LongRunningScriptDetectedEvent: { - prototype: LongRunningScriptDetectedEvent; - new(): LongRunningScriptDetectedEvent; -} - -interface MSApp { - clearTemporaryWebDataAsync(): MSAppAsyncOperation; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createDataPackage(object: any): any; - createDataPackageFromSelection(): any; - createFileFromStorageFile(storageFile: any): File; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; - getViewId(view: any): any; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - pageHandlesAllApplicationActivations(enabled: boolean): void; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - terminateApp(exceptionObject: any): void; - readonly CURRENT: string; - readonly HIGH: string; - readonly IDLE: string; - readonly NORMAL: string; -} -declare var MSApp: MSApp; - -interface MSAppAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSAppAsyncOperation: { - prototype: MSAppAsyncOperation; - new(): MSAppAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; -} - -interface MSAssertion { - readonly id: string; - readonly type: string; -} - -declare var MSAssertion: { - prototype: MSAssertion; - new(): MSAssertion; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} - -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new(): MSBlobBuilder; -} - -interface MSCredentials { - getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; - makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; -} - -declare var MSCredentials: { - prototype: MSCredentials; - new(): MSCredentials; -} - -interface MSFIDOCredentialAssertion extends MSAssertion { - readonly algorithm: string | Algorithm; - readonly attestation: any; - readonly publicKey: string; - readonly transportHints: string[]; -} - -declare var MSFIDOCredentialAssertion: { - prototype: MSFIDOCredentialAssertion; - new(): MSFIDOCredentialAssertion; -} - -interface MSFIDOSignature { - readonly authnrData: string; - readonly clientData: string; - readonly signature: string; -} - -declare var MSFIDOSignature: { - prototype: MSFIDOSignature; - new(): MSFIDOSignature; -} - -interface MSFIDOSignatureAssertion extends MSAssertion { - readonly signature: MSFIDOSignature; -} - -declare var MSFIDOSignatureAssertion: { - prototype: MSFIDOSignatureAssertion; - new(): MSFIDOSignatureAssertion; -} - -interface MSGesture { - target: Element; - addPointer(pointerId: number): void; - stop(): void; -} - -declare var MSGesture: { - prototype: MSGesture; - new(): MSGesture; -} - -interface MSGestureEvent extends UIEvent { - readonly clientX: number; - readonly clientY: number; - readonly expansion: number; - readonly gestureObject: any; - readonly hwTimestamp: number; - readonly offsetX: number; - readonly offsetY: number; - readonly rotation: number; - readonly scale: number; - readonly screenX: number; - readonly screenY: number; - readonly translationX: number; - readonly translationY: number; - readonly velocityAngular: number; - readonly velocityExpansion: number; - readonly velocityX: number; - readonly velocityY: number; - initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -declare var MSGestureEvent: { - prototype: MSGestureEvent; - new(): MSGestureEvent; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -interface MSGraphicsTrust { - readonly constrictionActive: boolean; - readonly status: string; -} - -declare var MSGraphicsTrust: { - prototype: MSGraphicsTrust; - new(): MSGraphicsTrust; -} - -interface MSHTMLWebViewElement extends HTMLElement { - readonly canGoBack: boolean; - readonly canGoForward: boolean; - readonly containsFullScreenElement: boolean; - readonly documentTitle: string; - height: number; - readonly settings: MSWebViewSettings; - src: string; - width: number; - addWebAllowedObject(name: string, applicationObject: any): void; - buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; - capturePreviewToBlobAsync(): MSWebViewAsyncOperation; - captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; - getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; - getDeferredPermissionRequests(): DeferredPermissionRequest[]; - goBack(): void; - goForward(): void; - invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; - navigate(uri: string): void; - navigateToLocalStreamUri(source: string, streamResolver: any): void; - navigateToString(contents: string): void; - navigateWithHttpRequestMessage(requestMessage: any): void; - refresh(): void; - stop(): void; -} - -declare var MSHTMLWebViewElement: { - prototype: MSHTMLWebViewElement; - new(): MSHTMLWebViewElement; -} - -interface MSInputMethodContext extends EventTarget { - readonly compositionEndOffset: number; - readonly compositionStartOffset: number; - oncandidatewindowhide: (this: this, ev: Event) => any; - oncandidatewindowshow: (this: this, ev: Event) => any; - oncandidatewindowupdate: (this: this, ev: Event) => any; - readonly target: HTMLElement; - getCandidateWindowClientRect(): ClientRect; - getCompositionAlternatives(): string[]; - hasComposition(): boolean; - isCandidateWindowVisible(): boolean; - addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSInputMethodContext: { - prototype: MSInputMethodContext; - new(): MSInputMethodContext; -} - -interface MSManipulationEvent extends UIEvent { - readonly currentState: number; - readonly inertiaDestinationX: number; - readonly inertiaDestinationY: number; - readonly lastState: number; - initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -declare var MSManipulationEvent: { - prototype: MSManipulationEvent; - new(): MSManipulationEvent; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -interface MSMediaKeyError { - readonly code: number; - readonly systemCode: number; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -declare var MSMediaKeyError: { - prototype: MSMediaKeyError; - new(): MSMediaKeyError; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -interface MSMediaKeyMessageEvent extends Event { - readonly destinationURL: string | null; - readonly message: Uint8Array; -} - -declare var MSMediaKeyMessageEvent: { - prototype: MSMediaKeyMessageEvent; - new(): MSMediaKeyMessageEvent; -} - -interface MSMediaKeyNeededEvent extends Event { - readonly initData: Uint8Array | null; -} - -declare var MSMediaKeyNeededEvent: { - prototype: MSMediaKeyNeededEvent; - new(): MSMediaKeyNeededEvent; -} - -interface MSMediaKeySession extends EventTarget { - readonly error: MSMediaKeyError | null; - readonly keySystem: string; - readonly sessionId: string; - close(): void; - update(key: Uint8Array): void; -} - -declare var MSMediaKeySession: { - prototype: MSMediaKeySession; - new(): MSMediaKeySession; -} - -interface MSMediaKeys { - readonly keySystem: string; - createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; -} - -declare var MSMediaKeys: { - prototype: MSMediaKeys; - new(keySystem: string): MSMediaKeys; - isTypeSupported(keySystem: string, type?: string): boolean; - isTypeSupportedWithFeatures(keySystem: string, type?: string): string; -} - -interface MSPointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var MSPointerEvent: { - prototype: MSPointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; -} - -interface MSRangeCollection { - readonly length: number; - item(index: number): Range; - [index: number]: Range; -} - -declare var MSRangeCollection: { - prototype: MSRangeCollection; - new(): MSRangeCollection; -} - -interface MSSiteModeEvent extends Event { - readonly actionURL: string; - readonly buttonID: number; -} - -declare var MSSiteModeEvent: { - prototype: MSSiteModeEvent; - new(): MSSiteModeEvent; -} - -interface MSStream { - readonly type: string; - msClose(): void; - msDetachStream(): any; -} - -declare var MSStream: { - prototype: MSStream; - new(): MSStream; -} - -interface MSStreamReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBinaryString(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSStreamReader: { - prototype: MSStreamReader; - new(): MSStreamReader; -} - -interface MSWebViewAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - readonly target: MSHTMLWebViewElement; - readonly type: number; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSWebViewAsyncOperation: { - prototype: MSWebViewAsyncOperation; - new(): MSWebViewAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; -} - -interface MSWebViewSettings { - isIndexedDBEnabled: boolean; - isJavaScriptEnabled: boolean; -} - -declare var MSWebViewSettings: { - prototype: MSWebViewSettings; - new(): MSWebViewSettings; -} - -interface MediaDeviceInfo { - readonly deviceId: string; - readonly groupId: string; - readonly kind: string; - readonly label: string; -} - -declare var MediaDeviceInfo: { - prototype: MediaDeviceInfo; - new(): MediaDeviceInfo; -} - -interface MediaDevices extends EventTarget { - ondevicechange: (this: this, ev: Event) => any; - enumerateDevices(): any; - getSupportedConstraints(): MediaTrackSupportedConstraints; - getUserMedia(constraints: MediaStreamConstraints): PromiseLike; - addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaDevices: { - prototype: MediaDevices; - new(): MediaDevices; -} - -interface MediaElementAudioSourceNode extends AudioNode { -} - -declare var MediaElementAudioSourceNode: { - prototype: MediaElementAudioSourceNode; - new(): MediaElementAudioSourceNode; -} - -interface MediaEncryptedEvent extends Event { - readonly initData: ArrayBuffer | null; - readonly initDataType: string; -} - -declare var MediaEncryptedEvent: { - prototype: MediaEncryptedEvent; - new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; -} - -interface MediaError { - readonly code: number; - readonly msExtendedCode: number; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -declare var MediaError: { - prototype: MediaError; - new(): MediaError; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -interface MediaKeyMessageEvent extends Event { - readonly message: ArrayBuffer; - readonly messageType: string; -} - -declare var MediaKeyMessageEvent: { - prototype: MediaKeyMessageEvent; - new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; -} - -interface MediaKeySession extends EventTarget { - readonly closed: PromiseLike; - readonly expiration: number; - readonly keyStatuses: MediaKeyStatusMap; - readonly sessionId: string; - close(): PromiseLike; - generateRequest(initDataType: string, initData: any): PromiseLike; - load(sessionId: string): PromiseLike; - remove(): PromiseLike; - update(response: any): PromiseLike; -} - -declare var MediaKeySession: { - prototype: MediaKeySession; - new(): MediaKeySession; -} - -interface MediaKeyStatusMap { - readonly size: number; - forEach(callback: ForEachCallback): void; - get(keyId: any): string; - has(keyId: any): boolean; -} - -declare var MediaKeyStatusMap: { - prototype: MediaKeyStatusMap; - new(): MediaKeyStatusMap; -} - -interface MediaKeySystemAccess { - readonly keySystem: string; - createMediaKeys(): PromiseLike; - getConfiguration(): MediaKeySystemConfiguration; -} - -declare var MediaKeySystemAccess: { - prototype: MediaKeySystemAccess; - new(): MediaKeySystemAccess; -} - -interface MediaKeys { - createSession(sessionType?: string): MediaKeySession; - setServerCertificate(serverCertificate: any): PromiseLike; -} - -declare var MediaKeys: { - prototype: MediaKeys; - new(): MediaKeys; -} - -interface MediaList { - readonly length: number; - mediaText: string; - appendMedium(newMedium: string): void; - deleteMedium(oldMedium: string): void; - item(index: number): string; - toString(): string; - [index: number]: string; -} - -declare var MediaList: { - prototype: MediaList; - new(): MediaList; -} - -interface MediaQueryList { - readonly matches: boolean; - readonly media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -declare var MediaQueryList: { - prototype: MediaQueryList; - new(): MediaQueryList; -} - -interface MediaSource extends EventTarget { - readonly activeSourceBuffers: SourceBufferList; - duration: number; - readonly readyState: string; - readonly sourceBuffers: SourceBufferList; - addSourceBuffer(type: string): SourceBuffer; - endOfStream(error?: number): void; - removeSourceBuffer(sourceBuffer: SourceBuffer): void; -} - -declare var MediaSource: { - prototype: MediaSource; - new(): MediaSource; - isTypeSupported(type: string): boolean; -} - -interface MediaStream extends EventTarget { - readonly active: boolean; - readonly id: string; - onactive: (this: this, ev: Event) => any; - onaddtrack: (this: this, ev: TrackEvent) => any; - oninactive: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - addTrack(track: MediaStreamTrack): void; - clone(): MediaStream; - getAudioTracks(): MediaStreamTrack[]; - getTrackById(trackId: string): MediaStreamTrack | null; - getTracks(): MediaStreamTrack[]; - getVideoTracks(): MediaStreamTrack[]; - removeTrack(track: MediaStreamTrack): void; - stop(): void; - addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStream: { - prototype: MediaStream; - new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; -} - -interface MediaStreamAudioSourceNode extends AudioNode { -} - -declare var MediaStreamAudioSourceNode: { - prototype: MediaStreamAudioSourceNode; - new(): MediaStreamAudioSourceNode; -} - -interface MediaStreamError { - readonly constraintName: string | null; - readonly message: string | null; - readonly name: string; -} - -declare var MediaStreamError: { - prototype: MediaStreamError; - new(): MediaStreamError; -} - -interface MediaStreamErrorEvent extends Event { - readonly error: MediaStreamError | null; -} - -declare var MediaStreamErrorEvent: { - prototype: MediaStreamErrorEvent; - new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; -} - -interface MediaStreamTrack extends EventTarget { - enabled: boolean; - readonly id: string; - readonly kind: string; - readonly label: string; - readonly muted: boolean; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onmute: (this: this, ev: Event) => any; - onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any; - onunmute: (this: this, ev: Event) => any; - readonly readonly: boolean; - readonly readyState: string; - readonly remote: boolean; - applyConstraints(constraints: MediaTrackConstraints): PromiseLike; - clone(): MediaStreamTrack; - getCapabilities(): MediaTrackCapabilities; - getConstraints(): MediaTrackConstraints; - getSettings(): MediaTrackSettings; - stop(): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStreamTrack: { - prototype: MediaStreamTrack; - new(): MediaStreamTrack; -} - -interface MediaStreamTrackEvent extends Event { - readonly track: MediaStreamTrack; -} - -declare var MediaStreamTrackEvent: { - prototype: MediaStreamTrackEvent; - new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; -} - -interface MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; -} - -declare var MessageChannel: { - prototype: MessageChannel; - new(): MessageChannel; -} - -interface MessageEvent extends Event { - readonly data: any; - readonly origin: string; - readonly ports: any; - readonly source: Window; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; -} - -declare var MessageEvent: { - prototype: MessageEvent; - new(type: string, eventInitDict?: MessageEventInit): MessageEvent; -} - -interface MessagePort extends EventTarget { - onmessage: (this: this, ev: MessageEvent) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MessagePort: { - prototype: MessagePort; - new(): MessagePort; -} - -interface MimeType { - readonly description: string; - readonly enabledPlugin: Plugin; - readonly suffixes: string; - readonly type: string; -} - -declare var MimeType: { - prototype: MimeType; - new(): MimeType; -} - -interface MimeTypeArray { - readonly length: number; - item(index: number): Plugin; - namedItem(type: string): Plugin; - [index: number]: Plugin; -} - -declare var MimeTypeArray: { - prototype: MimeTypeArray; - new(): MimeTypeArray; -} - -interface MouseEvent extends UIEvent { - readonly altKey: boolean; - readonly button: number; - readonly buttons: number; - readonly clientX: number; - readonly clientY: number; - readonly ctrlKey: boolean; - readonly fromElement: Element; - readonly layerX: number; - readonly layerY: number; - readonly metaKey: boolean; - readonly movementX: number; - readonly movementY: number; - readonly offsetX: number; - readonly offsetY: number; - readonly pageX: number; - readonly pageY: number; - readonly relatedTarget: EventTarget; - readonly screenX: number; - readonly screenY: number; - readonly shiftKey: boolean; - readonly toElement: Element; - readonly which: number; - readonly x: number; - readonly y: number; - getModifierState(keyArg: string): boolean; - initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; -} - -declare var MouseEvent: { - prototype: MouseEvent; - new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; -} - -interface MutationEvent extends Event { - readonly attrChange: number; - readonly attrName: string; - readonly newValue: string; - readonly prevValue: string; - readonly relatedNode: Node; - initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -declare var MutationEvent: { - prototype: MutationEvent; - new(): MutationEvent; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -interface MutationObserver { - disconnect(): void; - observe(target: Node, options: MutationObserverInit): void; - takeRecords(): MutationRecord[]; -} - -declare var MutationObserver: { - prototype: MutationObserver; - new(callback: MutationCallback): MutationObserver; -} - -interface MutationRecord { - readonly addedNodes: NodeList; - readonly attributeName: string | null; - readonly attributeNamespace: string | null; - readonly nextSibling: Node | null; - readonly oldValue: string | null; - readonly previousSibling: Node | null; - readonly removedNodes: NodeList; - readonly target: Node; - readonly type: string; -} - -declare var MutationRecord: { - prototype: MutationRecord; - new(): MutationRecord; -} - -interface NamedNodeMap { - readonly length: number; - getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - item(index: number): Attr; - removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - setNamedItem(arg: Attr): Attr; - setNamedItemNS(arg: Attr): Attr; - [index: number]: Attr; -} - -declare var NamedNodeMap: { - prototype: NamedNodeMap; - new(): NamedNodeMap; -} - -interface NavigationCompletedEvent extends NavigationEvent { - readonly isSuccess: boolean; - readonly webErrorStatus: number; -} - -declare var NavigationCompletedEvent: { - prototype: NavigationCompletedEvent; - new(): NavigationCompletedEvent; -} - -interface NavigationEvent extends Event { - readonly uri: string; -} - -declare var NavigationEvent: { - prototype: NavigationEvent; - new(): NavigationEvent; -} - -interface NavigationEventWithReferrer extends NavigationEvent { - readonly referer: string; -} - -declare var NavigationEventWithReferrer: { - prototype: NavigationEventWithReferrer; - new(): NavigationEventWithReferrer; -} - -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { - readonly appCodeName: string; - readonly cookieEnabled: boolean; - readonly language: string; - readonly maxTouchPoints: number; - readonly mimeTypes: MimeTypeArray; - readonly msManipulationViewsEnabled: boolean; - readonly msMaxTouchPoints: number; - readonly msPointerEnabled: boolean; - readonly plugins: PluginArray; - readonly pointerEnabled: boolean; - readonly webdriver: boolean; - readonly hardwareConcurrency: number; - getGamepads(): Gamepad[]; - javaEnabled(): boolean; - msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; - vibrate(pattern: number | number[]): boolean; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Navigator: { - prototype: Navigator; - new(): Navigator; -} - -interface Node extends EventTarget { - readonly attributes: NamedNodeMap; - readonly baseURI: string | null; - readonly childNodes: NodeList; - readonly firstChild: Node | null; - readonly lastChild: Node | null; - readonly localName: string | null; - readonly namespaceURI: string | null; - readonly nextSibling: Node | null; - readonly nodeName: string; - readonly nodeType: number; - nodeValue: string | null; - readonly ownerDocument: Document; - readonly parentElement: HTMLElement | null; - readonly parentNode: Node | null; - readonly previousSibling: Node | null; - textContent: string | null; - appendChild(newChild: Node): Node; - cloneNode(deep?: boolean): Node; - compareDocumentPosition(other: Node): number; - contains(child: Node): boolean; - hasAttributes(): boolean; - hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild: Node | null): Node; - isDefaultNamespace(namespaceURI: string | null): boolean; - isEqualNode(arg: Node): boolean; - isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string | null): string | null; - lookupPrefix(namespaceURI: string | null): string | null; - normalize(): void; - removeChild(oldChild: Node): Node; - replaceChild(newChild: Node, oldChild: Node): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -declare var Node: { - prototype: Node; - new(): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -interface NodeFilter { - acceptNode(n: Node): number; -} - -declare var NodeFilter: { - readonly FILTER_ACCEPT: number; - readonly FILTER_REJECT: number; - readonly FILTER_SKIP: number; - readonly SHOW_ALL: number; - readonly SHOW_ATTRIBUTE: number; - readonly SHOW_CDATA_SECTION: number; - readonly SHOW_COMMENT: number; - readonly SHOW_DOCUMENT: number; - readonly SHOW_DOCUMENT_FRAGMENT: number; - readonly SHOW_DOCUMENT_TYPE: number; - readonly SHOW_ELEMENT: number; - readonly SHOW_ENTITY: number; - readonly SHOW_ENTITY_REFERENCE: number; - readonly SHOW_NOTATION: number; - readonly SHOW_PROCESSING_INSTRUCTION: number; - readonly SHOW_TEXT: number; -} - -interface NodeIterator { - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - detach(): void; - nextNode(): Node; - previousNode(): Node; -} - -declare var NodeIterator: { - prototype: NodeIterator; - new(): NodeIterator; -} - -interface NodeList { - readonly length: number; - item(index: number): Node; - [index: number]: Node; -} - -declare var NodeList: { - prototype: NodeList; - new(): NodeList; -} - -interface OES_element_index_uint { -} - -declare var OES_element_index_uint: { - prototype: OES_element_index_uint; - new(): OES_element_index_uint; -} - -interface OES_standard_derivatives { - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -declare var OES_standard_derivatives: { - prototype: OES_standard_derivatives; - new(): OES_standard_derivatives; - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -interface OES_texture_float { -} - -declare var OES_texture_float: { - prototype: OES_texture_float; - new(): OES_texture_float; -} - -interface OES_texture_float_linear { -} - -declare var OES_texture_float_linear: { - prototype: OES_texture_float_linear; - new(): OES_texture_float_linear; -} - -interface OfflineAudioCompletionEvent extends Event { - readonly renderedBuffer: AudioBuffer; -} - -declare var OfflineAudioCompletionEvent: { - prototype: OfflineAudioCompletionEvent; - new(): OfflineAudioCompletionEvent; -} - -interface OfflineAudioContext extends AudioContext { - oncomplete: (this: this, ev: Event) => any; - startRendering(): PromiseLike; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OfflineAudioContext: { - prototype: OfflineAudioContext; - new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; -} - -interface OscillatorNode extends AudioNode { - readonly detune: AudioParam; - readonly frequency: AudioParam; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - type: string; - setPeriodicWave(periodicWave: PeriodicWave): void; - start(when?: number): void; - stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OscillatorNode: { - prototype: OscillatorNode; - new(): OscillatorNode; -} - -interface OverflowEvent extends UIEvent { - readonly horizontalOverflow: boolean; - readonly orient: number; - readonly verticalOverflow: boolean; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -declare var OverflowEvent: { - prototype: OverflowEvent; - new(): OverflowEvent; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -interface PageTransitionEvent extends Event { - readonly persisted: boolean; -} - -declare var PageTransitionEvent: { - prototype: PageTransitionEvent; - new(): PageTransitionEvent; -} - -interface PannerNode extends AudioNode { - coneInnerAngle: number; - coneOuterAngle: number; - coneOuterGain: number; - distanceModel: string; - maxDistance: number; - panningModel: string; - refDistance: number; - rolloffFactor: number; - setOrientation(x: number, y: number, z: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var PannerNode: { - prototype: PannerNode; - new(): PannerNode; -} - -interface PerfWidgetExternal { - readonly activeNetworkRequestCount: number; - readonly averageFrameTime: number; - readonly averagePaintTime: number; - readonly extraInformationEnabled: boolean; - readonly independentRenderingEnabled: boolean; - readonly irDisablingContentString: string; - readonly irStatusAvailable: boolean; - readonly maxCpuSpeed: number; - readonly paintRequestsPerSecond: number; - readonly performanceCounter: number; - readonly performanceCounterFrequency: number; - addEventListener(eventType: string, callback: Function): void; - getMemoryUsage(): number; - getProcessCpuUsage(): number; - getRecentCpuUsage(last: number | null): any; - getRecentFrames(last: number | null): any; - getRecentMemoryUsage(last: number | null): any; - getRecentPaintRequests(last: number | null): any; - removeEventListener(eventType: string, callback: Function): void; - repositionWindow(x: number, y: number): void; - resizeWindow(width: number, height: number): void; -} - -declare var PerfWidgetExternal: { - prototype: PerfWidgetExternal; - new(): PerfWidgetExternal; -} - -interface Performance { - readonly navigation: PerformanceNavigation; - readonly timing: PerformanceTiming; - clearMarks(markName?: string): void; - clearMeasures(measureName?: string): void; - clearResourceTimings(): void; - getEntries(): any; - getEntriesByName(name: string, entryType?: string): any; - getEntriesByType(entryType: string): any; - getMarks(markName?: string): any; - getMeasures(measureName?: string): any; - mark(markName: string): void; - measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - now(): number; - setResourceTimingBufferSize(maxSize: number): void; - toJSON(): any; -} - -declare var Performance: { - prototype: Performance; - new(): Performance; -} - -interface PerformanceEntry { - readonly duration: number; - readonly entryType: string; - readonly name: string; - readonly startTime: number; -} - -declare var PerformanceEntry: { - prototype: PerformanceEntry; - new(): PerformanceEntry; -} - -interface PerformanceMark extends PerformanceEntry { -} - -declare var PerformanceMark: { - prototype: PerformanceMark; - new(): PerformanceMark; -} - -interface PerformanceMeasure extends PerformanceEntry { -} - -declare var PerformanceMeasure: { - prototype: PerformanceMeasure; - new(): PerformanceMeasure; -} - -interface PerformanceNavigation { - readonly redirectCount: number; - readonly type: number; - toJSON(): any; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -declare var PerformanceNavigation: { - prototype: PerformanceNavigation; - new(): PerformanceNavigation; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -interface PerformanceNavigationTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly navigationStart: number; - readonly redirectCount: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly type: string; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; -} - -declare var PerformanceNavigationTiming: { - prototype: PerformanceNavigationTiming; - new(): PerformanceNavigationTiming; -} - -interface PerformanceResourceTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly initiatorType: string; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; -} - -declare var PerformanceResourceTiming: { - prototype: PerformanceResourceTiming; - new(): PerformanceResourceTiming; -} - -interface PerformanceTiming { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly msFirstPaint: number; - readonly navigationStart: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; - readonly secureConnectionStart: number; - toJSON(): any; -} - -declare var PerformanceTiming: { - prototype: PerformanceTiming; - new(): PerformanceTiming; -} - -interface PeriodicWave { -} - -declare var PeriodicWave: { - prototype: PeriodicWave; - new(): PeriodicWave; -} - -interface PermissionRequest extends DeferredPermissionRequest { - readonly state: string; - defer(): void; -} - -declare var PermissionRequest: { - prototype: PermissionRequest; - new(): PermissionRequest; -} - -interface PermissionRequestedEvent extends Event { - readonly permissionRequest: PermissionRequest; -} - -declare var PermissionRequestedEvent: { - prototype: PermissionRequestedEvent; - new(): PermissionRequestedEvent; -} - -interface Plugin { - readonly description: string; - readonly filename: string; - readonly length: number; - readonly name: string; - readonly version: string; - item(index: number): MimeType; - namedItem(type: string): MimeType; - [index: number]: MimeType; -} - -declare var Plugin: { - prototype: Plugin; - new(): Plugin; -} - -interface PluginArray { - readonly length: number; - item(index: number): Plugin; - namedItem(name: string): Plugin; - refresh(reload?: boolean): void; - [index: number]: Plugin; -} - -declare var PluginArray: { - prototype: PluginArray; - new(): PluginArray; -} - -interface PointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var PointerEvent: { - prototype: PointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; -} - -interface PopStateEvent extends Event { - readonly state: any; - initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; -} - -declare var PopStateEvent: { - prototype: PopStateEvent; - new(): PopStateEvent; -} - -interface Position { - readonly coords: Coordinates; - readonly timestamp: number; -} - -declare var Position: { - prototype: Position; - new(): Position; -} - -interface PositionError { - readonly code: number; - readonly message: string; - toString(): string; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -declare var PositionError: { - prototype: PositionError; - new(): PositionError; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -interface ProcessingInstruction extends CharacterData { - readonly target: string; -} - -declare var ProcessingInstruction: { - prototype: ProcessingInstruction; - new(): ProcessingInstruction; -} - -interface ProgressEvent extends Event { - readonly lengthComputable: boolean; - readonly loaded: number; - readonly total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -declare var ProgressEvent: { - prototype: ProgressEvent; - new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; -} - -interface RTCDTMFToneChangeEvent extends Event { - readonly tone: string; -} - -declare var RTCDTMFToneChangeEvent: { - prototype: RTCDTMFToneChangeEvent; - new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; -} - -interface RTCDtlsTransport extends RTCStatsProvider { - ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly state: string; - readonly transport: RTCIceTransport; - getLocalParameters(): RTCDtlsParameters; - getRemoteCertificates(): ArrayBuffer[]; - getRemoteParameters(): RTCDtlsParameters | null; - start(remoteParameters: RTCDtlsParameters): void; - stop(): void; - addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtlsTransport: { - prototype: RTCDtlsTransport; - new(transport: RTCIceTransport): RTCDtlsTransport; -} - -interface RTCDtlsTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCDtlsTransportStateChangedEvent: { - prototype: RTCDtlsTransportStateChangedEvent; - new(): RTCDtlsTransportStateChangedEvent; -} - -interface RTCDtmfSender extends EventTarget { - readonly canInsertDTMF: boolean; - readonly duration: number; - readonly interToneGap: number; - ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any; - readonly sender: RTCRtpSender; - readonly toneBuffer: string; - insertDTMF(tones: string, duration?: number, interToneGap?: number): void; - addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtmfSender: { - prototype: RTCDtmfSender; - new(sender: RTCRtpSender): RTCDtmfSender; -} - -interface RTCIceCandidatePairChangedEvent extends Event { - readonly pair: RTCIceCandidatePair; -} - -declare var RTCIceCandidatePairChangedEvent: { - prototype: RTCIceCandidatePairChangedEvent; - new(): RTCIceCandidatePairChangedEvent; -} - -interface RTCIceGatherer extends RTCStatsProvider { - readonly component: string; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null; - createAssociatedGatherer(): RTCIceGatherer; - getLocalCandidates(): RTCIceCandidate[]; - getLocalParameters(): RTCIceParameters; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceGatherer: { - prototype: RTCIceGatherer; - new(options: RTCIceGatherOptions): RTCIceGatherer; -} - -interface RTCIceGathererEvent extends Event { - readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; -} - -declare var RTCIceGathererEvent: { - prototype: RTCIceGathererEvent; - new(): RTCIceGathererEvent; -} - -interface RTCIceTransport extends RTCStatsProvider { - readonly component: string; - readonly iceGatherer: RTCIceGatherer | null; - oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null; - onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null; - readonly role: string; - readonly state: string; - addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; - createAssociatedTransport(): RTCIceTransport; - getNominatedCandidatePair(): RTCIceCandidatePair | null; - getRemoteCandidates(): RTCIceCandidate[]; - getRemoteParameters(): RTCIceParameters | null; - setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; - start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; - stop(): void; - addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceTransport: { - prototype: RTCIceTransport; - new(): RTCIceTransport; -} - -interface RTCIceTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCIceTransportStateChangedEvent: { - prototype: RTCIceTransportStateChangedEvent; - new(): RTCIceTransportStateChangedEvent; -} - -interface RTCRtpReceiver extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack | null; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - getContributingSources(): RTCRtpContributingSource[]; - receive(parameters: RTCRtpParameters): void; - requestSendCSRC(csrc: number): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpReceiver: { - prototype: RTCRtpReceiver; - new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCRtpSender extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - send(parameters: RTCRtpParameters): void; - setTrack(track: MediaStreamTrack): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpSender: { - prototype: RTCRtpSender; - new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCSrtpSdesTransport extends EventTarget { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly transport: RTCIceTransport; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCSrtpSdesTransport: { - prototype: RTCSrtpSdesTransport; - new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; - getLocalParameters(): RTCSrtpSdesParameters[]; -} - -interface RTCSsrcConflictEvent extends Event { - readonly ssrc: number; -} - -declare var RTCSsrcConflictEvent: { - prototype: RTCSsrcConflictEvent; - new(): RTCSsrcConflictEvent; -} - -interface RTCStatsProvider extends EventTarget { - getStats(): PromiseLike; - msGetStats(): PromiseLike; -} - -declare var RTCStatsProvider: { - prototype: RTCStatsProvider; - new(): RTCStatsProvider; -} - -interface Range { - readonly collapsed: boolean; - readonly commonAncestorContainer: Node; - readonly endContainer: Node; - readonly endOffset: number; - readonly startContainer: Node; - readonly startOffset: number; - cloneContents(): DocumentFragment; - cloneRange(): Range; - collapse(toStart: boolean): void; - compareBoundaryPoints(how: number, sourceRange: Range): number; - createContextualFragment(fragment: string): DocumentFragment; - deleteContents(): void; - detach(): void; - expand(Unit: string): boolean; - extractContents(): DocumentFragment; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - insertNode(newNode: Node): void; - selectNode(refNode: Node): void; - selectNodeContents(refNode: Node): void; - setEnd(refNode: Node, offset: number): void; - setEndAfter(refNode: Node): void; - setEndBefore(refNode: Node): void; - setStart(refNode: Node, offset: number): void; - setStartAfter(refNode: Node): void; - setStartBefore(refNode: Node): void; - surroundContents(newParent: Node): void; - toString(): string; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -declare var Range: { - prototype: Range; - new(): Range; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly target: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGAElement: { - prototype: SVGAElement; - new(): SVGAElement; -} - -interface SVGAngle { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -declare var SVGAngle: { - prototype: SVGAngle; - new(): SVGAngle; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -interface SVGAnimatedAngle { - readonly animVal: SVGAngle; - readonly baseVal: SVGAngle; -} - -declare var SVGAnimatedAngle: { - prototype: SVGAnimatedAngle; - new(): SVGAnimatedAngle; -} - -interface SVGAnimatedBoolean { - readonly animVal: boolean; - baseVal: boolean; -} - -declare var SVGAnimatedBoolean: { - prototype: SVGAnimatedBoolean; - new(): SVGAnimatedBoolean; -} - -interface SVGAnimatedEnumeration { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedEnumeration: { - prototype: SVGAnimatedEnumeration; - new(): SVGAnimatedEnumeration; -} - -interface SVGAnimatedInteger { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedInteger: { - prototype: SVGAnimatedInteger; - new(): SVGAnimatedInteger; -} - -interface SVGAnimatedLength { - readonly animVal: SVGLength; - readonly baseVal: SVGLength; -} - -declare var SVGAnimatedLength: { - prototype: SVGAnimatedLength; - new(): SVGAnimatedLength; -} - -interface SVGAnimatedLengthList { - readonly animVal: SVGLengthList; - readonly baseVal: SVGLengthList; -} - -declare var SVGAnimatedLengthList: { - prototype: SVGAnimatedLengthList; - new(): SVGAnimatedLengthList; -} - -interface SVGAnimatedNumber { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedNumber: { - prototype: SVGAnimatedNumber; - new(): SVGAnimatedNumber; -} - -interface SVGAnimatedNumberList { - readonly animVal: SVGNumberList; - readonly baseVal: SVGNumberList; -} - -declare var SVGAnimatedNumberList: { - prototype: SVGAnimatedNumberList; - new(): SVGAnimatedNumberList; -} - -interface SVGAnimatedPreserveAspectRatio { - readonly animVal: SVGPreserveAspectRatio; - readonly baseVal: SVGPreserveAspectRatio; -} - -declare var SVGAnimatedPreserveAspectRatio: { - prototype: SVGAnimatedPreserveAspectRatio; - new(): SVGAnimatedPreserveAspectRatio; -} - -interface SVGAnimatedRect { - readonly animVal: SVGRect; - readonly baseVal: SVGRect; -} - -declare var SVGAnimatedRect: { - prototype: SVGAnimatedRect; - new(): SVGAnimatedRect; -} - -interface SVGAnimatedString { - readonly animVal: string; - baseVal: string; -} - -declare var SVGAnimatedString: { - prototype: SVGAnimatedString; - new(): SVGAnimatedString; -} - -interface SVGAnimatedTransformList { - readonly animVal: SVGTransformList; - readonly baseVal: SVGTransformList; -} - -declare var SVGAnimatedTransformList: { - prototype: SVGAnimatedTransformList; - new(): SVGAnimatedTransformList; -} - -interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGCircleElement: { - prototype: SVGCircleElement; - new(): SVGCircleElement; -} - -interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly clipPathUnits: SVGAnimatedEnumeration; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGClipPathElement: { - prototype: SVGClipPathElement; - new(): SVGClipPathElement; -} - -interface SVGComponentTransferFunctionElement extends SVGElement { - readonly amplitude: SVGAnimatedNumber; - readonly exponent: SVGAnimatedNumber; - readonly intercept: SVGAnimatedNumber; - readonly offset: SVGAnimatedNumber; - readonly slope: SVGAnimatedNumber; - readonly tableValues: SVGAnimatedNumberList; - readonly type: SVGAnimatedEnumeration; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -declare var SVGComponentTransferFunctionElement: { - prototype: SVGComponentTransferFunctionElement; - new(): SVGComponentTransferFunctionElement; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDefsElement: { - prototype: SVGDefsElement; - new(): SVGDefsElement; -} - -interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDescElement: { - prototype: SVGDescElement; - new(): SVGDescElement; -} - -interface SVGElement extends Element { - onclick: (this: this, ev: MouseEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - onfocusin: (this: this, ev: FocusEvent) => any; - onfocusout: (this: this, ev: FocusEvent) => any; - onload: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - readonly ownerSVGElement: SVGSVGElement; - readonly viewportElement: SVGElement; - xmlbase: string; - className: any; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var SVGElement: { - prototype: SVGElement; - new(): SVGElement; -} - -interface SVGElementInstance extends EventTarget { - readonly childNodes: SVGElementInstanceList; - readonly correspondingElement: SVGElement; - readonly correspondingUseElement: SVGUseElement; - readonly firstChild: SVGElementInstance; - readonly lastChild: SVGElementInstance; - readonly nextSibling: SVGElementInstance; - readonly parentNode: SVGElementInstance; - readonly previousSibling: SVGElementInstance; -} - -declare var SVGElementInstance: { - prototype: SVGElementInstance; - new(): SVGElementInstance; -} - -interface SVGElementInstanceList { - readonly length: number; - item(index: number): SVGElementInstance; -} - -declare var SVGElementInstanceList: { - prototype: SVGElementInstanceList; - new(): SVGElementInstanceList; -} - -interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGEllipseElement: { - prototype: SVGEllipseElement; - new(): SVGEllipseElement; -} - -interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly mode: SVGAnimatedEnumeration; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEBlendElement: { - prototype: SVGFEBlendElement; - new(): SVGFEBlendElement; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; -} - -interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly type: SVGAnimatedEnumeration; - readonly values: SVGAnimatedNumberList; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEColorMatrixElement: { - prototype: SVGFEColorMatrixElement; - new(): SVGFEColorMatrixElement; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; -} - -interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEComponentTransferElement: { - prototype: SVGFEComponentTransferElement; - new(): SVGFEComponentTransferElement; -} - -interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly k1: SVGAnimatedNumber; - readonly k2: SVGAnimatedNumber; - readonly k3: SVGAnimatedNumber; - readonly k4: SVGAnimatedNumber; - readonly operator: SVGAnimatedEnumeration; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFECompositeElement: { - prototype: SVGFECompositeElement; - new(): SVGFECompositeElement; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; -} - -interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly bias: SVGAnimatedNumber; - readonly divisor: SVGAnimatedNumber; - readonly edgeMode: SVGAnimatedEnumeration; - readonly in1: SVGAnimatedString; - readonly kernelMatrix: SVGAnimatedNumberList; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly orderX: SVGAnimatedInteger; - readonly orderY: SVGAnimatedInteger; - readonly preserveAlpha: SVGAnimatedBoolean; - readonly targetX: SVGAnimatedInteger; - readonly targetY: SVGAnimatedInteger; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEConvolveMatrixElement: { - prototype: SVGFEConvolveMatrixElement; - new(): SVGFEConvolveMatrixElement; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; -} - -interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly diffuseConstant: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDiffuseLightingElement: { - prototype: SVGFEDiffuseLightingElement; - new(): SVGFEDiffuseLightingElement; -} - -interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly scale: SVGAnimatedNumber; - readonly xChannelSelector: SVGAnimatedEnumeration; - readonly yChannelSelector: SVGAnimatedEnumeration; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDisplacementMapElement: { - prototype: SVGFEDisplacementMapElement; - new(): SVGFEDisplacementMapElement; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; -} - -interface SVGFEDistantLightElement extends SVGElement { - readonly azimuth: SVGAnimatedNumber; - readonly elevation: SVGAnimatedNumber; -} - -declare var SVGFEDistantLightElement: { - prototype: SVGFEDistantLightElement; - new(): SVGFEDistantLightElement; -} - -interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEFloodElement: { - prototype: SVGFEFloodElement; - new(): SVGFEFloodElement; -} - -interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncAElement: { - prototype: SVGFEFuncAElement; - new(): SVGFEFuncAElement; -} - -interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncBElement: { - prototype: SVGFEFuncBElement; - new(): SVGFEFuncBElement; -} - -interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncGElement: { - prototype: SVGFEFuncGElement; - new(): SVGFEFuncGElement; -} - -interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncRElement: { - prototype: SVGFEFuncRElement; - new(): SVGFEFuncRElement; -} - -interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly stdDeviationX: SVGAnimatedNumber; - readonly stdDeviationY: SVGAnimatedNumber; - setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEGaussianBlurElement: { - prototype: SVGFEGaussianBlurElement; - new(): SVGFEGaussianBlurElement; -} - -interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEImageElement: { - prototype: SVGFEImageElement; - new(): SVGFEImageElement; -} - -interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeElement: { - prototype: SVGFEMergeElement; - new(): SVGFEMergeElement; -} - -interface SVGFEMergeNodeElement extends SVGElement { - readonly in1: SVGAnimatedString; -} - -declare var SVGFEMergeNodeElement: { - prototype: SVGFEMergeNodeElement; - new(): SVGFEMergeNodeElement; -} - -interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly operator: SVGAnimatedEnumeration; - readonly radiusX: SVGAnimatedNumber; - readonly radiusY: SVGAnimatedNumber; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMorphologyElement: { - prototype: SVGFEMorphologyElement; - new(): SVGFEMorphologyElement; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; -} - -interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly dx: SVGAnimatedNumber; - readonly dy: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEOffsetElement: { - prototype: SVGFEOffsetElement; - new(): SVGFEOffsetElement; -} - -interface SVGFEPointLightElement extends SVGElement { - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; -} - -declare var SVGFEPointLightElement: { - prototype: SVGFEPointLightElement; - new(): SVGFEPointLightElement; -} - -interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly specularConstant: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpecularLightingElement: { - prototype: SVGFESpecularLightingElement; - new(): SVGFESpecularLightingElement; -} - -interface SVGFESpotLightElement extends SVGElement { - readonly limitingConeAngle: SVGAnimatedNumber; - readonly pointsAtX: SVGAnimatedNumber; - readonly pointsAtY: SVGAnimatedNumber; - readonly pointsAtZ: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; -} - -declare var SVGFESpotLightElement: { - prototype: SVGFESpotLightElement; - new(): SVGFESpotLightElement; -} - -interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETileElement: { - prototype: SVGFETileElement; - new(): SVGFETileElement; -} - -interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly baseFrequencyX: SVGAnimatedNumber; - readonly baseFrequencyY: SVGAnimatedNumber; - readonly numOctaves: SVGAnimatedInteger; - readonly seed: SVGAnimatedNumber; - readonly stitchTiles: SVGAnimatedEnumeration; - readonly type: SVGAnimatedEnumeration; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETurbulenceElement: { - prototype: SVGFETurbulenceElement; - new(): SVGFETurbulenceElement; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; -} - -interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly filterResX: SVGAnimatedInteger; - readonly filterResY: SVGAnimatedInteger; - readonly filterUnits: SVGAnimatedEnumeration; - readonly height: SVGAnimatedLength; - readonly primitiveUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - setFilterRes(filterResX: number, filterResY: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFilterElement: { - prototype: SVGFilterElement; - new(): SVGFilterElement; -} - -interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGForeignObjectElement: { - prototype: SVGForeignObjectElement; - new(): SVGForeignObjectElement; -} - -interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGElement: { - prototype: SVGGElement; - new(): SVGGElement; -} - -interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - readonly gradientTransform: SVGAnimatedTransformList; - readonly gradientUnits: SVGAnimatedEnumeration; - readonly spreadMethod: SVGAnimatedEnumeration; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGradientElement: { - prototype: SVGGradientElement; - new(): SVGGradientElement; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; -} - -interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly height: SVGAnimatedLength; - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGImageElement: { - prototype: SVGImageElement; - new(): SVGImageElement; -} - -interface SVGLength { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -declare var SVGLength: { - prototype: SVGLength; - new(): SVGLength; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -interface SVGLengthList { - readonly numberOfItems: number; - appendItem(newItem: SVGLength): SVGLength; - clear(): void; - getItem(index: number): SVGLength; - initialize(newItem: SVGLength): SVGLength; - insertItemBefore(newItem: SVGLength, index: number): SVGLength; - removeItem(index: number): SVGLength; - replaceItem(newItem: SVGLength, index: number): SVGLength; -} - -declare var SVGLengthList: { - prototype: SVGLengthList; - new(): SVGLengthList; -} - -interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGLineElement: { - prototype: SVGLineElement; - new(): SVGLineElement; -} - -interface SVGLinearGradientElement extends SVGGradientElement { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; -} - -declare var SVGLinearGradientElement: { - prototype: SVGLinearGradientElement; - new(): SVGLinearGradientElement; -} - -interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - readonly markerHeight: SVGAnimatedLength; - readonly markerUnits: SVGAnimatedEnumeration; - readonly markerWidth: SVGAnimatedLength; - readonly orientAngle: SVGAnimatedAngle; - readonly orientType: SVGAnimatedEnumeration; - readonly refX: SVGAnimatedLength; - readonly refY: SVGAnimatedLength; - setOrientToAngle(angle: SVGAngle): void; - setOrientToAuto(): void; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMarkerElement: { - prototype: SVGMarkerElement; - new(): SVGMarkerElement; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; -} - -interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly maskContentUnits: SVGAnimatedEnumeration; - readonly maskUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMaskElement: { - prototype: SVGMaskElement; - new(): SVGMaskElement; -} - -interface SVGMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - flipX(): SVGMatrix; - flipY(): SVGMatrix; - inverse(): SVGMatrix; - multiply(secondMatrix: SVGMatrix): SVGMatrix; - rotate(angle: number): SVGMatrix; - rotateFromVector(x: number, y: number): SVGMatrix; - scale(scaleFactor: number): SVGMatrix; - scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; - skewX(angle: number): SVGMatrix; - skewY(angle: number): SVGMatrix; - translate(x: number, y: number): SVGMatrix; -} - -declare var SVGMatrix: { - prototype: SVGMatrix; - new(): SVGMatrix; -} - -interface SVGMetadataElement extends SVGElement { -} - -declare var SVGMetadataElement: { - prototype: SVGMetadataElement; - new(): SVGMetadataElement; -} - -interface SVGNumber { - value: number; -} - -declare var SVGNumber: { - prototype: SVGNumber; - new(): SVGNumber; -} - -interface SVGNumberList { - readonly numberOfItems: number; - appendItem(newItem: SVGNumber): SVGNumber; - clear(): void; - getItem(index: number): SVGNumber; - initialize(newItem: SVGNumber): SVGNumber; - insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; - removeItem(index: number): SVGNumber; - replaceItem(newItem: SVGNumber, index: number): SVGNumber; -} - -declare var SVGNumberList: { - prototype: SVGNumberList; - new(): SVGNumberList; -} - -interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { - createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; - createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; - createSVGPathSegClosePath(): SVGPathSegClosePath; - createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; - createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; - createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; - createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; - createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; - createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; - createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; - createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; - createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; - createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; - createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; - createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; - createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; - createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; - createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; - createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; - getPathSegAtLength(distance: number): number; - getPointAtLength(distance: number): SVGPoint; - getTotalLength(): number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPathElement: { - prototype: SVGPathElement; - new(): SVGPathElement; -} - -interface SVGPathSeg { - readonly pathSegType: number; - readonly pathSegTypeAsLetter: string; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -declare var SVGPathSeg: { - prototype: SVGPathSeg; - new(): SVGPathSeg; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -interface SVGPathSegArcAbs extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcAbs: { - prototype: SVGPathSegArcAbs; - new(): SVGPathSegArcAbs; -} - -interface SVGPathSegArcRel extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcRel: { - prototype: SVGPathSegArcRel; - new(): SVGPathSegArcRel; -} - -interface SVGPathSegClosePath extends SVGPathSeg { -} - -declare var SVGPathSegClosePath: { - prototype: SVGPathSegClosePath; - new(): SVGPathSegClosePath; -} - -interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicAbs: { - prototype: SVGPathSegCurvetoCubicAbs; - new(): SVGPathSegCurvetoCubicAbs; -} - -interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicRel: { - prototype: SVGPathSegCurvetoCubicRel; - new(): SVGPathSegCurvetoCubicRel; -} - -interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothAbs: { - prototype: SVGPathSegCurvetoCubicSmoothAbs; - new(): SVGPathSegCurvetoCubicSmoothAbs; -} - -interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothRel: { - prototype: SVGPathSegCurvetoCubicSmoothRel; - new(): SVGPathSegCurvetoCubicSmoothRel; -} - -interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticAbs: { - prototype: SVGPathSegCurvetoQuadraticAbs; - new(): SVGPathSegCurvetoQuadraticAbs; -} - -interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticRel: { - prototype: SVGPathSegCurvetoQuadraticRel; - new(): SVGPathSegCurvetoQuadraticRel; -} - -interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothAbs: { - prototype: SVGPathSegCurvetoQuadraticSmoothAbs; - new(): SVGPathSegCurvetoQuadraticSmoothAbs; -} - -interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothRel: { - prototype: SVGPathSegCurvetoQuadraticSmoothRel; - new(): SVGPathSegCurvetoQuadraticSmoothRel; -} - -interface SVGPathSegLinetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoAbs: { - prototype: SVGPathSegLinetoAbs; - new(): SVGPathSegLinetoAbs; -} - -interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalAbs: { - prototype: SVGPathSegLinetoHorizontalAbs; - new(): SVGPathSegLinetoHorizontalAbs; -} - -interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalRel: { - prototype: SVGPathSegLinetoHorizontalRel; - new(): SVGPathSegLinetoHorizontalRel; -} - -interface SVGPathSegLinetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoRel: { - prototype: SVGPathSegLinetoRel; - new(): SVGPathSegLinetoRel; -} - -interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalAbs: { - prototype: SVGPathSegLinetoVerticalAbs; - new(): SVGPathSegLinetoVerticalAbs; -} - -interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalRel: { - prototype: SVGPathSegLinetoVerticalRel; - new(): SVGPathSegLinetoVerticalRel; -} - -interface SVGPathSegList { - readonly numberOfItems: number; - appendItem(newItem: SVGPathSeg): SVGPathSeg; - clear(): void; - getItem(index: number): SVGPathSeg; - initialize(newItem: SVGPathSeg): SVGPathSeg; - insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; - removeItem(index: number): SVGPathSeg; - replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; -} - -declare var SVGPathSegList: { - prototype: SVGPathSegList; - new(): SVGPathSegList; -} - -interface SVGPathSegMovetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoAbs: { - prototype: SVGPathSegMovetoAbs; - new(): SVGPathSegMovetoAbs; -} - -interface SVGPathSegMovetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoRel: { - prototype: SVGPathSegMovetoRel; - new(): SVGPathSegMovetoRel; -} - -interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly patternContentUnits: SVGAnimatedEnumeration; - readonly patternTransform: SVGAnimatedTransformList; - readonly patternUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPatternElement: { - prototype: SVGPatternElement; - new(): SVGPatternElement; -} - -interface SVGPoint { - x: number; - y: number; - matrixTransform(matrix: SVGMatrix): SVGPoint; -} - -declare var SVGPoint: { - prototype: SVGPoint; - new(): SVGPoint; -} - -interface SVGPointList { - readonly numberOfItems: number; - appendItem(newItem: SVGPoint): SVGPoint; - clear(): void; - getItem(index: number): SVGPoint; - initialize(newItem: SVGPoint): SVGPoint; - insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; - removeItem(index: number): SVGPoint; - replaceItem(newItem: SVGPoint, index: number): SVGPoint; -} - -declare var SVGPointList: { - prototype: SVGPointList; - new(): SVGPointList; -} - -interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolygonElement: { - prototype: SVGPolygonElement; - new(): SVGPolygonElement; -} - -interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolylineElement: { - prototype: SVGPolylineElement; - new(): SVGPolylineElement; -} - -interface SVGPreserveAspectRatio { - align: number; - meetOrSlice: number; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -declare var SVGPreserveAspectRatio: { - prototype: SVGPreserveAspectRatio; - new(): SVGPreserveAspectRatio; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -interface SVGRadialGradientElement extends SVGGradientElement { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly fx: SVGAnimatedLength; - readonly fy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; -} - -declare var SVGRadialGradientElement: { - prototype: SVGRadialGradientElement; - new(): SVGRadialGradientElement; -} - -interface SVGRect { - height: number; - width: number; - x: number; - y: number; -} - -declare var SVGRect: { - prototype: SVGRect; - new(): SVGRect; -} - -interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGRectElement: { - prototype: SVGRectElement; - new(): SVGRectElement; -} - -interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - contentScriptType: string; - contentStyleType: string; - currentScale: number; - readonly currentTranslate: SVGPoint; - readonly height: SVGAnimatedLength; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onunload: (this: this, ev: Event) => any; - onzoom: (this: this, ev: SVGZoomEvent) => any; - readonly pixelUnitToMillimeterX: number; - readonly pixelUnitToMillimeterY: number; - readonly screenPixelToMillimeterX: number; - readonly screenPixelToMillimeterY: number; - readonly viewport: SVGRect; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - checkEnclosure(element: SVGElement, rect: SVGRect): boolean; - checkIntersection(element: SVGElement, rect: SVGRect): boolean; - createSVGAngle(): SVGAngle; - createSVGLength(): SVGLength; - createSVGMatrix(): SVGMatrix; - createSVGNumber(): SVGNumber; - createSVGPoint(): SVGPoint; - createSVGRect(): SVGRect; - createSVGTransform(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - deselectAll(): void; - forceRedraw(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getCurrentTime(): number; - getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - pauseAnimations(): void; - setCurrentTime(seconds: number): void; - suspendRedraw(maxWaitMilliseconds: number): number; - unpauseAnimations(): void; - unsuspendRedraw(suspendHandleID: number): void; - unsuspendRedrawAll(): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var SVGSVGElement: { - prototype: SVGSVGElement; - new(): SVGSVGElement; -} - -interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGScriptElement: { - prototype: SVGScriptElement; - new(): SVGScriptElement; -} - -interface SVGStopElement extends SVGElement, SVGStylable { - readonly offset: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStopElement: { - prototype: SVGStopElement; - new(): SVGStopElement; -} - -interface SVGStringList { - readonly numberOfItems: number; - appendItem(newItem: string): string; - clear(): void; - getItem(index: number): string; - initialize(newItem: string): string; - insertItemBefore(newItem: string, index: number): string; - removeItem(index: number): string; - replaceItem(newItem: string, index: number): string; -} - -declare var SVGStringList: { - prototype: SVGStringList; - new(): SVGStringList; -} - -interface SVGStyleElement extends SVGElement, SVGLangSpace { - disabled: boolean; - media: string; - title: string; - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStyleElement: { - prototype: SVGStyleElement; - new(): SVGStyleElement; -} - -interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSwitchElement: { - prototype: SVGSwitchElement; - new(): SVGSwitchElement; -} - -interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSymbolElement: { - prototype: SVGSymbolElement; - new(): SVGSymbolElement; -} - -interface SVGTSpanElement extends SVGTextPositioningElement { -} - -declare var SVGTSpanElement: { - prototype: SVGTSpanElement; - new(): SVGTSpanElement; -} - -interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly lengthAdjust: SVGAnimatedEnumeration; - readonly textLength: SVGAnimatedLength; - getCharNumAtPosition(point: SVGPoint): number; - getComputedTextLength(): number; - getEndPositionOfChar(charnum: number): SVGPoint; - getExtentOfChar(charnum: number): SVGRect; - getNumberOfChars(): number; - getRotationOfChar(charnum: number): number; - getStartPositionOfChar(charnum: number): SVGPoint; - getSubStringLength(charnum: number, nchars: number): number; - selectSubString(charnum: number, nchars: number): void; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextContentElement: { - prototype: SVGTextContentElement; - new(): SVGTextContentElement; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; -} - -interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextElement: { - prototype: SVGTextElement; - new(): SVGTextElement; -} - -interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - readonly method: SVGAnimatedEnumeration; - readonly spacing: SVGAnimatedEnumeration; - readonly startOffset: SVGAnimatedLength; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextPathElement: { - prototype: SVGTextPathElement; - new(): SVGTextPathElement; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -interface SVGTextPositioningElement extends SVGTextContentElement { - readonly dx: SVGAnimatedLengthList; - readonly dy: SVGAnimatedLengthList; - readonly rotate: SVGAnimatedNumberList; - readonly x: SVGAnimatedLengthList; - readonly y: SVGAnimatedLengthList; -} - -declare var SVGTextPositioningElement: { - prototype: SVGTextPositioningElement; - new(): SVGTextPositioningElement; -} - -interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTitleElement: { - prototype: SVGTitleElement; - new(): SVGTitleElement; -} - -interface SVGTransform { - readonly angle: number; - readonly matrix: SVGMatrix; - readonly type: number; - setMatrix(matrix: SVGMatrix): void; - setRotate(angle: number, cx: number, cy: number): void; - setScale(sx: number, sy: number): void; - setSkewX(angle: number): void; - setSkewY(angle: number): void; - setTranslate(tx: number, ty: number): void; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -declare var SVGTransform: { - prototype: SVGTransform; - new(): SVGTransform; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -interface SVGTransformList { - readonly numberOfItems: number; - appendItem(newItem: SVGTransform): SVGTransform; - clear(): void; - consolidate(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - getItem(index: number): SVGTransform; - initialize(newItem: SVGTransform): SVGTransform; - insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; - removeItem(index: number): SVGTransform; - replaceItem(newItem: SVGTransform, index: number): SVGTransform; -} - -declare var SVGTransformList: { - prototype: SVGTransformList; - new(): SVGTransformList; -} - -interface SVGUnitTypes { - readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - readonly SVG_UNIT_TYPE_UNKNOWN: number; - readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; -} -declare var SVGUnitTypes: SVGUnitTypes; - -interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly animatedInstanceRoot: SVGElementInstance; - readonly height: SVGAnimatedLength; - readonly instanceRoot: SVGElementInstance; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGUseElement: { - prototype: SVGUseElement; - new(): SVGUseElement; -} - -interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - readonly viewTarget: SVGStringList; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGViewElement: { - prototype: SVGViewElement; - new(): SVGViewElement; -} - -interface SVGZoomAndPan { - readonly zoomAndPan: number; -} - -declare var SVGZoomAndPan: { - readonly SVG_ZOOMANDPAN_DISABLE: number; - readonly SVG_ZOOMANDPAN_MAGNIFY: number; - readonly SVG_ZOOMANDPAN_UNKNOWN: number; -} - -interface SVGZoomEvent extends UIEvent { - readonly newScale: number; - readonly newTranslate: SVGPoint; - readonly previousScale: number; - readonly previousTranslate: SVGPoint; - readonly zoomRectScreen: SVGRect; -} - -declare var SVGZoomEvent: { - prototype: SVGZoomEvent; - new(): SVGZoomEvent; -} - -interface Screen extends EventTarget { - readonly availHeight: number; - readonly availWidth: number; - bufferDepth: number; - readonly colorDepth: number; - readonly deviceXDPI: number; - readonly deviceYDPI: number; - readonly fontSmoothingEnabled: boolean; - readonly height: number; - readonly logicalXDPI: number; - readonly logicalYDPI: number; - readonly msOrientation: string; - onmsorientationchange: (this: this, ev: Event) => any; - readonly pixelDepth: number; - readonly systemXDPI: number; - readonly systemYDPI: number; - readonly width: number; - msLockOrientation(orientations: string | string[]): boolean; - msUnlockOrientation(): void; - addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Screen: { - prototype: Screen; - new(): Screen; -} - -interface ScriptNotifyEvent extends Event { - readonly callingUri: string; - readonly value: string; -} - -declare var ScriptNotifyEvent: { - prototype: ScriptNotifyEvent; - new(): ScriptNotifyEvent; -} - -interface ScriptProcessorNode extends AudioNode { - readonly bufferSize: number; - onaudioprocess: (this: this, ev: AudioProcessingEvent) => any; - addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ScriptProcessorNode: { - prototype: ScriptProcessorNode; - new(): ScriptProcessorNode; -} - -interface Selection { - readonly anchorNode: Node; - readonly anchorOffset: number; - readonly focusNode: Node; - readonly focusOffset: number; - readonly isCollapsed: boolean; - readonly rangeCount: number; - readonly type: string; - addRange(range: Range): void; - collapse(parentNode: Node, offset: number): void; - collapseToEnd(): void; - collapseToStart(): void; - containsNode(node: Node, partlyContained: boolean): boolean; - deleteFromDocument(): void; - empty(): void; - extend(newNode: Node, offset: number): void; - getRangeAt(index: number): Range; - removeAllRanges(): void; - removeRange(range: Range): void; - selectAllChildren(parentNode: Node): void; - setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; - toString(): string; -} - -declare var Selection: { - prototype: Selection; - new(): Selection; -} - -interface SourceBuffer extends EventTarget { - appendWindowEnd: number; - appendWindowStart: number; - readonly audioTracks: AudioTrackList; - readonly buffered: TimeRanges; - mode: string; - timestampOffset: number; - readonly updating: boolean; - readonly videoTracks: VideoTrackList; - abort(): void; - appendBuffer(data: ArrayBuffer | ArrayBufferView): void; - appendStream(stream: MSStream, maxSize?: number): void; - remove(start: number, end: number): void; -} - -declare var SourceBuffer: { - prototype: SourceBuffer; - new(): SourceBuffer; -} - -interface SourceBufferList extends EventTarget { - readonly length: number; - item(index: number): SourceBuffer; - [index: number]: SourceBuffer; -} - -declare var SourceBufferList: { - prototype: SourceBufferList; - new(): SourceBufferList; -} - -interface StereoPannerNode extends AudioNode { - readonly pan: AudioParam; -} - -declare var StereoPannerNode: { - prototype: StereoPannerNode; - new(): StereoPannerNode; -} - -interface Storage { - readonly length: number; - clear(): void; - getItem(key: string): string | null; - key(index: number): string | null; - removeItem(key: string): void; - setItem(key: string, data: string): void; - [key: string]: any; - [index: number]: string; -} - -declare var Storage: { - prototype: Storage; - new(): Storage; -} - -interface StorageEvent extends Event { - readonly url: string; - key?: string; - oldValue?: string; - newValue?: string; - storageArea?: Storage; -} - -declare var StorageEvent: { - prototype: StorageEvent; - new (type: string, eventInitDict?: StorageEventInit): StorageEvent; -} - -interface StyleMedia { - readonly type: string; - matchMedium(mediaquery: string): boolean; -} - -declare var StyleMedia: { - prototype: StyleMedia; - new(): StyleMedia; -} - -interface StyleSheet { - disabled: boolean; - readonly href: string; - readonly media: MediaList; - readonly ownerNode: Node; - readonly parentStyleSheet: StyleSheet; - readonly title: string; - readonly type: string; -} - -declare var StyleSheet: { - prototype: StyleSheet; - new(): StyleSheet; -} - -interface StyleSheetList { - readonly length: number; - item(index?: number): StyleSheet; - [index: number]: StyleSheet; -} - -declare var StyleSheetList: { - prototype: StyleSheetList; - new(): StyleSheetList; -} - -interface StyleSheetPageList { - readonly length: number; - item(index: number): CSSPageRule; - [index: number]: CSSPageRule; -} - -declare var StyleSheetPageList: { - prototype: StyleSheetPageList; - new(): StyleSheetPageList; -} - -interface SubtleCrypto { - decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; - deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; - encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - exportKey(format: "jwk", key: CryptoKey): PromiseLike; - exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; - exportKey(format: string, key: CryptoKey): PromiseLike; - generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; - unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; - verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; -} - -declare var SubtleCrypto: { - prototype: SubtleCrypto; - new(): SubtleCrypto; -} - -interface Text extends CharacterData { - readonly wholeText: string; - splitText(offset: number): Text; -} - -declare var Text: { - prototype: Text; - new(): Text; -} - -interface TextEvent extends UIEvent { - readonly data: string; - readonly inputMethod: number; - readonly locale: string; - initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -declare var TextEvent: { - prototype: TextEvent; - new(): TextEvent; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -interface TextMetrics { - readonly width: number; -} - -declare var TextMetrics: { - prototype: TextMetrics; - new(): TextMetrics; -} - -interface TextTrack extends EventTarget { - readonly activeCues: TextTrackCueList; - readonly cues: TextTrackCueList; - readonly inBandMetadataTrackDispatchType: string; - readonly kind: string; - readonly label: string; - readonly language: string; - mode: any; - oncuechange: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - readonly readyState: number; - addCue(cue: TextTrackCue): void; - removeCue(cue: TextTrackCue): void; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; - addEventListener(type: "cuechange", 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrack: { - prototype: TextTrack; - new(): TextTrack; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; -} - -interface TextTrackCue extends EventTarget { - endTime: number; - id: string; - onenter: (this: this, ev: Event) => any; - onexit: (this: this, ev: Event) => any; - pauseOnExit: boolean; - startTime: number; - text: string; - readonly track: TextTrack; - getCueAsHTML(): DocumentFragment; - addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrackCue: { - prototype: TextTrackCue; - new(startTime: number, endTime: number, text: string): TextTrackCue; -} - -interface TextTrackCueList { - readonly length: number; - getCueById(id: string): TextTrackCue; - item(index: number): TextTrackCue; - [index: number]: TextTrackCue; -} - -declare var TextTrackCueList: { - prototype: TextTrackCueList; - new(): TextTrackCueList; -} - -interface TextTrackList extends EventTarget { - readonly length: number; - onaddtrack: ((this: this, ev: TrackEvent) => any) | null; - item(index: number): TextTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: TextTrack; -} - -declare var TextTrackList: { - prototype: TextTrackList; - new(): TextTrackList; -} - -interface TimeRanges { - readonly length: number; - end(index: number): number; - start(index: number): number; -} - -declare var TimeRanges: { - prototype: TimeRanges; - new(): TimeRanges; -} - -interface Touch { - readonly clientX: number; - readonly clientY: number; - readonly identifier: number; - readonly pageX: number; - readonly pageY: number; - readonly screenX: number; - readonly screenY: number; - readonly target: EventTarget; -} - -declare var Touch: { - prototype: Touch; - new(): Touch; -} - -interface TouchEvent extends UIEvent { - readonly altKey: boolean; - readonly changedTouches: TouchList; - readonly ctrlKey: boolean; - readonly metaKey: boolean; - readonly shiftKey: boolean; - readonly targetTouches: TouchList; - readonly touches: TouchList; -} - -declare var TouchEvent: { - prototype: TouchEvent; - new(): TouchEvent; -} - -interface TouchList { - readonly length: number; - item(index: number): Touch | null; - [index: number]: Touch; -} - -declare var TouchList: { - prototype: TouchList; - new(): TouchList; -} - -interface TrackEvent extends Event { - readonly track: any; -} - -declare var TrackEvent: { - prototype: TrackEvent; - new(): TrackEvent; -} - -interface TransitionEvent extends Event { - readonly elapsedTime: number; - readonly propertyName: string; - initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; -} - -declare var TransitionEvent: { - prototype: TransitionEvent; - new(): TransitionEvent; -} - -interface TreeWalker { - currentNode: Node; - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - firstChild(): Node; - lastChild(): Node; - nextNode(): Node; - nextSibling(): Node; - parentNode(): Node; - previousNode(): Node; - previousSibling(): Node; -} - -declare var TreeWalker: { - prototype: TreeWalker; - new(): TreeWalker; -} - -interface UIEvent extends Event { - readonly detail: number; - readonly view: Window; - initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; -} - -declare var UIEvent: { - prototype: UIEvent; - new(type: string, eventInitDict?: UIEventInit): UIEvent; -} - -interface URL { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - username: string; - toString(): string; -} - -declare var URL: { - prototype: URL; - new(url: string, base?: string): URL; - createObjectURL(object: any, options?: ObjectURLOptions): string; - revokeObjectURL(url: string): void; -} - -interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - readonly mediaType: string; -} - -declare var UnviewableContentIdentifiedEvent: { - prototype: UnviewableContentIdentifiedEvent; - new(): UnviewableContentIdentifiedEvent; -} - -interface ValidityState { - readonly badInput: boolean; - readonly customError: boolean; - readonly patternMismatch: boolean; - readonly rangeOverflow: boolean; - readonly rangeUnderflow: boolean; - readonly stepMismatch: boolean; - readonly tooLong: boolean; - readonly typeMismatch: boolean; - readonly valid: boolean; - readonly valueMissing: boolean; -} - -declare var ValidityState: { - prototype: ValidityState; - new(): ValidityState; -} - -interface VideoPlaybackQuality { - readonly corruptedVideoFrames: number; - readonly creationTime: number; - readonly droppedVideoFrames: number; - readonly totalFrameDelay: number; - readonly totalVideoFrames: number; -} - -declare var VideoPlaybackQuality: { - prototype: VideoPlaybackQuality; - new(): VideoPlaybackQuality; -} - -interface VideoTrack { - readonly id: string; - kind: string; - readonly label: string; - language: string; - selected: boolean; - readonly sourceBuffer: SourceBuffer; -} - -declare var VideoTrack: { - prototype: VideoTrack; - new(): VideoTrack; -} - -interface VideoTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - readonly selectedIndex: number; - getTrackById(id: string): VideoTrack | null; - item(index: number): VideoTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: VideoTrack; -} - -declare var VideoTrackList: { - prototype: VideoTrackList; - new(): VideoTrackList; -} - -interface WEBGL_compressed_texture_s3tc { - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -declare var WEBGL_compressed_texture_s3tc: { - prototype: WEBGL_compressed_texture_s3tc; - new(): WEBGL_compressed_texture_s3tc; - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -interface WEBGL_debug_renderer_info { - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -declare var WEBGL_debug_renderer_info: { - prototype: WEBGL_debug_renderer_info; - new(): WEBGL_debug_renderer_info; - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -interface WEBGL_depth_texture { - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -declare var WEBGL_depth_texture: { - prototype: WEBGL_depth_texture; - new(): WEBGL_depth_texture; - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -interface WaveShaperNode extends AudioNode { - curve: Float32Array | null; - oversample: string; -} - -declare var WaveShaperNode: { - prototype: WaveShaperNode; - new(): WaveShaperNode; -} - -interface WebGLActiveInfo { - readonly name: string; - readonly size: number; - readonly type: number; -} - -declare var WebGLActiveInfo: { - prototype: WebGLActiveInfo; - new(): WebGLActiveInfo; -} - -interface WebGLBuffer extends WebGLObject { -} - -declare var WebGLBuffer: { - prototype: WebGLBuffer; - new(): WebGLBuffer; -} - -interface WebGLContextEvent extends Event { - readonly statusMessage: string; -} - -declare var WebGLContextEvent: { - prototype: WebGLContextEvent; - new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; -} - -interface WebGLFramebuffer extends WebGLObject { -} - -declare var WebGLFramebuffer: { - prototype: WebGLFramebuffer; - new(): WebGLFramebuffer; -} - -interface WebGLObject { -} - -declare var WebGLObject: { - prototype: WebGLObject; - new(): WebGLObject; -} - -interface WebGLProgram extends WebGLObject { -} - -declare var WebGLProgram: { - prototype: WebGLProgram; - new(): WebGLProgram; -} - -interface WebGLRenderbuffer extends WebGLObject { -} - -declare var WebGLRenderbuffer: { - prototype: WebGLRenderbuffer; - new(): WebGLRenderbuffer; -} - -interface WebGLRenderingContext { - readonly canvas: HTMLCanvasElement; - readonly drawingBufferHeight: number; - readonly drawingBufferWidth: number; - activeTexture(texture: number): void; - attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer | null): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; - bindTexture(target: number, texture: WebGLTexture | null): void; - blendColor(red: number, green: number, blue: number, alpha: number): void; - blendEquation(mode: number): void; - blendEquationSeparate(modeRGB: number, modeAlpha: number): void; - blendFunc(sfactor: number, dfactor: number): void; - blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; - bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; - bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; - checkFramebufferStatus(target: number): number; - clear(mask: number): void; - clearColor(red: number, green: number, blue: number, alpha: number): void; - clearDepth(depth: number): void; - clearStencil(s: number): void; - colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader | null): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; - copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; - copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer | null; - createFramebuffer(): WebGLFramebuffer | null; - createProgram(): WebGLProgram | null; - createRenderbuffer(): WebGLRenderbuffer | null; - createShader(type: number): WebGLShader | null; - createTexture(): WebGLTexture | null; - cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer | null): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; - deleteProgram(program: WebGLProgram | null): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; - deleteShader(shader: WebGLShader | null): void; - deleteTexture(texture: WebGLTexture | null): void; - depthFunc(func: number): void; - depthMask(flag: boolean): void; - depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - disable(cap: number): void; - disableVertexAttribArray(index: number): void; - drawArrays(mode: number, first: number, count: number): void; - drawElements(mode: number, count: number, type: number, offset: number): void; - enable(cap: number): void; - enableVertexAttribArray(index: number): void; - finish(): void; - flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; - frontFace(mode: number): void; - generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; - getAttribLocation(program: WebGLProgram | null, name: string): number; - getBufferParameter(target: number, pname: number): any; - getContextAttributes(): WebGLContextAttributes; - getError(): number; - getExtension(name: string): any; - getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; - getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram | null): string | null; - getProgramParameter(program: WebGLProgram | null, pname: number): any; - getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader | null): string | null; - getShaderParameter(shader: WebGLShader | null, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; - getShaderSource(shader: WebGLShader | null): string | null; - getSupportedExtensions(): string[] | null; - getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; - getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; - getVertexAttrib(index: number, pname: number): any; - getVertexAttribOffset(index: number, pname: number): number; - hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer | null): boolean; - isContextLost(): boolean; - isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; - isProgram(program: WebGLProgram | null): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; - isShader(shader: WebGLShader | null): boolean; - isTexture(texture: WebGLTexture | null): boolean; - lineWidth(width: number): void; - linkProgram(program: WebGLProgram | null): void; - pixelStorei(pname: number, param: number): void; - polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; - renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; - sampleCoverage(value: number, invert: boolean): void; - scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader | null, source: string): void; - stencilFunc(func: number, ref: number, mask: number): void; - stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; - stencilMask(mask: number): void; - stencilMaskSeparate(face: number, mask: number): void; - stencilOp(fail: number, zfail: number, zpass: number): void; - stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - texParameterf(target: number, pname: number, param: number): void; - texParameteri(target: number, pname: number, param: number): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - useProgram(program: WebGLProgram | null): void; - validateProgram(program: WebGLProgram | null): void; - vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; - vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; - viewport(x: number, y: number, width: number, height: number): void; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -declare var WebGLRenderingContext: { - prototype: WebGLRenderingContext; - new(): WebGLRenderingContext; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -interface WebGLShader extends WebGLObject { -} - -declare var WebGLShader: { - prototype: WebGLShader; - new(): WebGLShader; -} - -interface WebGLShaderPrecisionFormat { - readonly precision: number; - readonly rangeMax: number; - readonly rangeMin: number; -} - -declare var WebGLShaderPrecisionFormat: { - prototype: WebGLShaderPrecisionFormat; - new(): WebGLShaderPrecisionFormat; -} - -interface WebGLTexture extends WebGLObject { -} - -declare var WebGLTexture: { - prototype: WebGLTexture; - new(): WebGLTexture; -} - -interface WebGLUniformLocation { -} - -declare var WebGLUniformLocation: { - prototype: WebGLUniformLocation; - new(): WebGLUniformLocation; -} - -interface WebKitCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): WebKitCSSMatrix; - multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): WebKitCSSMatrix; - skewY(angle: number): WebKitCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): WebKitCSSMatrix; -} - -declare var WebKitCSSMatrix: { - prototype: WebKitCSSMatrix; - new(text?: string): WebKitCSSMatrix; -} - -interface WebKitPoint { - x: number; - y: number; -} - -declare var WebKitPoint: { - prototype: WebKitPoint; - new(x?: number, y?: number): WebKitPoint; -} - -interface WebSocket extends EventTarget { - binaryType: string; - readonly bufferedAmount: number; - readonly extensions: string; - onclose: (this: this, ev: CloseEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onopen: (this: this, ev: Event) => any; - readonly protocol: string; - readonly readyState: number; - readonly url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WebSocket: { - prototype: WebSocket; - new(url: string, protocols?: string | string[]): WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; -} - -interface WheelEvent extends MouseEvent { - readonly deltaMode: number; - readonly deltaX: number; - readonly deltaY: number; - readonly deltaZ: number; - readonly wheelDelta: number; - readonly wheelDeltaX: number; - readonly wheelDeltaY: number; - getCurrentPoint(element: Element): void; - initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -declare var WheelEvent: { - prototype: WheelEvent; - new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - readonly applicationCache: ApplicationCache; - readonly clientInformation: Navigator; - readonly closed: boolean; - readonly crypto: Crypto; - defaultStatus: string; - readonly devicePixelRatio: number; - readonly doNotTrack: string; - readonly document: Document; - event: Event | undefined; - readonly external: External; - readonly frameElement: Element; - readonly frames: Window; - readonly history: History; - readonly innerHeight: number; - readonly innerWidth: number; - readonly length: number; - readonly location: Location; - readonly locationbar: BarProp; - readonly menubar: BarProp; - readonly msCredentials: MSCredentials; - name: string; - readonly navigator: Navigator; - offscreenBuffering: string | boolean; - onabort: (this: this, ev: UIEvent) => any; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncompassneedscalibration: (this: this, ev: Event) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondevicelight: (this: this, ev: DeviceLightEvent) => any; - ondevicemotion: (this: this, ev: DeviceMotionEvent) => any; - ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: ErrorEventHandler; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreadystatechange: (this: this, ev: ProgressEvent) => any; - onreset: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onstalled: (this: this, ev: Event) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onunload: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; - opener: any; - orientation: string | number; - readonly outerHeight: number; - readonly outerWidth: number; - readonly pageXOffset: number; - readonly pageYOffset: number; - readonly parent: Window; - readonly performance: Performance; - readonly personalbar: BarProp; - readonly screen: Screen; - readonly screenLeft: number; - readonly screenTop: number; - readonly screenX: number; - readonly screenY: number; - readonly scrollX: number; - readonly scrollY: number; - readonly scrollbars: BarProp; - readonly self: Window; - status: string; - readonly statusbar: BarProp; - readonly styleMedia: StyleMedia; - readonly toolbar: BarProp; - readonly top: Window; - readonly window: Window; - URL: typeof URL; - Blob: typeof Blob; - alert(message?: any): void; - blur(): void; - cancelAnimationFrame(handle: number): void; - captureEvents(): void; - close(): void; - confirm(message?: string): boolean; - focus(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; - getSelection(): Selection; - matchMedia(mediaQuery: string): MediaQueryList; - moveBy(x?: number, y?: number): void; - moveTo(x?: number, y?: number): void; - msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, transfer?: any[]): void; - print(): void; - prompt(message?: string, _default?: string): string | null; - releaseEvents(): void; - requestAnimationFrame(callback: FrameRequestCallback): number; - resizeBy(x?: number, y?: number): void; - resizeTo(x?: number, y?: number): void; - scroll(x?: number, y?: number): void; - scrollBy(x?: number, y?: number): void; - scrollTo(x?: number, y?: number): void; - webkitCancelAnimationFrame(handle: number): void; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - 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; -} - -declare var Window: { - prototype: Window; - new(): Window; -} - -interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: this, ev: MessageEvent) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Worker: { - prototype: Worker; - new(stringUrl: string): Worker; -} - -interface XMLDocument extends Document { -} - -declare var XMLDocument: { - prototype: XMLDocument; - new(): XMLDocument; -} - -interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: this, ev: Event) => any; - readonly readyState: number; - readonly response: any; - readonly responseText: string; - responseType: string; - readonly responseXML: any; - readonly status: number; - readonly statusText: string; - timeout: number; - readonly upload: XMLHttpRequestUpload; - withCredentials: boolean; - msCaching?: string; - readonly responseURL: string; - abort(): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string | null; - msCachingEnabled(): boolean; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - overrideMimeType(mime: string): void; - send(data?: Document): void; - send(data?: string): void; - send(data?: any): void; - setRequestHeader(header: string, value: string): void; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - 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: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", 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; -} - -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new(): XMLHttpRequest; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - create(): XMLHttpRequest; -} - -interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequestUpload: { - prototype: XMLHttpRequestUpload; - new(): XMLHttpRequestUpload; -} - -interface XMLSerializer { - serializeToString(target: Node): string; -} - -declare var XMLSerializer: { - prototype: XMLSerializer; - new(): XMLSerializer; -} - -interface XPathEvaluator { - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; -} - -declare var XPathEvaluator: { - prototype: XPathEvaluator; - new(): XPathEvaluator; -} - -interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; -} - -declare var XPathExpression: { - prototype: XPathExpression; - new(): XPathExpression; -} - -interface XPathNSResolver { - lookupNamespaceURI(prefix: string): string; -} - -declare var XPathNSResolver: { - prototype: XPathNSResolver; - new(): XPathNSResolver; -} - -interface XPathResult { - readonly booleanValue: boolean; - readonly invalidIteratorState: boolean; - readonly numberValue: number; - readonly resultType: number; - readonly singleNodeValue: Node; - readonly snapshotLength: number; - readonly stringValue: string; - iterateNext(): Node; - snapshotItem(index: number): Node; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -declare var XPathResult: { - prototype: XPathResult; - new(): XPathResult; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -interface XSLTProcessor { - clearParameters(): void; - getParameter(namespaceURI: string, localName: string): any; - importStylesheet(style: Node): void; - removeParameter(namespaceURI: string, localName: string): void; - reset(): void; - setParameter(namespaceURI: string, localName: string, value: any): void; - transformToDocument(source: Node): Document; - transformToFragment(source: Node, document: Document): DocumentFragment; -} - -declare var XSLTProcessor: { - prototype: XSLTProcessor; - new(): XSLTProcessor; -} - -interface AbstractWorker { - onerror: (this: this, ev: ErrorEvent) => any; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface CanvasPathMethods { - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; - closePath(): void; - ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - lineTo(x: number, y: number): void; - moveTo(x: number, y: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; -} - -interface ChildNode { - remove(): void; -} - -interface DOML2DeprecatedColorProperty { - color: string; -} - -interface DOML2DeprecatedSizeProperty { - size: number; -} - -interface DocumentEvent { - createEvent(eventInterface:"AnimationEvent"): AnimationEvent; - createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; - createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; - createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; - createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; - createEvent(eventInterface:"CloseEvent"): CloseEvent; - createEvent(eventInterface:"CommandEvent"): CommandEvent; - createEvent(eventInterface:"CompositionEvent"): CompositionEvent; - createEvent(eventInterface:"CustomEvent"): CustomEvent; - createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; - createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; - createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; - createEvent(eventInterface:"DragEvent"): DragEvent; - createEvent(eventInterface:"ErrorEvent"): ErrorEvent; - createEvent(eventInterface:"Event"): Event; - createEvent(eventInterface:"Events"): Event; - createEvent(eventInterface:"FocusEvent"): FocusEvent; - createEvent(eventInterface:"GamepadEvent"): GamepadEvent; - createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; - createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; - createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; - createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; - createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; - createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; - createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; - createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; - createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; - createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; - createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; - createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; - createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; - createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; - createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; - createEvent(eventInterface:"MessageEvent"): MessageEvent; - createEvent(eventInterface:"MouseEvent"): MouseEvent; - createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MutationEvent"): MutationEvent; - createEvent(eventInterface:"MutationEvents"): MutationEvent; - createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; - createEvent(eventInterface:"NavigationEvent"): NavigationEvent; - createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; - createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; - createEvent(eventInterface:"OverflowEvent"): OverflowEvent; - createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; - createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; - createEvent(eventInterface:"PointerEvent"): PointerEvent; - createEvent(eventInterface:"PopStateEvent"): PopStateEvent; - createEvent(eventInterface:"ProgressEvent"): ProgressEvent; - createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; - createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; - createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; - createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; - createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; - createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; - createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; - createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; - createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; - createEvent(eventInterface:"StorageEvent"): StorageEvent; - createEvent(eventInterface:"TextEvent"): TextEvent; - createEvent(eventInterface:"TouchEvent"): TouchEvent; - createEvent(eventInterface:"TrackEvent"): TrackEvent; - createEvent(eventInterface:"TransitionEvent"): TransitionEvent; - createEvent(eventInterface:"UIEvent"): UIEvent; - createEvent(eventInterface:"UIEvents"): UIEvent; - createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; - createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; - createEvent(eventInterface:"WheelEvent"): WheelEvent; - createEvent(eventInterface: string): Event; -} - -interface ElementTraversal { - readonly childElementCount: number; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly nextElementSibling: Element; - readonly previousElementSibling: Element; -} - -interface GetSVGDocument { - getSVGDocument(): Document; -} - -interface GlobalEventHandlers { - onpointercancel: (this: this, ev: PointerEvent) => any; - onpointerdown: (this: this, ev: PointerEvent) => any; - onpointerenter: (this: this, ev: PointerEvent) => any; - onpointerleave: (this: this, ev: PointerEvent) => any; - onpointermove: (this: this, ev: PointerEvent) => any; - onpointerout: (this: this, ev: PointerEvent) => any; - onpointerover: (this: this, ev: PointerEvent) => any; - onpointerup: (this: this, ev: PointerEvent) => any; - onwheel: (this: this, ev: WheelEvent) => any; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface HTMLTableAlignment { - /** - * Sets or retrieves a value that you can use to implement your own ch functionality for the object. - */ - ch: string; - /** - * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. - */ - chOff: string; - /** - * Sets or retrieves how text and other content are vertically aligned within the object that contains them. - */ - vAlign: string; -} - -interface IDBEnvironment { - readonly indexedDB: IDBFactory; -} - -interface LinkStyle { - readonly sheet: StyleSheet; -} - -interface MSBaseReader { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - readonly readyState: number; - readonly result: any; - abort(): void; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface MSFileSaver { - msSaveBlob(blob: any, defaultName?: string): boolean; - msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; -} - -interface MSNavigatorDoNotTrack { - confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; - confirmWebWideTrackingException(args: ExceptionInformation): boolean; - removeSiteSpecificTrackingException(args: ExceptionInformation): void; - removeWebWideTrackingException(args: ExceptionInformation): void; - storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; - storeWebWideTrackingException(args: StoreExceptionsInformation): void; -} - -interface NavigatorContentUtils { -} - -interface NavigatorGeolocation { - readonly geolocation: Geolocation; -} - -interface NavigatorID { - readonly appName: string; - readonly appVersion: string; - readonly platform: string; - readonly product: string; - readonly productSub: string; - readonly userAgent: string; - readonly vendor: string; - readonly vendorSub: string; -} - -interface NavigatorOnLine { - readonly onLine: boolean; -} - -interface NavigatorStorageUtils { -} - -interface NavigatorUserMedia { - readonly mediaDevices: MediaDevices; - getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; -} - -interface NodeSelector { - 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; - querySelectorAll(selectors: "abbr"): NodeListOf; - querySelectorAll(selectors: "acronym"): NodeListOf; - querySelectorAll(selectors: "address"): NodeListOf; - querySelectorAll(selectors: "applet"): NodeListOf; - querySelectorAll(selectors: "area"): NodeListOf; - querySelectorAll(selectors: "article"): NodeListOf; - querySelectorAll(selectors: "aside"): NodeListOf; - querySelectorAll(selectors: "audio"): NodeListOf; - querySelectorAll(selectors: "b"): NodeListOf; - querySelectorAll(selectors: "base"): NodeListOf; - querySelectorAll(selectors: "basefont"): NodeListOf; - querySelectorAll(selectors: "bdo"): NodeListOf; - querySelectorAll(selectors: "big"): NodeListOf; - querySelectorAll(selectors: "blockquote"): NodeListOf; - querySelectorAll(selectors: "body"): NodeListOf; - querySelectorAll(selectors: "br"): NodeListOf; - querySelectorAll(selectors: "button"): NodeListOf; - querySelectorAll(selectors: "canvas"): NodeListOf; - querySelectorAll(selectors: "caption"): NodeListOf; - querySelectorAll(selectors: "center"): NodeListOf; - querySelectorAll(selectors: "circle"): NodeListOf; - querySelectorAll(selectors: "cite"): NodeListOf; - querySelectorAll(selectors: "clippath"): NodeListOf; - querySelectorAll(selectors: "code"): NodeListOf; - querySelectorAll(selectors: "col"): NodeListOf; - querySelectorAll(selectors: "colgroup"): NodeListOf; - querySelectorAll(selectors: "datalist"): NodeListOf; - querySelectorAll(selectors: "dd"): NodeListOf; - querySelectorAll(selectors: "defs"): NodeListOf; - querySelectorAll(selectors: "del"): NodeListOf; - querySelectorAll(selectors: "desc"): NodeListOf; - querySelectorAll(selectors: "dfn"): NodeListOf; - querySelectorAll(selectors: "dir"): NodeListOf; - querySelectorAll(selectors: "div"): NodeListOf; - querySelectorAll(selectors: "dl"): NodeListOf; - querySelectorAll(selectors: "dt"): NodeListOf; - querySelectorAll(selectors: "ellipse"): NodeListOf; - querySelectorAll(selectors: "em"): NodeListOf; - querySelectorAll(selectors: "embed"): NodeListOf; - querySelectorAll(selectors: "feblend"): NodeListOf; - querySelectorAll(selectors: "fecolormatrix"): NodeListOf; - querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf; - querySelectorAll(selectors: "fecomposite"): NodeListOf; - querySelectorAll(selectors: "feconvolvematrix"): NodeListOf; - querySelectorAll(selectors: "fediffuselighting"): NodeListOf; - querySelectorAll(selectors: "fedisplacementmap"): NodeListOf; - querySelectorAll(selectors: "fedistantlight"): NodeListOf; - querySelectorAll(selectors: "feflood"): NodeListOf; - querySelectorAll(selectors: "fefunca"): NodeListOf; - querySelectorAll(selectors: "fefuncb"): NodeListOf; - querySelectorAll(selectors: "fefuncg"): NodeListOf; - querySelectorAll(selectors: "fefuncr"): NodeListOf; - querySelectorAll(selectors: "fegaussianblur"): NodeListOf; - querySelectorAll(selectors: "feimage"): NodeListOf; - querySelectorAll(selectors: "femerge"): NodeListOf; - querySelectorAll(selectors: "femergenode"): NodeListOf; - querySelectorAll(selectors: "femorphology"): NodeListOf; - querySelectorAll(selectors: "feoffset"): NodeListOf; - querySelectorAll(selectors: "fepointlight"): NodeListOf; - querySelectorAll(selectors: "fespecularlighting"): NodeListOf; - querySelectorAll(selectors: "fespotlight"): NodeListOf; - querySelectorAll(selectors: "fetile"): NodeListOf; - querySelectorAll(selectors: "feturbulence"): NodeListOf; - querySelectorAll(selectors: "fieldset"): NodeListOf; - querySelectorAll(selectors: "figcaption"): NodeListOf; - querySelectorAll(selectors: "figure"): NodeListOf; - querySelectorAll(selectors: "filter"): NodeListOf; - querySelectorAll(selectors: "font"): NodeListOf; - querySelectorAll(selectors: "footer"): NodeListOf; - querySelectorAll(selectors: "foreignobject"): NodeListOf; - querySelectorAll(selectors: "form"): NodeListOf; - querySelectorAll(selectors: "frame"): NodeListOf; - querySelectorAll(selectors: "frameset"): NodeListOf; - querySelectorAll(selectors: "g"): NodeListOf; - querySelectorAll(selectors: "h1"): NodeListOf; - querySelectorAll(selectors: "h2"): NodeListOf; - querySelectorAll(selectors: "h3"): NodeListOf; - querySelectorAll(selectors: "h4"): NodeListOf; - querySelectorAll(selectors: "h5"): NodeListOf; - querySelectorAll(selectors: "h6"): NodeListOf; - querySelectorAll(selectors: "head"): NodeListOf; - querySelectorAll(selectors: "header"): NodeListOf; - querySelectorAll(selectors: "hgroup"): NodeListOf; - querySelectorAll(selectors: "hr"): NodeListOf; - querySelectorAll(selectors: "html"): NodeListOf; - querySelectorAll(selectors: "i"): NodeListOf; - querySelectorAll(selectors: "iframe"): NodeListOf; - querySelectorAll(selectors: "image"): NodeListOf; - querySelectorAll(selectors: "img"): NodeListOf; - querySelectorAll(selectors: "input"): NodeListOf; - querySelectorAll(selectors: "ins"): NodeListOf; - querySelectorAll(selectors: "isindex"): NodeListOf; - querySelectorAll(selectors: "kbd"): NodeListOf; - querySelectorAll(selectors: "keygen"): NodeListOf; - querySelectorAll(selectors: "label"): NodeListOf; - querySelectorAll(selectors: "legend"): NodeListOf; - querySelectorAll(selectors: "li"): NodeListOf; - querySelectorAll(selectors: "line"): NodeListOf; - querySelectorAll(selectors: "lineargradient"): NodeListOf; - querySelectorAll(selectors: "link"): NodeListOf; - querySelectorAll(selectors: "listing"): NodeListOf; - querySelectorAll(selectors: "map"): NodeListOf; - querySelectorAll(selectors: "mark"): NodeListOf; - querySelectorAll(selectors: "marker"): NodeListOf; - querySelectorAll(selectors: "marquee"): NodeListOf; - querySelectorAll(selectors: "mask"): NodeListOf; - querySelectorAll(selectors: "menu"): NodeListOf; - querySelectorAll(selectors: "meta"): NodeListOf; - querySelectorAll(selectors: "metadata"): NodeListOf; - querySelectorAll(selectors: "meter"): NodeListOf; - querySelectorAll(selectors: "nav"): NodeListOf; - querySelectorAll(selectors: "nextid"): NodeListOf; - querySelectorAll(selectors: "nobr"): NodeListOf; - querySelectorAll(selectors: "noframes"): NodeListOf; - querySelectorAll(selectors: "noscript"): NodeListOf; - querySelectorAll(selectors: "object"): NodeListOf; - querySelectorAll(selectors: "ol"): NodeListOf; - querySelectorAll(selectors: "optgroup"): NodeListOf; - querySelectorAll(selectors: "option"): NodeListOf; - querySelectorAll(selectors: "p"): NodeListOf; - querySelectorAll(selectors: "param"): NodeListOf; - querySelectorAll(selectors: "path"): NodeListOf; - querySelectorAll(selectors: "pattern"): NodeListOf; - querySelectorAll(selectors: "picture"): NodeListOf; - querySelectorAll(selectors: "plaintext"): NodeListOf; - querySelectorAll(selectors: "polygon"): NodeListOf; - querySelectorAll(selectors: "polyline"): NodeListOf; - querySelectorAll(selectors: "pre"): NodeListOf; - querySelectorAll(selectors: "progress"): NodeListOf; - querySelectorAll(selectors: "q"): NodeListOf; - querySelectorAll(selectors: "radialgradient"): NodeListOf; - querySelectorAll(selectors: "rect"): NodeListOf; - querySelectorAll(selectors: "rt"): NodeListOf; - querySelectorAll(selectors: "ruby"): NodeListOf; - querySelectorAll(selectors: "s"): NodeListOf; - querySelectorAll(selectors: "samp"): NodeListOf; - querySelectorAll(selectors: "script"): NodeListOf; - querySelectorAll(selectors: "section"): NodeListOf; - querySelectorAll(selectors: "select"): NodeListOf; - querySelectorAll(selectors: "small"): NodeListOf; - querySelectorAll(selectors: "source"): NodeListOf; - querySelectorAll(selectors: "span"): NodeListOf; - querySelectorAll(selectors: "stop"): NodeListOf; - querySelectorAll(selectors: "strike"): NodeListOf; - querySelectorAll(selectors: "strong"): NodeListOf; - querySelectorAll(selectors: "style"): NodeListOf; - querySelectorAll(selectors: "sub"): NodeListOf; - querySelectorAll(selectors: "sup"): NodeListOf; - querySelectorAll(selectors: "svg"): NodeListOf; - querySelectorAll(selectors: "switch"): NodeListOf; - querySelectorAll(selectors: "symbol"): NodeListOf; - querySelectorAll(selectors: "table"): NodeListOf; - querySelectorAll(selectors: "tbody"): NodeListOf; - querySelectorAll(selectors: "td"): NodeListOf; - querySelectorAll(selectors: "template"): NodeListOf; - querySelectorAll(selectors: "text"): NodeListOf; - querySelectorAll(selectors: "textpath"): NodeListOf; - querySelectorAll(selectors: "textarea"): NodeListOf; - querySelectorAll(selectors: "tfoot"): NodeListOf; - querySelectorAll(selectors: "th"): NodeListOf; - querySelectorAll(selectors: "thead"): NodeListOf; - querySelectorAll(selectors: "title"): NodeListOf; - querySelectorAll(selectors: "tr"): NodeListOf; - querySelectorAll(selectors: "track"): NodeListOf; - querySelectorAll(selectors: "tspan"): NodeListOf; - querySelectorAll(selectors: "tt"): NodeListOf; - querySelectorAll(selectors: "u"): NodeListOf; - querySelectorAll(selectors: "ul"): NodeListOf; - querySelectorAll(selectors: "use"): NodeListOf; - querySelectorAll(selectors: "var"): NodeListOf; - querySelectorAll(selectors: "video"): NodeListOf; - querySelectorAll(selectors: "view"): NodeListOf; - querySelectorAll(selectors: "wbr"): NodeListOf; - querySelectorAll(selectors: "x-ms-webview"): NodeListOf; - querySelectorAll(selectors: "xmp"): NodeListOf; - querySelectorAll(selectors: string): NodeListOf; -} - -interface RandomSource { - getRandomValues(array: ArrayBufferView): ArrayBufferView; -} - -interface SVGAnimatedPathData { - readonly pathSegList: SVGPathSegList; -} - -interface SVGAnimatedPoints { - readonly animatedPoints: SVGPointList; - readonly points: SVGPointList; -} - -interface SVGExternalResourcesRequired { - readonly externalResourcesRequired: SVGAnimatedBoolean; -} - -interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - readonly height: SVGAnimatedLength; - readonly result: SVGAnimatedString; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; -} - -interface SVGFitToViewBox { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly viewBox: SVGAnimatedRect; -} - -interface SVGLangSpace { - xmllang: string; - xmlspace: string; -} - -interface SVGLocatable { - readonly farthestViewportElement: SVGElement; - readonly nearestViewportElement: SVGElement; - getBBox(): SVGRect; - getCTM(): SVGMatrix; - getScreenCTM(): SVGMatrix; - getTransformToElement(element: SVGElement): SVGMatrix; -} - -interface SVGStylable { - className: any; - readonly style: CSSStyleDeclaration; -} - -interface SVGTests { - readonly requiredExtensions: SVGStringList; - readonly requiredFeatures: SVGStringList; - readonly systemLanguage: SVGStringList; - hasExtension(extension: string): boolean; -} - -interface SVGTransformable extends SVGLocatable { - readonly transform: SVGAnimatedTransformList; -} - -interface SVGURIReference { - readonly href: SVGAnimatedString; -} - -interface WindowBase64 { - atob(encodedString: string): string; - btoa(rawString: string): string; -} - -interface WindowConsole { - readonly console: Console; -} - -interface WindowLocalStorage { - readonly localStorage: Storage; -} - -interface WindowSessionStorage { - readonly sessionStorage: Storage; -} - -interface WindowTimers extends Object, WindowTimersExtension { - clearInterval(handle: number): void; - clearTimeout(handle: number): void; - setInterval(handler: (...args: any[]) => void, timeout: number): number; - setInterval(handler: any, timeout?: any, ...args: any[]): number; - setTimeout(handler: (...args: any[]) => void, timeout: number): number; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; -} - -interface WindowTimersExtension { - clearImmediate(handle: number): void; - setImmediate(handler: (...args: any[]) => void): number; - setImmediate(handler: any, ...args: any[]): number; -} - -interface XMLHttpRequestEventTarget { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - ontimeout: (this: this, ev: ProgressEvent) => any; - 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface StorageEventInit extends EventInit { - key?: string; - oldValue?: string; - newValue?: string; - url: string; - storageArea?: Storage; -} - -interface Canvas2DContextAttributes { - alpha?: boolean; - willReadFrequently?: boolean; - storage?: boolean; - [attribute: string]: boolean | string | undefined; -} - -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - -interface HTMLCollectionOf extends HTMLCollection { - item(index: number): T; - namedItem(name: string): T; - [index: number]: T; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface FilePropertyBag { - type?: string; - lastModified?: number; -} - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface MessageEventInit extends EventInit { - data?: any; - origin?: string; - lastEventId?: string; - channel?: string; - source?: any; - ports?: MessagePort[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - 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; -} - -interface IDBArrayKey extends Array { -} - -interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: AlgorithmIdentifier; -} - -interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: AlgorithmIdentifier; -} - -interface RsaHashedImportParams { - hash: AlgorithmIdentifier; -} - -interface RsaPssParams { - saltLength: number; -} - -interface RsaOaepParams extends Algorithm { - label?: BufferSource; -} - -interface EcdsaParams extends Algorithm { - hash: AlgorithmIdentifier; -} - -interface EcKeyGenParams extends Algorithm { - namedCurve: string; -} - -interface EcKeyAlgorithm extends KeyAlgorithm { - typedCurve: string; -} - -interface EcKeyImportParams { - namedCurve: string; -} - -interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; -} - -interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; -} - -interface AesKeyGenParams extends Algorithm { - length: number; -} - -interface AesDerivedKeyParams extends Algorithm { - length: number; -} - -interface AesCbcParams extends Algorithm { - iv: BufferSource; -} - -interface AesCmacParams extends Algorithm { - length: number; -} - -interface AesGcmParams extends Algorithm { - iv: BufferSource; - additionalData?: BufferSource; - tagLength?: number; -} - -interface AesCfbParams extends Algorithm { - iv: BufferSource; -} - -interface HmacImportParams extends Algorithm { - hash?: AlgorithmIdentifier; - length?: number; -} - -interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: AlgorithmIdentifier; - length: number; -} - -interface HmacKeyGenParams extends Algorithm { - hash: AlgorithmIdentifier; - length?: number; -} - -interface DhKeyGenParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyAlgorithm extends KeyAlgorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface DhImportKeyParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface ConcatParams extends Algorithm { - hash?: AlgorithmIdentifier; - algorithmId: Uint8Array; - partyUInfo: Uint8Array; - partyVInfo: Uint8Array; - publicInfo?: Uint8Array; - privateInfo?: Uint8Array; -} - -interface HkdfCtrParams extends Algorithm { - hash: AlgorithmIdentifier; - label: BufferSource; - context: BufferSource; -} - -interface Pbkdf2Params extends Algorithm { - salt: BufferSource; - iterations: number; - hash: AlgorithmIdentifier; -} - -interface RsaOtherPrimesInfo { - r: string; - d: string; - t: string; -} - -interface JsonWebKey { - kty: string; - use?: string; - key_ops?: string[]; - alg?: string; - kid?: string; - x5u?: string; - x5c?: string; - x5t?: string; - ext?: boolean; - crv?: string; - x?: string; - y?: string; - d?: string; - n?: string; - e?: string; - p?: string; - q?: string; - dp?: string; - dq?: string; - qi?: string; - oth?: RsaOtherPrimesInfo[]; - k?: string; -} - -interface ParentNode { - readonly children: HTMLCollection; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly childElementCount: number; -} - -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - -interface ErrorEventHandler { - (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; -} -interface PositionCallback { - (position: Position): void; -} -interface PositionErrorCallback { - (error: PositionError): void; -} -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} -interface MSLaunchUriCallback { - (): void; -} -interface FrameRequestCallback { - (time: number): void; -} -interface MSUnsafeFunctionCallback { - (): any; -} -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; -} -interface DecodeSuccessCallback { - (decodedData: AudioBuffer): void; -} -interface DecodeErrorCallback { - (error: DOMException): void; -} -interface FunctionStringCallback { - (data: string): void; -} -interface NavigatorUserMediaSuccessCallback { - (stream: MediaStream): void; -} -interface NavigatorUserMediaErrorCallback { - (error: MediaStreamError): void; -} -interface ForEachCallback { - (keyId: any, status: string): void; -} -declare var Audio: {new(src?: string): HTMLAudioElement; }; -declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; -declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var applicationCache: ApplicationCache; -declare var clientInformation: Navigator; -declare var closed: boolean; -declare var crypto: Crypto; -declare var defaultStatus: string; -declare var devicePixelRatio: number; -declare var doNotTrack: string; -declare var document: Document; -declare var event: Event | undefined; -declare var external: External; -declare var frameElement: Element; -declare var frames: Window; -declare var history: History; -declare var innerHeight: number; -declare var innerWidth: number; -declare var length: number; -declare var location: Location; -declare var locationbar: BarProp; -declare var menubar: BarProp; -declare var msCredentials: MSCredentials; -declare const name: never; -declare var navigator: Navigator; -declare var offscreenBuffering: string | boolean; -declare var onabort: (this: Window, ev: UIEvent) => any; -declare var onafterprint: (this: Window, ev: Event) => any; -declare var onbeforeprint: (this: Window, ev: Event) => any; -declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; -declare var onblur: (this: Window, ev: FocusEvent) => any; -declare var oncanplay: (this: Window, ev: Event) => any; -declare var oncanplaythrough: (this: Window, ev: Event) => any; -declare var onchange: (this: Window, ev: Event) => any; -declare var onclick: (this: Window, ev: MouseEvent) => any; -declare var oncompassneedscalibration: (this: Window, ev: Event) => any; -declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; -declare var ondblclick: (this: Window, ev: MouseEvent) => any; -declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; -declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; -declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; -declare var ondrag: (this: Window, ev: DragEvent) => any; -declare var ondragend: (this: Window, ev: DragEvent) => any; -declare var ondragenter: (this: Window, ev: DragEvent) => any; -declare var ondragleave: (this: Window, ev: DragEvent) => any; -declare var ondragover: (this: Window, ev: DragEvent) => any; -declare var ondragstart: (this: Window, ev: DragEvent) => any; -declare var ondrop: (this: Window, ev: DragEvent) => any; -declare var ondurationchange: (this: Window, ev: Event) => any; -declare var onemptied: (this: Window, ev: Event) => any; -declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; -declare var onerror: ErrorEventHandler; -declare var onfocus: (this: Window, ev: FocusEvent) => any; -declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; -declare var oninput: (this: Window, ev: Event) => any; -declare var oninvalid: (this: Window, ev: Event) => any; -declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; -declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; -declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; -declare var onload: (this: Window, ev: Event) => any; -declare var onloadeddata: (this: Window, ev: Event) => any; -declare var onloadedmetadata: (this: Window, ev: Event) => any; -declare var onloadstart: (this: Window, ev: Event) => any; -declare var onmessage: (this: Window, ev: MessageEvent) => any; -declare var onmousedown: (this: Window, ev: MouseEvent) => any; -declare var onmouseenter: (this: Window, ev: MouseEvent) => any; -declare var onmouseleave: (this: Window, ev: MouseEvent) => any; -declare var onmousemove: (this: Window, ev: MouseEvent) => any; -declare var onmouseout: (this: Window, ev: MouseEvent) => any; -declare var onmouseover: (this: Window, ev: MouseEvent) => any; -declare var onmouseup: (this: Window, ev: MouseEvent) => any; -declare var onmousewheel: (this: Window, ev: WheelEvent) => any; -declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; -declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; -declare var onoffline: (this: Window, ev: Event) => any; -declare var ononline: (this: Window, ev: Event) => any; -declare var onorientationchange: (this: Window, ev: Event) => any; -declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; -declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; -declare var onpause: (this: Window, ev: Event) => any; -declare var onplay: (this: Window, ev: Event) => any; -declare var onplaying: (this: Window, ev: Event) => any; -declare var onpopstate: (this: Window, ev: PopStateEvent) => any; -declare var onprogress: (this: Window, ev: ProgressEvent) => any; -declare var onratechange: (this: Window, ev: Event) => any; -declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; -declare var onreset: (this: Window, ev: Event) => any; -declare var onresize: (this: Window, ev: UIEvent) => any; -declare var onscroll: (this: Window, ev: UIEvent) => any; -declare var onseeked: (this: Window, ev: Event) => any; -declare var onseeking: (this: Window, ev: Event) => any; -declare var onselect: (this: Window, ev: UIEvent) => any; -declare var onstalled: (this: Window, ev: Event) => any; -declare var onstorage: (this: Window, ev: StorageEvent) => any; -declare var onsubmit: (this: Window, ev: Event) => any; -declare var onsuspend: (this: Window, ev: Event) => any; -declare var ontimeupdate: (this: Window, ev: Event) => any; -declare var ontouchcancel: (ev: TouchEvent) => any; -declare var ontouchend: (ev: TouchEvent) => any; -declare var ontouchmove: (ev: TouchEvent) => any; -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: any; -declare var orientation: string | number; -declare var outerHeight: number; -declare var outerWidth: number; -declare var pageXOffset: number; -declare var pageYOffset: number; -declare var parent: Window; -declare var performance: Performance; -declare var personalbar: BarProp; -declare var screen: Screen; -declare var screenLeft: number; -declare var screenTop: number; -declare var screenX: number; -declare var screenY: number; -declare var scrollX: number; -declare var scrollY: number; -declare var scrollbars: BarProp; -declare var self: Window; -declare var status: string; -declare var statusbar: BarProp; -declare var styleMedia: StyleMedia; -declare var toolbar: BarProp; -declare var top: Window; -declare var window: Window; -declare function alert(message?: any): void; -declare function blur(): void; -declare function cancelAnimationFrame(handle: number): void; -declare function captureEvents(): void; -declare function close(): void; -declare function confirm(message?: string): boolean; -declare function focus(): void; -declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; -declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; -declare function getSelection(): Selection; -declare function matchMedia(mediaQuery: string): MediaQueryList; -declare function moveBy(x?: number, y?: number): void; -declare function moveTo(x?: number, y?: number): void; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; -declare function print(): void; -declare function prompt(message?: string, _default?: string): string | null; -declare function releaseEvents(): void; -declare function requestAnimationFrame(callback: FrameRequestCallback): number; -declare function resizeBy(x?: number, y?: number): void; -declare function resizeTo(x?: number, y?: number): void; -declare function scroll(x?: number, y?: number): void; -declare function scrollBy(x?: number, y?: number): void; -declare function scrollTo(x?: number, y?: number): void; -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; -declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function clearInterval(handle: number): void; -declare function clearTimeout(handle: number): void; -declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; -declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function clearImmediate(handle: number): void; -declare function setImmediate(handler: (...args: any[]) => void): number; -declare function setImmediate(handler: any, ...args: any[]): number; -declare var sessionStorage: Storage; -declare var localStorage: Storage; -declare var console: Console; -declare var onpointercancel: (this: Window, ev: PointerEvent) => any; -declare var onpointerdown: (this: Window, ev: PointerEvent) => any; -declare var onpointerenter: (this: Window, ev: PointerEvent) => any; -declare var onpointerleave: (this: Window, ev: PointerEvent) => any; -declare var onpointermove: (this: Window, ev: PointerEvent) => any; -declare var onpointerout: (this: Window, ev: PointerEvent) => any; -declare var onpointerover: (this: Window, ev: PointerEvent) => any; -declare var onpointerup: (this: Window, ev: PointerEvent) => any; -declare var onwheel: (this: Window, ev: WheelEvent) => any; -declare var indexedDB: IDBFactory; -declare function atob(encodedString: string): string; -declare function btoa(rawString: string): string; -declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -type AAGUID = string; -type AlgorithmIdentifier = string | Algorithm; -type ConstrainBoolean = boolean | ConstrainBooleanParameters; -type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; -type ConstrainDouble = number | ConstrainDoubleRange; -type ConstrainLong = number | ConstrainLongRange; -type CryptoOperationData = ArrayBufferView; -type GLbitfield = number; -type GLboolean = boolean; -type GLbyte = number; -type GLclampf = number; -type GLenum = number; -type GLfloat = number; -type GLint = number; -type GLintptr = number; -type GLshort = number; -type GLsizei = number; -type GLsizeiptr = number; -type GLubyte = number; -type GLuint = number; -type GLushort = number; -type IDBKeyPath = string; -type KeyFormat = string; -type KeyType = string; -type KeyUsage = string; -type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; -type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; -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; + +///////////////////////////// +/// IE DOM APIs +///////////////////////////// + +interface Algorithm { + name: string; +} + +interface AriaRequestEventInit extends EventInit { + attributeName?: string; + attributeValue?: string; +} + +interface CommandEventInit extends EventInit { + commandName?: string; + detail?: string; +} + +interface CompositionEventInit extends UIEventInit { + data?: string; +} + +interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { + arrayOfDomainStrings?: string[]; +} + +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface CustomEventInit extends EventInit { + detail?: any; +} + +interface DeviceAccelerationDict { + x?: number; + y?: number; + z?: number; +} + +interface DeviceLightEventInit extends EventInit { + value?: number; +} + +interface DeviceRotationRateDict { + alpha?: number; + beta?: number; + gamma?: number; +} + +interface DoubleRange { + max?: number; + min?: number; +} + +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; +} + +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + +interface ExceptionInformation { + domain?: string; +} + +interface FocusEventInit extends UIEventInit { + relatedTarget?: EventTarget; +} + +interface HashChangeEventInit extends EventInit { + newURL?: string; + oldURL?: string; +} + +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + +interface KeyAlgorithm { + name?: string; +} + +interface KeyboardEventInit extends EventModifierInit { + code?: string; + key?: string; + location?: number; + repeat?: boolean; +} + +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: string; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: string; +} + +interface MSCredentialSpec { + type?: string; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: string; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: string; + localInterface?: MSNetworkInterfaceType; + localAddrType?: string; + remoteAddrType?: string; + iceRole?: string; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resoluton?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: string; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: string; + persistentState?: string; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MouseEventInit extends EventModifierInit { + screenX?: number; + screenY?: number; + clientX?: number; + clientY?: number; + button?: number; + buttons?: number; + relatedTarget?: EventTarget; +} + +interface MsZoomToOptions { + contentX?: number; + contentY?: number; + viewportX?: string; + viewportY?: string; + scaleFactor?: number; + animate?: string; +} + +interface MutationObserverInit { + childList?: boolean; + attributes?: boolean; + characterData?: boolean; + subtree?: boolean; + attributeOldValue?: boolean; + characterDataOldValue?: boolean; + attributeFilter?: string[]; +} + +interface ObjectURLOptions { + oneTimeOnly?: boolean; +} + +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + +interface PointerEventInit extends MouseEventInit { + pointerId?: number; + width?: number; + height?: number; + pressure?: number; + tiltX?: number; + tiltY?: number; + pointerType?: string; + isPrimary?: boolean; +} + +interface PositionOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; +} + +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: string; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidate { + foundation?: string; + priority?: number; + ip?: string; + protocol?: string; + port?: number; + type?: string; + tcpType?: string; + relatedAddress?: string; + relatedPort?: number; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: string; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: string; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: string; + iceservers?: RTCIceServer[]; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + framerateBias?: number; + resolutionScale?: number; + framerateScale?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: string; + id?: string; + msType?: string; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; +} + +interface StoreExceptionsInformation extends ExceptionInformation { + siteName?: string; + explanationString?: string; + detailURI?: string; +} + +interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { + arrayOfDomainStrings?: string[]; +} + +interface UIEventInit extends EventInit { + view?: Window; + detail?: number; +} + +interface WebGLContextAttributes { + failIfMajorPerformanceCaveat?: boolean; + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; +} + +interface WebGLContextEventInit extends EventInit { + statusMessage?: string; +} + +interface WheelEventInit extends MouseEventInit { + deltaX?: number; + deltaY?: number; + deltaZ?: number; + deltaMode?: number; +} + +interface EventListener { + (evt: Event): void; +} + +interface ANGLE_instanced_arrays { + drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; + drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; + vertexAttribDivisorANGLE(index: number, divisor: number): void; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +declare var ANGLE_instanced_arrays: { + prototype: ANGLE_instanced_arrays; + new(): ANGLE_instanced_arrays; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +interface AnalyserNode extends AudioNode { + fftSize: number; + readonly frequencyBinCount: number; + maxDecibels: number; + minDecibels: number; + smoothingTimeConstant: number; + getByteFrequencyData(array: Uint8Array): void; + getByteTimeDomainData(array: Uint8Array): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; +} + +declare var AnalyserNode: { + prototype: AnalyserNode; + new(): AnalyserNode; +} + +interface AnimationEvent extends Event { + readonly animationName: string; + readonly elapsedTime: number; + initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; +} + +declare var AnimationEvent: { + prototype: AnimationEvent; + new(): AnimationEvent; +} + +interface ApplicationCache extends EventTarget { + oncached: (this: this, ev: Event) => any; + onchecking: (this: this, ev: Event) => any; + ondownloading: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onnoupdate: (this: this, ev: Event) => any; + onobsolete: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + onupdateready: (this: this, ev: Event) => any; + readonly status: number; + abort(): void; + swapCache(): void; + update(): void; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; + addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ApplicationCache: { + prototype: ApplicationCache; + new(): ApplicationCache; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; +} + +interface AriaRequestEvent extends Event { + readonly attributeName: string; + attributeValue: string | null; +} + +declare var AriaRequestEvent: { + prototype: AriaRequestEvent; + new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; +} + +interface Attr extends Node { + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string | null; + readonly specified: boolean; + value: string; +} + +declare var Attr: { + prototype: Attr; + new(): Attr; +} + +interface AudioBuffer { + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; + getChannelData(channel: number): Float32Array; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(): AudioBuffer; +} + +interface AudioBufferSourceNode extends AudioNode { + buffer: AudioBuffer | null; + readonly detune: AudioParam; + loop: boolean; + loopEnd: number; + loopStart: number; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; + start(when?: number, offset?: number, duration?: number): void; + stop(when?: number): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var AudioBufferSourceNode: { + prototype: AudioBufferSourceNode; + new(): AudioBufferSourceNode; +} + +interface AudioContext extends EventTarget { + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + readonly sampleRate: number; + state: string; + createAnalyser(): AnalyserNode; + createBiquadFilter(): BiquadFilterNode; + createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; + createBufferSource(): AudioBufferSourceNode; + createChannelMerger(numberOfInputs?: number): ChannelMergerNode; + createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; + createConvolver(): ConvolverNode; + createDelay(maxDelayTime?: number): DelayNode; + createDynamicsCompressor(): DynamicsCompressorNode; + createGain(): GainNode; + createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; + createOscillator(): OscillatorNode; + createPanner(): PannerNode; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; + createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; + createStereoPanner(): StereoPannerNode; + createWaveShaper(): WaveShaperNode; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; +} + +declare var AudioContext: { + prototype: AudioContext; + new(): AudioContext; +} + +interface AudioDestinationNode extends AudioNode { + readonly maxChannelCount: number; +} + +declare var AudioDestinationNode: { + prototype: AudioDestinationNode; + new(): AudioDestinationNode; +} + +interface AudioListener { + dopplerFactor: number; + speedOfSound: number; + setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var AudioListener: { + prototype: AudioListener; + new(): AudioListener; +} + +interface AudioNode extends EventTarget { + channelCount: number; + channelCountMode: string; + channelInterpretation: string; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; + connect(destination: AudioNode, output?: number, input?: number): void; + disconnect(output?: number): void; + disconnect(destination: AudioNode, output?: number, input?: number): void; + disconnect(destination: AudioParam, output?: number): void; +} + +declare var AudioNode: { + prototype: AudioNode; + new(): AudioNode; +} + +interface AudioParam { + readonly defaultValue: number; + value: number; + cancelScheduledValues(startTime: number): void; + exponentialRampToValueAtTime(value: number, endTime: number): void; + linearRampToValueAtTime(value: number, endTime: number): void; + setTargetAtTime(target: number, startTime: number, timeConstant: number): void; + setValueAtTime(value: number, startTime: number): void; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; +} + +declare var AudioParam: { + prototype: AudioParam; + new(): AudioParam; +} + +interface AudioProcessingEvent extends Event { + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; +} + +declare var AudioProcessingEvent: { + prototype: AudioProcessingEvent; + new(): AudioProcessingEvent; +} + +interface AudioTrack { + enabled: boolean; + readonly id: string; + kind: string; + readonly label: string; + language: string; + readonly sourceBuffer: SourceBuffer; +} + +declare var AudioTrack: { + prototype: AudioTrack; + new(): AudioTrack; +} + +interface AudioTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: this, ev: TrackEvent) => any; + onchange: (this: this, ev: Event) => any; + onremovetrack: (this: this, ev: TrackEvent) => any; + getTrackById(id: string): AudioTrack | null; + item(index: number): AudioTrack; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: AudioTrack; +} + +declare var AudioTrackList: { + prototype: AudioTrackList; + new(): AudioTrackList; +} + +interface BarProp { + readonly visible: boolean; +} + +declare var BarProp: { + prototype: BarProp; + new(): BarProp; +} + +interface BeforeUnloadEvent extends Event { + returnValue: any; +} + +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +} + +interface BiquadFilterNode extends AudioNode { + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; + type: string; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var BiquadFilterNode: { + prototype: BiquadFilterNode; + new(): BiquadFilterNode; +} + +interface Blob { + readonly size: number; + readonly type: string; + msClose(): void; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; +} + +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface CDATASection extends Text { +} + +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +} + +interface CSS { + supports(property: string, value?: string): boolean; +} +declare var CSS: CSS; + +interface CSSConditionRule extends CSSGroupingRule { + conditionText: string; +} + +declare var CSSConditionRule: { + prototype: CSSConditionRule; + new(): CSSConditionRule; +} + +interface CSSFontFaceRule extends CSSRule { + readonly style: CSSStyleDeclaration; +} + +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +} + +interface CSSGroupingRule extends CSSRule { + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; +} + +declare var CSSGroupingRule: { + prototype: CSSGroupingRule; + new(): CSSGroupingRule; +} + +interface CSSImportRule extends CSSRule { + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; +} + +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +} + +interface CSSKeyframeRule extends CSSRule { + keyText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +} + +interface CSSKeyframesRule extends CSSRule { + readonly cssRules: CSSRuleList; + name: string; + appendRule(rule: string): void; + deleteRule(rule: string): void; + findRule(rule: string): CSSKeyframeRule; +} + +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +} + +interface CSSMediaRule extends CSSConditionRule { + readonly media: MediaList; +} + +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +} + +interface CSSNamespaceRule extends CSSRule { + readonly namespaceURI: string; + readonly prefix: string; +} + +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +} + +interface CSSPageRule extends CSSRule { + readonly pseudoClass: string; + readonly selector: string; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +} + +interface CSSRule { + cssText: string; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +interface CSSRuleList { + readonly length: number; + item(index: number): CSSRule; + [index: number]: CSSRule; +} + +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +} + +interface CSSStyleDeclaration { + alignContent: string | null; + alignItems: string | null; + alignSelf: string | null; + alignmentBaseline: string | null; + animation: string | null; + animationDelay: string | null; + animationDirection: string | null; + animationDuration: string | null; + animationFillMode: string | null; + animationIterationCount: string | null; + animationName: string | null; + animationPlayState: string | null; + animationTimingFunction: string | null; + backfaceVisibility: string | null; + background: string | null; + backgroundAttachment: string | null; + backgroundClip: string | null; + backgroundColor: string | null; + backgroundImage: string | null; + backgroundOrigin: string | null; + backgroundPosition: string | null; + backgroundPositionX: string | null; + backgroundPositionY: string | null; + backgroundRepeat: string | null; + backgroundSize: string | null; + baselineShift: string | null; + border: string | null; + borderBottom: string | null; + borderBottomColor: string | null; + borderBottomLeftRadius: string | null; + borderBottomRightRadius: string | null; + borderBottomStyle: string | null; + borderBottomWidth: string | null; + borderCollapse: string | null; + borderColor: string | null; + borderImage: string | null; + borderImageOutset: string | null; + borderImageRepeat: string | null; + borderImageSlice: string | null; + borderImageSource: string | null; + borderImageWidth: string | null; + borderLeft: string | null; + borderLeftColor: string | null; + borderLeftStyle: string | null; + borderLeftWidth: string | null; + borderRadius: string | null; + borderRight: string | null; + borderRightColor: string | null; + borderRightStyle: string | null; + borderRightWidth: string | null; + borderSpacing: string | null; + borderStyle: string | null; + borderTop: string | null; + borderTopColor: string | null; + borderTopLeftRadius: string | null; + borderTopRightRadius: string | null; + borderTopStyle: string | null; + borderTopWidth: string | null; + borderWidth: string | null; + bottom: string | null; + boxShadow: string | null; + boxSizing: string | null; + breakAfter: string | null; + breakBefore: string | null; + breakInside: string | null; + captionSide: string | null; + clear: string | null; + clip: string | null; + clipPath: string | null; + clipRule: string | null; + color: string | null; + colorInterpolationFilters: string | null; + columnCount: any; + columnFill: string | null; + columnGap: any; + columnRule: string | null; + columnRuleColor: any; + columnRuleStyle: string | null; + columnRuleWidth: any; + columnSpan: string | null; + columnWidth: any; + columns: string | null; + content: string | null; + counterIncrement: string | null; + counterReset: string | null; + cssFloat: string | null; + cssText: string; + cursor: string | null; + direction: string | null; + display: string | null; + dominantBaseline: string | null; + emptyCells: string | null; + enableBackground: string | null; + fill: string | null; + fillOpacity: string | null; + fillRule: string | null; + filter: string | null; + flex: string | null; + flexBasis: string | null; + flexDirection: string | null; + flexFlow: string | null; + flexGrow: string | null; + flexShrink: string | null; + flexWrap: string | null; + floodColor: string | null; + floodOpacity: string | null; + font: string | null; + fontFamily: string | null; + fontFeatureSettings: string | null; + fontSize: string | null; + fontSizeAdjust: string | null; + fontStretch: string | null; + fontStyle: string | null; + fontVariant: string | null; + fontWeight: string | null; + glyphOrientationHorizontal: string | null; + glyphOrientationVertical: string | null; + height: string | null; + imeMode: string | null; + justifyContent: string | null; + kerning: string | null; + left: string | null; + readonly length: number; + letterSpacing: string | null; + lightingColor: string | null; + lineHeight: string | null; + listStyle: string | null; + listStyleImage: string | null; + listStylePosition: string | null; + listStyleType: string | null; + margin: string | null; + marginBottom: string | null; + marginLeft: string | null; + marginRight: string | null; + marginTop: string | null; + marker: string | null; + markerEnd: string | null; + markerMid: string | null; + markerStart: string | null; + mask: string | null; + maxHeight: string | null; + maxWidth: string | null; + minHeight: string | null; + minWidth: string | null; + msContentZoomChaining: string | null; + msContentZoomLimit: string | null; + msContentZoomLimitMax: any; + msContentZoomLimitMin: any; + msContentZoomSnap: string | null; + msContentZoomSnapPoints: string | null; + msContentZoomSnapType: string | null; + msContentZooming: string | null; + msFlowFrom: string | null; + msFlowInto: string | null; + msFontFeatureSettings: string | null; + msGridColumn: any; + msGridColumnAlign: string | null; + msGridColumnSpan: any; + msGridColumns: string | null; + msGridRow: any; + msGridRowAlign: string | null; + msGridRowSpan: any; + msGridRows: string | null; + msHighContrastAdjust: string | null; + msHyphenateLimitChars: string | null; + msHyphenateLimitLines: any; + msHyphenateLimitZone: any; + msHyphens: string | null; + msImeAlign: string | null; + msOverflowStyle: string | null; + msScrollChaining: string | null; + msScrollLimit: string | null; + msScrollLimitXMax: any; + msScrollLimitXMin: any; + msScrollLimitYMax: any; + msScrollLimitYMin: any; + msScrollRails: string | null; + msScrollSnapPointsX: string | null; + msScrollSnapPointsY: string | null; + msScrollSnapType: string | null; + msScrollSnapX: string | null; + msScrollSnapY: string | null; + msScrollTranslation: string | null; + msTextCombineHorizontal: string | null; + msTextSizeAdjust: any; + msTouchAction: string | null; + msTouchSelect: string | null; + msUserSelect: string | null; + msWrapFlow: string; + msWrapMargin: any; + msWrapThrough: string; + opacity: string | null; + order: string | null; + orphans: string | null; + outline: string | null; + outlineColor: string | null; + outlineStyle: string | null; + outlineWidth: string | null; + overflow: string | null; + overflowX: string | null; + overflowY: string | null; + padding: string | null; + paddingBottom: string | null; + paddingLeft: string | null; + paddingRight: string | null; + paddingTop: string | null; + pageBreakAfter: string | null; + pageBreakBefore: string | null; + pageBreakInside: string | null; + readonly parentRule: CSSRule; + perspective: string | null; + perspectiveOrigin: string | null; + pointerEvents: string | null; + position: string | null; + quotes: string | null; + right: string | null; + rubyAlign: string | null; + rubyOverhang: string | null; + rubyPosition: string | null; + stopColor: string | null; + stopOpacity: string | null; + stroke: string | null; + strokeDasharray: string | null; + strokeDashoffset: string | null; + strokeLinecap: string | null; + strokeLinejoin: string | null; + strokeMiterlimit: string | null; + strokeOpacity: string | null; + strokeWidth: string | null; + tableLayout: string | null; + textAlign: string | null; + textAlignLast: string | null; + textAnchor: string | null; + textDecoration: string | null; + textIndent: string | null; + textJustify: string | null; + textKashida: string | null; + textKashidaSpace: string | null; + textOverflow: string | null; + textShadow: string | null; + textTransform: string | null; + textUnderlinePosition: string | null; + top: string | null; + touchAction: string | null; + transform: string | null; + transformOrigin: string | null; + transformStyle: string | null; + transition: string | null; + transitionDelay: string | null; + transitionDuration: string | null; + transitionProperty: string | null; + transitionTimingFunction: string | null; + unicodeBidi: string | null; + verticalAlign: string | null; + visibility: string | null; + webkitAlignContent: string | null; + webkitAlignItems: string | null; + webkitAlignSelf: string | null; + webkitAnimation: string | null; + webkitAnimationDelay: string | null; + webkitAnimationDirection: string | null; + webkitAnimationDuration: string | null; + webkitAnimationFillMode: string | null; + webkitAnimationIterationCount: string | null; + webkitAnimationName: string | null; + webkitAnimationPlayState: string | null; + webkitAnimationTimingFunction: string | null; + webkitAppearance: string | null; + webkitBackfaceVisibility: string | null; + webkitBackgroundClip: string | null; + webkitBackgroundOrigin: string | null; + webkitBackgroundSize: string | null; + webkitBorderBottomLeftRadius: string | null; + webkitBorderBottomRightRadius: string | null; + webkitBorderImage: string | null; + webkitBorderRadius: string | null; + webkitBorderTopLeftRadius: string | null; + webkitBorderTopRightRadius: string | null; + webkitBoxAlign: string | null; + webkitBoxDirection: string | null; + webkitBoxFlex: string | null; + webkitBoxOrdinalGroup: string | null; + webkitBoxOrient: string | null; + webkitBoxPack: string | null; + webkitBoxSizing: string | null; + webkitColumnBreakAfter: string | null; + webkitColumnBreakBefore: string | null; + webkitColumnBreakInside: string | null; + webkitColumnCount: any; + webkitColumnGap: any; + webkitColumnRule: string | null; + webkitColumnRuleColor: any; + webkitColumnRuleStyle: string | null; + webkitColumnRuleWidth: any; + webkitColumnSpan: string | null; + webkitColumnWidth: any; + webkitColumns: string | null; + webkitFilter: string | null; + webkitFlex: string | null; + webkitFlexBasis: string | null; + webkitFlexDirection: string | null; + webkitFlexFlow: string | null; + webkitFlexGrow: string | null; + webkitFlexShrink: string | null; + webkitFlexWrap: string | null; + webkitJustifyContent: string | null; + webkitOrder: string | null; + webkitPerspective: string | null; + webkitPerspectiveOrigin: string | null; + webkitTapHighlightColor: string | null; + webkitTextFillColor: string | null; + webkitTextSizeAdjust: any; + webkitTransform: string | null; + webkitTransformOrigin: string | null; + webkitTransformStyle: string | null; + webkitTransition: string | null; + webkitTransitionDelay: string | null; + webkitTransitionDuration: string | null; + webkitTransitionProperty: string | null; + webkitTransitionTimingFunction: string | null; + webkitUserModify: string | null; + webkitUserSelect: string | null; + webkitWritingMode: string | null; + whiteSpace: string | null; + widows: string | null; + width: string | null; + wordBreak: string | null; + wordSpacing: string | null; + wordWrap: string | null; + writingMode: string | null; + zIndex: string | null; + zoom: string | null; + resize: string | null; + getPropertyPriority(propertyName: string): string; + getPropertyValue(propertyName: string): string; + item(index: number): string; + removeProperty(propertyName: string): string; + setProperty(propertyName: string, value: string | null, priority?: string): void; + [index: number]: string; +} + +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +} + +interface CSSStyleRule extends CSSRule { + readonly readOnly: boolean; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +} + +interface CSSStyleSheet extends StyleSheet { + readonly cssRules: CSSRuleList; + cssText: string; + readonly href: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; + addImport(bstrURL: string, lIndex?: number): number; + addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; + addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; + deleteRule(index?: number): void; + insertRule(rule: string, index?: number): number; + removeImport(lIndex: number): void; + removeRule(lIndex: number): void; +} + +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(): CSSStyleSheet; +} + +interface CSSSupportsRule extends CSSConditionRule { +} + +declare var CSSSupportsRule: { + prototype: CSSSupportsRule; + new(): CSSSupportsRule; +} + +interface CanvasGradient { + addColorStop(offset: number, color: string): void; +} + +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +} + +interface CanvasPattern { + setTransform(matrix: SVGMatrix): void; +} + +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +} + +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; + fillStyle: string | CanvasGradient | CanvasPattern; + font: string; + globalAlpha: number; + globalCompositeOperation: string; + lineCap: string; + lineDashOffset: number; + lineJoin: string; + lineWidth: number; + miterLimit: number; + msFillRule: string; + msImageSmoothingEnabled: boolean; + shadowBlur: number; + shadowColor: string; + shadowOffsetX: number; + shadowOffsetY: number; + strokeStyle: string | CanvasGradient | CanvasPattern; + textAlign: string; + textBaseline: string; + mozImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; + beginPath(): void; + clearRect(x: number, y: number, w: number, h: number): void; + clip(fillRule?: string): void; + createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; + createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; + fill(fillRule?: string): void; + fillRect(x: number, y: number, w: number, h: number): void; + fillText(text: string, x: number, y: number, maxWidth?: number): void; + getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; + getLineDash(): number[]; + isPointInPath(x: number, y: number, fillRule?: string): boolean; + measureText(text: string): TextMetrics; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; + restore(): void; + rotate(angle: number): void; + save(): void; + scale(x: number, y: number): void; + setLineDash(segments: number[]): void; + setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + stroke(): void; + strokeRect(x: number, y: number, w: number, h: number): void; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; + transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + translate(x: number, y: number): void; +} + +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +} + +interface ChannelMergerNode extends AudioNode { +} + +declare var ChannelMergerNode: { + prototype: ChannelMergerNode; + new(): ChannelMergerNode; +} + +interface ChannelSplitterNode extends AudioNode { +} + +declare var ChannelSplitterNode: { + prototype: ChannelSplitterNode; + new(): ChannelSplitterNode; +} + +interface CharacterData extends Node, ChildNode { + data: string; + readonly length: number; + appendData(arg: string): void; + deleteData(offset: number, count: number): void; + insertData(offset: number, arg: string): void; + replaceData(offset: number, count: number, arg: string): void; + substringData(offset: number, count: number): string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +} + +interface ClientRect { + bottom: number; + readonly height: number; + left: number; + right: number; + top: number; + readonly width: number; +} + +declare var ClientRect: { + prototype: ClientRect; + new(): ClientRect; +} + +interface ClientRectList { + readonly length: number; + item(index: number): ClientRect; + [index: number]: ClientRect; +} + +declare var ClientRectList: { + prototype: ClientRectList; + new(): ClientRectList; +} + +interface ClipboardEvent extends Event { + readonly clipboardData: DataTransfer; +} + +declare var ClipboardEvent: { + prototype: ClipboardEvent; + new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; +} + +interface CloseEvent extends Event { + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} + +declare var CloseEvent: { + prototype: CloseEvent; + new(): CloseEvent; +} + +interface CommandEvent extends Event { + readonly commandName: string; + readonly detail: string | null; +} + +declare var CommandEvent: { + prototype: CommandEvent; + new(type: string, eventInitDict?: CommandEventInit): CommandEvent; +} + +interface Comment extends CharacterData { + text: string; +} + +declare var Comment: { + prototype: Comment; + new(): Comment; +} + +interface CompositionEvent extends UIEvent { + readonly data: string; + readonly locale: string; + initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; +} + +declare var CompositionEvent: { + prototype: CompositionEvent; + new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; +} + +interface Console { + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + clear(): void; + count(countTitle?: string): void; + debug(message?: string, ...optionalParams: any[]): void; + dir(value?: any, ...optionalParams: any[]): void; + dirxml(value: any): void; + error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; + group(groupTitle?: string): void; + groupCollapsed(groupTitle?: string): void; + groupEnd(): void; + info(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: Element): boolean; + profile(reportName?: string): void; + profileEnd(): void; + select(element: Element): void; + table(...data: any[]): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; +} + +declare var Console: { + prototype: Console; + new(): Console; +} + +interface ConvolverNode extends AudioNode { + buffer: AudioBuffer | null; + normalize: boolean; +} + +declare var ConvolverNode: { + prototype: ConvolverNode; + new(): ConvolverNode; +} + +interface Coordinates { + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; +} + +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface Crypto extends Object, RandomSource { + readonly subtle: SubtleCrypto; +} + +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +} + +interface CryptoKey { + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; +} + +declare var CryptoKey: { + prototype: CryptoKey; + new(): CryptoKey; +} + +interface CryptoKeyPair { + privateKey: CryptoKey; + publicKey: CryptoKey; +} + +declare var CryptoKeyPair: { + prototype: CryptoKeyPair; + new(): CryptoKeyPair; +} + +interface CustomEvent extends Event { + readonly detail: any; + initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; +} + +declare var CustomEvent: { + prototype: CustomEvent; + new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; +} + +interface DOMError { + readonly name: string; + toString(): string; +} + +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface DOMException { + readonly code: number; + readonly message: string; + readonly name: string; + toString(): string; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +interface DOMImplementation { + createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; + createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; + createHTMLDocument(title: string): Document; + hasFeature(feature: string | null, version: string | null): boolean; +} + +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +} + +interface DOMParser { + parseFromString(source: string, mimeType: string): Document; +} + +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +} + +interface DOMSettableTokenList extends DOMTokenList { + value: string; +} + +declare var DOMSettableTokenList: { + prototype: DOMSettableTokenList; + new(): DOMSettableTokenList; +} + +interface DOMStringList { + readonly length: number; + contains(str: string): boolean; + item(index: number): string | null; + [index: number]: string; +} + +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface DOMStringMap { + [name: string]: string; +} + +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +} + +interface DOMTokenList { + readonly length: number; + add(...token: string[]): void; + contains(token: string): boolean; + item(index: number): string; + remove(...token: string[]): void; + toString(): string; + toggle(token: string, force?: boolean): boolean; + [index: number]: string; +} + +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +} + +interface DataCue extends TextTrackCue { + data: ArrayBuffer; +} + +declare var DataCue: { + prototype: DataCue; + new(): DataCue; +} + +interface DataTransfer { + dropEffect: string; + effectAllowed: string; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: string[]; + clearData(format?: string): boolean; + getData(format: string): string; + setData(format: string, data: string): boolean; +} + +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +} + +interface DataTransferItem { + readonly kind: string; + readonly type: string; + getAsFile(): File | null; + getAsString(_callback: FunctionStringCallback | null): void; +} + +declare var DataTransferItem: { + prototype: DataTransferItem; + new(): DataTransferItem; +} + +interface DataTransferItemList { + readonly length: number; + add(data: File): DataTransferItem | null; + clear(): void; + item(index: number): DataTransferItem; + remove(index: number): void; + [index: number]: DataTransferItem; +} + +declare var DataTransferItemList: { + prototype: DataTransferItemList; + new(): DataTransferItemList; +} + +interface DeferredPermissionRequest { + readonly id: number; + readonly type: string; + readonly uri: string; + allow(): void; + deny(): void; +} + +declare var DeferredPermissionRequest: { + prototype: DeferredPermissionRequest; + new(): DeferredPermissionRequest; +} + +interface DelayNode extends AudioNode { + readonly delayTime: AudioParam; +} + +declare var DelayNode: { + prototype: DelayNode; + new(): DelayNode; +} + +interface DeviceAcceleration { + readonly x: number | null; + readonly y: number | null; + readonly z: number | null; +} + +declare var DeviceAcceleration: { + prototype: DeviceAcceleration; + new(): DeviceAcceleration; +} + +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + +interface DeviceMotionEvent extends Event { + readonly acceleration: DeviceAcceleration | null; + readonly accelerationIncludingGravity: DeviceAcceleration | null; + readonly interval: number | null; + readonly rotationRate: DeviceRotationRate | null; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; +} + +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(): DeviceMotionEvent; +} + +interface DeviceOrientationEvent extends Event { + readonly absolute: boolean; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; +} + +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(): DeviceOrientationEvent; +} + +interface DeviceRotationRate { + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; +} + +declare var DeviceRotationRate: { + prototype: DeviceRotationRate; + new(): DeviceRotationRate; +} + +interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode { + /** + * Sets or gets the URL for the current document. + */ + readonly URL: string; + /** + * Gets the URL for the document, stripped of any character encoding. + */ + readonly URLUnencoded: string; + /** + * Gets the object that has the focus when the parent document has focus. + */ + readonly activeElement: Element; + /** + * Sets or gets the color of all active links in the document. + */ + alinkColor: string; + /** + * Returns a reference to the collection of elements contained by the object. + */ + readonly all: HTMLAllCollection; + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + */ + anchors: HTMLCollectionOf; + /** + * Retrieves a collection of all applet objects in the document. + */ + applets: HTMLCollectionOf; + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + */ + bgColor: string; + /** + * Specifies the beginning and end of the document body. + */ + body: HTMLElement; + readonly characterSet: string; + /** + * Gets or sets the character set used to encode the object. + */ + charset: string; + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. + */ + readonly compatMode: string; + cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; + /** + * Gets the default character set from the current regional language settings. + */ + readonly defaultCharset: string; + readonly defaultView: Window; + /** + * Sets or gets a value that indicates whether the document can be edited. + */ + designMode: string; + /** + * Sets or retrieves a value that indicates the reading order of the object. + */ + dir: string; + /** + * Gets an object representing the document type declaration associated with the current document. + */ + readonly doctype: DocumentType; + /** + * Gets a reference to the root node of the document. + */ + documentElement: HTMLElement; + /** + * Sets or gets the security domain of the document. + */ + domain: string; + /** + * Retrieves a collection of all embed objects in the document. + */ + embeds: HTMLCollectionOf; + /** + * Sets or gets the foreground (text) color of the document. + */ + fgColor: string; + /** + * Retrieves a collection, in source order, of all form objects in the document. + */ + forms: HTMLCollectionOf; + readonly fullscreenElement: Element | null; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; + /** + * Retrieves a collection, in source order, of img objects in the document. + */ + images: HTMLCollectionOf; + /** + * Gets the implementation object of the current document. + */ + readonly implementation: DOMImplementation; + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. + */ + readonly inputEncoding: string | null; + /** + * Gets the date that the page was last modified, if the page supplies one. + */ + readonly lastModified: string; + /** + * Sets or gets the color of the document links. + */ + linkColor: string; + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + */ + links: HTMLCollectionOf; + /** + * Contains information about the current URL. + */ + readonly location: Location; + msCSSOMElementFloatMetrics: boolean; + msCapsLockWarningOff: boolean; + /** + * Fires when the user aborts the download. + * @param ev The event. + */ + onabort: (this: this, ev: UIEvent) => any; + /** + * Fires when the object is set as the active element. + * @param ev The event. + */ + onactivate: (this: this, ev: UIEvent) => any; + /** + * Fires immediately before the object is set as the active element. + * @param ev The event. + */ + onbeforeactivate: (this: this, ev: UIEvent) => any; + /** + * Fires immediately before the activeElement is changed from the current object to another object in the parent document. + * @param ev The event. + */ + onbeforedeactivate: (this: this, ev: UIEvent) => any; + /** + * Fires when the object loses the input focus. + * @param ev The focus event. + */ + onblur: (this: this, ev: FocusEvent) => any; + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. + */ + oncanplay: (this: this, ev: Event) => any; + oncanplaythrough: (this: this, ev: Event) => any; + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. + */ + onchange: (this: this, ev: Event) => any; + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. + */ + onclick: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. + */ + oncontextmenu: (this: this, ev: PointerEvent) => any; + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. + */ + ondblclick: (this: this, ev: MouseEvent) => any; + /** + * Fires when the activeElement is changed from the current object to another object in the parent document. + * @param ev The UI Event + */ + ondeactivate: (this: this, ev: UIEvent) => any; + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. + */ + ondrag: (this: this, ev: DragEvent) => any; + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. + */ + ondragend: (this: this, ev: DragEvent) => any; + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. + */ + ondragenter: (this: this, ev: DragEvent) => any; + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. + */ + ondragleave: (this: this, ev: DragEvent) => any; + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. + */ + ondragover: (this: this, ev: DragEvent) => any; + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. + */ + ondragstart: (this: this, ev: DragEvent) => any; + ondrop: (this: this, ev: DragEvent) => any; + /** + * Occurs when the duration attribute is updated. + * @param ev The event. + */ + ondurationchange: (this: this, ev: Event) => any; + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. + */ + onemptied: (this: this, ev: Event) => any; + /** + * Occurs when the end of playback is reached. + * @param ev The event + */ + onended: (this: this, ev: MediaStreamErrorEvent) => any; + /** + * Fires when an error occurs during object loading. + * @param ev The event. + */ + onerror: (this: this, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + * @param ev The event. + */ + onfocus: (this: this, ev: FocusEvent) => any; + onfullscreenchange: (this: this, ev: Event) => any; + onfullscreenerror: (this: this, ev: Event) => any; + oninput: (this: this, ev: Event) => any; + oninvalid: (this: this, ev: Event) => any; + /** + * Fires when the user presses a key. + * @param ev The keyboard event + */ + onkeydown: (this: this, ev: KeyboardEvent) => any; + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. + */ + onkeypress: (this: this, ev: KeyboardEvent) => any; + /** + * Fires when the user releases a key. + * @param ev The keyboard event + */ + onkeyup: (this: this, ev: KeyboardEvent) => any; + /** + * Fires immediately after the browser loads the object. + * @param ev The event. + */ + onload: (this: this, ev: Event) => any; + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. + */ + onloadeddata: (this: this, ev: Event) => any; + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. + */ + onloadedmetadata: (this: this, ev: Event) => any; + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. + */ + onloadstart: (this: this, ev: Event) => any; + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. + */ + onmousedown: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. + */ + onmousemove: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. + */ + onmouseout: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. + */ + onmouseover: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. + */ + onmouseup: (this: this, ev: MouseEvent) => any; + /** + * Fires when the wheel button is rotated. + * @param ev The mouse event + */ + onmousewheel: (this: this, ev: WheelEvent) => any; + onmscontentzoom: (this: this, ev: UIEvent) => any; + onmsgesturechange: (this: this, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; + onmsgestureend: (this: this, ev: MSGestureEvent) => any; + onmsgesturehold: (this: this, ev: MSGestureEvent) => any; + onmsgesturestart: (this: this, ev: MSGestureEvent) => any; + onmsgesturetap: (this: this, ev: MSGestureEvent) => any; + onmsinertiastart: (this: this, ev: MSGestureEvent) => any; + onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; + onmspointercancel: (this: this, ev: MSPointerEvent) => any; + onmspointerdown: (this: this, ev: MSPointerEvent) => any; + onmspointerenter: (this: this, ev: MSPointerEvent) => any; + onmspointerleave: (this: this, ev: MSPointerEvent) => any; + onmspointermove: (this: this, ev: MSPointerEvent) => any; + onmspointerout: (this: this, ev: MSPointerEvent) => any; + onmspointerover: (this: this, ev: MSPointerEvent) => any; + onmspointerup: (this: this, ev: MSPointerEvent) => any; + /** + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * @param ev The event. + */ + onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any; + /** + * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. + * @param ev The event. + */ + onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any; + /** + * Occurs when playback is paused. + * @param ev The event. + */ + onpause: (this: this, ev: Event) => any; + /** + * Occurs when the play method is requested. + * @param ev The event. + */ + onplay: (this: this, ev: Event) => any; + /** + * Occurs when the audio or video has started playing. + * @param ev The event. + */ + onplaying: (this: this, ev: Event) => any; + onpointerlockchange: (this: this, ev: Event) => any; + onpointerlockerror: (this: this, ev: Event) => any; + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. + */ + onprogress: (this: this, ev: ProgressEvent) => any; + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. + */ + onratechange: (this: this, ev: Event) => any; + /** + * Fires when the state of the object has changed. + * @param ev The event + */ + onreadystatechange: (this: this, ev: ProgressEvent) => any; + /** + * Fires when the user resets a form. + * @param ev The event. + */ + onreset: (this: this, ev: Event) => any; + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. + */ + onscroll: (this: this, ev: UIEvent) => any; + /** + * Occurs when the seek operation ends. + * @param ev The event. + */ + onseeked: (this: this, ev: Event) => any; + /** + * Occurs when the current playback position is moved. + * @param ev The event. + */ + onseeking: (this: this, ev: Event) => any; + /** + * Fires when the current selection changes. + * @param ev The event. + */ + onselect: (this: this, ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (this: this, ev: Event) => any; + onselectstart: (this: this, ev: Event) => any; + /** + * Occurs when the download has stopped. + * @param ev The event. + */ + onstalled: (this: this, ev: Event) => any; + /** + * Fires when the user clicks the Stop button or leaves the Web page. + * @param ev The event. + */ + onstop: (this: this, ev: Event) => any; + onsubmit: (this: this, ev: Event) => any; + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. + */ + onsuspend: (this: this, ev: Event) => any; + /** + * Occurs to indicate the current playback position. + * @param ev The event. + */ + ontimeupdate: (this: this, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. + */ + onvolumechange: (this: this, ev: Event) => any; + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. + */ + onwaiting: (this: this, ev: Event) => any; + onwebkitfullscreenchange: (this: this, ev: Event) => any; + onwebkitfullscreenerror: (this: this, ev: Event) => any; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; + /** + * Retrieves a value that indicates the current state of the object. + */ + readonly readyState: string; + /** + * Gets the URL of the location that referred the user to the current page. + */ + readonly referrer: string; + /** + * Gets the root svg element in the document hierarchy. + */ + readonly rootElement: SVGSVGElement; + /** + * Retrieves a collection of all script objects in the document. + */ + scripts: HTMLCollectionOf; + readonly scrollingElement: Element | null; + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + */ + readonly styleSheets: StyleSheetList; + /** + * Contains the title of the document. + */ + title: string; + readonly visibilityState: string; + /** + * Sets or gets the color of the links that the user has visited. + */ + vlinkColor: string; + readonly webkitCurrentFullScreenElement: Element | null; + readonly webkitFullscreenElement: Element | null; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string | null; + xmlStandalone: boolean; + /** + * Gets or sets the version attribute specified in the declaration of an XML document. + */ + xmlVersion: string | null; + adoptNode(source: Node): Node; + captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; + clear(): void; + /** + * Closes an output stream and forces the sent data to display. + */ + close(): void; + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. + */ + createAttribute(name: string): Attr; + createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; + createCDATASection(data: string): CDATASection; + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. + */ + createComment(data: string): Comment; + /** + * Creates a new document. + */ + createDocumentFragment(): DocumentFragment; + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + */ + createElement(tagName: "a"): HTMLAnchorElement; + createElement(tagName: "applet"): HTMLAppletElement; + createElement(tagName: "area"): HTMLAreaElement; + createElement(tagName: "audio"): HTMLAudioElement; + createElement(tagName: "base"): HTMLBaseElement; + createElement(tagName: "basefont"): HTMLBaseFontElement; + createElement(tagName: "blockquote"): HTMLQuoteElement; + createElement(tagName: "body"): HTMLBodyElement; + createElement(tagName: "br"): HTMLBRElement; + createElement(tagName: "button"): HTMLButtonElement; + createElement(tagName: "canvas"): HTMLCanvasElement; + createElement(tagName: "caption"): HTMLTableCaptionElement; + createElement(tagName: "col"): HTMLTableColElement; + createElement(tagName: "colgroup"): HTMLTableColElement; + createElement(tagName: "datalist"): HTMLDataListElement; + createElement(tagName: "del"): HTMLModElement; + createElement(tagName: "dir"): HTMLDirectoryElement; + createElement(tagName: "div"): HTMLDivElement; + createElement(tagName: "dl"): HTMLDListElement; + createElement(tagName: "embed"): HTMLEmbedElement; + createElement(tagName: "fieldset"): HTMLFieldSetElement; + createElement(tagName: "font"): HTMLFontElement; + createElement(tagName: "form"): HTMLFormElement; + createElement(tagName: "frame"): HTMLFrameElement; + createElement(tagName: "frameset"): HTMLFrameSetElement; + createElement(tagName: "h1"): HTMLHeadingElement; + createElement(tagName: "h2"): HTMLHeadingElement; + createElement(tagName: "h3"): HTMLHeadingElement; + createElement(tagName: "h4"): HTMLHeadingElement; + createElement(tagName: "h5"): HTMLHeadingElement; + createElement(tagName: "h6"): HTMLHeadingElement; + createElement(tagName: "head"): HTMLHeadElement; + createElement(tagName: "hr"): HTMLHRElement; + createElement(tagName: "html"): HTMLHtmlElement; + createElement(tagName: "iframe"): HTMLIFrameElement; + createElement(tagName: "img"): HTMLImageElement; + createElement(tagName: "input"): HTMLInputElement; + createElement(tagName: "ins"): HTMLModElement; + createElement(tagName: "isindex"): HTMLUnknownElement; + createElement(tagName: "label"): HTMLLabelElement; + createElement(tagName: "legend"): HTMLLegendElement; + createElement(tagName: "li"): HTMLLIElement; + createElement(tagName: "link"): HTMLLinkElement; + createElement(tagName: "listing"): HTMLPreElement; + createElement(tagName: "map"): HTMLMapElement; + createElement(tagName: "marquee"): HTMLMarqueeElement; + createElement(tagName: "menu"): HTMLMenuElement; + createElement(tagName: "meta"): HTMLMetaElement; + createElement(tagName: "meter"): HTMLMeterElement; + createElement(tagName: "nextid"): HTMLUnknownElement; + createElement(tagName: "object"): HTMLObjectElement; + createElement(tagName: "ol"): HTMLOListElement; + createElement(tagName: "optgroup"): HTMLOptGroupElement; + createElement(tagName: "option"): HTMLOptionElement; + createElement(tagName: "p"): HTMLParagraphElement; + createElement(tagName: "param"): HTMLParamElement; + createElement(tagName: "picture"): HTMLPictureElement; + createElement(tagName: "pre"): HTMLPreElement; + createElement(tagName: "progress"): HTMLProgressElement; + createElement(tagName: "q"): HTMLQuoteElement; + createElement(tagName: "script"): HTMLScriptElement; + createElement(tagName: "select"): HTMLSelectElement; + createElement(tagName: "source"): HTMLSourceElement; + createElement(tagName: "span"): HTMLSpanElement; + createElement(tagName: "style"): HTMLStyleElement; + createElement(tagName: "table"): HTMLTableElement; + createElement(tagName: "tbody"): HTMLTableSectionElement; + createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "template"): HTMLTemplateElement; + createElement(tagName: "textarea"): HTMLTextAreaElement; + createElement(tagName: "tfoot"): HTMLTableSectionElement; + createElement(tagName: "th"): HTMLTableHeaderCellElement; + createElement(tagName: "thead"): HTMLTableSectionElement; + createElement(tagName: "title"): HTMLTitleElement; + createElement(tagName: "tr"): HTMLTableRowElement; + createElement(tagName: "track"): HTMLTrackElement; + createElement(tagName: "ul"): HTMLUListElement; + createElement(tagName: "video"): HTMLVideoElement; + createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; + createElement(tagName: "xmp"): HTMLPreElement; + createElement(tagName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement + createElementNS(namespaceURI: string | null, qualifiedName: string): Element; + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver: Node): XPathNSResolver; + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + */ + createRange(): Range; + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. + */ + createTextNode(data: string): Text; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouchList(...touches: Touch[]): TouchList; + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset + */ + elementFromPoint(x: number, y: number): Element; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. + */ + execCommand(commandId: string, showUI?: boolean, value?: any): boolean; + /** + * Displays help information for the given command identifier. + * @param commandId Displays help information for the given command identifier. + */ + execCommandShowHelp(commandId: string): boolean; + exitFullscreen(): void; + exitPointerLock(): void; + /** + * Causes the element to receive the focus and executes the code specified by the onfocus event. + */ + focus(): void; + /** + * Returns a reference to the first object with the specified value of the ID or NAME attribute. + * @param elementId String that specifies the ID value. Case-insensitive. + */ + getElementById(elementId: string): HTMLElement | null; + getElementsByClassName(classNames: string): HTMLCollectionOf; + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + */ + getElementsByName(elementName: string): NodeListOf; + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. + */ + getElementsByTagName(tagname: "a"): NodeListOf; + getElementsByTagName(tagname: "abbr"): NodeListOf; + getElementsByTagName(tagname: "acronym"): NodeListOf; + getElementsByTagName(tagname: "address"): NodeListOf; + getElementsByTagName(tagname: "applet"): NodeListOf; + getElementsByTagName(tagname: "area"): NodeListOf; + getElementsByTagName(tagname: "article"): NodeListOf; + getElementsByTagName(tagname: "aside"): NodeListOf; + getElementsByTagName(tagname: "audio"): NodeListOf; + getElementsByTagName(tagname: "b"): NodeListOf; + getElementsByTagName(tagname: "base"): NodeListOf; + getElementsByTagName(tagname: "basefont"): NodeListOf; + getElementsByTagName(tagname: "bdo"): NodeListOf; + getElementsByTagName(tagname: "big"): NodeListOf; + getElementsByTagName(tagname: "blockquote"): NodeListOf; + getElementsByTagName(tagname: "body"): NodeListOf; + getElementsByTagName(tagname: "br"): NodeListOf; + getElementsByTagName(tagname: "button"): NodeListOf; + getElementsByTagName(tagname: "canvas"): NodeListOf; + getElementsByTagName(tagname: "caption"): NodeListOf; + getElementsByTagName(tagname: "center"): NodeListOf; + getElementsByTagName(tagname: "circle"): NodeListOf; + getElementsByTagName(tagname: "cite"): NodeListOf; + getElementsByTagName(tagname: "clippath"): NodeListOf; + getElementsByTagName(tagname: "code"): NodeListOf; + getElementsByTagName(tagname: "col"): NodeListOf; + getElementsByTagName(tagname: "colgroup"): NodeListOf; + getElementsByTagName(tagname: "datalist"): NodeListOf; + getElementsByTagName(tagname: "dd"): NodeListOf; + getElementsByTagName(tagname: "defs"): NodeListOf; + getElementsByTagName(tagname: "del"): NodeListOf; + getElementsByTagName(tagname: "desc"): NodeListOf; + getElementsByTagName(tagname: "dfn"): NodeListOf; + getElementsByTagName(tagname: "dir"): NodeListOf; + getElementsByTagName(tagname: "div"): NodeListOf; + getElementsByTagName(tagname: "dl"): NodeListOf; + getElementsByTagName(tagname: "dt"): NodeListOf; + getElementsByTagName(tagname: "ellipse"): NodeListOf; + getElementsByTagName(tagname: "em"): NodeListOf; + getElementsByTagName(tagname: "embed"): NodeListOf; + getElementsByTagName(tagname: "feblend"): NodeListOf; + getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; + getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; + getElementsByTagName(tagname: "fecomposite"): NodeListOf; + getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; + getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; + getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; + getElementsByTagName(tagname: "fedistantlight"): NodeListOf; + getElementsByTagName(tagname: "feflood"): NodeListOf; + getElementsByTagName(tagname: "fefunca"): NodeListOf; + getElementsByTagName(tagname: "fefuncb"): NodeListOf; + getElementsByTagName(tagname: "fefuncg"): NodeListOf; + getElementsByTagName(tagname: "fefuncr"): NodeListOf; + getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; + getElementsByTagName(tagname: "feimage"): NodeListOf; + getElementsByTagName(tagname: "femerge"): NodeListOf; + getElementsByTagName(tagname: "femergenode"): NodeListOf; + getElementsByTagName(tagname: "femorphology"): NodeListOf; + getElementsByTagName(tagname: "feoffset"): NodeListOf; + getElementsByTagName(tagname: "fepointlight"): NodeListOf; + getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; + getElementsByTagName(tagname: "fespotlight"): NodeListOf; + getElementsByTagName(tagname: "fetile"): NodeListOf; + getElementsByTagName(tagname: "feturbulence"): NodeListOf; + getElementsByTagName(tagname: "fieldset"): NodeListOf; + getElementsByTagName(tagname: "figcaption"): NodeListOf; + getElementsByTagName(tagname: "figure"): NodeListOf; + getElementsByTagName(tagname: "filter"): NodeListOf; + getElementsByTagName(tagname: "font"): NodeListOf; + getElementsByTagName(tagname: "footer"): NodeListOf; + getElementsByTagName(tagname: "foreignobject"): NodeListOf; + getElementsByTagName(tagname: "form"): NodeListOf; + getElementsByTagName(tagname: "frame"): NodeListOf; + getElementsByTagName(tagname: "frameset"): NodeListOf; + getElementsByTagName(tagname: "g"): NodeListOf; + getElementsByTagName(tagname: "h1"): NodeListOf; + getElementsByTagName(tagname: "h2"): NodeListOf; + getElementsByTagName(tagname: "h3"): NodeListOf; + getElementsByTagName(tagname: "h4"): NodeListOf; + getElementsByTagName(tagname: "h5"): NodeListOf; + getElementsByTagName(tagname: "h6"): NodeListOf; + getElementsByTagName(tagname: "head"): NodeListOf; + getElementsByTagName(tagname: "header"): NodeListOf; + getElementsByTagName(tagname: "hgroup"): NodeListOf; + getElementsByTagName(tagname: "hr"): NodeListOf; + getElementsByTagName(tagname: "html"): NodeListOf; + getElementsByTagName(tagname: "i"): NodeListOf; + getElementsByTagName(tagname: "iframe"): NodeListOf; + getElementsByTagName(tagname: "image"): NodeListOf; + getElementsByTagName(tagname: "img"): NodeListOf; + getElementsByTagName(tagname: "input"): NodeListOf; + getElementsByTagName(tagname: "ins"): NodeListOf; + getElementsByTagName(tagname: "isindex"): NodeListOf; + getElementsByTagName(tagname: "kbd"): NodeListOf; + getElementsByTagName(tagname: "keygen"): NodeListOf; + getElementsByTagName(tagname: "label"): NodeListOf; + getElementsByTagName(tagname: "legend"): NodeListOf; + getElementsByTagName(tagname: "li"): NodeListOf; + getElementsByTagName(tagname: "line"): NodeListOf; + getElementsByTagName(tagname: "lineargradient"): NodeListOf; + getElementsByTagName(tagname: "link"): NodeListOf; + getElementsByTagName(tagname: "listing"): NodeListOf; + getElementsByTagName(tagname: "map"): NodeListOf; + getElementsByTagName(tagname: "mark"): NodeListOf; + getElementsByTagName(tagname: "marker"): NodeListOf; + getElementsByTagName(tagname: "marquee"): NodeListOf; + getElementsByTagName(tagname: "mask"): NodeListOf; + getElementsByTagName(tagname: "menu"): NodeListOf; + getElementsByTagName(tagname: "meta"): NodeListOf; + getElementsByTagName(tagname: "metadata"): NodeListOf; + getElementsByTagName(tagname: "meter"): NodeListOf; + getElementsByTagName(tagname: "nav"): NodeListOf; + getElementsByTagName(tagname: "nextid"): NodeListOf; + getElementsByTagName(tagname: "nobr"): NodeListOf; + getElementsByTagName(tagname: "noframes"): NodeListOf; + getElementsByTagName(tagname: "noscript"): NodeListOf; + getElementsByTagName(tagname: "object"): NodeListOf; + getElementsByTagName(tagname: "ol"): NodeListOf; + getElementsByTagName(tagname: "optgroup"): NodeListOf; + getElementsByTagName(tagname: "option"): NodeListOf; + getElementsByTagName(tagname: "p"): NodeListOf; + getElementsByTagName(tagname: "param"): NodeListOf; + getElementsByTagName(tagname: "path"): NodeListOf; + getElementsByTagName(tagname: "pattern"): NodeListOf; + getElementsByTagName(tagname: "picture"): NodeListOf; + getElementsByTagName(tagname: "plaintext"): NodeListOf; + getElementsByTagName(tagname: "polygon"): NodeListOf; + getElementsByTagName(tagname: "polyline"): NodeListOf; + getElementsByTagName(tagname: "pre"): NodeListOf; + getElementsByTagName(tagname: "progress"): NodeListOf; + getElementsByTagName(tagname: "q"): NodeListOf; + getElementsByTagName(tagname: "radialgradient"): NodeListOf; + getElementsByTagName(tagname: "rect"): NodeListOf; + getElementsByTagName(tagname: "rt"): NodeListOf; + getElementsByTagName(tagname: "ruby"): NodeListOf; + getElementsByTagName(tagname: "s"): NodeListOf; + getElementsByTagName(tagname: "samp"): NodeListOf; + getElementsByTagName(tagname: "script"): NodeListOf; + getElementsByTagName(tagname: "section"): NodeListOf; + getElementsByTagName(tagname: "select"): NodeListOf; + getElementsByTagName(tagname: "small"): NodeListOf; + getElementsByTagName(tagname: "source"): NodeListOf; + getElementsByTagName(tagname: "span"): NodeListOf; + getElementsByTagName(tagname: "stop"): NodeListOf; + getElementsByTagName(tagname: "strike"): NodeListOf; + getElementsByTagName(tagname: "strong"): NodeListOf; + getElementsByTagName(tagname: "style"): NodeListOf; + getElementsByTagName(tagname: "sub"): NodeListOf; + getElementsByTagName(tagname: "sup"): NodeListOf; + getElementsByTagName(tagname: "svg"): NodeListOf; + getElementsByTagName(tagname: "switch"): NodeListOf; + getElementsByTagName(tagname: "symbol"): NodeListOf; + getElementsByTagName(tagname: "table"): NodeListOf; + getElementsByTagName(tagname: "tbody"): NodeListOf; + getElementsByTagName(tagname: "td"): NodeListOf; + getElementsByTagName(tagname: "template"): NodeListOf; + getElementsByTagName(tagname: "text"): NodeListOf; + getElementsByTagName(tagname: "textpath"): NodeListOf; + getElementsByTagName(tagname: "textarea"): NodeListOf; + getElementsByTagName(tagname: "tfoot"): NodeListOf; + getElementsByTagName(tagname: "th"): NodeListOf; + getElementsByTagName(tagname: "thead"): NodeListOf; + getElementsByTagName(tagname: "title"): NodeListOf; + getElementsByTagName(tagname: "tr"): NodeListOf; + getElementsByTagName(tagname: "track"): NodeListOf; + getElementsByTagName(tagname: "tspan"): NodeListOf; + getElementsByTagName(tagname: "tt"): NodeListOf; + getElementsByTagName(tagname: "u"): NodeListOf; + getElementsByTagName(tagname: "ul"): NodeListOf; + getElementsByTagName(tagname: "use"): NodeListOf; + getElementsByTagName(tagname: "var"): NodeListOf; + getElementsByTagName(tagname: "video"): NodeListOf; + getElementsByTagName(tagname: "view"): NodeListOf; + getElementsByTagName(tagname: "wbr"): NodeListOf; + getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; + getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + */ + getSelection(): Selection; + /** + * Gets a value indicating whether the object currently has focus. + */ + hasFocus(): boolean; + importNode(importedNode: Node, deep: boolean): Node; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(url?: string, name?: string, features?: string, replace?: boolean): Document; + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. + */ + queryCommandEnabled(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. + */ + queryCommandIndeterm(commandId: string): boolean; + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. + */ + queryCommandState(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. + */ + queryCommandSupported(commandId: string): boolean; + /** + * Retrieves the string associated with a command. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + */ + queryCommandText(commandId: string): string; + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. + */ + queryCommandValue(commandId: string): string; + releaseEvents(): void; + /** + * Allows updating the print settings for the page. + */ + updateSettings(): void; + webkitCancelFullScreen(): void; + webkitExitFullscreen(): void; + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. + */ + write(...content: string[]): void; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...content: string[]): 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var Document: { + prototype: Document; + new(): Document; +} + +interface DocumentFragment extends Node, NodeSelector, ParentNode { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +} + +interface DocumentType extends Node, ChildNode { + readonly entities: NamedNodeMap; + readonly internalSubset: string | null; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string | null; + readonly systemId: string | null; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +} + +interface DragEvent extends MouseEvent { + readonly dataTransfer: DataTransfer; + initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; + msConvertURL(file: File, targetType: string, targetURL?: string): void; +} + +declare var DragEvent: { + prototype: DragEvent; + new(): DragEvent; +} + +interface DynamicsCompressorNode extends AudioNode { + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: AudioParam; + readonly release: AudioParam; + readonly threshold: AudioParam; +} + +declare var DynamicsCompressorNode: { + prototype: DynamicsCompressorNode; + new(): DynamicsCompressorNode; +} + +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + +interface EXT_texture_filter_anisotropic { + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +declare var EXT_texture_filter_anisotropic: { + prototype: EXT_texture_filter_anisotropic; + new(): EXT_texture_filter_anisotropic; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; + msContentZoomFactor: number; + readonly msRegionOverflow: string; + onariarequest: (this: this, ev: AriaRequestEvent) => any; + oncommand: (this: this, ev: CommandEvent) => any; + ongotpointercapture: (this: this, ev: PointerEvent) => any; + onlostpointercapture: (this: this, ev: PointerEvent) => any; + onmsgesturechange: (this: this, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; + onmsgestureend: (this: this, ev: MSGestureEvent) => any; + onmsgesturehold: (this: this, ev: MSGestureEvent) => any; + onmsgesturestart: (this: this, ev: MSGestureEvent) => any; + onmsgesturetap: (this: this, ev: MSGestureEvent) => any; + onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any; + onmsinertiastart: (this: this, ev: MSGestureEvent) => any; + onmslostpointercapture: (this: this, ev: MSPointerEvent) => any; + onmspointercancel: (this: this, ev: MSPointerEvent) => any; + onmspointerdown: (this: this, ev: MSPointerEvent) => any; + onmspointerenter: (this: this, ev: MSPointerEvent) => any; + onmspointerleave: (this: this, ev: MSPointerEvent) => any; + onmspointermove: (this: this, ev: MSPointerEvent) => any; + onmspointerout: (this: this, ev: MSPointerEvent) => any; + onmspointerover: (this: this, ev: MSPointerEvent) => any; + onmspointerup: (this: this, ev: MSPointerEvent) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onwebkitfullscreenchange: (this: this, ev: Event) => any; + onwebkitfullscreenerror: (this: this, ev: Event) => any; + readonly prefix: string | null; + readonly scrollHeight: number; + scrollLeft: number; + scrollTop: number; + readonly scrollWidth: number; + readonly tagName: string; + innerHTML: string; + getAttribute(name: string): string | null; + getAttributeNS(namespaceURI: string, localName: string): string; + getAttributeNode(name: string): Attr; + getAttributeNodeNS(namespaceURI: string, localName: string): Attr; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + getElementsByTagName(name: "a"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "applet"): NodeListOf; + getElementsByTagName(name: "area"): NodeListOf; + getElementsByTagName(name: "article"): NodeListOf; + getElementsByTagName(name: "aside"): NodeListOf; + getElementsByTagName(name: "audio"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "base"): NodeListOf; + getElementsByTagName(name: "basefont"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "body"): NodeListOf; + getElementsByTagName(name: "br"): NodeListOf; + getElementsByTagName(name: "button"): NodeListOf; + getElementsByTagName(name: "canvas"): NodeListOf; + getElementsByTagName(name: "caption"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "circle"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "clippath"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "col"): NodeListOf; + getElementsByTagName(name: "colgroup"): NodeListOf; + getElementsByTagName(name: "datalist"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "defs"): NodeListOf; + getElementsByTagName(name: "del"): NodeListOf; + getElementsByTagName(name: "desc"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dir"): NodeListOf; + getElementsByTagName(name: "div"): NodeListOf; + getElementsByTagName(name: "dl"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "ellipse"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "embed"): NodeListOf; + getElementsByTagName(name: "feblend"): NodeListOf; + getElementsByTagName(name: "fecolormatrix"): NodeListOf; + getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; + getElementsByTagName(name: "fecomposite"): NodeListOf; + getElementsByTagName(name: "feconvolvematrix"): NodeListOf; + getElementsByTagName(name: "fediffuselighting"): NodeListOf; + getElementsByTagName(name: "fedisplacementmap"): NodeListOf; + getElementsByTagName(name: "fedistantlight"): NodeListOf; + getElementsByTagName(name: "feflood"): NodeListOf; + getElementsByTagName(name: "fefunca"): NodeListOf; + getElementsByTagName(name: "fefuncb"): NodeListOf; + getElementsByTagName(name: "fefuncg"): NodeListOf; + getElementsByTagName(name: "fefuncr"): NodeListOf; + getElementsByTagName(name: "fegaussianblur"): NodeListOf; + getElementsByTagName(name: "feimage"): NodeListOf; + getElementsByTagName(name: "femerge"): NodeListOf; + getElementsByTagName(name: "femergenode"): NodeListOf; + getElementsByTagName(name: "femorphology"): NodeListOf; + getElementsByTagName(name: "feoffset"): NodeListOf; + getElementsByTagName(name: "fepointlight"): NodeListOf; + getElementsByTagName(name: "fespecularlighting"): NodeListOf; + getElementsByTagName(name: "fespotlight"): NodeListOf; + getElementsByTagName(name: "fetile"): NodeListOf; + getElementsByTagName(name: "feturbulence"): NodeListOf; + getElementsByTagName(name: "fieldset"): NodeListOf; + getElementsByTagName(name: "figcaption"): NodeListOf; + getElementsByTagName(name: "figure"): NodeListOf; + getElementsByTagName(name: "filter"): NodeListOf; + getElementsByTagName(name: "font"): NodeListOf; + getElementsByTagName(name: "footer"): NodeListOf; + getElementsByTagName(name: "foreignobject"): NodeListOf; + getElementsByTagName(name: "form"): NodeListOf; + getElementsByTagName(name: "frame"): NodeListOf; + getElementsByTagName(name: "frameset"): NodeListOf; + getElementsByTagName(name: "g"): NodeListOf; + getElementsByTagName(name: "h1"): NodeListOf; + getElementsByTagName(name: "h2"): NodeListOf; + getElementsByTagName(name: "h3"): NodeListOf; + getElementsByTagName(name: "h4"): NodeListOf; + getElementsByTagName(name: "h5"): NodeListOf; + getElementsByTagName(name: "h6"): NodeListOf; + getElementsByTagName(name: "head"): NodeListOf; + getElementsByTagName(name: "header"): NodeListOf; + getElementsByTagName(name: "hgroup"): NodeListOf; + getElementsByTagName(name: "hr"): NodeListOf; + getElementsByTagName(name: "html"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "iframe"): NodeListOf; + getElementsByTagName(name: "image"): NodeListOf; + getElementsByTagName(name: "img"): NodeListOf; + getElementsByTagName(name: "input"): NodeListOf; + getElementsByTagName(name: "ins"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "label"): NodeListOf; + getElementsByTagName(name: "legend"): NodeListOf; + getElementsByTagName(name: "li"): NodeListOf; + getElementsByTagName(name: "line"): NodeListOf; + getElementsByTagName(name: "lineargradient"): NodeListOf; + getElementsByTagName(name: "link"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "map"): NodeListOf; + getElementsByTagName(name: "mark"): NodeListOf; + getElementsByTagName(name: "marker"): NodeListOf; + getElementsByTagName(name: "marquee"): NodeListOf; + getElementsByTagName(name: "mask"): NodeListOf; + getElementsByTagName(name: "menu"): NodeListOf; + getElementsByTagName(name: "meta"): NodeListOf; + getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "meter"): NodeListOf; + getElementsByTagName(name: "nav"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "noframes"): NodeListOf; + getElementsByTagName(name: "noscript"): NodeListOf; + getElementsByTagName(name: "object"): NodeListOf; + getElementsByTagName(name: "ol"): NodeListOf; + getElementsByTagName(name: "optgroup"): NodeListOf; + getElementsByTagName(name: "option"): NodeListOf; + getElementsByTagName(name: "p"): NodeListOf; + getElementsByTagName(name: "param"): NodeListOf; + getElementsByTagName(name: "path"): NodeListOf; + getElementsByTagName(name: "pattern"): NodeListOf; + getElementsByTagName(name: "picture"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "polygon"): NodeListOf; + getElementsByTagName(name: "polyline"): NodeListOf; + getElementsByTagName(name: "pre"): NodeListOf; + getElementsByTagName(name: "progress"): NodeListOf; + getElementsByTagName(name: "q"): NodeListOf; + getElementsByTagName(name: "radialgradient"): NodeListOf; + getElementsByTagName(name: "rect"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "script"): NodeListOf; + getElementsByTagName(name: "section"): NodeListOf; + getElementsByTagName(name: "select"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "source"): NodeListOf; + getElementsByTagName(name: "span"): NodeListOf; + getElementsByTagName(name: "stop"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "style"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "svg"): NodeListOf; + getElementsByTagName(name: "switch"): NodeListOf; + getElementsByTagName(name: "symbol"): NodeListOf; + getElementsByTagName(name: "table"): NodeListOf; + getElementsByTagName(name: "tbody"): NodeListOf; + getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "template"): NodeListOf; + getElementsByTagName(name: "text"): NodeListOf; + getElementsByTagName(name: "textpath"): NodeListOf; + getElementsByTagName(name: "textarea"): NodeListOf; + getElementsByTagName(name: "tfoot"): NodeListOf; + getElementsByTagName(name: "th"): NodeListOf; + getElementsByTagName(name: "thead"): NodeListOf; + getElementsByTagName(name: "title"): NodeListOf; + getElementsByTagName(name: "tr"): NodeListOf; + getElementsByTagName(name: "track"): NodeListOf; + getElementsByTagName(name: "tspan"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "ul"): NodeListOf; + getElementsByTagName(name: "use"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "video"): NodeListOf; + getElementsByTagName(name: "view"): NodeListOf; + getElementsByTagName(name: "wbr"): NodeListOf; + getElementsByTagName(name: "x-ms-webview"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + hasAttribute(name: string): boolean; + hasAttributeNS(namespaceURI: string, localName: string): boolean; + msGetRegionContent(): MSRangeCollection; + msGetUntransformedBounds(): ClientRect; + msMatchesSelector(selectors: string): boolean; + msReleasePointerCapture(pointerId: number): void; + msSetPointerCapture(pointerId: number): void; + msZoomTo(args: MsZoomToOptions): void; + releasePointerCapture(pointerId: number): void; + removeAttribute(name?: string): void; + removeAttributeNS(namespaceURI: string, localName: string): void; + removeAttributeNode(oldAttr: Attr): Attr; + requestFullscreen(): void; + requestPointerLock(): void; + setAttribute(name: string, value: string): void; + setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; + setAttributeNode(newAttr: Attr): Attr; + setAttributeNodeNS(newAttr: Attr): Attr; + setPointerCapture(pointerId: number): void; + webkitMatchesSelector(selectors: string): boolean; + webkitRequestFullScreen(): void; + webkitRequestFullscreen(): void; + getElementsByClassName(classNames: string): NodeListOf; + 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var Element: { + prototype: Element; + new(): Element; +} + +interface ErrorEvent extends Event { + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} + +declare var ErrorEvent: { + prototype: ErrorEvent; + new(): ErrorEvent; +} + +interface Event { + readonly bubbles: boolean; + cancelBubble: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; + returnValue: boolean; + readonly srcElement: Element | null; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + preventDefault(): void; + stopImmediatePropagation(): void; + stopPropagation(): void; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +declare var Event: { + prototype: Event; + new(type: string, eventInitDict?: EventInit): Event; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +interface EventTarget { + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; + dispatchEvent(evt: Event): boolean; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var EventTarget: { + prototype: EventTarget; + new(): EventTarget; +} + +interface External { +} + +declare var External: { + prototype: External; + new(): External; +} + +interface File extends Blob { + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; +} + +declare var File: { + prototype: File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; +} + +interface FileList { + readonly length: number; + item(index: number): File; + [index: number]: File; +} + +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface FileReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface FocusEvent extends UIEvent { + readonly relatedTarget: EventTarget; + initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; +} + +declare var FocusEvent: { + prototype: FocusEvent; + new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; +} + +interface FormData { + append(name: any, value: any, blobName?: string): void; +} + +declare var FormData: { + prototype: FormData; + new (form?: HTMLFormElement): FormData; +} + +interface GainNode extends AudioNode { + readonly gain: AudioParam; +} + +declare var GainNode: { + prototype: GainNode; + new(): GainNode; +} + +interface Gamepad { + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; +} + +declare var Gamepad: { + prototype: Gamepad; + new(): Gamepad; +} + +interface GamepadButton { + readonly pressed: boolean; + readonly value: number; +} + +declare var GamepadButton: { + prototype: GamepadButton; + new(): GamepadButton; +} + +interface GamepadEvent extends Event { + readonly gamepad: Gamepad; +} + +declare var GamepadEvent: { + prototype: GamepadEvent; + new(): GamepadEvent; +} + +interface Geolocation { + clearWatch(watchId: number): void; + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; +} + +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +} + +interface HTMLAllCollection extends HTMLCollection { + namedItem(name: string): Element; +} + +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +} + +interface HTMLAnchorElement extends HTMLElement { + Methods: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Contains the anchor portion of the URL including the hash sign (#). + */ + hash: string; + /** + * Contains the hostname and port values of the URL. + */ + host: string; + /** + * Contains the hostname of a URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + readonly mimeType: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + readonly nameProp: string; + /** + * Contains the pathname of the URL. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Contains the protocol of the URL. + */ + protocol: string; + readonly protocolLong: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + type: string; + urn: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} + +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +} + +interface HTMLAppletElement extends HTMLElement { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. + */ + declare: boolean; + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + object: string | null; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + vspace: number; + width: number; +} + +declare var HTMLAppletElement: { + prototype: HTMLAppletElement; + new(): HTMLAppletElement; +} + +interface HTMLAreaElement extends HTMLElement { + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Sets or retrieves the subsection of the href property that follows the number sign (#). + */ + hash: string; + /** + * Sets or retrieves the hostname and port number of the location or URL. + */ + host: string; + /** + * Sets or retrieves the host name part of the location or URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or gets whether clicks in this region cause action. + */ + noHref: boolean; + /** + * Sets or retrieves the file name or path specified by the object. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Sets or retrieves the protocol portion of a URL. + */ + protocol: string; + rel: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} + +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +} + +interface HTMLAreasCollection extends HTMLCollection { + /** + * Adds an element to the areas, controlRange, or options collection. + */ + add(element: HTMLElement, before?: HTMLElement | number): void; + /** + * Removes an element from the collection. + */ + remove(index?: number): void; +} + +declare var HTMLAreasCollection: { + prototype: HTMLAreasCollection; + new(): HTMLAreasCollection; +} + +interface HTMLAudioElement extends HTMLMediaElement { +} + +declare var HTMLAudioElement: { + prototype: HTMLAudioElement; + new(): HTMLAudioElement; +} + +interface HTMLBRElement extends HTMLElement { + /** + * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. + */ + clear: string; +} + +declare var HTMLBRElement: { + prototype: HTMLBRElement; + new(): HTMLBRElement; +} + +interface HTMLBaseElement extends HTMLElement { + /** + * Gets or sets the baseline URL on which relative links are based. + */ + href: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; +} + +declare var HTMLBaseElement: { + prototype: HTMLBaseElement; + new(): HTMLBaseElement; +} + +interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + /** + * Sets or retrieves the font size of the object. + */ + size: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBaseFontElement: { + prototype: HTMLBaseFontElement; + new(): HTMLBaseFontElement; +} + +interface HTMLBodyElement extends HTMLElement { + aLink: any; + background: string; + bgColor: any; + bgProperties: string; + link: any; + noWrap: boolean; + onafterprint: (this: this, ev: Event) => any; + onbeforeprint: (this: this, ev: Event) => any; + onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + onblur: (this: this, ev: FocusEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onfocus: (this: this, ev: FocusEvent) => any; + onhashchange: (this: this, ev: HashChangeEvent) => any; + onload: (this: this, ev: Event) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onoffline: (this: this, ev: Event) => any; + ononline: (this: this, ev: Event) => any; + onorientationchange: (this: this, ev: Event) => any; + onpagehide: (this: this, ev: PageTransitionEvent) => any; + onpageshow: (this: this, ev: PageTransitionEvent) => any; + onpopstate: (this: this, ev: PopStateEvent) => any; + onresize: (this: this, ev: UIEvent) => any; + onstorage: (this: this, ev: StorageEvent) => any; + onunload: (this: this, ev: Event) => any; + text: any; + vLink: any; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLBodyElement: { + prototype: HTMLBodyElement; + new(): HTMLBodyElement; +} + +interface HTMLButtonElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + status: any; + /** + * Gets the classification and default behavior of the button. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the default or selected value of the control. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} + +declare var HTMLButtonElement: { + prototype: HTMLButtonElement; + new(): HTMLButtonElement; +} + +interface HTMLCanvasElement extends HTMLElement { + /** + * Gets or sets the height of a canvas element on a document. + */ + height: number; + /** + * Gets or sets the width of a canvas element on a document. + */ + width: number; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; + getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; + /** + * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. + */ + msToBlob(): Blob; + /** + * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. + * @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, type?: string, ...arguments: any[]): void; +} + +declare var HTMLCanvasElement: { + prototype: HTMLCanvasElement; + new(): HTMLCanvasElement; +} + +interface HTMLCollection { + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Retrieves an object from various collections. + */ + item(index: number): Element; + /** + * Retrieves a select object or an object from an options collection. + */ + namedItem(name: string): Element; + [index: number]: Element; +} + +declare var HTMLCollection: { + prototype: HTMLCollection; + new(): HTMLCollection; +} + +interface HTMLDListElement extends HTMLElement { + compact: boolean; +} + +declare var HTMLDListElement: { + prototype: HTMLDListElement; + new(): HTMLDListElement; +} + +interface HTMLDataListElement extends HTMLElement { + options: HTMLCollectionOf; +} + +declare var HTMLDataListElement: { + prototype: HTMLDataListElement; + new(): HTMLDataListElement; +} + +interface HTMLDirectoryElement extends HTMLElement { + compact: boolean; +} + +declare var HTMLDirectoryElement: { + prototype: HTMLDirectoryElement; + new(): HTMLDirectoryElement; +} + +interface HTMLDivElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} + +declare var HTMLDivElement: { + prototype: HTMLDivElement; + new(): HTMLDivElement; +} + +interface HTMLDocument extends Document { +} + +declare var HTMLDocument: { + prototype: HTMLDocument; + new(): HTMLDocument; +} + +interface HTMLElement extends Element { + accessKey: string; + readonly children: HTMLCollection; + contentEditable: string; + readonly dataset: DOMStringMap; + dir: string; + draggable: boolean; + hidden: boolean; + hideFocus: boolean; + innerHTML: string; + innerText: string; + readonly isContentEditable: boolean; + lang: string; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; + onabort: (this: this, ev: UIEvent) => any; + onactivate: (this: this, ev: UIEvent) => any; + onbeforeactivate: (this: this, ev: UIEvent) => any; + onbeforecopy: (this: this, ev: ClipboardEvent) => any; + onbeforecut: (this: this, ev: ClipboardEvent) => any; + onbeforedeactivate: (this: this, ev: UIEvent) => any; + onbeforepaste: (this: this, ev: ClipboardEvent) => any; + onblur: (this: this, ev: FocusEvent) => any; + oncanplay: (this: this, ev: Event) => any; + oncanplaythrough: (this: this, ev: Event) => any; + onchange: (this: this, ev: Event) => any; + onclick: (this: this, ev: MouseEvent) => any; + oncontextmenu: (this: this, ev: PointerEvent) => any; + oncopy: (this: this, ev: ClipboardEvent) => any; + oncuechange: (this: this, ev: Event) => any; + oncut: (this: this, ev: ClipboardEvent) => any; + ondblclick: (this: this, ev: MouseEvent) => any; + ondeactivate: (this: this, ev: UIEvent) => any; + ondrag: (this: this, ev: DragEvent) => any; + ondragend: (this: this, ev: DragEvent) => any; + ondragenter: (this: this, ev: DragEvent) => any; + ondragleave: (this: this, ev: DragEvent) => any; + ondragover: (this: this, ev: DragEvent) => any; + ondragstart: (this: this, ev: DragEvent) => any; + ondrop: (this: this, ev: DragEvent) => any; + ondurationchange: (this: this, ev: Event) => any; + onemptied: (this: this, ev: Event) => any; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onfocus: (this: this, ev: FocusEvent) => any; + oninput: (this: this, ev: Event) => any; + oninvalid: (this: this, ev: Event) => any; + onkeydown: (this: this, ev: KeyboardEvent) => any; + onkeypress: (this: this, ev: KeyboardEvent) => any; + onkeyup: (this: this, ev: KeyboardEvent) => any; + onload: (this: this, ev: Event) => any; + onloadeddata: (this: this, ev: Event) => any; + onloadedmetadata: (this: this, ev: Event) => any; + onloadstart: (this: this, ev: Event) => any; + onmousedown: (this: this, ev: MouseEvent) => any; + onmouseenter: (this: this, ev: MouseEvent) => any; + onmouseleave: (this: this, ev: MouseEvent) => any; + onmousemove: (this: this, ev: MouseEvent) => any; + onmouseout: (this: this, ev: MouseEvent) => any; + onmouseover: (this: this, ev: MouseEvent) => any; + onmouseup: (this: this, ev: MouseEvent) => any; + onmousewheel: (this: this, ev: WheelEvent) => any; + onmscontentzoom: (this: this, ev: UIEvent) => any; + onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; + onpaste: (this: this, ev: ClipboardEvent) => any; + onpause: (this: this, ev: Event) => any; + onplay: (this: this, ev: Event) => any; + onplaying: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + onratechange: (this: this, ev: Event) => any; + onreset: (this: this, ev: Event) => any; + onscroll: (this: this, ev: UIEvent) => any; + onseeked: (this: this, ev: Event) => any; + onseeking: (this: this, ev: Event) => any; + onselect: (this: this, ev: UIEvent) => any; + onselectstart: (this: this, ev: Event) => any; + onstalled: (this: this, ev: Event) => any; + onsubmit: (this: this, ev: Event) => any; + onsuspend: (this: this, ev: Event) => any; + ontimeupdate: (this: this, ev: Event) => any; + onvolumechange: (this: this, ev: Event) => any; + onwaiting: (this: this, ev: Event) => any; + outerHTML: string; + outerText: string; + spellcheck: boolean; + readonly style: CSSStyleDeclaration; + tabIndex: number; + title: string; + blur(): void; + click(): void; + dragDrop(): boolean; + focus(): void; + msGetInputContext(): MSInputMethodContext; + 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLElement: { + prototype: HTMLElement; + new(): HTMLElement; +} + +interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves the height of the object. + */ + height: string; + hidden: any; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves the palette used for the embedded document. + */ + readonly palette: string; + /** + * Retrieves the URL of the plug-in used to view an embedded document. + */ + readonly pluginspage: string; + readonly readyState: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the height and width units of the embed object. + */ + units: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLEmbedElement: { + prototype: HTMLEmbedElement; + new(): HTMLEmbedElement; +} + +interface HTMLFieldSetElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} + +declare var HTMLFieldSetElement: { + prototype: HTMLFieldSetElement; + new(): HTMLFieldSetElement; +} + +interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFontElement: { + prototype: HTMLFontElement; + new(): HTMLFontElement; +} + +interface HTMLFormElement extends HTMLElement { + /** + * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. + */ + acceptCharset: string; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Retrieves a collection, in source order, of all controls in a given form. + */ + readonly elements: HTMLCollection; + /** + * Sets or retrieves the MIME encoding for the form. + */ + encoding: string; + /** + * Sets or retrieves the encoding type for the form. + */ + enctype: string; + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Sets or retrieves how to send the form data to the server. + */ + method: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Designates a form that is not validated when submitted. + */ + noValidate: boolean; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a form object or an object from an elements collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a form object or an object from an elements collection. + */ + namedItem(name: string): any; + /** + * Fires when the user resets a form. + */ + reset(): void; + /** + * Fires when a FORM is about to be submitted. + */ + submit(): void; + [name: string]: any; +} + +declare var HTMLFormElement: { + prototype: HTMLFormElement; + new(): HTMLFormElement; +} + +interface HTMLFrameElement extends HTMLElement, GetSVGDocument { + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string | number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: this, ev: Event) => any; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the width of the object. + */ + width: string | number; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLFrameElement: { + prototype: HTMLFrameElement; + new(): HTMLFrameElement; +} + +interface HTMLFrameSetElement extends HTMLElement { + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the frame widths of the object. + */ + cols: string; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + name: string; + onafterprint: (this: this, ev: Event) => any; + onbeforeprint: (this: this, ev: Event) => any; + onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + /** + * Fires when the object loses the input focus. + */ + onblur: (this: this, ev: FocusEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + */ + onfocus: (this: this, ev: FocusEvent) => any; + onhashchange: (this: this, ev: HashChangeEvent) => any; + onload: (this: this, ev: Event) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onoffline: (this: this, ev: Event) => any; + ononline: (this: this, ev: Event) => any; + onorientationchange: (this: this, ev: Event) => any; + onpagehide: (this: this, ev: PageTransitionEvent) => any; + onpageshow: (this: this, ev: PageTransitionEvent) => any; + onresize: (this: this, ev: UIEvent) => any; + onstorage: (this: this, ev: StorageEvent) => any; + onunload: (this: this, ev: Event) => any; + /** + * Sets or retrieves the frame heights of the object. + */ + rows: string; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLFrameSetElement: { + prototype: HTMLFrameSetElement; + new(): HTMLFrameSetElement; +} + +interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. + */ + noShade: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHRElement: { + prototype: HTMLHRElement; + new(): HTMLHRElement; +} + +interface HTMLHeadElement extends HTMLElement { + profile: string; +} + +declare var HTMLHeadElement: { + prototype: HTMLHeadElement; + new(): HTMLHeadElement; +} + +interface HTMLHeadingElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; +} + +declare var HTMLHeadingElement: { + prototype: HTMLHeadingElement; + new(): HTMLHeadingElement; +} + +interface HTMLHtmlElement extends HTMLElement { + /** + * Sets or retrieves the DTD version that governs the current document. + */ + version: string; +} + +declare var HTMLHtmlElement: { + prototype: HTMLHtmlElement; + new(): HTMLHtmlElement; +} + +interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + allowFullscreen: boolean; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the horizontal margin for the object. + */ + hspace: number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: this, ev: Event) => any; + readonly sandbox: DOMSettableTokenList; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLIFrameElement: { + prototype: HTMLIFrameElement; + new(): HTMLIFrameElement; +} + +interface HTMLImageElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + crossOrigin: string; + readonly currentSrc: string; + /** + * Sets or retrieves the height of the object. + */ + height: number; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves whether the image is a server-side image map. + */ + isMap: boolean; + /** + * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. + */ + longDesc: string; + lowsrc: string; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * The original height of the image resource before sizing. + */ + readonly naturalHeight: number; + /** + * The original width of the image resource before sizing. + */ + readonly naturalWidth: number; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: number; + readonly x: number; + readonly y: number; + msGetAsCastingSource(): any; +} + +declare var HTMLImageElement: { + prototype: HTMLImageElement; + new(): HTMLImageElement; + create(): HTMLImageElement; +} + +interface HTMLInputElement extends HTMLElement { + /** + * Sets or retrieves a comma-separated list of content types. + */ + accept: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + checked: boolean; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + /** + * Sets or retrieves the state of the check box or radio button. + */ + defaultChecked: boolean; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Returns a FileList object on a file type input object. + */ + readonly files: FileList | null; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + indeterminate: boolean; + /** + * Specifies the ID of a pre-defined datalist of options for an input element. + */ + readonly list: HTMLElement; + /** + * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. + */ + max: string; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. + */ + min: string; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a string containing a regular expression that the user's input must match. + */ + pattern: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + selectionDirection: string; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + size: number; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + status: boolean; + /** + * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. + */ + step: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns the value of the data at the cursor's current position. + */ + value: string; + valueAsDate: Date; + /** + * Returns the input field value as a number. + */ + valueAsNumber: number; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + webkitdirectory: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Makes the selection equal to the current object. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start?: number, end?: number, direction?: string): void; + /** + * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. + * @param n Value to decrement the value by. + */ + stepDown(n?: number): void; + /** + * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. + * @param n Value to increment the value by. + */ + stepUp(n?: number): void; +} + +declare var HTMLInputElement: { + prototype: HTMLInputElement; + new(): HTMLInputElement; +} + +interface HTMLLIElement extends HTMLElement { + type: string; + /** + * Sets or retrieves the value of a list item. + */ + value: number; +} + +declare var HTMLLIElement: { + prototype: HTMLLIElement; + new(): HTMLLIElement; +} + +interface HTMLLabelElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the object to which the given label object is assigned. + */ + htmlFor: string; +} + +declare var HTMLLabelElement: { + prototype: HTMLLabelElement; + new(): HTMLLabelElement; +} + +interface HTMLLegendElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; +} + +declare var HTMLLegendElement: { + prototype: HTMLLegendElement; + new(): HTMLLegendElement; +} + +interface HTMLLinkElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + disabled: boolean; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + import?: Document; + integrity: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLinkElement: { + prototype: HTMLLinkElement; + new(): HTMLLinkElement; +} + +interface HTMLMapElement extends HTMLElement { + /** + * Retrieves a collection of the area objects defined for the given map object. + */ + readonly areas: HTMLAreasCollection; + /** + * Sets or retrieves the name of the object. + */ + name: string; +} + +declare var HTMLMapElement: { + prototype: HTMLMapElement; + new(): HTMLMapElement; +} + +interface HTMLMarqueeElement extends HTMLElement { + behavior: string; + bgColor: any; + direction: string; + height: string; + hspace: number; + loop: number; + onbounce: (this: this, ev: Event) => any; + onfinish: (this: this, ev: Event) => any; + onstart: (this: this, ev: Event) => any; + scrollAmount: number; + scrollDelay: number; + trueSpeed: boolean; + vspace: number; + width: string; + start(): void; + stop(): 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLMarqueeElement: { + prototype: HTMLMarqueeElement; + new(): HTMLMarqueeElement; +} + +interface HTMLMediaElement extends HTMLElement { + /** + * Returns an AudioTrackList object with the audio tracks for a given video element. + */ + readonly audioTracks: AudioTrackList; + /** + * Gets or sets a value that indicates whether to start playing the media automatically. + */ + autoplay: boolean; + /** + * Gets a collection of buffered time ranges. + */ + readonly buffered: TimeRanges; + /** + * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). + */ + controls: boolean; + crossOrigin: string; + /** + * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. + */ + readonly currentSrc: string; + /** + * Gets or sets the current playback position, in seconds. + */ + currentTime: number; + defaultMuted: boolean; + /** + * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. + */ + defaultPlaybackRate: number; + /** + * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. + */ + readonly duration: number; + /** + * Gets information about whether the playback has ended or not. + */ + readonly ended: boolean; + /** + * Returns an object representing the current error state of the audio or video element. + */ + readonly error: MediaError; + /** + * Gets or sets a flag to specify whether playback should restart after it completes. + */ + loop: boolean; + readonly mediaKeys: MediaKeys | null; + /** + * Specifies the purpose of the audio or video media, such as background audio or alerts. + */ + msAudioCategory: string; + /** + * Specifies the output device id that the audio will be sent to. + */ + msAudioDeviceType: string; + readonly msGraphicsTrustStatus: MSGraphicsTrust; + /** + * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. + */ + readonly msKeys: MSMediaKeys; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Specifies whether or not to enable low-latency playback on the media element. + */ + msRealTime: boolean; + /** + * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. + */ + muted: boolean; + /** + * Gets the current network activity for the element. + */ + readonly networkState: number; + onencrypted: (this: this, ev: MediaEncryptedEvent) => any; + onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any; + /** + * Gets a flag that specifies whether playback is paused. + */ + readonly paused: boolean; + /** + * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. + */ + playbackRate: number; + /** + * Gets TimeRanges for the current media resource that has been played. + */ + readonly played: TimeRanges; + /** + * Gets or sets the current playback position, in seconds. + */ + preload: string; + readyState: number; + /** + * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. + */ + readonly seekable: TimeRanges; + /** + * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. + */ + readonly seeking: boolean; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcObject: MediaStream | null; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; + /** + * Gets or sets the volume level for audio portions of the media element. + */ + volume: number; + addTextTrack(kind: string, label?: string, language?: string): TextTrack; + /** + * Returns a string that specifies whether the client can play a given media resource type. + */ + canPlayType(type: string): string; + /** + * Resets the audio or video object and loads a new media resource. + */ + load(): void; + /** + * Clears all effects from the media pipeline. + */ + msClearEffects(): void; + msGetAsCastingSource(): any; + /** + * Inserts the specified audio effect into media pipeline. + */ + msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetMediaKeys(mediaKeys: MSMediaKeys): void; + /** + * Specifies the media protection manager for a given media pipeline. + */ + msSetMediaProtectionManager(mediaProtectionManager?: any): void; + /** + * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. + */ + pause(): void; + /** + * Loads and starts playback of a media resource. + */ + play(): void; + setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLMediaElement: { + prototype: HTMLMediaElement; + new(): HTMLMediaElement; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; +} + +interface HTMLMenuElement extends HTMLElement { + compact: boolean; + type: string; +} + +declare var HTMLMenuElement: { + prototype: HTMLMenuElement; + new(): HTMLMenuElement; +} + +interface HTMLMetaElement extends HTMLElement { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Gets or sets meta-information to associate with httpEquiv or name. + */ + content: string; + /** + * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. + */ + httpEquiv: string; + /** + * Sets or retrieves the value specified in the content attribute of the meta object. + */ + name: string; + /** + * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. + */ + scheme: string; + /** + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + */ + url: string; +} + +declare var HTMLMetaElement: { + prototype: HTMLMetaElement; + new(): HTMLMetaElement; +} + +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + +interface HTMLModElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; +} + +declare var HTMLModElement: { + prototype: HTMLModElement; + new(): HTMLModElement; +} + +interface HTMLOListElement extends HTMLElement { + compact: boolean; + /** + * The starting number. + */ + start: number; + type: string; +} + +declare var HTMLOListElement: { + prototype: HTMLOListElement; + new(): HTMLOListElement; +} + +interface HTMLObjectElement extends HTMLElement, GetSVGDocument { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + /** + * Sets or retrieves the URL of the file containing the compiled Java class. + */ + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + declare: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves the contained object. + */ + readonly object: any; + readonly readyState: number; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLObjectElement: { + prototype: HTMLObjectElement; + new(): HTMLObjectElement; +} + +interface HTMLOptGroupElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + readonly text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; +} + +declare var HTMLOptGroupElement: { + prototype: HTMLOptGroupElement; + new(): HTMLOptGroupElement; +} + +interface HTMLOptionElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; +} + +declare var HTMLOptionElement: { + prototype: HTMLOptionElement; + new(): HTMLOptionElement; + create(): HTMLOptionElement; +} + +interface HTMLOptionsCollection extends HTMLCollectionOf { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + +interface HTMLParagraphElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + clear: string; +} + +declare var HTMLParagraphElement: { + prototype: HTMLParagraphElement; + new(): HTMLParagraphElement; +} + +interface HTMLParamElement extends HTMLElement { + /** + * Sets or retrieves the name of an input parameter for an element. + */ + name: string; + /** + * Sets or retrieves the content type of the resource designated by the value attribute. + */ + type: string; + /** + * Sets or retrieves the value of an input parameter for an element. + */ + value: string; + /** + * Sets or retrieves the data type of the value attribute. + */ + valueType: string; +} + +declare var HTMLParamElement: { + prototype: HTMLParamElement; + new(): HTMLParamElement; +} + +interface HTMLPictureElement extends HTMLElement { +} + +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; +} + +interface HTMLPreElement extends HTMLElement { + /** + * Sets or gets a value that you can use to implement your own width functionality for the object. + */ + width: number; +} + +declare var HTMLPreElement: { + prototype: HTMLPreElement; + new(): HTMLPreElement; +} + +interface HTMLProgressElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Defines the maximum, or "done" value for a progress element. + */ + max: number; + /** + * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). + */ + readonly position: number; + /** + * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. + */ + value: number; +} + +declare var HTMLProgressElement: { + prototype: HTMLProgressElement; + new(): HTMLProgressElement; +} + +interface HTMLQuoteElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} + +declare var HTMLQuoteElement: { + prototype: HTMLQuoteElement; + new(): HTMLQuoteElement; +} + +interface HTMLScriptElement extends HTMLElement { + async: boolean; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the status of the script. + */ + defer: boolean; + /** + * Sets or retrieves the event for which the script is written. + */ + event: string; + /** + * Sets or retrieves the object that is bound to the event script. + */ + htmlFor: string; + /** + * Retrieves the URL to an external file that contains the source code or data. + */ + src: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Sets or retrieves the MIME type for the associated scripting engine. + */ + type: string; + integrity: string; +} + +declare var HTMLScriptElement: { + prototype: HTMLScriptElement; + new(): HTMLScriptElement; +} + +interface HTMLSelectElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + readonly options: HTMLOptionsCollection; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the index of the selected option in a select object. + */ + selectedIndex: number; + selectedOptions: HTMLCollectionOf; + /** + * Sets or retrieves the number of rows in the list box. + */ + size: number; + /** + * Retrieves the type of select control based on the value of the MULTIPLE attribute. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Adds an element to the areas, controlRange, or options collection. + * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + */ + add(element: HTMLElement, before?: HTMLElement | number): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a select object or an object from an options collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a select object or an object from an options collection. + * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. + */ + namedItem(name: string): any; + /** + * Removes an element from the collection. + * @param index Number that specifies the zero-based index of the element to remove from the collection. + */ + remove(index?: number): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + [name: string]: any; +} + +declare var HTMLSelectElement: { + prototype: HTMLSelectElement; + new(): HTMLSelectElement; +} + +interface HTMLSourceElement extends HTMLElement { + /** + * Gets or sets the intended media type of the media source. + */ + media: string; + msKeySystem: string; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Gets or sets the MIME type of a media resource. + */ + type: string; +} + +declare var HTMLSourceElement: { + prototype: HTMLSourceElement; + new(): HTMLSourceElement; +} + +interface HTMLSpanElement extends HTMLElement { +} + +declare var HTMLSpanElement: { + prototype: HTMLSpanElement; + new(): HTMLSpanElement; +} + +interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Retrieves the CSS language in which the style sheet is written. + */ + type: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLStyleElement: { + prototype: HTMLStyleElement; + new(): HTMLStyleElement; +} + +interface HTMLTableCaptionElement extends HTMLElement { + /** + * Sets or retrieves the alignment of the caption or legend. + */ + align: string; + /** + * Sets or retrieves whether the caption appears at the top or bottom of the table. + */ + vAlign: string; +} + +declare var HTMLTableCaptionElement: { + prototype: HTMLTableCaptionElement; + new(): HTMLTableCaptionElement; +} + +interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves abbreviated text for the object. + */ + abbr: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. + */ + axis: string; + bgColor: any; + /** + * Retrieves the position of the object in the cells collection of a row. + */ + readonly cellIndex: number; + /** + * Sets or retrieves the number columns in the table that the object should span. + */ + colSpan: number; + /** + * Sets or retrieves a list of header cells that provide information for the object. + */ + headers: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + /** + * Sets or retrieves how many rows in a table the cell should span. + */ + rowSpan: number; + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableCellElement: { + prototype: HTMLTableCellElement; + new(): HTMLTableCellElement; +} + +interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves the alignment of the object relative to the display or table. + */ + align: string; + /** + * Sets or retrieves the number of columns in the group. + */ + span: number; + /** + * Sets or retrieves the width of the object. + */ + width: any; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableColElement: { + prototype: HTMLTableColElement; + new(): HTMLTableColElement; +} + +interface HTMLTableDataCellElement extends HTMLTableCellElement { +} + +declare var HTMLTableDataCellElement: { + prototype: HTMLTableDataCellElement; + new(): HTMLTableDataCellElement; +} + +interface HTMLTableElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + bgColor: any; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the caption object of a table. + */ + caption: HTMLTableCaptionElement; + /** + * Sets or retrieves the amount of space between the border of the cell and the content of the cell. + */ + cellPadding: string; + /** + * Sets or retrieves the amount of space between cells in a table. + */ + cellSpacing: string; + /** + * Sets or retrieves the number of columns in the table. + */ + cols: number; + /** + * Sets or retrieves the way the border frame around the table is displayed. + */ + frame: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Sets or retrieves which dividing lines (inner borders) are displayed. + */ + rules: string; + /** + * Sets or retrieves a description and/or structure of the object. + */ + summary: string; + /** + * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. + */ + tBodies: HTMLCollectionOf; + /** + * Retrieves the tFoot object of the table. + */ + tFoot: HTMLTableSectionElement; + /** + * Retrieves the tHead object of the table. + */ + tHead: HTMLTableSectionElement; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Creates an empty caption element in the table. + */ + createCaption(): HTMLTableCaptionElement; + /** + * Creates an empty tBody element in the table. + */ + createTBody(): HTMLTableSectionElement; + /** + * Creates an empty tFoot element in the table. + */ + createTFoot(): HTMLTableSectionElement; + /** + * Returns the tHead element object if successful, or null otherwise. + */ + createTHead(): HTMLTableSectionElement; + /** + * Deletes the caption element and its contents from the table. + */ + deleteCaption(): void; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Deletes the tFoot element and its contents from the table. + */ + deleteTFoot(): void; + /** + * Deletes the tHead element and its contents from the table. + */ + deleteTHead(): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; +} + +declare var HTMLTableElement: { + prototype: HTMLTableElement; + new(): HTMLTableElement; +} + +interface HTMLTableHeaderCellElement extends HTMLTableCellElement { + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; +} + +declare var HTMLTableHeaderCellElement: { + prototype: HTMLTableHeaderCellElement; + new(): HTMLTableHeaderCellElement; +} + +interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + bgColor: any; + /** + * Retrieves a collection of all cells in the table row. + */ + cells: HTMLCollectionOf; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Retrieves the position of the object in the rows collection for the table. + */ + readonly rowIndex: number; + /** + * Retrieves the position of the object in the collection. + */ + readonly sectionRowIndex: number; + /** + * Removes the specified cell from the table row, as well as from the cells collection. + * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. + */ + deleteCell(index?: number): void; + /** + * Creates a new cell in the table row, and adds the cell to the cells collection. + * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. + */ + insertCell(index?: number): HTMLTableDataCellElement; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableRowElement: { + prototype: HTMLTableRowElement; + new(): HTMLTableRowElement; +} + +interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableSectionElement: { + prototype: HTMLTableSectionElement; + new(): HTMLTableSectionElement; +} + +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + +interface HTMLTextAreaElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the object. + */ + cols: number; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Sets or retrieves the value indicated whether the content of the object is read-only. + */ + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: number; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + /** + * Sets or retrieves the value indicating whether the control is selected. + */ + status: any; + /** + * Retrieves the type of control. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Retrieves or sets the text in the entry field of the textArea element. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Sets or retrieves how to handle wordwrapping in the object. + */ + wrap: string; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Highlights the input area of a form element. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; +} + +declare var HTMLTextAreaElement: { + prototype: HTMLTextAreaElement; + new(): HTMLTextAreaElement; +} + +interface HTMLTitleElement extends HTMLElement { + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; +} + +declare var HTMLTitleElement: { + prototype: HTMLTitleElement; + new(): HTMLTitleElement; +} + +interface HTMLTrackElement extends HTMLElement { + default: boolean; + kind: string; + label: string; + readonly readyState: number; + src: string; + srclang: string; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; +} + +declare var HTMLTrackElement: { + prototype: HTMLTrackElement; + new(): HTMLTrackElement; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; +} + +interface HTMLUListElement extends HTMLElement { + compact: boolean; + type: string; +} + +declare var HTMLUListElement: { + prototype: HTMLUListElement; + new(): HTMLUListElement; +} + +interface HTMLUnknownElement extends HTMLElement { +} + +declare var HTMLUnknownElement: { + prototype: HTMLUnknownElement; + new(): HTMLUnknownElement; +} + +interface HTMLVideoElement extends HTMLMediaElement { + /** + * Gets or sets the height of the video element. + */ + height: number; + msHorizontalMirror: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; + msStereo3DPackingMode: string; + msStereo3DRenderMode: string; + msZoom: boolean; + onMSVideoFormatChanged: (this: this, ev: Event) => any; + onMSVideoFrameStepCompleted: (this: this, ev: Event) => any; + onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any; + /** + * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. + */ + poster: string; + /** + * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoHeight: number; + /** + * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; + /** + * Gets or sets the width of the video element. + */ + width: number; + getVideoPlaybackQuality(): VideoPlaybackQuality; + msFrameStep(forward: boolean): void; + msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; + webkitEnterFullScreen(): void; + webkitEnterFullscreen(): void; + webkitExitFullScreen(): void; + webkitExitFullscreen(): 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLVideoElement: { + prototype: HTMLVideoElement; + new(): HTMLVideoElement; +} + +interface HashChangeEvent extends Event { + readonly newURL: string | null; + readonly oldURL: string | null; +} + +declare var HashChangeEvent: { + prototype: HashChangeEvent; + new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; +} + +interface History { + readonly length: number; + readonly state: any; + 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: { + prototype: History; + new(): History; +} + +interface IDBCursor { + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; + advance(count: number): void; + continue(key?: IDBKeyRange | IDBValidKey): void; + delete(): IDBRequest; + update(value: any): IDBRequest; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +interface IDBCursorWithValue extends IDBCursor { + readonly value: any; +} + +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface IDBDatabase extends EventTarget { + readonly name: string; + readonly objectStoreNames: DOMStringList; + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; + close(): void; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; + deleteObjectStore(name: string): void; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface IDBFactory { + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; + open(name: string, version?: number): IDBOpenDBRequest; +} + +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface IDBIndex { + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; +} + +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface IDBKeyRange { + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; +} + +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; +} + +interface IDBObjectStore { + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; + clear(): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; + deleteIndex(indexName: string): void; + get(key: any): IDBRequest; + index(name: string): IDBIndex; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; +} + +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface IDBOpenDBRequest extends IDBRequest { + onblocked: (this: this, ev: Event) => any; + onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; + addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface IDBRequest extends EventTarget { + readonly error: DOMError; + onerror: (this: this, ev: ErrorEvent) => any; + onsuccess: (this: this, ev: Event) => any; + readonly readyState: string; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface IDBTransaction extends EventTarget { + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; + onabort: (this: this, ev: Event) => any; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; + addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; +} + +interface IDBVersionChangeEvent extends Event { + readonly newVersion: number | null; + readonly oldVersion: number; +} + +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface ImageData { + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; +} + +declare var ImageData: { + prototype: ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; +} + +interface KeyboardEvent extends UIEvent { + readonly altKey: boolean; + readonly char: string | null; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + 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; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +declare var KeyboardEvent: { + prototype: KeyboardEvent; + new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: string; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; +} + +interface Location { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + pathname: string; + port: string; + protocol: string; + search: string; + assign(url: string): void; + reload(forcedReload?: boolean): void; + replace(url: string): void; + toString(): string; +} + +declare var Location: { + prototype: Location; + new(): Location; +} + +interface LongRunningScriptDetectedEvent extends Event { + readonly executionTime: number; + stopPageScriptExecution: boolean; +} + +declare var LongRunningScriptDetectedEvent: { + prototype: LongRunningScriptDetectedEvent; + new(): LongRunningScriptDetectedEvent; +} + +interface MSApp { + clearTemporaryWebDataAsync(): MSAppAsyncOperation; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createDataPackage(object: any): any; + createDataPackageFromSelection(): any; + createFileFromStorageFile(storageFile: any): File; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + getCurrentPriority(): string; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; + getViewId(view: any): any; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + pageHandlesAllApplicationActivations(enabled: boolean): void; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + terminateApp(exceptionObject: any): void; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; +} +declare var MSApp: MSApp; + +interface MSAppAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + readonly readyState: number; + readonly result: any; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSAppAsyncOperation: { + prototype: MSAppAsyncOperation; + new(): MSAppAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: string; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} + +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; +} + +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: string[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; +} + +interface MSGesture { + target: Element; + addPointer(pointerId: number): void; + stop(): void; +} + +declare var MSGesture: { + prototype: MSGesture; + new(): MSGesture; +} + +interface MSGestureEvent extends UIEvent { + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; + initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +declare var MSGestureEvent: { + prototype: MSGestureEvent; + new(): MSGestureEvent; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +interface MSGraphicsTrust { + readonly constrictionActive: boolean; + readonly status: string; +} + +declare var MSGraphicsTrust: { + prototype: MSGraphicsTrust; + new(): MSGraphicsTrust; +} + +interface MSHTMLWebViewElement extends HTMLElement { + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; + height: number; + readonly settings: MSWebViewSettings; + src: string; + width: number; + addWebAllowedObject(name: string, applicationObject: any): void; + buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; + capturePreviewToBlobAsync(): MSWebViewAsyncOperation; + captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; + getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; + getDeferredPermissionRequests(): DeferredPermissionRequest[]; + goBack(): void; + goForward(): void; + invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; + navigate(uri: string): void; + navigateToLocalStreamUri(source: string, streamResolver: any): void; + navigateToString(contents: string): void; + navigateWithHttpRequestMessage(requestMessage: any): void; + refresh(): void; + stop(): void; +} + +declare var MSHTMLWebViewElement: { + prototype: MSHTMLWebViewElement; + new(): MSHTMLWebViewElement; +} + +interface MSInputMethodContext extends EventTarget { + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; + oncandidatewindowhide: (this: this, ev: Event) => any; + oncandidatewindowshow: (this: this, ev: Event) => any; + oncandidatewindowupdate: (this: this, ev: Event) => any; + readonly target: HTMLElement; + getCandidateWindowClientRect(): ClientRect; + getCompositionAlternatives(): string[]; + hasComposition(): boolean; + isCandidateWindowVisible(): boolean; + addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSInputMethodContext: { + prototype: MSInputMethodContext; + new(): MSInputMethodContext; +} + +interface MSManipulationEvent extends UIEvent { + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; + initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +declare var MSManipulationEvent: { + prototype: MSManipulationEvent; + new(): MSManipulationEvent; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +interface MSMediaKeyError { + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +declare var MSMediaKeyError: { + prototype: MSMediaKeyError; + new(): MSMediaKeyError; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +interface MSMediaKeyMessageEvent extends Event { + readonly destinationURL: string | null; + readonly message: Uint8Array; +} + +declare var MSMediaKeyMessageEvent: { + prototype: MSMediaKeyMessageEvent; + new(): MSMediaKeyMessageEvent; +} + +interface MSMediaKeyNeededEvent extends Event { + readonly initData: Uint8Array | null; +} + +declare var MSMediaKeyNeededEvent: { + prototype: MSMediaKeyNeededEvent; + new(): MSMediaKeyNeededEvent; +} + +interface MSMediaKeySession extends EventTarget { + readonly error: MSMediaKeyError | null; + readonly keySystem: string; + readonly sessionId: string; + close(): void; + update(key: Uint8Array): void; +} + +declare var MSMediaKeySession: { + prototype: MSMediaKeySession; + new(): MSMediaKeySession; +} + +interface MSMediaKeys { + readonly keySystem: string; + createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; +} + +declare var MSMediaKeys: { + prototype: MSMediaKeys; + new(keySystem: string): MSMediaKeys; + isTypeSupported(keySystem: string, type?: string): boolean; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; +} + +interface MSPointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var MSPointerEvent: { + prototype: MSPointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; +} + +interface MSRangeCollection { + readonly length: number; + item(index: number): Range; + [index: number]: Range; +} + +declare var MSRangeCollection: { + prototype: MSRangeCollection; + new(): MSRangeCollection; +} + +interface MSSiteModeEvent extends Event { + readonly actionURL: string; + readonly buttonID: number; +} + +declare var MSSiteModeEvent: { + prototype: MSSiteModeEvent; + new(): MSSiteModeEvent; +} + +interface MSStream { + readonly type: string; + msClose(): void; + msDetachStream(): any; +} + +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSStreamReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBinaryString(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface MSWebViewAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSWebViewAsyncOperation: { + prototype: MSWebViewAsyncOperation; + new(): MSWebViewAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; +} + +interface MSWebViewSettings { + isIndexedDBEnabled: boolean; + isJavaScriptEnabled: boolean; +} + +declare var MSWebViewSettings: { + prototype: MSWebViewSettings; + new(): MSWebViewSettings; +} + +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: string; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (this: this, ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + +interface MediaElementAudioSourceNode extends AudioNode { +} + +declare var MediaElementAudioSourceNode: { + prototype: MediaElementAudioSourceNode; + new(): MediaElementAudioSourceNode; +} + +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer | null; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + +interface MediaError { + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +declare var MediaError: { + prototype: MediaError; + new(): MediaError; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: string; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: PromiseLike; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): PromiseLike; + generateRequest(initDataType: string, initData: any): PromiseLike; + load(sessionId: string): PromiseLike; + remove(): PromiseLike; + update(response: any): PromiseLike; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): string; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): PromiseLike; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: string): MediaKeySession; + setServerCertificate(serverCertificate: any): PromiseLike; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; +} + +interface MediaList { + readonly length: number; + mediaText: string; + appendMedium(newMedium: string): void; + deleteMedium(oldMedium: string): void; + item(index: number): string; + toString(): string; + [index: number]: string; +} + +declare var MediaList: { + prototype: MediaList; + new(): MediaList; +} + +interface MediaQueryList { + readonly matches: boolean; + readonly media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} + +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + +interface MediaSource extends EventTarget { + readonly activeSourceBuffers: SourceBufferList; + duration: number; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; + addSourceBuffer(type: string): SourceBuffer; + endOfStream(error?: number): void; + removeSourceBuffer(sourceBuffer: SourceBuffer): void; +} + +declare var MediaSource: { + prototype: MediaSource; + new(): MediaSource; + isTypeSupported(type: string): boolean; +} + +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (this: this, ev: Event) => any; + onaddtrack: (this: this, ev: TrackEvent) => any; + oninactive: (this: this, ev: Event) => any; + onremovetrack: (this: this, ev: TrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack | null; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string | null; + readonly message: string | null; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError | null; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + onmute: (this: this, ev: Event) => any; + onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any; + onunmute: (this: this, ev: Event) => any; + readonly readonly: boolean; + readonly readyState: string; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + +interface MessageChannel { + readonly port1: MessagePort; + readonly port2: MessagePort; +} + +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface MessageEvent extends Event { + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; +} + +declare var MessageEvent: { + prototype: MessageEvent; + new(type: string, eventInitDict?: MessageEventInit): MessageEvent; +} + +interface MessagePort extends EventTarget { + onmessage: (this: this, ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, ports?: any): void; + start(): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface MimeType { + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; +} + +declare var MimeType: { + prototype: MimeType; + new(): MimeType; +} + +interface MimeTypeArray { + readonly length: number; + item(index: number): Plugin; + namedItem(type: string): Plugin; + [index: number]: Plugin; +} + +declare var MimeTypeArray: { + prototype: MimeTypeArray; + new(): MimeTypeArray; +} + +interface MouseEvent extends UIEvent { + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; + getModifierState(keyArg: string): boolean; + initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; +} + +declare var MouseEvent: { + prototype: MouseEvent; + new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; +} + +interface MutationEvent extends Event { + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; + initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +declare var MutationEvent: { + prototype: MutationEvent; + new(): MutationEvent; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +interface MutationObserver { + disconnect(): void; + observe(target: Node, options: MutationObserverInit): void; + takeRecords(): MutationRecord[]; +} + +declare var MutationObserver: { + prototype: MutationObserver; + new(callback: MutationCallback): MutationObserver; +} + +interface MutationRecord { + readonly addedNodes: NodeList; + readonly attributeName: string | null; + readonly attributeNamespace: string | null; + readonly nextSibling: Node | null; + readonly oldValue: string | null; + readonly previousSibling: Node | null; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; +} + +declare var MutationRecord: { + prototype: MutationRecord; + new(): MutationRecord; +} + +interface NamedNodeMap { + readonly length: number; + getNamedItem(name: string): Attr; + getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + item(index: number): Attr; + removeNamedItem(name: string): Attr; + removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + setNamedItem(arg: Attr): Attr; + setNamedItemNS(arg: Attr): Attr; + [index: number]: Attr; +} + +declare var NamedNodeMap: { + prototype: NamedNodeMap; + new(): NamedNodeMap; +} + +interface NavigationCompletedEvent extends NavigationEvent { + readonly isSuccess: boolean; + readonly webErrorStatus: number; +} + +declare var NavigationCompletedEvent: { + prototype: NavigationCompletedEvent; + new(): NavigationCompletedEvent; +} + +interface NavigationEvent extends Event { + readonly uri: string; +} + +declare var NavigationEvent: { + prototype: NavigationEvent; + new(): NavigationEvent; +} + +interface NavigationEventWithReferrer extends NavigationEvent { + readonly referer: string; +} + +declare var NavigationEventWithReferrer: { + prototype: NavigationEventWithReferrer; + new(): NavigationEventWithReferrer; +} + +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { + readonly appCodeName: string; + readonly cookieEnabled: boolean; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly webdriver: boolean; + readonly hardwareConcurrency: number; + getGamepads(): Gamepad[]; + javaEnabled(): boolean; + msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; + vibrate(pattern: number | number[]): boolean; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Navigator: { + prototype: Navigator; + new(): Navigator; +} + +interface Node extends EventTarget { + readonly attributes: NamedNodeMap; + readonly baseURI: string | null; + readonly childNodes: NodeList; + readonly firstChild: Node | null; + readonly lastChild: Node | null; + readonly localName: string | null; + readonly namespaceURI: string | null; + readonly nextSibling: Node | null; + readonly nodeName: string; + readonly nodeType: number; + nodeValue: string | null; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement | null; + readonly parentNode: Node | null; + readonly previousSibling: Node | null; + textContent: string | null; + appendChild(newChild: Node): Node; + cloneNode(deep?: boolean): Node; + compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; + hasAttributes(): boolean; + hasChildNodes(): boolean; + insertBefore(newChild: Node, refChild: Node | null): Node; + isDefaultNamespace(namespaceURI: string | null): boolean; + isEqualNode(arg: Node): boolean; + isSameNode(other: Node): boolean; + lookupNamespaceURI(prefix: string | null): string | null; + lookupPrefix(namespaceURI: string | null): string | null; + normalize(): void; + removeChild(oldChild: Node): Node; + replaceChild(newChild: Node, oldChild: Node): Node; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +declare var Node: { + prototype: Node; + new(): Node; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; +} + +interface NodeIterator { + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + detach(): void; + nextNode(): Node; + previousNode(): Node; +} + +declare var NodeIterator: { + prototype: NodeIterator; + new(): NodeIterator; +} + +interface NodeList { + readonly length: number; + item(index: number): Node; + [index: number]: Node; +} + +declare var NodeList: { + prototype: NodeList; + new(): NodeList; +} + +interface OES_element_index_uint { +} + +declare var OES_element_index_uint: { + prototype: OES_element_index_uint; + new(): OES_element_index_uint; +} + +interface OES_standard_derivatives { + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +declare var OES_standard_derivatives: { + prototype: OES_standard_derivatives; + new(): OES_standard_derivatives; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +interface OES_texture_float { +} + +declare var OES_texture_float: { + prototype: OES_texture_float; + new(): OES_texture_float; +} + +interface OES_texture_float_linear { +} + +declare var OES_texture_float_linear: { + prototype: OES_texture_float_linear; + new(): OES_texture_float_linear; +} + +interface OfflineAudioCompletionEvent extends Event { + readonly renderedBuffer: AudioBuffer; +} + +declare var OfflineAudioCompletionEvent: { + prototype: OfflineAudioCompletionEvent; + new(): OfflineAudioCompletionEvent; +} + +interface OfflineAudioContext extends AudioContext { + oncomplete: (this: this, ev: Event) => any; + startRendering(): PromiseLike; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OfflineAudioContext: { + prototype: OfflineAudioContext; + new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; +} + +interface OscillatorNode extends AudioNode { + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + type: string; + setPeriodicWave(periodicWave: PeriodicWave): void; + start(when?: number): void; + stop(when?: number): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OscillatorNode: { + prototype: OscillatorNode; + new(): OscillatorNode; +} + +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +interface PageTransitionEvent extends Event { + readonly persisted: boolean; +} + +declare var PageTransitionEvent: { + prototype: PageTransitionEvent; + new(): PageTransitionEvent; +} + +interface PannerNode extends AudioNode { + coneInnerAngle: number; + coneOuterAngle: number; + coneOuterGain: number; + distanceModel: string; + maxDistance: number; + panningModel: string; + refDistance: number; + rolloffFactor: number; + setOrientation(x: number, y: number, z: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var PannerNode: { + prototype: PannerNode; + new(): PannerNode; +} + +interface PerfWidgetExternal { + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; + addEventListener(eventType: string, callback: Function): void; + getMemoryUsage(): number; + getProcessCpuUsage(): number; + getRecentCpuUsage(last: number | null): any; + getRecentFrames(last: number | null): any; + getRecentMemoryUsage(last: number | null): any; + getRecentPaintRequests(last: number | null): any; + removeEventListener(eventType: string, callback: Function): void; + repositionWindow(x: number, y: number): void; + resizeWindow(width: number, height: number): void; +} + +declare var PerfWidgetExternal: { + prototype: PerfWidgetExternal; + new(): PerfWidgetExternal; +} + +interface Performance { + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; + clearMarks(markName?: string): void; + clearMeasures(measureName?: string): void; + clearResourceTimings(): void; + getEntries(): any; + getEntriesByName(name: string, entryType?: string): any; + getEntriesByType(entryType: string): any; + getMarks(markName?: string): any; + getMeasures(measureName?: string): any; + mark(markName: string): void; + measure(measureName: string, startMarkName?: string, endMarkName?: string): void; + now(): number; + setResourceTimingBufferSize(maxSize: number): void; + toJSON(): any; +} + +declare var Performance: { + prototype: Performance; + new(): Performance; +} + +interface PerformanceEntry { + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; +} + +declare var PerformanceEntry: { + prototype: PerformanceEntry; + new(): PerformanceEntry; +} + +interface PerformanceMark extends PerformanceEntry { +} + +declare var PerformanceMark: { + prototype: PerformanceMark; + new(): PerformanceMark; +} + +interface PerformanceMeasure extends PerformanceEntry { +} + +declare var PerformanceMeasure: { + prototype: PerformanceMeasure; + new(): PerformanceMeasure; +} + +interface PerformanceNavigation { + readonly redirectCount: number; + readonly type: number; + toJSON(): any; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +declare var PerformanceNavigation: { + prototype: PerformanceNavigation; + new(): PerformanceNavigation; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +interface PerformanceNavigationTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: string; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; +} + +declare var PerformanceNavigationTiming: { + prototype: PerformanceNavigationTiming; + new(): PerformanceNavigationTiming; +} + +interface PerformanceResourceTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; +} + +declare var PerformanceResourceTiming: { + prototype: PerformanceResourceTiming; + new(): PerformanceResourceTiming; +} + +interface PerformanceTiming { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; + readonly secureConnectionStart: number; + toJSON(): any; +} + +declare var PerformanceTiming: { + prototype: PerformanceTiming; + new(): PerformanceTiming; +} + +interface PeriodicWave { +} + +declare var PeriodicWave: { + prototype: PeriodicWave; + new(): PeriodicWave; +} + +interface PermissionRequest extends DeferredPermissionRequest { + readonly state: string; + defer(): void; +} + +declare var PermissionRequest: { + prototype: PermissionRequest; + new(): PermissionRequest; +} + +interface PermissionRequestedEvent extends Event { + readonly permissionRequest: PermissionRequest; +} + +declare var PermissionRequestedEvent: { + prototype: PermissionRequestedEvent; + new(): PermissionRequestedEvent; +} + +interface Plugin { + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; + item(index: number): MimeType; + namedItem(type: string): MimeType; + [index: number]: MimeType; +} + +declare var Plugin: { + prototype: Plugin; + new(): Plugin; +} + +interface PluginArray { + readonly length: number; + item(index: number): Plugin; + namedItem(name: string): Plugin; + refresh(reload?: boolean): void; + [index: number]: Plugin; +} + +declare var PluginArray: { + prototype: PluginArray; + new(): PluginArray; +} + +interface PointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var PointerEvent: { + prototype: PointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; +} + +interface PopStateEvent extends Event { + readonly state: any; + initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; +} + +declare var PopStateEvent: { + prototype: PopStateEvent; + new(): PopStateEvent; +} + +interface Position { + readonly coords: Coordinates; + readonly timestamp: number; +} + +declare var Position: { + prototype: Position; + new(): Position; +} + +interface PositionError { + readonly code: number; + readonly message: string; + toString(): string; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +interface ProcessingInstruction extends CharacterData { + readonly target: string; +} + +declare var ProcessingInstruction: { + prototype: ProcessingInstruction; + new(): ProcessingInstruction; +} + +interface ProgressEvent extends Event { + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} + +declare var ProgressEvent: { + prototype: ProgressEvent; + new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; +} + +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((this: this, ev: ErrorEvent) => any) | null; + readonly state: string; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters | null; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: string; + onerror: ((this: this, ev: ErrorEvent) => any) | null; + onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: string; + readonly iceGatherer: RTCIceGatherer | null; + oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null; + readonly role: string; + readonly state: string; + addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair | null; + getRemoteCandidates(): RTCIceCandidate[]; + getRemoteParameters(): RTCIceParameters | null; + setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; + stop(): void; + addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: ((this: this, ev: ErrorEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack | null; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: ((this: this, ev: ErrorEvent) => any) | null; + onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: ((this: this, ev: ErrorEvent) => any) | null; + readonly transport: RTCIceTransport; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): PromiseLike; + msGetStats(): PromiseLike; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + +interface Range { + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; + cloneContents(): DocumentFragment; + cloneRange(): Range; + collapse(toStart: boolean): void; + compareBoundaryPoints(how: number, sourceRange: Range): number; + createContextualFragment(fragment: string): DocumentFragment; + deleteContents(): void; + detach(): void; + expand(Unit: string): boolean; + extractContents(): DocumentFragment; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + insertNode(newNode: Node): void; + selectNode(refNode: Node): void; + selectNodeContents(refNode: Node): void; + setEnd(refNode: Node, offset: number): void; + setEndAfter(refNode: Node): void; + setEndBefore(refNode: Node): void; + setStart(refNode: Node, offset: number): void; + setStartAfter(refNode: Node): void; + setStartBefore(refNode: Node): void; + surroundContents(newParent: Node): void; + toString(): string; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +declare var Range: { + prototype: Range; + new(): Range; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { + readonly target: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGAElement: { + prototype: SVGAElement; + new(): SVGAElement; +} + +interface SVGAngle { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +declare var SVGAngle: { + prototype: SVGAngle; + new(): SVGAngle; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +interface SVGAnimatedAngle { + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; +} + +declare var SVGAnimatedAngle: { + prototype: SVGAnimatedAngle; + new(): SVGAnimatedAngle; +} + +interface SVGAnimatedBoolean { + readonly animVal: boolean; + baseVal: boolean; +} + +declare var SVGAnimatedBoolean: { + prototype: SVGAnimatedBoolean; + new(): SVGAnimatedBoolean; +} + +interface SVGAnimatedEnumeration { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedEnumeration: { + prototype: SVGAnimatedEnumeration; + new(): SVGAnimatedEnumeration; +} + +interface SVGAnimatedInteger { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedInteger: { + prototype: SVGAnimatedInteger; + new(): SVGAnimatedInteger; +} + +interface SVGAnimatedLength { + readonly animVal: SVGLength; + readonly baseVal: SVGLength; +} + +declare var SVGAnimatedLength: { + prototype: SVGAnimatedLength; + new(): SVGAnimatedLength; +} + +interface SVGAnimatedLengthList { + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; +} + +declare var SVGAnimatedLengthList: { + prototype: SVGAnimatedLengthList; + new(): SVGAnimatedLengthList; +} + +interface SVGAnimatedNumber { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedNumber: { + prototype: SVGAnimatedNumber; + new(): SVGAnimatedNumber; +} + +interface SVGAnimatedNumberList { + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; +} + +declare var SVGAnimatedNumberList: { + prototype: SVGAnimatedNumberList; + new(): SVGAnimatedNumberList; +} + +interface SVGAnimatedPreserveAspectRatio { + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; +} + +declare var SVGAnimatedPreserveAspectRatio: { + prototype: SVGAnimatedPreserveAspectRatio; + new(): SVGAnimatedPreserveAspectRatio; +} + +interface SVGAnimatedRect { + readonly animVal: SVGRect; + readonly baseVal: SVGRect; +} + +declare var SVGAnimatedRect: { + prototype: SVGAnimatedRect; + new(): SVGAnimatedRect; +} + +interface SVGAnimatedString { + readonly animVal: string; + baseVal: string; +} + +declare var SVGAnimatedString: { + prototype: SVGAnimatedString; + new(): SVGAnimatedString; +} + +interface SVGAnimatedTransformList { + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; +} + +declare var SVGAnimatedTransformList: { + prototype: SVGAnimatedTransformList; + new(): SVGAnimatedTransformList; +} + +interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGCircleElement: { + prototype: SVGCircleElement; + new(): SVGCircleElement; +} + +interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { + readonly clipPathUnits: SVGAnimatedEnumeration; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGClipPathElement: { + prototype: SVGClipPathElement; + new(): SVGClipPathElement; +} + +interface SVGComponentTransferFunctionElement extends SVGElement { + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; +} + +declare var SVGComponentTransferFunctionElement: { + prototype: SVGComponentTransferFunctionElement; + new(): SVGComponentTransferFunctionElement; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; +} + +interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDefsElement: { + prototype: SVGDefsElement; + new(): SVGDefsElement; +} + +interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDescElement: { + prototype: SVGDescElement; + new(): SVGDescElement; +} + +interface SVGElement extends Element { + onclick: (this: this, ev: MouseEvent) => any; + ondblclick: (this: this, ev: MouseEvent) => any; + onfocusin: (this: this, ev: FocusEvent) => any; + onfocusout: (this: this, ev: FocusEvent) => any; + onload: (this: this, ev: Event) => any; + onmousedown: (this: this, ev: MouseEvent) => any; + onmousemove: (this: this, ev: MouseEvent) => any; + onmouseout: (this: this, ev: MouseEvent) => any; + onmouseover: (this: this, ev: MouseEvent) => any; + onmouseup: (this: this, ev: MouseEvent) => any; + readonly ownerSVGElement: SVGSVGElement; + readonly viewportElement: SVGElement; + xmlbase: string; + className: any; + 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var SVGElement: { + prototype: SVGElement; + new(): SVGElement; +} + +interface SVGElementInstance extends EventTarget { + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; +} + +declare var SVGElementInstance: { + prototype: SVGElementInstance; + new(): SVGElementInstance; +} + +interface SVGElementInstanceList { + readonly length: number; + item(index: number): SVGElementInstance; +} + +declare var SVGElementInstanceList: { + prototype: SVGElementInstanceList; + new(): SVGElementInstanceList; +} + +interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGEllipseElement: { + prototype: SVGEllipseElement; + new(): SVGEllipseElement; +} + +interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEBlendElement: { + prototype: SVGFEBlendElement; + new(): SVGFEBlendElement; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; +} + +interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEColorMatrixElement: { + prototype: SVGFEColorMatrixElement; + new(): SVGFEColorMatrixElement; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; +} + +interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEComponentTransferElement: { + prototype: SVGFEComponentTransferElement; + new(): SVGFEComponentTransferElement; +} + +interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFECompositeElement: { + prototype: SVGFECompositeElement; + new(): SVGFECompositeElement; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; +} + +interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEConvolveMatrixElement: { + prototype: SVGFEConvolveMatrixElement; + new(): SVGFEConvolveMatrixElement; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; +} + +interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDiffuseLightingElement: { + prototype: SVGFEDiffuseLightingElement; + new(): SVGFEDiffuseLightingElement; +} + +interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDisplacementMapElement: { + prototype: SVGFEDisplacementMapElement; + new(): SVGFEDisplacementMapElement; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; +} + +interface SVGFEDistantLightElement extends SVGElement { + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; +} + +declare var SVGFEDistantLightElement: { + prototype: SVGFEDistantLightElement; + new(): SVGFEDistantLightElement; +} + +interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFloodElement: { + prototype: SVGFEFloodElement; + new(): SVGFEFloodElement; +} + +interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncAElement: { + prototype: SVGFEFuncAElement; + new(): SVGFEFuncAElement; +} + +interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncBElement: { + prototype: SVGFEFuncBElement; + new(): SVGFEFuncBElement; +} + +interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncGElement: { + prototype: SVGFEFuncGElement; + new(): SVGFEFuncGElement; +} + +interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncRElement: { + prototype: SVGFEFuncRElement; + new(): SVGFEFuncRElement; +} + +interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEGaussianBlurElement: { + prototype: SVGFEGaussianBlurElement; + new(): SVGFEGaussianBlurElement; +} + +interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEImageElement: { + prototype: SVGFEImageElement; + new(): SVGFEImageElement; +} + +interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMergeElement: { + prototype: SVGFEMergeElement; + new(): SVGFEMergeElement; +} + +interface SVGFEMergeNodeElement extends SVGElement { + readonly in1: SVGAnimatedString; +} + +declare var SVGFEMergeNodeElement: { + prototype: SVGFEMergeNodeElement; + new(): SVGFEMergeNodeElement; +} + +interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMorphologyElement: { + prototype: SVGFEMorphologyElement; + new(): SVGFEMorphologyElement; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; +} + +interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEOffsetElement: { + prototype: SVGFEOffsetElement; + new(): SVGFEOffsetElement; +} + +interface SVGFEPointLightElement extends SVGElement { + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; +} + +declare var SVGFEPointLightElement: { + prototype: SVGFEPointLightElement; + new(): SVGFEPointLightElement; +} + +interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFESpecularLightingElement: { + prototype: SVGFESpecularLightingElement; + new(): SVGFESpecularLightingElement; +} + +interface SVGFESpotLightElement extends SVGElement { + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; +} + +declare var SVGFESpotLightElement: { + prototype: SVGFESpotLightElement; + new(): SVGFESpotLightElement; +} + +interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETileElement: { + prototype: SVGFETileElement; + new(): SVGFETileElement; +} + +interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETurbulenceElement: { + prototype: SVGFETurbulenceElement; + new(): SVGFETurbulenceElement; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; +} + +interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + setFilterRes(filterResX: number, filterResY: number): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFilterElement: { + prototype: SVGFilterElement; + new(): SVGFilterElement; +} + +interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGForeignObjectElement: { + prototype: SVGForeignObjectElement; + new(): SVGForeignObjectElement; +} + +interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGElement: { + prototype: SVGGElement; + new(): SVGGElement; +} + +interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGradientElement: { + prototype: SVGGradientElement; + new(): SVGGradientElement; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; +} + +interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGImageElement: { + prototype: SVGImageElement; + new(): SVGImageElement; +} + +interface SVGLength { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +declare var SVGLength: { + prototype: SVGLength; + new(): SVGLength; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +interface SVGLengthList { + readonly numberOfItems: number; + appendItem(newItem: SVGLength): SVGLength; + clear(): void; + getItem(index: number): SVGLength; + initialize(newItem: SVGLength): SVGLength; + insertItemBefore(newItem: SVGLength, index: number): SVGLength; + removeItem(index: number): SVGLength; + replaceItem(newItem: SVGLength, index: number): SVGLength; +} + +declare var SVGLengthList: { + prototype: SVGLengthList; + new(): SVGLengthList; +} + +interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGLineElement: { + prototype: SVGLineElement; + new(): SVGLineElement; +} + +interface SVGLinearGradientElement extends SVGGradientElement { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; +} + +declare var SVGLinearGradientElement: { + prototype: SVGLinearGradientElement; + new(): SVGLinearGradientElement; +} + +interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; + setOrientToAngle(angle: SVGAngle): void; + setOrientToAuto(): void; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMarkerElement: { + prototype: SVGMarkerElement; + new(): SVGMarkerElement; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; +} + +interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMaskElement: { + prototype: SVGMaskElement; + new(): SVGMaskElement; +} + +interface SVGMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + flipX(): SVGMatrix; + flipY(): SVGMatrix; + inverse(): SVGMatrix; + multiply(secondMatrix: SVGMatrix): SVGMatrix; + rotate(angle: number): SVGMatrix; + rotateFromVector(x: number, y: number): SVGMatrix; + scale(scaleFactor: number): SVGMatrix; + scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; + skewX(angle: number): SVGMatrix; + skewY(angle: number): SVGMatrix; + translate(x: number, y: number): SVGMatrix; +} + +declare var SVGMatrix: { + prototype: SVGMatrix; + new(): SVGMatrix; +} + +interface SVGMetadataElement extends SVGElement { +} + +declare var SVGMetadataElement: { + prototype: SVGMetadataElement; + new(): SVGMetadataElement; +} + +interface SVGNumber { + value: number; +} + +declare var SVGNumber: { + prototype: SVGNumber; + new(): SVGNumber; +} + +interface SVGNumberList { + readonly numberOfItems: number; + appendItem(newItem: SVGNumber): SVGNumber; + clear(): void; + getItem(index: number): SVGNumber; + initialize(newItem: SVGNumber): SVGNumber; + insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; + removeItem(index: number): SVGNumber; + replaceItem(newItem: SVGNumber, index: number): SVGNumber; +} + +declare var SVGNumberList: { + prototype: SVGNumberList; + new(): SVGNumberList; +} + +interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { + createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; + createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; + createSVGPathSegClosePath(): SVGPathSegClosePath; + createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; + createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; + createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; + createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; + createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; + createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; + createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; + createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; + createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; + createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; + createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; + createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; + createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; + createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; + createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; + createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; + getPathSegAtLength(distance: number): number; + getPointAtLength(distance: number): SVGPoint; + getTotalLength(): number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPathElement: { + prototype: SVGPathElement; + new(): SVGPathElement; +} + +interface SVGPathSeg { + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +declare var SVGPathSeg: { + prototype: SVGPathSeg; + new(): SVGPathSeg; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +interface SVGPathSegArcAbs extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcAbs: { + prototype: SVGPathSegArcAbs; + new(): SVGPathSegArcAbs; +} + +interface SVGPathSegArcRel extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcRel: { + prototype: SVGPathSegArcRel; + new(): SVGPathSegArcRel; +} + +interface SVGPathSegClosePath extends SVGPathSeg { +} + +declare var SVGPathSegClosePath: { + prototype: SVGPathSegClosePath; + new(): SVGPathSegClosePath; +} + +interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicAbs: { + prototype: SVGPathSegCurvetoCubicAbs; + new(): SVGPathSegCurvetoCubicAbs; +} + +interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicRel: { + prototype: SVGPathSegCurvetoCubicRel; + new(): SVGPathSegCurvetoCubicRel; +} + +interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothAbs: { + prototype: SVGPathSegCurvetoCubicSmoothAbs; + new(): SVGPathSegCurvetoCubicSmoothAbs; +} + +interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothRel: { + prototype: SVGPathSegCurvetoCubicSmoothRel; + new(): SVGPathSegCurvetoCubicSmoothRel; +} + +interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticAbs: { + prototype: SVGPathSegCurvetoQuadraticAbs; + new(): SVGPathSegCurvetoQuadraticAbs; +} + +interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticRel: { + prototype: SVGPathSegCurvetoQuadraticRel; + new(): SVGPathSegCurvetoQuadraticRel; +} + +interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothAbs: { + prototype: SVGPathSegCurvetoQuadraticSmoothAbs; + new(): SVGPathSegCurvetoQuadraticSmoothAbs; +} + +interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothRel: { + prototype: SVGPathSegCurvetoQuadraticSmoothRel; + new(): SVGPathSegCurvetoQuadraticSmoothRel; +} + +interface SVGPathSegLinetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoAbs: { + prototype: SVGPathSegLinetoAbs; + new(): SVGPathSegLinetoAbs; +} + +interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalAbs: { + prototype: SVGPathSegLinetoHorizontalAbs; + new(): SVGPathSegLinetoHorizontalAbs; +} + +interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalRel: { + prototype: SVGPathSegLinetoHorizontalRel; + new(): SVGPathSegLinetoHorizontalRel; +} + +interface SVGPathSegLinetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoRel: { + prototype: SVGPathSegLinetoRel; + new(): SVGPathSegLinetoRel; +} + +interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalAbs: { + prototype: SVGPathSegLinetoVerticalAbs; + new(): SVGPathSegLinetoVerticalAbs; +} + +interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalRel: { + prototype: SVGPathSegLinetoVerticalRel; + new(): SVGPathSegLinetoVerticalRel; +} + +interface SVGPathSegList { + readonly numberOfItems: number; + appendItem(newItem: SVGPathSeg): SVGPathSeg; + clear(): void; + getItem(index: number): SVGPathSeg; + initialize(newItem: SVGPathSeg): SVGPathSeg; + insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; + removeItem(index: number): SVGPathSeg; + replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; +} + +declare var SVGPathSegList: { + prototype: SVGPathSegList; + new(): SVGPathSegList; +} + +interface SVGPathSegMovetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoAbs: { + prototype: SVGPathSegMovetoAbs; + new(): SVGPathSegMovetoAbs; +} + +interface SVGPathSegMovetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoRel: { + prototype: SVGPathSegMovetoRel; + new(): SVGPathSegMovetoRel; +} + +interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPatternElement: { + prototype: SVGPatternElement; + new(): SVGPatternElement; +} + +interface SVGPoint { + x: number; + y: number; + matrixTransform(matrix: SVGMatrix): SVGPoint; +} + +declare var SVGPoint: { + prototype: SVGPoint; + new(): SVGPoint; +} + +interface SVGPointList { + readonly numberOfItems: number; + appendItem(newItem: SVGPoint): SVGPoint; + clear(): void; + getItem(index: number): SVGPoint; + initialize(newItem: SVGPoint): SVGPoint; + insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; + removeItem(index: number): SVGPoint; + replaceItem(newItem: SVGPoint, index: number): SVGPoint; +} + +declare var SVGPointList: { + prototype: SVGPointList; + new(): SVGPointList; +} + +interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolygonElement: { + prototype: SVGPolygonElement; + new(): SVGPolygonElement; +} + +interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolylineElement: { + prototype: SVGPolylineElement; + new(): SVGPolylineElement; +} + +interface SVGPreserveAspectRatio { + align: number; + meetOrSlice: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +declare var SVGPreserveAspectRatio: { + prototype: SVGPreserveAspectRatio; + new(): SVGPreserveAspectRatio; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +interface SVGRadialGradientElement extends SVGGradientElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; +} + +declare var SVGRadialGradientElement: { + prototype: SVGRadialGradientElement; + new(): SVGRadialGradientElement; +} + +interface SVGRect { + height: number; + width: number; + x: number; + y: number; +} + +declare var SVGRect: { + prototype: SVGRect; + new(): SVGRect; +} + +interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGRectElement: { + prototype: SVGRectElement; + new(): SVGRectElement; +} + +interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { + contentScriptType: string; + contentStyleType: string; + currentScale: number; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: Event) => any; + onresize: (this: this, ev: UIEvent) => any; + onscroll: (this: this, ev: UIEvent) => any; + onunload: (this: this, ev: Event) => any; + onzoom: (this: this, ev: SVGZoomEvent) => any; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + checkEnclosure(element: SVGElement, rect: SVGRect): boolean; + checkIntersection(element: SVGElement, rect: SVGRect): boolean; + createSVGAngle(): SVGAngle; + createSVGLength(): SVGLength; + createSVGMatrix(): SVGMatrix; + createSVGNumber(): SVGNumber; + createSVGPoint(): SVGPoint; + createSVGRect(): SVGRect; + createSVGTransform(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + deselectAll(): void; + forceRedraw(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getCurrentTime(): number; + getElementById(elementId: string): Element; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + pauseAnimations(): void; + setCurrentTime(seconds: number): void; + suspendRedraw(maxWaitMilliseconds: number): number; + unpauseAnimations(): void; + unsuspendRedraw(suspendHandleID: number): void; + unsuspendRedrawAll(): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var SVGSVGElement: { + prototype: SVGSVGElement; + new(): SVGSVGElement; +} + +interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { + type: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGScriptElement: { + prototype: SVGScriptElement; + new(): SVGScriptElement; +} + +interface SVGStopElement extends SVGElement, SVGStylable { + readonly offset: SVGAnimatedNumber; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStopElement: { + prototype: SVGStopElement; + new(): SVGStopElement; +} + +interface SVGStringList { + readonly numberOfItems: number; + appendItem(newItem: string): string; + clear(): void; + getItem(index: number): string; + initialize(newItem: string): string; + insertItemBefore(newItem: string, index: number): string; + removeItem(index: number): string; + replaceItem(newItem: string, index: number): string; +} + +declare var SVGStringList: { + prototype: SVGStringList; + new(): SVGStringList; +} + +interface SVGStyleElement extends SVGElement, SVGLangSpace { + disabled: boolean; + media: string; + title: string; + type: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStyleElement: { + prototype: SVGStyleElement; + new(): SVGStyleElement; +} + +interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSwitchElement: { + prototype: SVGSwitchElement; + new(): SVGSwitchElement; +} + +interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSymbolElement: { + prototype: SVGSymbolElement; + new(): SVGSymbolElement; +} + +interface SVGTSpanElement extends SVGTextPositioningElement { +} + +declare var SVGTSpanElement: { + prototype: SVGTSpanElement; + new(): SVGTSpanElement; +} + +interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; + getCharNumAtPosition(point: SVGPoint): number; + getComputedTextLength(): number; + getEndPositionOfChar(charnum: number): SVGPoint; + getExtentOfChar(charnum: number): SVGRect; + getNumberOfChars(): number; + getRotationOfChar(charnum: number): number; + getStartPositionOfChar(charnum: number): SVGPoint; + getSubStringLength(charnum: number, nchars: number): number; + selectSubString(charnum: number, nchars: number): void; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextContentElement: { + prototype: SVGTextContentElement; + new(): SVGTextContentElement; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; +} + +interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextElement: { + prototype: SVGTextElement; + new(): SVGTextElement; +} + +interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextPathElement: { + prototype: SVGTextPathElement; + new(): SVGTextPathElement; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; +} + +interface SVGTextPositioningElement extends SVGTextContentElement { + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; +} + +declare var SVGTextPositioningElement: { + prototype: SVGTextPositioningElement; + new(): SVGTextPositioningElement; +} + +interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTitleElement: { + prototype: SVGTitleElement; + new(): SVGTitleElement; +} + +interface SVGTransform { + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; + setMatrix(matrix: SVGMatrix): void; + setRotate(angle: number, cx: number, cy: number): void; + setScale(sx: number, sy: number): void; + setSkewX(angle: number): void; + setSkewY(angle: number): void; + setTranslate(tx: number, ty: number): void; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +declare var SVGTransform: { + prototype: SVGTransform; + new(): SVGTransform; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +interface SVGTransformList { + readonly numberOfItems: number; + appendItem(newItem: SVGTransform): SVGTransform; + clear(): void; + consolidate(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + getItem(index: number): SVGTransform; + initialize(newItem: SVGTransform): SVGTransform; + insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; + removeItem(index: number): SVGTransform; + replaceItem(newItem: SVGTransform, index: number): SVGTransform; +} + +declare var SVGTransformList: { + prototype: SVGTransformList; + new(): SVGTransformList; +} + +interface SVGUnitTypes { + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; +} +declare var SVGUnitTypes: SVGUnitTypes; + +interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGUseElement: { + prototype: SVGUseElement; + new(): SVGUseElement; +} + +interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { + readonly viewTarget: SVGStringList; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGViewElement: { + prototype: SVGViewElement; + new(): SVGViewElement; +} + +interface SVGZoomAndPan { + readonly zoomAndPan: number; +} + +declare var SVGZoomAndPan: { + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; +} + +interface SVGZoomEvent extends UIEvent { + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; +} + +declare var SVGZoomEvent: { + prototype: SVGZoomEvent; + new(): SVGZoomEvent; +} + +interface Screen extends EventTarget { + readonly availHeight: number; + readonly availWidth: number; + bufferDepth: number; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; + onmsorientationchange: (this: this, ev: Event) => any; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; + msLockOrientation(orientations: string | string[]): boolean; + msUnlockOrientation(): void; + addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Screen: { + prototype: Screen; + new(): Screen; +} + +interface ScriptNotifyEvent extends Event { + readonly callingUri: string; + readonly value: string; +} + +declare var ScriptNotifyEvent: { + prototype: ScriptNotifyEvent; + new(): ScriptNotifyEvent; +} + +interface ScriptProcessorNode extends AudioNode { + readonly bufferSize: number; + onaudioprocess: (this: this, ev: AudioProcessingEvent) => any; + addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ScriptProcessorNode: { + prototype: ScriptProcessorNode; + new(): ScriptProcessorNode; +} + +interface Selection { + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; + addRange(range: Range): void; + collapse(parentNode: Node, offset: number): void; + collapseToEnd(): void; + collapseToStart(): void; + containsNode(node: Node, partlyContained: boolean): boolean; + deleteFromDocument(): void; + empty(): void; + extend(newNode: Node, offset: number): void; + getRangeAt(index: number): Range; + removeAllRanges(): void; + removeRange(range: Range): void; + selectAllChildren(parentNode: Node): void; + setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; + toString(): string; +} + +declare var Selection: { + prototype: Selection; + new(): Selection; +} + +interface SourceBuffer extends EventTarget { + appendWindowEnd: number; + appendWindowStart: number; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; + mode: string; + timestampOffset: number; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; + abort(): void; + appendBuffer(data: ArrayBuffer | ArrayBufferView): void; + appendStream(stream: MSStream, maxSize?: number): void; + remove(start: number, end: number): void; +} + +declare var SourceBuffer: { + prototype: SourceBuffer; + new(): SourceBuffer; +} + +interface SourceBufferList extends EventTarget { + readonly length: number; + item(index: number): SourceBuffer; + [index: number]: SourceBuffer; +} + +declare var SourceBufferList: { + prototype: SourceBufferList; + new(): SourceBufferList; +} + +interface StereoPannerNode extends AudioNode { + readonly pan: AudioParam; +} + +declare var StereoPannerNode: { + prototype: StereoPannerNode; + new(): StereoPannerNode; +} + +interface Storage { + readonly length: number; + clear(): void; + getItem(key: string): string | null; + key(index: number): string | null; + removeItem(key: string): void; + setItem(key: string, data: string): void; + [key: string]: any; + [index: number]: string; +} + +declare var Storage: { + prototype: Storage; + new(): Storage; +} + +interface StorageEvent extends Event { + readonly url: string; + key?: string; + oldValue?: string; + newValue?: string; + storageArea?: Storage; +} + +declare var StorageEvent: { + prototype: StorageEvent; + new (type: string, eventInitDict?: StorageEventInit): StorageEvent; +} + +interface StyleMedia { + readonly type: string; + matchMedium(mediaquery: string): boolean; +} + +declare var StyleMedia: { + prototype: StyleMedia; + new(): StyleMedia; +} + +interface StyleSheet { + disabled: boolean; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; +} + +declare var StyleSheet: { + prototype: StyleSheet; + new(): StyleSheet; +} + +interface StyleSheetList { + readonly length: number; + item(index?: number): StyleSheet; + [index: number]: StyleSheet; +} + +declare var StyleSheetList: { + prototype: StyleSheetList; + new(): StyleSheetList; +} + +interface StyleSheetPageList { + readonly length: number; + item(index: number): CSSPageRule; + [index: number]: CSSPageRule; +} + +declare var StyleSheetPageList: { + prototype: StyleSheetPageList; + new(): StyleSheetPageList; +} + +interface SubtleCrypto { + decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; + encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + exportKey(format: "jwk", key: CryptoKey): PromiseLike; + exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; + unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; +} + +declare var SubtleCrypto: { + prototype: SubtleCrypto; + new(): SubtleCrypto; +} + +interface Text extends CharacterData { + readonly wholeText: string; + splitText(offset: number): Text; +} + +declare var Text: { + prototype: Text; + new(): Text; +} + +interface TextEvent extends UIEvent { + readonly data: string; + readonly inputMethod: number; + readonly locale: string; + initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +declare var TextEvent: { + prototype: TextEvent; + new(): TextEvent; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +interface TextMetrics { + readonly width: number; +} + +declare var TextMetrics: { + prototype: TextMetrics; + new(): TextMetrics; +} + +interface TextTrack extends EventTarget { + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; + mode: any; + oncuechange: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + readonly readyState: number; + addCue(cue: TextTrackCue): void; + removeCue(cue: TextTrackCue): void; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; + addEventListener(type: "cuechange", 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrack: { + prototype: TextTrack; + new(): TextTrack; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; +} + +interface TextTrackCue extends EventTarget { + endTime: number; + id: string; + onenter: (this: this, ev: Event) => any; + onexit: (this: this, ev: Event) => any; + pauseOnExit: boolean; + startTime: number; + text: string; + readonly track: TextTrack; + getCueAsHTML(): DocumentFragment; + addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrackCue: { + prototype: TextTrackCue; + new(startTime: number, endTime: number, text: string): TextTrackCue; +} + +interface TextTrackCueList { + readonly length: number; + getCueById(id: string): TextTrackCue; + item(index: number): TextTrackCue; + [index: number]: TextTrackCue; +} + +declare var TextTrackCueList: { + prototype: TextTrackCueList; + new(): TextTrackCueList; +} + +interface TextTrackList extends EventTarget { + readonly length: number; + onaddtrack: ((this: this, ev: TrackEvent) => any) | null; + item(index: number): TextTrack; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: TextTrack; +} + +declare var TextTrackList: { + prototype: TextTrackList; + new(): TextTrackList; +} + +interface TimeRanges { + readonly length: number; + end(index: number): number; + start(index: number): number; +} + +declare var TimeRanges: { + prototype: TimeRanges; + new(): TimeRanges; +} + +interface Touch { + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; +} + +declare var Touch: { + prototype: Touch; + new(): Touch; +} + +interface TouchEvent extends UIEvent { + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly ctrlKey: boolean; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; +} + +declare var TouchEvent: { + prototype: TouchEvent; + new(): TouchEvent; +} + +interface TouchList { + readonly length: number; + item(index: number): Touch | null; + [index: number]: Touch; +} + +declare var TouchList: { + prototype: TouchList; + new(): TouchList; +} + +interface TrackEvent extends Event { + readonly track: any; +} + +declare var TrackEvent: { + prototype: TrackEvent; + new(): TrackEvent; +} + +interface TransitionEvent extends Event { + readonly elapsedTime: number; + readonly propertyName: string; + initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; +} + +declare var TransitionEvent: { + prototype: TransitionEvent; + new(): TransitionEvent; +} + +interface TreeWalker { + currentNode: Node; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + firstChild(): Node; + lastChild(): Node; + nextNode(): Node; + nextSibling(): Node; + parentNode(): Node; + previousNode(): Node; + previousSibling(): Node; +} + +declare var TreeWalker: { + prototype: TreeWalker; + new(): TreeWalker; +} + +interface UIEvent extends Event { + readonly detail: number; + readonly view: Window; + initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; +} + +declare var UIEvent: { + prototype: UIEvent; + new(type: string, eventInitDict?: UIEventInit): UIEvent; +} + +interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; + createObjectURL(object: any, options?: ObjectURLOptions): string; + revokeObjectURL(url: string): void; +} + +interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { + readonly mediaType: string; +} + +declare var UnviewableContentIdentifiedEvent: { + prototype: UnviewableContentIdentifiedEvent; + new(): UnviewableContentIdentifiedEvent; +} + +interface ValidityState { + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; +} + +declare var ValidityState: { + prototype: ValidityState; + new(): ValidityState; +} + +interface VideoPlaybackQuality { + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; +} + +declare var VideoPlaybackQuality: { + prototype: VideoPlaybackQuality; + new(): VideoPlaybackQuality; +} + +interface VideoTrack { + readonly id: string; + kind: string; + readonly label: string; + language: string; + selected: boolean; + readonly sourceBuffer: SourceBuffer; +} + +declare var VideoTrack: { + prototype: VideoTrack; + new(): VideoTrack; +} + +interface VideoTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: this, ev: TrackEvent) => any; + onchange: (this: this, ev: Event) => any; + onremovetrack: (this: this, ev: TrackEvent) => any; + readonly selectedIndex: number; + getTrackById(id: string): VideoTrack | null; + item(index: number): VideoTrack; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: VideoTrack; +} + +declare var VideoTrackList: { + prototype: VideoTrackList; + new(): VideoTrackList; +} + +interface WEBGL_compressed_texture_s3tc { + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +declare var WEBGL_compressed_texture_s3tc: { + prototype: WEBGL_compressed_texture_s3tc; + new(): WEBGL_compressed_texture_s3tc; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +interface WEBGL_debug_renderer_info { + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +declare var WEBGL_debug_renderer_info: { + prototype: WEBGL_debug_renderer_info; + new(): WEBGL_debug_renderer_info; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +interface WEBGL_depth_texture { + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +declare var WEBGL_depth_texture: { + prototype: WEBGL_depth_texture; + new(): WEBGL_depth_texture; + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +interface WaveShaperNode extends AudioNode { + curve: Float32Array | null; + oversample: string; +} + +declare var WaveShaperNode: { + prototype: WaveShaperNode; + new(): WaveShaperNode; +} + +interface WebGLActiveInfo { + readonly name: string; + readonly size: number; + readonly type: number; +} + +declare var WebGLActiveInfo: { + prototype: WebGLActiveInfo; + new(): WebGLActiveInfo; +} + +interface WebGLBuffer extends WebGLObject { +} + +declare var WebGLBuffer: { + prototype: WebGLBuffer; + new(): WebGLBuffer; +} + +interface WebGLContextEvent extends Event { + readonly statusMessage: string; +} + +declare var WebGLContextEvent: { + prototype: WebGLContextEvent; + new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; +} + +interface WebGLFramebuffer extends WebGLObject { +} + +declare var WebGLFramebuffer: { + prototype: WebGLFramebuffer; + new(): WebGLFramebuffer; +} + +interface WebGLObject { +} + +declare var WebGLObject: { + prototype: WebGLObject; + new(): WebGLObject; +} + +interface WebGLProgram extends WebGLObject { +} + +declare var WebGLProgram: { + prototype: WebGLProgram; + new(): WebGLProgram; +} + +interface WebGLRenderbuffer extends WebGLObject { +} + +declare var WebGLRenderbuffer: { + prototype: WebGLRenderbuffer; + new(): WebGLRenderbuffer; +} + +interface WebGLRenderingContext { + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; + activeTexture(texture: number): void; + attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; + bindBuffer(target: number, buffer: WebGLBuffer | null): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; + bindTexture(target: number, texture: WebGLTexture | null): void; + blendColor(red: number, green: number, blue: number, alpha: number): void; + blendEquation(mode: number): void; + blendEquationSeparate(modeRGB: number, modeAlpha: number): void; + blendFunc(sfactor: number, dfactor: number): void; + blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; + bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; + checkFramebufferStatus(target: number): number; + clear(mask: number): void; + clearColor(red: number, green: number, blue: number, alpha: number): void; + clearDepth(depth: number): void; + clearStencil(s: number): void; + colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; + compileShader(shader: WebGLShader | null): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; + copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; + copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; + createBuffer(): WebGLBuffer | null; + createFramebuffer(): WebGLFramebuffer | null; + createProgram(): WebGLProgram | null; + createRenderbuffer(): WebGLRenderbuffer | null; + createShader(type: number): WebGLShader | null; + createTexture(): WebGLTexture | null; + cullFace(mode: number): void; + deleteBuffer(buffer: WebGLBuffer | null): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; + deleteProgram(program: WebGLProgram | null): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; + deleteShader(shader: WebGLShader | null): void; + deleteTexture(texture: WebGLTexture | null): void; + depthFunc(func: number): void; + depthMask(flag: boolean): void; + depthRange(zNear: number, zFar: number): void; + detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + disable(cap: number): void; + disableVertexAttribArray(index: number): void; + drawArrays(mode: number, first: number, count: number): void; + drawElements(mode: number, count: number, type: number, offset: number): void; + enable(cap: number): void; + enableVertexAttribArray(index: number): void; + finish(): void; + flush(): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; + frontFace(mode: number): void; + generateMipmap(target: number): void; + getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; + getAttribLocation(program: WebGLProgram | null, name: string): number; + getBufferParameter(target: number, pname: number): any; + getContextAttributes(): WebGLContextAttributes; + getError(): number; + getExtension(name: string): any; + getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; + getParameter(pname: number): any; + getProgramInfoLog(program: WebGLProgram | null): string | null; + getProgramParameter(program: WebGLProgram | null, pname: number): any; + getRenderbufferParameter(target: number, pname: number): any; + getShaderInfoLog(shader: WebGLShader | null): string | null; + getShaderParameter(shader: WebGLShader | null, pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; + getShaderSource(shader: WebGLShader | null): string | null; + getSupportedExtensions(): string[] | null; + getTexParameter(target: number, pname: number): any; + getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; + getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; + getVertexAttrib(index: number, pname: number): any; + getVertexAttribOffset(index: number, pname: number): number; + hint(target: number, mode: number): void; + isBuffer(buffer: WebGLBuffer | null): boolean; + isContextLost(): boolean; + isEnabled(cap: number): boolean; + isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; + isProgram(program: WebGLProgram | null): boolean; + isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; + isShader(shader: WebGLShader | null): boolean; + isTexture(texture: WebGLTexture | null): boolean; + lineWidth(width: number): void; + linkProgram(program: WebGLProgram | null): void; + pixelStorei(pname: number, param: number): void; + polygonOffset(factor: number, units: number): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; + renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; + sampleCoverage(value: number, invert: boolean): void; + scissor(x: number, y: number, width: number, height: number): void; + shaderSource(shader: WebGLShader | null, source: string): void; + stencilFunc(func: number, ref: number, mask: number): void; + stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; + stencilMask(mask: number): void; + stencilMaskSeparate(face: number, mask: number): void; + stencilOp(fail: number, zfail: number, zpass: number): void; + stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; + texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + texParameterf(target: number, pname: number, param: number): void; + texParameteri(target: number, pname: number, param: number): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + uniform1f(location: WebGLUniformLocation | null, x: number): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform1i(location: WebGLUniformLocation | null, x: number): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + useProgram(program: WebGLProgram | null): void; + validateProgram(program: WebGLProgram | null): void; + vertexAttrib1f(indx: number, x: number): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib2f(indx: number, x: number, y: number): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib3f(indx: number, x: number, y: number, z: number): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; + vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; + viewport(x: number, y: number, width: number, height: number): void; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +declare var WebGLRenderingContext: { + prototype: WebGLRenderingContext; + new(): WebGLRenderingContext; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +interface WebGLShader extends WebGLObject { +} + +declare var WebGLShader: { + prototype: WebGLShader; + new(): WebGLShader; +} + +interface WebGLShaderPrecisionFormat { + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; +} + +declare var WebGLShaderPrecisionFormat: { + prototype: WebGLShaderPrecisionFormat; + new(): WebGLShaderPrecisionFormat; +} + +interface WebGLTexture extends WebGLObject { +} + +declare var WebGLTexture: { + prototype: WebGLTexture; + new(): WebGLTexture; +} + +interface WebGLUniformLocation { +} + +declare var WebGLUniformLocation: { + prototype: WebGLUniformLocation; + new(): WebGLUniformLocation; +} + +interface WebKitCSSMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + m11: number; + m12: number; + m13: number; + m14: number; + m21: number; + m22: number; + m23: number; + m24: number; + m31: number; + m32: number; + m33: number; + m34: number; + m41: number; + m42: number; + m43: number; + m44: number; + inverse(): WebKitCSSMatrix; + multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; + rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; + rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; + scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; + setMatrixValue(value: string): void; + skewX(angle: number): WebKitCSSMatrix; + skewY(angle: number): WebKitCSSMatrix; + toString(): string; + translate(x: number, y: number, z?: number): WebKitCSSMatrix; +} + +declare var WebKitCSSMatrix: { + prototype: WebKitCSSMatrix; + new(text?: string): WebKitCSSMatrix; +} + +interface WebKitPoint { + x: number; + y: number; +} + +declare var WebKitPoint: { + prototype: WebKitPoint; + new(x?: number, y?: number): WebKitPoint; +} + +interface WebSocket extends EventTarget { + binaryType: string; + readonly bufferedAmount: number; + readonly extensions: string; + onclose: (this: this, ev: CloseEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onopen: (this: this, ev: Event) => any; + readonly protocol: string; + readonly readyState: number; + readonly url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; + addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string | string[]): WebSocket; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; +} + +interface WheelEvent extends MouseEvent { + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; + getCurrentPoint(element: Element): void; + initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +declare var WheelEvent: { + prototype: WheelEvent; + new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { + readonly applicationCache: ApplicationCache; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; + defaultStatus: string; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; + event: Event | undefined; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msCredentials: MSCredentials; + name: string; + readonly navigator: Navigator; + offscreenBuffering: string | boolean; + onabort: (this: this, ev: UIEvent) => any; + onafterprint: (this: this, ev: Event) => any; + onbeforeprint: (this: this, ev: Event) => any; + onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + onblur: (this: this, ev: FocusEvent) => any; + oncanplay: (this: this, ev: Event) => any; + oncanplaythrough: (this: this, ev: Event) => any; + onchange: (this: this, ev: Event) => any; + onclick: (this: this, ev: MouseEvent) => any; + oncompassneedscalibration: (this: this, ev: Event) => any; + oncontextmenu: (this: this, ev: PointerEvent) => any; + ondblclick: (this: this, ev: MouseEvent) => any; + ondevicelight: (this: this, ev: DeviceLightEvent) => any; + ondevicemotion: (this: this, ev: DeviceMotionEvent) => any; + ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any; + ondrag: (this: this, ev: DragEvent) => any; + ondragend: (this: this, ev: DragEvent) => any; + ondragenter: (this: this, ev: DragEvent) => any; + ondragleave: (this: this, ev: DragEvent) => any; + ondragover: (this: this, ev: DragEvent) => any; + ondragstart: (this: this, ev: DragEvent) => any; + ondrop: (this: this, ev: DragEvent) => any; + ondurationchange: (this: this, ev: Event) => any; + onemptied: (this: this, ev: Event) => any; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + onerror: ErrorEventHandler; + onfocus: (this: this, ev: FocusEvent) => any; + onhashchange: (this: this, ev: HashChangeEvent) => any; + oninput: (this: this, ev: Event) => any; + oninvalid: (this: this, ev: Event) => any; + onkeydown: (this: this, ev: KeyboardEvent) => any; + onkeypress: (this: this, ev: KeyboardEvent) => any; + onkeyup: (this: this, ev: KeyboardEvent) => any; + onload: (this: this, ev: Event) => any; + onloadeddata: (this: this, ev: Event) => any; + onloadedmetadata: (this: this, ev: Event) => any; + onloadstart: (this: this, ev: Event) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onmousedown: (this: this, ev: MouseEvent) => any; + onmouseenter: (this: this, ev: MouseEvent) => any; + onmouseleave: (this: this, ev: MouseEvent) => any; + onmousemove: (this: this, ev: MouseEvent) => any; + onmouseout: (this: this, ev: MouseEvent) => any; + onmouseover: (this: this, ev: MouseEvent) => any; + onmouseup: (this: this, ev: MouseEvent) => any; + onmousewheel: (this: this, ev: WheelEvent) => any; + onmsgesturechange: (this: this, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; + onmsgestureend: (this: this, ev: MSGestureEvent) => any; + onmsgesturehold: (this: this, ev: MSGestureEvent) => any; + onmsgesturestart: (this: this, ev: MSGestureEvent) => any; + onmsgesturetap: (this: this, ev: MSGestureEvent) => any; + onmsinertiastart: (this: this, ev: MSGestureEvent) => any; + onmspointercancel: (this: this, ev: MSPointerEvent) => any; + onmspointerdown: (this: this, ev: MSPointerEvent) => any; + onmspointerenter: (this: this, ev: MSPointerEvent) => any; + onmspointerleave: (this: this, ev: MSPointerEvent) => any; + onmspointermove: (this: this, ev: MSPointerEvent) => any; + onmspointerout: (this: this, ev: MSPointerEvent) => any; + onmspointerover: (this: this, ev: MSPointerEvent) => any; + onmspointerup: (this: this, ev: MSPointerEvent) => any; + onoffline: (this: this, ev: Event) => any; + ononline: (this: this, ev: Event) => any; + onorientationchange: (this: this, ev: Event) => any; + onpagehide: (this: this, ev: PageTransitionEvent) => any; + onpageshow: (this: this, ev: PageTransitionEvent) => any; + onpause: (this: this, ev: Event) => any; + onplay: (this: this, ev: Event) => any; + onplaying: (this: this, ev: Event) => any; + onpopstate: (this: this, ev: PopStateEvent) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + onratechange: (this: this, ev: Event) => any; + onreadystatechange: (this: this, ev: ProgressEvent) => any; + onreset: (this: this, ev: Event) => any; + onresize: (this: this, ev: UIEvent) => any; + onscroll: (this: this, ev: UIEvent) => any; + onseeked: (this: this, ev: Event) => any; + onseeking: (this: this, ev: Event) => any; + onselect: (this: this, ev: UIEvent) => any; + onstalled: (this: this, ev: Event) => any; + onstorage: (this: this, ev: StorageEvent) => any; + onsubmit: (this: this, ev: Event) => any; + onsuspend: (this: this, ev: Event) => any; + ontimeupdate: (this: this, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onunload: (this: this, ev: Event) => any; + onvolumechange: (this: this, ev: Event) => any; + onwaiting: (this: this, ev: Event) => any; + opener: any; + orientation: string | number; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; + status: string; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; + Blob: typeof Blob; + alert(message?: any): void; + blur(): void; + cancelAnimationFrame(handle: number): void; + captureEvents(): void; + close(): void; + confirm(message?: string): boolean; + focus(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; + getSelection(): Selection; + matchMedia(mediaQuery: string): MediaQueryList; + moveBy(x?: number, y?: number): void; + moveTo(x?: number, y?: number): void; + msWriteProfilerMark(profilerMarkName: string): void; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; + print(): void; + prompt(message?: string, _default?: string): string | null; + releaseEvents(): void; + requestAnimationFrame(callback: FrameRequestCallback): number; + resizeBy(x?: number, y?: number): void; + resizeTo(x?: number, y?: number): void; + scroll(x?: number, y?: number): void; + scrollBy(x?: number, y?: number): void; + scrollTo(x?: number, y?: number): void; + webkitCancelAnimationFrame(handle: number): void; + 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + 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; +} + +declare var Window: { + prototype: Window; + new(): Window; +} + +interface Worker extends EventTarget, AbstractWorker { + onmessage: (this: this, ev: MessageEvent) => any; + postMessage(message: any, ports?: any): void; + terminate(): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface XMLDocument extends Document { +} + +declare var XMLDocument: { + prototype: XMLDocument; + new(): XMLDocument; +} + +interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { + onreadystatechange: (this: this, ev: Event) => any; + readonly readyState: number; + readonly response: any; + readonly responseText: string; + responseType: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; + timeout: number; + readonly upload: XMLHttpRequestUpload; + withCredentials: boolean; + msCaching?: string; + readonly responseURL: string; + abort(): void; + getAllResponseHeaders(): string; + getResponseHeader(header: string): string | null; + msCachingEnabled(): boolean; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + overrideMimeType(mime: string): void; + send(data?: Document): void; + send(data?: string): void; + send(data?: any): void; + setRequestHeader(header: string, value: string): void; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + 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: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", 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; +} + +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + create(): XMLHttpRequest; +} + +interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequestUpload: { + prototype: XMLHttpRequestUpload; + new(): XMLHttpRequestUpload; +} + +interface XMLSerializer { + serializeToString(target: Node): string; +} + +declare var XMLSerializer: { + prototype: XMLSerializer; + new(): XMLSerializer; +} + +interface XPathEvaluator { + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver?: Node): XPathNSResolver; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; +} + +declare var XPathEvaluator: { + prototype: XPathEvaluator; + new(): XPathEvaluator; +} + +interface XPathExpression { + evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; +} + +declare var XPathExpression: { + prototype: XPathExpression; + new(): XPathExpression; +} + +interface XPathNSResolver { + lookupNamespaceURI(prefix: string): string; +} + +declare var XPathNSResolver: { + prototype: XPathNSResolver; + new(): XPathNSResolver; +} + +interface XPathResult { + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; + iterateNext(): Node; + snapshotItem(index: number): Node; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +declare var XPathResult: { + prototype: XPathResult; + new(): XPathResult; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +interface XSLTProcessor { + clearParameters(): void; + getParameter(namespaceURI: string, localName: string): any; + importStylesheet(style: Node): void; + removeParameter(namespaceURI: string, localName: string): void; + reset(): void; + setParameter(namespaceURI: string, localName: string, value: any): void; + transformToDocument(source: Node): Document; + transformToFragment(source: Node, document: Document): DocumentFragment; +} + +declare var XSLTProcessor: { + prototype: XSLTProcessor; + new(): XSLTProcessor; +} + +interface AbstractWorker { + onerror: (this: this, ev: ErrorEvent) => any; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + +interface ChildNode { + remove(): void; +} + +interface DOML2DeprecatedColorProperty { + color: string; +} + +interface DOML2DeprecatedSizeProperty { + size: number; +} + +interface DocumentEvent { + createEvent(eventInterface:"AnimationEvent"): AnimationEvent; + createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; + createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; + createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; + createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; + createEvent(eventInterface:"CloseEvent"): CloseEvent; + createEvent(eventInterface:"CommandEvent"): CommandEvent; + createEvent(eventInterface:"CompositionEvent"): CompositionEvent; + createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; + createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface:"DragEvent"): DragEvent; + createEvent(eventInterface:"ErrorEvent"): ErrorEvent; + createEvent(eventInterface:"Event"): Event; + createEvent(eventInterface:"Events"): Event; + createEvent(eventInterface:"FocusEvent"): FocusEvent; + createEvent(eventInterface:"GamepadEvent"): GamepadEvent; + createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; + createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; + createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; + createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; + createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; + createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; + createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; + createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; + createEvent(eventInterface:"MessageEvent"): MessageEvent; + createEvent(eventInterface:"MouseEvent"): MouseEvent; + createEvent(eventInterface:"MouseEvents"): MouseEvent; + createEvent(eventInterface:"MutationEvent"): MutationEvent; + createEvent(eventInterface:"MutationEvents"): MutationEvent; + createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; + createEvent(eventInterface:"NavigationEvent"): NavigationEvent; + createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; + createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; + createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; + createEvent(eventInterface:"PointerEvent"): PointerEvent; + createEvent(eventInterface:"PopStateEvent"): PopStateEvent; + createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; + createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; + createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; + createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; + createEvent(eventInterface:"StorageEvent"): StorageEvent; + createEvent(eventInterface:"TextEvent"): TextEvent; + createEvent(eventInterface:"TouchEvent"): TouchEvent; + createEvent(eventInterface:"TrackEvent"): TrackEvent; + createEvent(eventInterface:"TransitionEvent"): TransitionEvent; + createEvent(eventInterface:"UIEvent"): UIEvent; + createEvent(eventInterface:"UIEvents"): UIEvent; + createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; + createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface:"WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; +} + +interface ElementTraversal { + readonly childElementCount: number; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly nextElementSibling: Element; + readonly previousElementSibling: Element; +} + +interface GetSVGDocument { + getSVGDocument(): Document; +} + +interface GlobalEventHandlers { + onpointercancel: (this: this, ev: PointerEvent) => any; + onpointerdown: (this: this, ev: PointerEvent) => any; + onpointerenter: (this: this, ev: PointerEvent) => any; + onpointerleave: (this: this, ev: PointerEvent) => any; + onpointermove: (this: this, ev: PointerEvent) => any; + onpointerout: (this: this, ev: PointerEvent) => any; + onpointerover: (this: this, ev: PointerEvent) => any; + onpointerup: (this: this, ev: PointerEvent) => any; + onwheel: (this: this, ev: WheelEvent) => any; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface HTMLTableAlignment { + /** + * Sets or retrieves a value that you can use to implement your own ch functionality for the object. + */ + ch: string; + /** + * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. + */ + chOff: string; + /** + * Sets or retrieves how text and other content are vertically aligned within the object that contains them. + */ + vAlign: string; +} + +interface IDBEnvironment { + readonly indexedDB: IDBFactory; +} + +interface LinkStyle { + readonly sheet: StyleSheet; +} + +interface MSBaseReader { + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + onloadend: (this: this, ev: ProgressEvent) => any; + onloadstart: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + readonly readyState: number; + readonly result: any; + abort(): void; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface MSFileSaver { + msSaveBlob(blob: any, defaultName?: string): boolean; + msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; +} + +interface MSNavigatorDoNotTrack { + confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; + confirmWebWideTrackingException(args: ExceptionInformation): boolean; + removeSiteSpecificTrackingException(args: ExceptionInformation): void; + removeWebWideTrackingException(args: ExceptionInformation): void; + storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; + storeWebWideTrackingException(args: StoreExceptionsInformation): void; +} + +interface NavigatorContentUtils { +} + +interface NavigatorGeolocation { + readonly geolocation: Geolocation; +} + +interface NavigatorID { + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; +} + +interface NavigatorOnLine { + readonly onLine: boolean; +} + +interface NavigatorStorageUtils { +} + +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + +interface NodeSelector { + 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; + querySelectorAll(selectors: "abbr"): NodeListOf; + querySelectorAll(selectors: "acronym"): NodeListOf; + querySelectorAll(selectors: "address"): NodeListOf; + querySelectorAll(selectors: "applet"): NodeListOf; + querySelectorAll(selectors: "area"): NodeListOf; + querySelectorAll(selectors: "article"): NodeListOf; + querySelectorAll(selectors: "aside"): NodeListOf; + querySelectorAll(selectors: "audio"): NodeListOf; + querySelectorAll(selectors: "b"): NodeListOf; + querySelectorAll(selectors: "base"): NodeListOf; + querySelectorAll(selectors: "basefont"): NodeListOf; + querySelectorAll(selectors: "bdo"): NodeListOf; + querySelectorAll(selectors: "big"): NodeListOf; + querySelectorAll(selectors: "blockquote"): NodeListOf; + querySelectorAll(selectors: "body"): NodeListOf; + querySelectorAll(selectors: "br"): NodeListOf; + querySelectorAll(selectors: "button"): NodeListOf; + querySelectorAll(selectors: "canvas"): NodeListOf; + querySelectorAll(selectors: "caption"): NodeListOf; + querySelectorAll(selectors: "center"): NodeListOf; + querySelectorAll(selectors: "circle"): NodeListOf; + querySelectorAll(selectors: "cite"): NodeListOf; + querySelectorAll(selectors: "clippath"): NodeListOf; + querySelectorAll(selectors: "code"): NodeListOf; + querySelectorAll(selectors: "col"): NodeListOf; + querySelectorAll(selectors: "colgroup"): NodeListOf; + querySelectorAll(selectors: "datalist"): NodeListOf; + querySelectorAll(selectors: "dd"): NodeListOf; + querySelectorAll(selectors: "defs"): NodeListOf; + querySelectorAll(selectors: "del"): NodeListOf; + querySelectorAll(selectors: "desc"): NodeListOf; + querySelectorAll(selectors: "dfn"): NodeListOf; + querySelectorAll(selectors: "dir"): NodeListOf; + querySelectorAll(selectors: "div"): NodeListOf; + querySelectorAll(selectors: "dl"): NodeListOf; + querySelectorAll(selectors: "dt"): NodeListOf; + querySelectorAll(selectors: "ellipse"): NodeListOf; + querySelectorAll(selectors: "em"): NodeListOf; + querySelectorAll(selectors: "embed"): NodeListOf; + querySelectorAll(selectors: "feblend"): NodeListOf; + querySelectorAll(selectors: "fecolormatrix"): NodeListOf; + querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf; + querySelectorAll(selectors: "fecomposite"): NodeListOf; + querySelectorAll(selectors: "feconvolvematrix"): NodeListOf; + querySelectorAll(selectors: "fediffuselighting"): NodeListOf; + querySelectorAll(selectors: "fedisplacementmap"): NodeListOf; + querySelectorAll(selectors: "fedistantlight"): NodeListOf; + querySelectorAll(selectors: "feflood"): NodeListOf; + querySelectorAll(selectors: "fefunca"): NodeListOf; + querySelectorAll(selectors: "fefuncb"): NodeListOf; + querySelectorAll(selectors: "fefuncg"): NodeListOf; + querySelectorAll(selectors: "fefuncr"): NodeListOf; + querySelectorAll(selectors: "fegaussianblur"): NodeListOf; + querySelectorAll(selectors: "feimage"): NodeListOf; + querySelectorAll(selectors: "femerge"): NodeListOf; + querySelectorAll(selectors: "femergenode"): NodeListOf; + querySelectorAll(selectors: "femorphology"): NodeListOf; + querySelectorAll(selectors: "feoffset"): NodeListOf; + querySelectorAll(selectors: "fepointlight"): NodeListOf; + querySelectorAll(selectors: "fespecularlighting"): NodeListOf; + querySelectorAll(selectors: "fespotlight"): NodeListOf; + querySelectorAll(selectors: "fetile"): NodeListOf; + querySelectorAll(selectors: "feturbulence"): NodeListOf; + querySelectorAll(selectors: "fieldset"): NodeListOf; + querySelectorAll(selectors: "figcaption"): NodeListOf; + querySelectorAll(selectors: "figure"): NodeListOf; + querySelectorAll(selectors: "filter"): NodeListOf; + querySelectorAll(selectors: "font"): NodeListOf; + querySelectorAll(selectors: "footer"): NodeListOf; + querySelectorAll(selectors: "foreignobject"): NodeListOf; + querySelectorAll(selectors: "form"): NodeListOf; + querySelectorAll(selectors: "frame"): NodeListOf; + querySelectorAll(selectors: "frameset"): NodeListOf; + querySelectorAll(selectors: "g"): NodeListOf; + querySelectorAll(selectors: "h1"): NodeListOf; + querySelectorAll(selectors: "h2"): NodeListOf; + querySelectorAll(selectors: "h3"): NodeListOf; + querySelectorAll(selectors: "h4"): NodeListOf; + querySelectorAll(selectors: "h5"): NodeListOf; + querySelectorAll(selectors: "h6"): NodeListOf; + querySelectorAll(selectors: "head"): NodeListOf; + querySelectorAll(selectors: "header"): NodeListOf; + querySelectorAll(selectors: "hgroup"): NodeListOf; + querySelectorAll(selectors: "hr"): NodeListOf; + querySelectorAll(selectors: "html"): NodeListOf; + querySelectorAll(selectors: "i"): NodeListOf; + querySelectorAll(selectors: "iframe"): NodeListOf; + querySelectorAll(selectors: "image"): NodeListOf; + querySelectorAll(selectors: "img"): NodeListOf; + querySelectorAll(selectors: "input"): NodeListOf; + querySelectorAll(selectors: "ins"): NodeListOf; + querySelectorAll(selectors: "isindex"): NodeListOf; + querySelectorAll(selectors: "kbd"): NodeListOf; + querySelectorAll(selectors: "keygen"): NodeListOf; + querySelectorAll(selectors: "label"): NodeListOf; + querySelectorAll(selectors: "legend"): NodeListOf; + querySelectorAll(selectors: "li"): NodeListOf; + querySelectorAll(selectors: "line"): NodeListOf; + querySelectorAll(selectors: "lineargradient"): NodeListOf; + querySelectorAll(selectors: "link"): NodeListOf; + querySelectorAll(selectors: "listing"): NodeListOf; + querySelectorAll(selectors: "map"): NodeListOf; + querySelectorAll(selectors: "mark"): NodeListOf; + querySelectorAll(selectors: "marker"): NodeListOf; + querySelectorAll(selectors: "marquee"): NodeListOf; + querySelectorAll(selectors: "mask"): NodeListOf; + querySelectorAll(selectors: "menu"): NodeListOf; + querySelectorAll(selectors: "meta"): NodeListOf; + querySelectorAll(selectors: "metadata"): NodeListOf; + querySelectorAll(selectors: "meter"): NodeListOf; + querySelectorAll(selectors: "nav"): NodeListOf; + querySelectorAll(selectors: "nextid"): NodeListOf; + querySelectorAll(selectors: "nobr"): NodeListOf; + querySelectorAll(selectors: "noframes"): NodeListOf; + querySelectorAll(selectors: "noscript"): NodeListOf; + querySelectorAll(selectors: "object"): NodeListOf; + querySelectorAll(selectors: "ol"): NodeListOf; + querySelectorAll(selectors: "optgroup"): NodeListOf; + querySelectorAll(selectors: "option"): NodeListOf; + querySelectorAll(selectors: "p"): NodeListOf; + querySelectorAll(selectors: "param"): NodeListOf; + querySelectorAll(selectors: "path"): NodeListOf; + querySelectorAll(selectors: "pattern"): NodeListOf; + querySelectorAll(selectors: "picture"): NodeListOf; + querySelectorAll(selectors: "plaintext"): NodeListOf; + querySelectorAll(selectors: "polygon"): NodeListOf; + querySelectorAll(selectors: "polyline"): NodeListOf; + querySelectorAll(selectors: "pre"): NodeListOf; + querySelectorAll(selectors: "progress"): NodeListOf; + querySelectorAll(selectors: "q"): NodeListOf; + querySelectorAll(selectors: "radialgradient"): NodeListOf; + querySelectorAll(selectors: "rect"): NodeListOf; + querySelectorAll(selectors: "rt"): NodeListOf; + querySelectorAll(selectors: "ruby"): NodeListOf; + querySelectorAll(selectors: "s"): NodeListOf; + querySelectorAll(selectors: "samp"): NodeListOf; + querySelectorAll(selectors: "script"): NodeListOf; + querySelectorAll(selectors: "section"): NodeListOf; + querySelectorAll(selectors: "select"): NodeListOf; + querySelectorAll(selectors: "small"): NodeListOf; + querySelectorAll(selectors: "source"): NodeListOf; + querySelectorAll(selectors: "span"): NodeListOf; + querySelectorAll(selectors: "stop"): NodeListOf; + querySelectorAll(selectors: "strike"): NodeListOf; + querySelectorAll(selectors: "strong"): NodeListOf; + querySelectorAll(selectors: "style"): NodeListOf; + querySelectorAll(selectors: "sub"): NodeListOf; + querySelectorAll(selectors: "sup"): NodeListOf; + querySelectorAll(selectors: "svg"): NodeListOf; + querySelectorAll(selectors: "switch"): NodeListOf; + querySelectorAll(selectors: "symbol"): NodeListOf; + querySelectorAll(selectors: "table"): NodeListOf; + querySelectorAll(selectors: "tbody"): NodeListOf; + querySelectorAll(selectors: "td"): NodeListOf; + querySelectorAll(selectors: "template"): NodeListOf; + querySelectorAll(selectors: "text"): NodeListOf; + querySelectorAll(selectors: "textpath"): NodeListOf; + querySelectorAll(selectors: "textarea"): NodeListOf; + querySelectorAll(selectors: "tfoot"): NodeListOf; + querySelectorAll(selectors: "th"): NodeListOf; + querySelectorAll(selectors: "thead"): NodeListOf; + querySelectorAll(selectors: "title"): NodeListOf; + querySelectorAll(selectors: "tr"): NodeListOf; + querySelectorAll(selectors: "track"): NodeListOf; + querySelectorAll(selectors: "tspan"): NodeListOf; + querySelectorAll(selectors: "tt"): NodeListOf; + querySelectorAll(selectors: "u"): NodeListOf; + querySelectorAll(selectors: "ul"): NodeListOf; + querySelectorAll(selectors: "use"): NodeListOf; + querySelectorAll(selectors: "var"): NodeListOf; + querySelectorAll(selectors: "video"): NodeListOf; + querySelectorAll(selectors: "view"): NodeListOf; + querySelectorAll(selectors: "wbr"): NodeListOf; + querySelectorAll(selectors: "x-ms-webview"): NodeListOf; + querySelectorAll(selectors: "xmp"): NodeListOf; + querySelectorAll(selectors: string): NodeListOf; +} + +interface RandomSource { + getRandomValues(array: ArrayBufferView): ArrayBufferView; +} + +interface SVGAnimatedPathData { + readonly pathSegList: SVGPathSegList; +} + +interface SVGAnimatedPoints { + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; +} + +interface SVGExternalResourcesRequired { + readonly externalResourcesRequired: SVGAnimatedBoolean; +} + +interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; +} + +interface SVGFitToViewBox { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; +} + +interface SVGLangSpace { + xmllang: string; + xmlspace: string; +} + +interface SVGLocatable { + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; + getBBox(): SVGRect; + getCTM(): SVGMatrix; + getScreenCTM(): SVGMatrix; + getTransformToElement(element: SVGElement): SVGMatrix; +} + +interface SVGStylable { + className: any; + readonly style: CSSStyleDeclaration; +} + +interface SVGTests { + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; + hasExtension(extension: string): boolean; +} + +interface SVGTransformable extends SVGLocatable { + readonly transform: SVGAnimatedTransformList; +} + +interface SVGURIReference { + readonly href: SVGAnimatedString; +} + +interface WindowBase64 { + atob(encodedString: string): string; + btoa(rawString: string): string; +} + +interface WindowConsole { + readonly console: Console; +} + +interface WindowLocalStorage { + readonly localStorage: Storage; +} + +interface WindowSessionStorage { + readonly sessionStorage: Storage; +} + +interface WindowTimers extends Object, WindowTimersExtension { + clearInterval(handle: number): void; + clearTimeout(handle: number): void; + setInterval(handler: (...args: any[]) => void, timeout: number): number; + setInterval(handler: any, timeout?: any, ...args: any[]): number; + setTimeout(handler: (...args: any[]) => void, timeout: number): number; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; +} + +interface WindowTimersExtension { + clearImmediate(handle: number): void; + setImmediate(handler: (...args: any[]) => void): number; + setImmediate(handler: any, ...args: any[]): number; +} + +interface XMLHttpRequestEventTarget { + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + onloadend: (this: this, ev: ProgressEvent) => any; + onloadstart: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + ontimeout: (this: this, ev: ProgressEvent) => any; + 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface StorageEventInit extends EventInit { + key?: string; + oldValue?: string; + newValue?: string; + url: string; + storageArea?: Storage; +} + +interface Canvas2DContextAttributes { + alpha?: boolean; + willReadFrequently?: boolean; + storage?: boolean; + [attribute: string]: boolean | string | undefined; +} + +interface NodeListOf extends NodeList { + length: number; + item(index: number): TNode; + [index: number]: TNode; +} + +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + +interface EventListenerObject { + handleEvent(evt: Event): void; +} + +interface MessageEventInit extends EventInit { + data?: any; + origin?: string; + lastEventId?: string; + channel?: string; + source?: any; + ports?: MessagePort[]; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + 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; +} + +interface IDBArrayKey extends Array { +} + +interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: AlgorithmIdentifier; +} + +interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: AlgorithmIdentifier; +} + +interface RsaHashedImportParams { + hash: AlgorithmIdentifier; +} + +interface RsaPssParams { + saltLength: number; +} + +interface RsaOaepParams extends Algorithm { + label?: BufferSource; +} + +interface EcdsaParams extends Algorithm { + hash: AlgorithmIdentifier; +} + +interface EcKeyGenParams extends Algorithm { + namedCurve: string; +} + +interface EcKeyAlgorithm extends KeyAlgorithm { + typedCurve: string; +} + +interface EcKeyImportParams { + namedCurve: string; +} + +interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; +} + +interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +interface AesKeyGenParams extends Algorithm { + length: number; +} + +interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +interface AesCbcParams extends Algorithm { + iv: BufferSource; +} + +interface AesCmacParams extends Algorithm { + length: number; +} + +interface AesGcmParams extends Algorithm { + iv: BufferSource; + additionalData?: BufferSource; + tagLength?: number; +} + +interface AesCfbParams extends Algorithm { + iv: BufferSource; +} + +interface HmacImportParams extends Algorithm { + hash?: AlgorithmIdentifier; + length?: number; +} + +interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: AlgorithmIdentifier; + length: number; +} + +interface HmacKeyGenParams extends Algorithm { + hash: AlgorithmIdentifier; + length?: number; +} + +interface DhKeyGenParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyAlgorithm extends KeyAlgorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface DhImportKeyParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface ConcatParams extends Algorithm { + hash?: AlgorithmIdentifier; + algorithmId: Uint8Array; + partyUInfo: Uint8Array; + partyVInfo: Uint8Array; + publicInfo?: Uint8Array; + privateInfo?: Uint8Array; +} + +interface HkdfCtrParams extends Algorithm { + hash: AlgorithmIdentifier; + label: BufferSource; + context: BufferSource; +} + +interface Pbkdf2Params extends Algorithm { + salt: BufferSource; + iterations: number; + hash: AlgorithmIdentifier; +} + +interface RsaOtherPrimesInfo { + r: string; + d: string; + t: string; +} + +interface JsonWebKey { + kty: string; + use?: string; + key_ops?: string[]; + alg?: string; + kid?: string; + x5u?: string; + x5c?: string; + x5t?: string; + ext?: boolean; + crv?: string; + x?: string; + y?: string; + d?: string; + n?: string; + e?: string; + p?: string; + q?: string; + dp?: string; + dq?: string; + qi?: string; + oth?: RsaOtherPrimesInfo[]; + k?: string; +} + +interface ParentNode { + readonly children: HTMLCollection; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly childElementCount: number; +} + +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + +interface ErrorEventHandler { + (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; +} +interface PositionCallback { + (position: Position): void; +} +interface PositionErrorCallback { + (error: PositionError): void; +} +interface MediaQueryListListener { + (mql: MediaQueryList): void; +} +interface MSLaunchUriCallback { + (): void; +} +interface FrameRequestCallback { + (time: number): void; +} +interface MSUnsafeFunctionCallback { + (): any; +} +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} +interface MutationCallback { + (mutations: MutationRecord[], observer: MutationObserver): void; +} +interface DecodeSuccessCallback { + (decodedData: AudioBuffer): void; +} +interface DecodeErrorCallback { + (error: DOMException): void; +} +interface FunctionStringCallback { + (data: string): void; +} +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: string): void; +} +declare var Audio: {new(src?: string): HTMLAudioElement; }; +declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; +declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; +declare var applicationCache: ApplicationCache; +declare var clientInformation: Navigator; +declare var closed: boolean; +declare var crypto: Crypto; +declare var defaultStatus: string; +declare var devicePixelRatio: number; +declare var doNotTrack: string; +declare var document: Document; +declare var event: Event | undefined; +declare var external: External; +declare var frameElement: Element; +declare var frames: Window; +declare var history: History; +declare var innerHeight: number; +declare var innerWidth: number; +declare var length: number; +declare var location: Location; +declare var locationbar: BarProp; +declare var menubar: BarProp; +declare var msCredentials: MSCredentials; +declare const name: never; +declare var navigator: Navigator; +declare var offscreenBuffering: string | boolean; +declare var onabort: (this: Window, ev: UIEvent) => any; +declare var onafterprint: (this: Window, ev: Event) => any; +declare var onbeforeprint: (this: Window, ev: Event) => any; +declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; +declare var onblur: (this: Window, ev: FocusEvent) => any; +declare var oncanplay: (this: Window, ev: Event) => any; +declare var oncanplaythrough: (this: Window, ev: Event) => any; +declare var onchange: (this: Window, ev: Event) => any; +declare var onclick: (this: Window, ev: MouseEvent) => any; +declare var oncompassneedscalibration: (this: Window, ev: Event) => any; +declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; +declare var ondblclick: (this: Window, ev: MouseEvent) => any; +declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; +declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; +declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; +declare var ondrag: (this: Window, ev: DragEvent) => any; +declare var ondragend: (this: Window, ev: DragEvent) => any; +declare var ondragenter: (this: Window, ev: DragEvent) => any; +declare var ondragleave: (this: Window, ev: DragEvent) => any; +declare var ondragover: (this: Window, ev: DragEvent) => any; +declare var ondragstart: (this: Window, ev: DragEvent) => any; +declare var ondrop: (this: Window, ev: DragEvent) => any; +declare var ondurationchange: (this: Window, ev: Event) => any; +declare var onemptied: (this: Window, ev: Event) => any; +declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; +declare var onerror: ErrorEventHandler; +declare var onfocus: (this: Window, ev: FocusEvent) => any; +declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; +declare var oninput: (this: Window, ev: Event) => any; +declare var oninvalid: (this: Window, ev: Event) => any; +declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; +declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; +declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; +declare var onload: (this: Window, ev: Event) => any; +declare var onloadeddata: (this: Window, ev: Event) => any; +declare var onloadedmetadata: (this: Window, ev: Event) => any; +declare var onloadstart: (this: Window, ev: Event) => any; +declare var onmessage: (this: Window, ev: MessageEvent) => any; +declare var onmousedown: (this: Window, ev: MouseEvent) => any; +declare var onmouseenter: (this: Window, ev: MouseEvent) => any; +declare var onmouseleave: (this: Window, ev: MouseEvent) => any; +declare var onmousemove: (this: Window, ev: MouseEvent) => any; +declare var onmouseout: (this: Window, ev: MouseEvent) => any; +declare var onmouseover: (this: Window, ev: MouseEvent) => any; +declare var onmouseup: (this: Window, ev: MouseEvent) => any; +declare var onmousewheel: (this: Window, ev: WheelEvent) => any; +declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; +declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; +declare var onoffline: (this: Window, ev: Event) => any; +declare var ononline: (this: Window, ev: Event) => any; +declare var onorientationchange: (this: Window, ev: Event) => any; +declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; +declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; +declare var onpause: (this: Window, ev: Event) => any; +declare var onplay: (this: Window, ev: Event) => any; +declare var onplaying: (this: Window, ev: Event) => any; +declare var onpopstate: (this: Window, ev: PopStateEvent) => any; +declare var onprogress: (this: Window, ev: ProgressEvent) => any; +declare var onratechange: (this: Window, ev: Event) => any; +declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; +declare var onreset: (this: Window, ev: Event) => any; +declare var onresize: (this: Window, ev: UIEvent) => any; +declare var onscroll: (this: Window, ev: UIEvent) => any; +declare var onseeked: (this: Window, ev: Event) => any; +declare var onseeking: (this: Window, ev: Event) => any; +declare var onselect: (this: Window, ev: UIEvent) => any; +declare var onstalled: (this: Window, ev: Event) => any; +declare var onstorage: (this: Window, ev: StorageEvent) => any; +declare var onsubmit: (this: Window, ev: Event) => any; +declare var onsuspend: (this: Window, ev: Event) => any; +declare var ontimeupdate: (this: Window, ev: Event) => any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +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: any; +declare var orientation: string | number; +declare var outerHeight: number; +declare var outerWidth: number; +declare var pageXOffset: number; +declare var pageYOffset: number; +declare var parent: Window; +declare var performance: Performance; +declare var personalbar: BarProp; +declare var screen: Screen; +declare var screenLeft: number; +declare var screenTop: number; +declare var screenX: number; +declare var screenY: number; +declare var scrollX: number; +declare var scrollY: number; +declare var scrollbars: BarProp; +declare var self: Window; +declare var status: string; +declare var statusbar: BarProp; +declare var styleMedia: StyleMedia; +declare var toolbar: BarProp; +declare var top: Window; +declare var window: Window; +declare function alert(message?: any): void; +declare function blur(): void; +declare function cancelAnimationFrame(handle: number): void; +declare function captureEvents(): void; +declare function close(): void; +declare function confirm(message?: string): boolean; +declare function focus(): void; +declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; +declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; +declare function getSelection(): Selection; +declare function matchMedia(mediaQuery: string): MediaQueryList; +declare function moveBy(x?: number, y?: number): void; +declare function moveTo(x?: number, y?: number): void; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; +declare function print(): void; +declare function prompt(message?: string, _default?: string): string | null; +declare function releaseEvents(): void; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; +declare function resizeBy(x?: number, y?: number): void; +declare function resizeTo(x?: number, y?: number): void; +declare function scroll(x?: number, y?: number): void; +declare function scrollBy(x?: number, y?: number): void; +declare function scrollTo(x?: number, y?: number): void; +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; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function clearInterval(handle: number): void; +declare function clearTimeout(handle: number): void; +declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function clearImmediate(handle: number): void; +declare function setImmediate(handler: (...args: any[]) => void): number; +declare function setImmediate(handler: any, ...args: any[]): number; +declare var sessionStorage: Storage; +declare var localStorage: Storage; +declare var console: Console; +declare var onpointercancel: (this: Window, ev: PointerEvent) => any; +declare var onpointerdown: (this: Window, ev: PointerEvent) => any; +declare var onpointerenter: (this: Window, ev: PointerEvent) => any; +declare var onpointerleave: (this: Window, ev: PointerEvent) => any; +declare var onpointermove: (this: Window, ev: PointerEvent) => any; +declare var onpointerout: (this: Window, ev: PointerEvent) => any; +declare var onpointerover: (this: Window, ev: PointerEvent) => any; +declare var onpointerup: (this: Window, ev: PointerEvent) => any; +declare var onwheel: (this: Window, ev: WheelEvent) => any; +declare var indexedDB: IDBFactory; +declare function atob(encodedString: string): string; +declare function btoa(rawString: string): string; +declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +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; type ScrollRestoration = "auto" | "manual"; \ No newline at end of file diff --git a/lib/lib.dom.iterable.d.ts b/lib/lib.dom.iterable.d.ts index 2b62054765b..7557e4d06e3 100644 --- a/lib/lib.dom.iterable.d.ts +++ b/lib/lib.dom.iterable.d.ts @@ -1,33 +1,33 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -/// - -interface DOMTokenList { - [Symbol.iterator](): IterableIterator; -} - -interface NodeList { - [Symbol.iterator](): IterableIterator -} - -interface NodeListOf { - [Symbol.iterator](): IterableIterator -} +/// + +interface DOMTokenList { + [Symbol.iterator](): IterableIterator; +} + +interface NodeList { + [Symbol.iterator](): IterableIterator +} + +interface NodeListOf { + [Symbol.iterator](): IterableIterator +} diff --git a/lib/lib.es2015.collection.d.ts b/lib/lib.es2015.collection.d.ts index eabd6319de6..9f4a23f3254 100644 --- a/lib/lib.es2015.collection.d.ts +++ b/lib/lib.es2015.collection.d.ts @@ -1,92 +1,92 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -interface Map { - clear(): void; - delete(key: K): boolean; - forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): this; - readonly size: number; -} - -interface MapConstructor { - new (): Map; - new (entries?: [K, V][]): Map; - readonly prototype: Map; -} -declare var Map: MapConstructor; - -interface ReadonlyMap { - forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void; - get(key: K): V|undefined; - has(key: K): boolean; - readonly size: number; -} - -interface WeakMap { - delete(key: K): boolean; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): this; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (entries?: [K, V][]): WeakMap; - readonly prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): this; - clear(): void; - delete(value: T): boolean; - forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - readonly size: number; -} - -interface SetConstructor { - new (): Set; - new (values?: T[]): Set; - readonly prototype: Set; -} -declare var Set: SetConstructor; - -interface ReadonlySet { - forEach(callbackfn: (value: T, value2: T, set: ReadonlySet) => void, thisArg?: any): void; - has(value: T): boolean; - readonly size: number; -} - -interface WeakSet { - add(value: T): this; - delete(value: T): boolean; - has(value: T): boolean; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (values?: T[]): WeakSet; - readonly prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): this; + readonly size: number; +} + +interface MapConstructor { + new (): Map; + new (entries?: [K, V][]): Map; + readonly prototype: Map; +} +declare var Map: MapConstructor; + +interface ReadonlyMap { + forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void; + get(key: K): V|undefined; + has(key: K): boolean; + readonly size: number; +} + +interface WeakMap { + delete(key: K): boolean; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): this; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (entries?: [K, V][]): WeakMap; + readonly prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): this; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface SetConstructor { + new (): Set; + new (values?: T[]): Set; + readonly prototype: Set; +} +declare var Set: SetConstructor; + +interface ReadonlySet { + forEach(callbackfn: (value: T, value2: T, set: ReadonlySet) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface WeakSet { + add(value: T): this; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (values?: T[]): WeakSet; + readonly prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; diff --git a/lib/lib.es2015.core.d.ts b/lib/lib.es2015.core.d.ts index 82e2761b759..66666fe1f18 100644 --- a/lib/lib.es2015.core.d.ts +++ b/lib/lib.es2015.core.d.ts @@ -1,544 +1,544 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -declare type PropertyKey = string | number | symbol; - -interface Array { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => 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) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): this; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface DateConstructor { - new (value: Date): Date; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; -} - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - readonly EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(value: any): value is number; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(value: any): value is number; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(value: any): value is number; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(value: any): value is number; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - readonly MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - readonly MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface ReadonlyArray { - /** - * 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) => 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) => boolean, thisArg?: any): number; -} - -interface RegExp { - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - readonly flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - readonly sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - readonly unicode: boolean; -} - -interface RegExpConstructor { - new (pattern: RegExp, flags?: string): RegExp; - (pattern: RegExp, flags?: string): RegExp; -} - -interface String { - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number | undefined; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} +declare type PropertyKey = string | number | symbol; + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => 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) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): this; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface DateConstructor { + new (value: Date): Date; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + readonly EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(value: any): value is number; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(value: any): value is number; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(value: any): value is number; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(value: any): value is number; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + readonly MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + readonly MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface ReadonlyArray { + /** + * 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) => 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) => boolean, thisArg?: any): number; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + readonly flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + readonly sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + readonly unicode: boolean; +} + +interface RegExpConstructor { + new (pattern: RegExp, flags?: string): RegExp; + (pattern: RegExp, flags?: string): RegExp; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number | undefined; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} diff --git a/lib/lib.es2015.d.ts b/lib/lib.es2015.d.ts index ff5c555bfee..a536e9c8922 100644 --- a/lib/lib.es2015.d.ts +++ b/lib/lib.es2015.d.ts @@ -1,30 +1,30 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -/// -/// -/// -/// -/// -/// -/// -/// -/// +/// +/// +/// +/// +/// +/// +/// +/// +/// /// \ No newline at end of file diff --git a/lib/lib.es2015.generator.d.ts b/lib/lib.es2015.generator.d.ts index 20d6725f66b..3166063a42e 100644 --- a/lib/lib.es2015.generator.d.ts +++ b/lib/lib.es2015.generator.d.ts @@ -1,32 +1,32 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -interface GeneratorFunction extends Function { } - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - readonly prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; +interface GeneratorFunction extends Function { } + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; diff --git a/lib/lib.es2015.iterable.d.ts b/lib/lib.es2015.iterable.d.ts index cb92cb4b8aa..02c72a5ee36 100644 --- a/lib/lib.es2015.iterable.d.ts +++ b/lib/lib.es2015.iterable.d.ts @@ -1,465 +1,465 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -/// - -interface SymbolConstructor { - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - readonly iterator: symbol; -} - -interface IteratorResult { - done: boolean; - value: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * 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; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; -} - -interface ReadonlyArray { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * 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; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface Map { - [Symbol.iterator](): IterableIterator<[K,V]>; - entries(): IterableIterator<[K, V]>; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface MapConstructor { - new (iterable: Iterable<[K, V]>): Map; -} - -interface WeakMap { } - -interface WeakMapConstructor { - new (iterable: Iterable<[K, V]>): WeakMap; -} - -interface Set { - [Symbol.iterator](): IterableIterator; - entries(): IterableIterator<[T, T]>; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface SetConstructor { - new (iterable: Iterable): Set; -} - -interface WeakSet { } - -interface WeakSetConstructor { - new (iterable: Iterable): WeakSet; -} - -interface Promise { } - -interface PromiseConstructor { - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: Iterable>): Promise; - - /** - * 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(values: Iterable>): Promise; -} - -declare namespace Reflect { - function enumerate(target: any): IterableIterator; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +/// + +interface SymbolConstructor { + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; +} + +interface IteratorResult { + done: boolean; + value: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * 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; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; +} + +interface ReadonlyArray { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * 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; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Map { + [Symbol.iterator](): IterableIterator<[K,V]>; + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Set { + [Symbol.iterator](): IterableIterator; + entries(): IterableIterator<[T, T]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface SetConstructor { + new (iterable: Iterable): Set; +} + +interface WeakSet { } + +interface WeakSetConstructor { + new (iterable: Iterable): WeakSet; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * 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(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: any): IterableIterator; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } \ No newline at end of file diff --git a/lib/lib.es2015.promise.d.ts b/lib/lib.es2015.promise.d.ts index 02352da4061..99df9263ea1 100644 --- a/lib/lib.es2015.promise.d.ts +++ b/lib/lib.es2015.promise.d.ts @@ -1,274 +1,274 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -/** - * Represents the completion of an asynchronous operation - */ -interface 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(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): 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(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): 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(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): 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(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; - - /** - * 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) | undefined | null): Promise; - - /** - * 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) => TResult | PromiseLike): Promise; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: (T | PromiseLike)[]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; - - /** - * 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(values: (T | PromiseLike)[]): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; -} - +/** + * Represents the completion of an asynchronous operation + */ +interface 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(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): 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(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): 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(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): 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(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; + + /** + * 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) | undefined | null): Promise; + + /** + * 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) => TResult | PromiseLike): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: (T | PromiseLike)[]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; + + /** + * 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(values: (T | PromiseLike)[]): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + declare var Promise: PromiseConstructor; \ No newline at end of file diff --git a/lib/lib.es2015.proxy.d.ts b/lib/lib.es2015.proxy.d.ts index 6f01f10bfbd..d935cdf9781 100644 --- a/lib/lib.es2015.proxy.d.ts +++ b/lib/lib.es2015.proxy.d.ts @@ -1,42 +1,42 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -interface ProxyHandler { - getPrototypeOf? (target: T): {} | null; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - 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; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, argArray: any, newTarget?: any): {}; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; +interface ProxyHandler { + getPrototypeOf? (target: T): {} | null; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + 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; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, argArray: any, newTarget?: any): {}; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor; diff --git a/lib/lib.es2015.reflect.d.ts b/lib/lib.es2015.reflect.d.ts index b6a6853457a..53a087143c9 100644 --- a/lib/lib.es2015.reflect.d.ts +++ b/lib/lib.es2015.reflect.d.ts @@ -1,35 +1,35 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: PropertyKey): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; +declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: PropertyKey): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; } \ No newline at end of file diff --git a/lib/lib.es2015.symbol.d.ts b/lib/lib.es2015.symbol.d.ts index c0474aec011..3776a44670d 100644 --- a/lib/lib.es2015.symbol.d.ts +++ b/lib/lib.es2015.symbol.d.ts @@ -1,56 +1,56 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string | undefined; -} - +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; +} + declare var Symbol: SymbolConstructor; \ No newline at end of file diff --git a/lib/lib.es2015.symbol.wellknown.d.ts b/lib/lib.es2015.symbol.wellknown.d.ts index 42299fe7d09..e95f324131a 100644 --- a/lib/lib.es2015.symbol.wellknown.d.ts +++ b/lib/lib.es2015.symbol.wellknown.d.ts @@ -1,347 +1,347 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -/// - -interface SymbolConstructor { - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - readonly hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - readonly isConcatSpreadable: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - readonly match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - readonly replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - readonly search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - readonly species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - readonly split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - readonly toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - readonly unscopables: symbol; -} - -interface Symbol { - readonly [Symbol.toStringTag]: "Symbol"; -} - -interface Array { - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface Map { - readonly [Symbol.toStringTag]: "Map"; -} - -interface WeakMap{ - readonly [Symbol.toStringTag]: "WeakMap"; -} - -interface Set { - readonly [Symbol.toStringTag]: "Set"; -} - -interface WeakSet { - readonly [Symbol.toStringTag]: "WeakSet"; -} - -interface JSON { - readonly [Symbol.toStringTag]: "JSON"; -} - -interface Function { - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface GeneratorFunction extends Function { - readonly [Symbol.toStringTag]: "GeneratorFunction"; -} - -interface Math { - readonly [Symbol.toStringTag]: "Math"; -} - -interface Promise { - readonly [Symbol.toStringTag]: "Promise"; -} - -interface PromiseConstructor { - readonly [Symbol.species]: Function; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray | null; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface String { - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - readonly [Symbol.toStringTag]: "ArrayBuffer"; -} - -interface DataView { - readonly [Symbol.toStringTag]: "DataView"; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - readonly [Symbol.toStringTag]: "Int8Array"; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - readonly [Symbol.toStringTag]: "UInt8Array"; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - readonly [Symbol.toStringTag]: "Uint8ClampedArray"; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - readonly [Symbol.toStringTag]: "Int16Array"; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - readonly [Symbol.toStringTag]: "Uint16Array"; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - readonly [Symbol.toStringTag]: "Int32Array"; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - readonly [Symbol.toStringTag]: "Uint32Array"; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - readonly [Symbol.toStringTag]: "Float32Array"; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - readonly [Symbol.toStringTag]: "Float64Array"; +/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; +} + +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap{ + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface Set { + readonly [Symbol.toStringTag]: "Set"; +} + +interface WeakSet { + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction extends Function { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + readonly [Symbol.toStringTag]: "Int8Array"; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + readonly [Symbol.toStringTag]: "Int16Array"; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + readonly [Symbol.toStringTag]: "Int32Array"; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + readonly [Symbol.toStringTag]: "Float32Array"; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + readonly [Symbol.toStringTag]: "Float64Array"; } \ No newline at end of file diff --git a/lib/lib.es2016.array.include.d.ts b/lib/lib.es2016.array.include.d.ts index 42b95c478d0..8ec56cc6418 100644 --- a/lib/lib.es2016.array.include.d.ts +++ b/lib/lib.es2016.array.include.d.ts @@ -1,109 +1,109 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -interface Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: T, fromIndex?: number): boolean; -} - -interface Int8Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint8Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint8ClampedArray { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Int16Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint16Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Int32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Float32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Float64Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; +interface Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: T, fromIndex?: number): boolean; +} + +interface Int8Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint8Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint8ClampedArray { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Int16Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint16Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Int32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Float32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Float64Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; } \ No newline at end of file diff --git a/lib/lib.es2016.d.ts b/lib/lib.es2016.d.ts index 5921e060d0f..50fdffa8592 100644 --- a/lib/lib.es2016.d.ts +++ b/lib/lib.es2016.d.ts @@ -1,22 +1,22 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -/// +/// /// \ No newline at end of file diff --git a/lib/lib.es2017.d.ts b/lib/lib.es2017.d.ts index 94c75a1b49e..91d11bcf301 100644 --- a/lib/lib.es2017.d.ts +++ b/lib/lib.es2017.d.ts @@ -1,24 +1,24 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -/// -/// -/// -/// +/// +/// +/// +/// diff --git a/lib/lib.es2017.object.d.ts b/lib/lib.es2017.object.d.ts index dc3806835ef..3fc6966f843 100644 --- a/lib/lib.es2017.object.d.ts +++ b/lib/lib.es2017.object.d.ts @@ -1,34 +1,34 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -interface ObjectConstructor { - /** - * Returns an array of values of the enumerable properties of an object - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - values(o: { [s: string]: T }): T[]; - values(o: any): any[]; - /** - * Returns an array of key/values of the enumerable properties of an object - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - entries(o: T): [keyof T, T[K]][]; - entries(o: any): [string, any][]; -} +interface ObjectConstructor { + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + values(o: { [s: string]: T }): T[]; + values(o: any): any[]; + /** + * Returns an array of key/values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + entries(o: T): [keyof T, T[K]][]; + entries(o: any): [string, any][]; +} diff --git a/lib/lib.es2017.sharedmemory.d.ts b/lib/lib.es2017.sharedmemory.d.ts index c59e1255519..656caaefee7 100644 --- a/lib/lib.es2017.sharedmemory.d.ts +++ b/lib/lib.es2017.sharedmemory.d.ts @@ -1,47 +1,47 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -/// -/// - -interface SharedArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /* - * The SharedArrayBuffer constructor's length property whose value is 1. - */ - length: number; - /** - * Returns a section of an SharedArrayBuffer. - */ - slice(begin:number, end?:number): SharedArrayBuffer; - readonly [Symbol.species]: SharedArrayBuffer; - readonly [Symbol.toStringTag]: "SharedArrayBuffer"; -} - -interface SharedArrayBufferConstructor { - readonly prototype: SharedArrayBuffer; - new (byteLength: number): SharedArrayBuffer; -} - +/// +/// + +interface SharedArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /* + * The SharedArrayBuffer constructor's length property whose value is 1. + */ + length: number; + /** + * Returns a section of an SharedArrayBuffer. + */ + slice(begin:number, end?:number): SharedArrayBuffer; + readonly [Symbol.species]: SharedArrayBuffer; + readonly [Symbol.toStringTag]: "SharedArrayBuffer"; +} + +interface SharedArrayBufferConstructor { + readonly prototype: SharedArrayBuffer; + new (byteLength: number): SharedArrayBuffer; +} + declare var SharedArrayBuffer: SharedArrayBufferConstructor; \ No newline at end of file diff --git a/lib/lib.es2017.string.d.ts b/lib/lib.es2017.string.d.ts index d82def20ece..303c4644b96 100644 --- a/lib/lib.es2017.string.d.ts +++ b/lib/lib.es2017.string.d.ts @@ -1,21 +1,21 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// interface String { diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts index 2cf3f742522..3fc18505dbd 100644 --- a/lib/lib.es5.d.ts +++ b/lib/lib.es5.d.ts @@ -1,4155 +1,4155 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare const NaN: number; -declare const Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has null prototype. - * @param o Object to use as a prototype. May be null - */ - create(o: null): any; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - */ - create(o: T): T; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): T; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare const Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(this: Function, thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(this: Function, thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(this: Function, thisArg: any, ...argArray: any[]): any; - - /** Returns a string representation of a function. */ - toString(): string; - - prototype: any; - readonly length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} - -declare const Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray | null; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray | null; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - readonly length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - readonly [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare const String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - readonly prototype: Boolean; -} - -declare const Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - readonly prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} - -/** 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 ReadonlyArray { - readonly raw: ReadonlyArray -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - readonly E: number; - /** The natural logarithm of 10. */ - readonly LN10: number; - /** The natural logarithm of 2. */ - readonly LN2: number; - /** The base-2 logarithm of e. */ - readonly LOG2E: number; - /** The base-10 logarithm of e. */ - readonly LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - readonly PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - readonly SQRT1_2: number; - /** The square root of 2. */ - readonly SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare const Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare const Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray | null; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): this; -} - -interface RegExpConstructor { - new (pattern: RegExp): RegExp; - new (pattern: string, flags?: string): RegExp; - (pattern: RegExp): RegExp; - (pattern: string, flags?: string): RegExp; - readonly prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare const RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; - stack?: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare const Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare const EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare const RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare const ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} - -declare const SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} - -declare const TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} - -declare const URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; -} - -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare const JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat>(...items: U[]): T[]; - /** - * 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. - */ - 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. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - - readonly [n: number]: T; -} - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * 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. - */ - 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. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T | undefined; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: T, b: T) => number): this; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: T, index: number, array: 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(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - readonly prototype: Array; -} - -declare const Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * 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) | undefined | null, - onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; - - /** - * 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) | undefined | null, - onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; - - /** - * 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) => TResult | PromiseLike, - onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; - - /** - * 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) => TResult1 | PromiseLike, - onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; -} - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare const ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare const DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare const Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare const Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare const Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare const Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare const Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare const Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare const Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare const Float64Array: Float64ArrayConstructor; - -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string | string[], options?: CollatorOptions): Collator; - (locales?: string | string[], options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - 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 or specified locale. - * @param that String to compare to target string - * @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 | string[], options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @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 | string[], options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @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 | string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @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 | string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @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(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; -} +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare const NaN: number; +declare const Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + readonly prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has null prototype. + * @param o Object to use as a prototype. May be null + */ + create(o: null): any; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + */ + create(o: T): T; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: any, properties: PropertyDescriptorMap): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): T; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare const Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(this: Function, thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(this: Function, thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(this: Function, thisArg: any, ...argArray: any[]): any; + + /** Returns a string representation of a function. */ + toString(): string; + + prototype: any; + readonly length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + readonly prototype: Function; +} + +declare const Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string): RegExpMatchArray | null; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + */ + match(regexp: RegExp): RegExpMatchArray | null; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string that represents the regular expression. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: string, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string that represents the regular expression. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string): number; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string, limit?: number): string[]; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + readonly length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): string; + + readonly [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + readonly prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare const String: StringConstructor; + +interface Boolean { + /** Returns the primitive value of the specified object. */ + valueOf(): boolean; +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + readonly prototype: Boolean; +} + +declare const Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + readonly prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + readonly MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + readonly MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + readonly NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; +} + +/** 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 ReadonlyArray { + readonly raw: ReadonlyArray +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + readonly E: number; + /** The natural logarithm of 10. */ + readonly LN10: number; + /** The natural logarithm of 2. */ + readonly LN2: number; + /** The base-2 logarithm of e. */ + readonly LOG2E: number; + /** The base-10 logarithm of e. */ + readonly LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + readonly PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + readonly SQRT1_2: number; + /** The square root of 2. */ + readonly SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point. + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare const Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + readonly prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare const Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray | null; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ + readonly source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + readonly global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + readonly ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + readonly multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): this; +} + +interface RegExpConstructor { + new (pattern: RegExp): RegExp; + new (pattern: string, flags?: string): RegExp; + (pattern: RegExp): RegExp; + (pattern: string, flags?: string): RegExp; + readonly prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare const RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; + stack?: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + readonly prototype: Error; +} + +declare const Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + readonly prototype: EvalError; +} + +declare const EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + readonly prototype: RangeError; +} + +declare const RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + readonly prototype: ReferenceError; +} + +declare const ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + readonly prototype: SyntaxError; +} + +declare const SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + readonly prototype: TypeError; +} + +declare const TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + readonly prototype: URIError; +} + +declare const URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; +} + +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare const JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat>(...items: U[]): T[]; + /** + * 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. + */ + 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. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * 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. + */ + 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. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T | undefined; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): this; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + */ + splice(start: number): T[]; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: T, index: number, array: 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(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is Array; + readonly prototype: Array; +} + +declare const Array: ArrayConstructor; + +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} + +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; + +declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +interface PromiseLike { + /** + * 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) | undefined | null, + onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; + + /** + * 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) | undefined | null, + onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; + + /** + * 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) => TResult | PromiseLike, + onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; + + /** + * 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) => TResult1 | PromiseLike, + onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; +} + +interface ArrayLike { + readonly length: number; + readonly [n: number]: T; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin:number, end?:number): ArrayBuffer; +} + +interface ArrayBufferConstructor { + readonly prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): arg is ArrayBufferView; +} +declare const ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare const DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + readonly prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + +} +declare const Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + readonly prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; + +} +declare const Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + readonly prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + readonly prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + +} +declare const Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + readonly prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + +} +declare const Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + readonly prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} +declare const Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + readonly prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} +declare const Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + readonly prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + +} +declare const Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + readonly prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} +declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare module Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string | string[], options?: CollatorOptions): Collator; + (locales?: string | string[], options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; + } + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; + } + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + 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 or specified locale. + * @param that String to compare to target string + * @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 | string[], options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @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 | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @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 | string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @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 | string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @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(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +} diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 27a57bd914e..2006211c905 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -1,20822 +1,20822 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// -///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare const NaN: number; -declare const Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has null prototype. - * @param o Object to use as a prototype. May be null - */ - create(o: null): any; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - */ - create(o: T): T; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): T; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare const Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(this: Function, thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(this: Function, thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(this: Function, thisArg: any, ...argArray: any[]): any; - - /** Returns a string representation of a function. */ - toString(): string; - - prototype: any; - readonly length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} - -declare const Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray | null; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray | null; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - readonly length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - readonly [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare const String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - readonly prototype: Boolean; -} - -declare const Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - readonly prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} - -/** 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 ReadonlyArray { - readonly raw: ReadonlyArray -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - readonly E: number; - /** The natural logarithm of 10. */ - readonly LN10: number; - /** The natural logarithm of 2. */ - readonly LN2: number; - /** The base-2 logarithm of e. */ - readonly LOG2E: number; - /** The base-10 logarithm of e. */ - readonly LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - readonly PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - readonly SQRT1_2: number; - /** The square root of 2. */ - readonly SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare const Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare const Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray | null; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): this; -} - -interface RegExpConstructor { - new (pattern: RegExp): RegExp; - new (pattern: string, flags?: string): RegExp; - (pattern: RegExp): RegExp; - (pattern: string, flags?: string): RegExp; - readonly prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare const RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; - stack?: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare const Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare const EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare const RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare const ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} - -declare const SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} - -declare const TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} - -declare const URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; -} - -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare const JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat>(...items: U[]): T[]; - /** - * 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. - */ - 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. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - - readonly [n: number]: T; -} - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * 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. - */ - 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. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T | undefined; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: T, b: T) => number): this; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: T, index: number, array: 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(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - readonly prototype: Array; -} - -declare const Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * 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) | undefined | null, - onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; - - /** - * 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) | undefined | null, - onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; - - /** - * 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) => TResult | PromiseLike, - onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; - - /** - * 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) => TResult1 | PromiseLike, - onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; -} - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare const ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare const DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare const Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare const Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare const Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare const Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare const Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare const Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare const Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * 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(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - - /** - * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * 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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map 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. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare const Float64Array: Float64ArrayConstructor; - -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string | string[], options?: CollatorOptions): Collator; - (locales?: string | string[], options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - 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 or specified locale. - * @param that String to compare to target string - * @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 | string[], options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @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 | string[], options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @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 | string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @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 | string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @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(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; -} +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// +declare const NaN: number; +declare const Infinity: number; -declare type PropertyKey = string | number | symbol; - -interface Array { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => 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) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): this; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface DateConstructor { - new (value: Date): Date; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; -} - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - readonly EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(value: any): value is number; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(value: any): value is number; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(value: any): value is number; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(value: any): value is number; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - readonly MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - readonly MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface ReadonlyArray { - /** - * 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) => 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) => boolean, thisArg?: any): number; -} - -interface RegExp { - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - readonly flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - readonly sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - readonly unicode: boolean; -} - -interface RegExpConstructor { - new (pattern: RegExp, flags?: string): RegExp; - (pattern: RegExp, flags?: string): RegExp; -} - -interface String { - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number | undefined; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; -interface Map { - clear(): void; - delete(key: K): boolean; - forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): this; - readonly size: number; -} - -interface MapConstructor { - new (): Map; - new (entries?: [K, V][]): Map; - readonly prototype: Map; -} -declare var Map: MapConstructor; - -interface ReadonlyMap { - forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void; - get(key: K): V|undefined; - has(key: K): boolean; - readonly size: number; -} - -interface WeakMap { - delete(key: K): boolean; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): this; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (entries?: [K, V][]): WeakMap; - readonly prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): this; - clear(): void; - delete(value: T): boolean; - forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - readonly size: number; -} - -interface SetConstructor { - new (): Set; - new (values?: T[]): Set; - readonly prototype: Set; -} -declare var Set: SetConstructor; - -interface ReadonlySet { - forEach(callbackfn: (value: T, value2: T, set: ReadonlySet) => void, thisArg?: any): void; - has(value: T): boolean; - readonly size: number; -} - -interface WeakSet { - add(value: T): this; - delete(value: T): boolean; - has(value: T): boolean; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (values?: T[]): WeakSet; - readonly prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; -interface GeneratorFunction extends Function { } - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - readonly prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; -/// - -interface SymbolConstructor { - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - readonly iterator: symbol; -} - -interface IteratorResult { - done: boolean; - value: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * 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; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; -} - -interface ReadonlyArray { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * 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; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface Map { - [Symbol.iterator](): IterableIterator<[K,V]>; - entries(): IterableIterator<[K, V]>; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface MapConstructor { - new (iterable: Iterable<[K, V]>): Map; -} - -interface WeakMap { } - -interface WeakMapConstructor { - new (iterable: Iterable<[K, V]>): WeakMap; -} - -interface Set { - [Symbol.iterator](): IterableIterator; - entries(): IterableIterator<[T, T]>; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface SetConstructor { - new (iterable: Iterable): Set; -} - -interface WeakSet { } - -interface WeakSetConstructor { - new (iterable: Iterable): WeakSet; -} - -interface Promise { } - -interface PromiseConstructor { - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: Iterable>): Promise; - - /** - * 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(values: Iterable>): Promise; -} - -declare namespace Reflect { - function enumerate(target: any): IterableIterator; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + readonly prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has null prototype. + * @param o Object to use as a prototype. May be null + */ + create(o: null): any; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + */ + create(o: T): T; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: any, properties: PropertyDescriptorMap): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): T; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare const Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(this: Function, thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(this: Function, thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(this: Function, thisArg: any, ...argArray: any[]): any; + + /** Returns a string representation of a function. */ + toString(): string; + + prototype: any; + readonly length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + readonly prototype: Function; +} + +declare const Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string): RegExpMatchArray | null; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + */ + match(regexp: RegExp): RegExpMatchArray | null; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string that represents the regular expression. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: string, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string that represents the regular expression. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string): number; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string, limit?: number): string[]; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + readonly length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): string; + + readonly [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + readonly prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare const String: StringConstructor; + +interface Boolean { + /** Returns the primitive value of the specified object. */ + valueOf(): boolean; +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + readonly prototype: Boolean; +} + +declare const Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + readonly prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + readonly MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + readonly MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + readonly NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; +} + +/** 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 ReadonlyArray { + readonly raw: ReadonlyArray +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + readonly E: number; + /** The natural logarithm of 10. */ + readonly LN10: number; + /** The natural logarithm of 2. */ + readonly LN2: number; + /** The base-2 logarithm of e. */ + readonly LOG2E: number; + /** The base-10 logarithm of e. */ + readonly LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + readonly PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + readonly SQRT1_2: number; + /** The square root of 2. */ + readonly SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point. + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare const Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + readonly prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare const Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray | null; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ + readonly source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + readonly global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + readonly ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + readonly multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): this; +} + +interface RegExpConstructor { + new (pattern: RegExp): RegExp; + new (pattern: string, flags?: string): RegExp; + (pattern: RegExp): RegExp; + (pattern: string, flags?: string): RegExp; + readonly prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare const RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; + stack?: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + readonly prototype: Error; +} + +declare const Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + readonly prototype: EvalError; +} + +declare const EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + readonly prototype: RangeError; +} + +declare const RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + readonly prototype: ReferenceError; +} + +declare const ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + readonly prototype: SyntaxError; +} + +declare const SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + readonly prototype: TypeError; +} + +declare const TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + readonly prototype: URIError; +} + +declare const URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; +} + +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare const JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat>(...items: U[]): T[]; + /** + * 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. + */ + 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. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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(callbackfn: (value: T, index: number, array: ReadonlyArray) => 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. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * 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. + */ + 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. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T | undefined; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): this; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + */ + splice(start: number): T[]; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: T, index: number, array: 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(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is Array; + readonly prototype: Array; +} + +declare const Array: ArrayConstructor; + +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} + +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; + +declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +interface PromiseLike { + /** + * 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) | undefined | null, + onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; + + /** + * 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) | undefined | null, + onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; + + /** + * 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) => TResult | PromiseLike, + onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; + + /** + * 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) => TResult1 | PromiseLike, + onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; +} + +interface ArrayLike { + readonly length: number; + readonly [n: number]: T; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin:number, end?:number): ArrayBuffer; +} + +interface ArrayBufferConstructor { + readonly prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): arg is ArrayBufferView; +} +declare const ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare const DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + readonly prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + +} +declare const Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + readonly prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; + +} +declare const Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + readonly prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + readonly prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + +} +declare const Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + readonly prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + +} +declare const Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + readonly prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} +declare const Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + readonly prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} +declare const Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + readonly prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + +} +declare const Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * 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(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; + + /** + * 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: number, index: number, obj: Array) => boolean, thisArg?: any): number | 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: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * 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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map 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. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + readonly prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} +declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare module Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string | string[], options?: CollatorOptions): Collator; + (locales?: string | string[], options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; + } + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; + } + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + 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 or specified locale. + * @param that String to compare to target string + * @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 | string[], options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @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 | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @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 | string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @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 | string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @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(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +} + + +declare type PropertyKey = string | number | symbol; + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => 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) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): this; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface DateConstructor { + new (value: Date): Date; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + readonly EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(value: any): value is number; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(value: any): value is number; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(value: any): value is number; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(value: any): value is number; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + readonly MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + readonly MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface ReadonlyArray { + /** + * 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) => 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) => boolean, thisArg?: any): number; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + readonly flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + readonly sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + readonly unicode: boolean; +} + +interface RegExpConstructor { + new (pattern: RegExp, flags?: string): RegExp; + (pattern: RegExp, flags?: string): RegExp; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number | undefined; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): this; + readonly size: number; +} + +interface MapConstructor { + new (): Map; + new (entries?: [K, V][]): Map; + readonly prototype: Map; +} +declare var Map: MapConstructor; + +interface ReadonlyMap { + forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void; + get(key: K): V|undefined; + has(key: K): boolean; + readonly size: number; +} + +interface WeakMap { + delete(key: K): boolean; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): this; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (entries?: [K, V][]): WeakMap; + readonly prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): this; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface SetConstructor { + new (): Set; + new (values?: T[]): Set; + readonly prototype: Set; +} +declare var Set: SetConstructor; + +interface ReadonlySet { + forEach(callbackfn: (value: T, value2: T, set: ReadonlySet) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface WeakSet { + add(value: T): this; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (values?: T[]): WeakSet; + readonly prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; + + +interface GeneratorFunction extends Function { } + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; + + +/// + +interface SymbolConstructor { + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; +} + +interface IteratorResult { + done: boolean; + value: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * 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; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; +} + +interface ReadonlyArray { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * 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; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Map { + [Symbol.iterator](): IterableIterator<[K,V]>; + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Set { + [Symbol.iterator](): IterableIterator; + entries(): IterableIterator<[T, T]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface SetConstructor { + new (iterable: Iterable): Set; +} + +interface WeakSet { } + +interface WeakSetConstructor { + new (iterable: Iterable): WeakSet; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * 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(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: any): IterableIterator; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface 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(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): 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(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): 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(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): 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(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; + + /** + * 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) | undefined | null): Promise; + + /** + * 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) => TResult | PromiseLike): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: (T | PromiseLike)[]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; + + /** + * 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(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; + + /** + * 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(values: (T | PromiseLike)[]): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; } -/** - * Represents the completion of an asynchronous operation - */ -interface 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(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): 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(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): 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(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): 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(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; - - /** - * 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) | undefined | null): Promise; - - /** - * 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) => TResult | PromiseLike): Promise; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: (T | PromiseLike)[]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; - - /** - * 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(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; - - /** - * 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(values: (T | PromiseLike)[]): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; -} - declare var Promise: PromiseConstructor; -interface ProxyHandler { - getPrototypeOf? (target: T): {} | null; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - 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; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, argArray: any, newTarget?: any): {}; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; - - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: PropertyKey): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; +interface ProxyHandler { + getPrototypeOf? (target: T): {} | null; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + 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; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, argArray: any, newTarget?: any): {}; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor; + + +declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: PropertyKey): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} + +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; } -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string | undefined; -} - declare var Symbol: SymbolConstructor; -/// - -interface SymbolConstructor { - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - readonly hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - readonly isConcatSpreadable: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - readonly match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - readonly replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - readonly search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - readonly species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - readonly split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - readonly toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - readonly unscopables: symbol; -} - -interface Symbol { - readonly [Symbol.toStringTag]: "Symbol"; -} - -interface Array { - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface Map { - readonly [Symbol.toStringTag]: "Map"; -} - -interface WeakMap{ - readonly [Symbol.toStringTag]: "WeakMap"; -} - -interface Set { - readonly [Symbol.toStringTag]: "Set"; -} - -interface WeakSet { - readonly [Symbol.toStringTag]: "WeakSet"; -} - -interface JSON { - readonly [Symbol.toStringTag]: "JSON"; -} - -interface Function { - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface GeneratorFunction extends Function { - readonly [Symbol.toStringTag]: "GeneratorFunction"; -} - -interface Math { - readonly [Symbol.toStringTag]: "Math"; -} - -interface Promise { - readonly [Symbol.toStringTag]: "Promise"; -} - -interface PromiseConstructor { - readonly [Symbol.species]: Function; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray | null; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface String { - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - readonly [Symbol.toStringTag]: "ArrayBuffer"; -} - -interface DataView { - readonly [Symbol.toStringTag]: "DataView"; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - readonly [Symbol.toStringTag]: "Int8Array"; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - readonly [Symbol.toStringTag]: "UInt8Array"; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - readonly [Symbol.toStringTag]: "Uint8ClampedArray"; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - readonly [Symbol.toStringTag]: "Int16Array"; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - readonly [Symbol.toStringTag]: "Uint16Array"; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - readonly [Symbol.toStringTag]: "Int32Array"; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - readonly [Symbol.toStringTag]: "Uint32Array"; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - readonly [Symbol.toStringTag]: "Float32Array"; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - readonly [Symbol.toStringTag]: "Float64Array"; +/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; } - -///////////////////////////// -/// IE DOM APIs -///////////////////////////// - -interface Algorithm { - name: string; -} - -interface AriaRequestEventInit extends EventInit { - attributeName?: string; - attributeValue?: string; -} - -interface CommandEventInit extends EventInit { - commandName?: string; - detail?: string; -} - -interface CompositionEventInit extends UIEventInit { - data?: string; -} - -interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { - arrayOfDomainStrings?: string[]; -} - -interface ConstrainBooleanParameters { - exact?: boolean; - ideal?: boolean; -} - -interface ConstrainDOMStringParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface ConstrainDoubleRange extends DoubleRange { - exact?: number; - ideal?: number; -} - -interface ConstrainLongRange extends LongRange { - exact?: number; - ideal?: number; -} - -interface ConstrainVideoFacingModeParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface CustomEventInit extends EventInit { - detail?: any; -} - -interface DeviceAccelerationDict { - x?: number; - y?: number; - z?: number; -} - -interface DeviceLightEventInit extends EventInit { - value?: number; -} - -interface DeviceRotationRateDict { - alpha?: number; - beta?: number; - gamma?: number; -} - -interface DoubleRange { - max?: number; - min?: number; -} - -interface EventInit { - bubbles?: boolean; - cancelable?: boolean; -} - -interface EventModifierInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - modifierAltGraph?: boolean; - modifierCapsLock?: boolean; - modifierFn?: boolean; - modifierFnLock?: boolean; - modifierHyper?: boolean; - modifierNumLock?: boolean; - modifierOS?: boolean; - modifierScrollLock?: boolean; - modifierSuper?: boolean; - modifierSymbol?: boolean; - modifierSymbolLock?: boolean; -} - -interface ExceptionInformation { - domain?: string; -} - -interface FocusEventInit extends UIEventInit { - relatedTarget?: EventTarget; -} - -interface HashChangeEventInit extends EventInit { - newURL?: string; - oldURL?: string; -} - -interface IDBIndexParameters { - multiEntry?: boolean; - unique?: boolean; -} - -interface IDBObjectStoreParameters { - autoIncrement?: boolean; - keyPath?: IDBKeyPath; -} - -interface KeyAlgorithm { - name?: string; -} - -interface KeyboardEventInit extends EventModifierInit { - code?: string; - key?: string; - location?: number; - repeat?: boolean; -} - -interface LongRange { - max?: number; - min?: number; -} - -interface MSAccountInfo { - rpDisplayName?: string; - userDisplayName?: string; - accountName?: string; - userId?: string; - accountImageUri?: string; -} - -interface MSAudioLocalClientEvent extends MSLocalClientEventBase { - networkSendQualityEventRatio?: number; - networkDelayEventRatio?: number; - cpuInsufficientEventRatio?: number; - deviceHalfDuplexAECEventRatio?: number; - deviceRenderNotFunctioningEventRatio?: number; - deviceCaptureNotFunctioningEventRatio?: number; - deviceGlitchesEventRatio?: number; - deviceLowSNREventRatio?: number; - deviceLowSpeechLevelEventRatio?: number; - deviceClippingEventRatio?: number; - deviceEchoEventRatio?: number; - deviceNearEndToEchoRatioEventRatio?: number; - deviceRenderZeroVolumeEventRatio?: number; - deviceRenderMuteEventRatio?: number; - deviceMultipleEndpointsEventCount?: number; - deviceHowlingEventCount?: number; -} - -interface MSAudioRecvPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioRecvSignal; - packetReorderRatio?: number; - packetReorderDepthAvg?: number; - packetReorderDepthMax?: number; - burstLossLength1?: number; - burstLossLength2?: number; - burstLossLength3?: number; - burstLossLength4?: number; - burstLossLength5?: number; - burstLossLength6?: number; - burstLossLength7?: number; - burstLossLength8OrHigher?: number; - fecRecvDistance1?: number; - fecRecvDistance2?: number; - fecRecvDistance3?: number; - ratioConcealedSamplesAvg?: number; - ratioStretchedSamplesAvg?: number; - ratioCompressedSamplesAvg?: number; -} - -interface MSAudioRecvSignal { - initialSignalLevelRMS?: number; - recvSignalLevelCh1?: number; - recvNoiseLevelCh1?: number; - renderSignalLevel?: number; - renderNoiseLevel?: number; - renderLoopbackSignalLevel?: number; -} - -interface MSAudioSendPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioSendSignal; - audioFECUsed?: boolean; - sendMutePercent?: number; -} - -interface MSAudioSendSignal { - noiseLevel?: number; - sendSignalLevelCh1?: number; - sendNoiseLevelCh1?: number; -} - -interface MSConnectivity { - iceType?: string; - iceWarningFlags?: MSIceWarningFlags; - relayAddress?: MSRelayAddress; -} - -interface MSCredentialFilter { - accept?: MSCredentialSpec[]; -} - -interface MSCredentialParameters { - type?: string; -} - -interface MSCredentialSpec { - type?: string; - id?: string; -} - -interface MSDelay { - roundTrip?: number; - roundTripMax?: number; -} - -interface MSDescription extends RTCStats { - connectivity?: MSConnectivity; - transport?: string; - networkconnectivity?: MSNetworkConnectivityInfo; - localAddr?: MSIPAddressInfo; - remoteAddr?: MSIPAddressInfo; - deviceDevName?: string; - reflexiveLocalIPAddr?: MSIPAddressInfo; -} - -interface MSFIDOCredentialParameters extends MSCredentialParameters { - algorithm?: string | Algorithm; - authenticators?: AAGUID[]; -} - -interface MSIPAddressInfo { - ipAddr?: string; - port?: number; - manufacturerMacAddrMask?: string; -} - -interface MSIceWarningFlags { - turnTcpTimedOut?: boolean; - turnUdpAllocateFailed?: boolean; - turnUdpSendFailed?: boolean; - turnTcpAllocateFailed?: boolean; - turnTcpSendFailed?: boolean; - udpLocalConnectivityFailed?: boolean; - udpNatConnectivityFailed?: boolean; - udpRelayConnectivityFailed?: boolean; - tcpNatConnectivityFailed?: boolean; - tcpRelayConnectivityFailed?: boolean; - connCheckMessageIntegrityFailed?: boolean; - allocationMessageIntegrityFailed?: boolean; - connCheckOtherError?: boolean; - turnAuthUnknownUsernameError?: boolean; - noRelayServersConfigured?: boolean; - multipleRelayServersAttempted?: boolean; - portRangeExhausted?: boolean; - alternateServerReceived?: boolean; - pseudoTLSFailure?: boolean; - turnTurnTcpConnectivityFailed?: boolean; - useCandidateChecksFailed?: boolean; - fipsAllocationFailure?: boolean; -} - -interface MSJitter { - interArrival?: number; - interArrivalMax?: number; - interArrivalSD?: number; -} - -interface MSLocalClientEventBase extends RTCStats { - networkReceiveQualityEventRatio?: number; - networkBandwidthLowEventRatio?: number; -} - -interface MSNetwork extends RTCStats { - jitter?: MSJitter; - delay?: MSDelay; - packetLoss?: MSPacketLoss; - utilization?: MSUtilization; -} - -interface MSNetworkConnectivityInfo { - vpn?: boolean; - linkspeed?: number; - networkConnectionDetails?: string; -} - -interface MSNetworkInterfaceType { - interfaceTypeEthernet?: boolean; - interfaceTypeWireless?: boolean; - interfaceTypePPP?: boolean; - interfaceTypeTunnel?: boolean; - interfaceTypeWWAN?: boolean; -} - -interface MSOutboundNetwork extends MSNetwork { - appliedBandwidthLimit?: number; -} - -interface MSPacketLoss { - lossRate?: number; - lossRateMax?: number; -} - -interface MSPayloadBase extends RTCStats { - payloadDescription?: string; -} - -interface MSRelayAddress { - relayAddress?: string; - port?: number; -} - -interface MSSignatureParameters { - userPrompt?: string; -} - -interface MSTransportDiagnosticsStats extends RTCStats { - baseAddress?: string; - localAddress?: string; - localSite?: string; - networkName?: string; - remoteAddress?: string; - remoteSite?: string; - localMR?: string; - remoteMR?: string; - iceWarningFlags?: MSIceWarningFlags; - portRangeMin?: number; - portRangeMax?: number; - localMRTCPPort?: number; - remoteMRTCPPort?: number; - stunVer?: number; - numConsentReqSent?: number; - numConsentReqReceived?: number; - numConsentRespSent?: number; - numConsentRespReceived?: number; - interfaces?: MSNetworkInterfaceType; - baseInterface?: MSNetworkInterfaceType; - protocol?: string; - localInterface?: MSNetworkInterfaceType; - localAddrType?: string; - remoteAddrType?: string; - iceRole?: string; - rtpRtcpMux?: boolean; - allocationTimeInMs?: number; - msRtcEngineVersion?: string; -} - -interface MSUtilization { - packets?: number; - bandwidthEstimation?: number; - bandwidthEstimationMin?: number; - bandwidthEstimationMax?: number; - bandwidthEstimationStdDev?: number; - bandwidthEstimationAvg?: number; -} - -interface MSVideoPayload extends MSPayloadBase { - resoluton?: string; - videoBitRateAvg?: number; - videoBitRateMax?: number; - videoFrameRateAvg?: number; - videoPacketLossRate?: number; - durationSeconds?: number; -} - -interface MSVideoRecvPayload extends MSVideoPayload { - videoFrameLossRate?: number; - recvCodecType?: string; - recvResolutionWidth?: number; - recvResolutionHeight?: number; - videoResolutions?: MSVideoResolutionDistribution; - recvFrameRateAverage?: number; - recvBitRateMaximum?: number; - recvBitRateAverage?: number; - recvVideoStreamsMax?: number; - recvVideoStreamsMin?: number; - recvVideoStreamsMode?: number; - videoPostFECPLR?: number; - lowBitRateCallPercent?: number; - lowFrameRateCallPercent?: number; - reorderBufferTotalPackets?: number; - recvReorderBufferReorderedPackets?: number; - recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; - recvReorderBufferMaxSuccessfullyOrderedExtent?: number; - recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; - recvReorderBufferPacketsDroppedDueToTimeout?: number; - recvFpsHarmonicAverage?: number; - recvNumResSwitches?: number; -} - -interface MSVideoResolutionDistribution { - cifQuality?: number; - vgaQuality?: number; - h720Quality?: number; - h1080Quality?: number; - h1440Quality?: number; - h2160Quality?: number; -} - -interface MSVideoSendPayload extends MSVideoPayload { - sendFrameRateAverage?: number; - sendBitRateMaximum?: number; - sendBitRateAverage?: number; - sendVideoStreamsMax?: number; - sendResolutionWidth?: number; - sendResolutionHeight?: number; -} - -interface MediaEncryptedEventInit extends EventInit { - initDataType?: string; - initData?: ArrayBuffer; -} - -interface MediaKeyMessageEventInit extends EventInit { - messageType?: string; - message?: ArrayBuffer; -} - -interface MediaKeySystemConfiguration { - initDataTypes?: string[]; - audioCapabilities?: MediaKeySystemMediaCapability[]; - videoCapabilities?: MediaKeySystemMediaCapability[]; - distinctiveIdentifier?: string; - persistentState?: string; -} - -interface MediaKeySystemMediaCapability { - contentType?: string; - robustness?: string; -} - -interface MediaStreamConstraints { - video?: boolean | MediaTrackConstraints; - audio?: boolean | MediaTrackConstraints; -} - -interface MediaStreamErrorEventInit extends EventInit { - error?: MediaStreamError; -} - -interface MediaStreamTrackEventInit extends EventInit { - track?: MediaStreamTrack; -} - -interface MediaTrackCapabilities { - width?: number | LongRange; - height?: number | LongRange; - aspectRatio?: number | DoubleRange; - frameRate?: number | DoubleRange; - facingMode?: string; - volume?: number | DoubleRange; - sampleRate?: number | LongRange; - sampleSize?: number | LongRange; - echoCancellation?: boolean[]; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackConstraintSet { - width?: number | ConstrainLongRange; - height?: number | ConstrainLongRange; - aspectRatio?: number | ConstrainDoubleRange; - frameRate?: number | ConstrainDoubleRange; - facingMode?: string | string[] | ConstrainDOMStringParameters; - volume?: number | ConstrainDoubleRange; - sampleRate?: number | ConstrainLongRange; - sampleSize?: number | ConstrainLongRange; - echoCancelation?: boolean | ConstrainBooleanParameters; - deviceId?: string | string[] | ConstrainDOMStringParameters; - groupId?: string | string[] | ConstrainDOMStringParameters; -} - -interface MediaTrackConstraints extends MediaTrackConstraintSet { - advanced?: MediaTrackConstraintSet[]; -} - -interface MediaTrackSettings { - width?: number; - height?: number; - aspectRatio?: number; - frameRate?: number; - facingMode?: string; - volume?: number; - sampleRate?: number; - sampleSize?: number; - echoCancellation?: boolean; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackSupportedConstraints { - width?: boolean; - height?: boolean; - aspectRatio?: boolean; - frameRate?: boolean; - facingMode?: boolean; - volume?: boolean; - sampleRate?: boolean; - sampleSize?: boolean; - echoCancellation?: boolean; - deviceId?: boolean; - groupId?: boolean; -} - -interface MouseEventInit extends EventModifierInit { - screenX?: number; - screenY?: number; - clientX?: number; - clientY?: number; - button?: number; - buttons?: number; - relatedTarget?: EventTarget; -} - -interface MsZoomToOptions { - contentX?: number; - contentY?: number; - viewportX?: string; - viewportY?: string; - scaleFactor?: number; - animate?: string; -} - -interface MutationObserverInit { - childList?: boolean; - attributes?: boolean; - characterData?: boolean; - subtree?: boolean; - attributeOldValue?: boolean; - characterDataOldValue?: boolean; - attributeFilter?: string[]; -} - -interface ObjectURLOptions { - oneTimeOnly?: boolean; -} - -interface PeriodicWaveConstraints { - disableNormalization?: boolean; -} - -interface PointerEventInit extends MouseEventInit { - pointerId?: number; - width?: number; - height?: number; - pressure?: number; - tiltX?: number; - tiltY?: number; - pointerType?: string; - isPrimary?: boolean; -} - -interface PositionOptions { - enableHighAccuracy?: boolean; - timeout?: number; - maximumAge?: number; -} - -interface RTCDTMFToneChangeEventInit extends EventInit { - tone?: string; -} - -interface RTCDtlsFingerprint { - algorithm?: string; - value?: string; -} - -interface RTCDtlsParameters { - role?: string; - fingerprints?: RTCDtlsFingerprint[]; -} - -interface RTCIceCandidate { - foundation?: string; - priority?: number; - ip?: string; - protocol?: string; - port?: number; - type?: string; - tcpType?: string; - relatedAddress?: string; - relatedPort?: number; -} - -interface RTCIceCandidateAttributes extends RTCStats { - ipAddress?: string; - portNumber?: number; - transport?: string; - candidateType?: string; - priority?: number; - addressSourceUrl?: string; -} - -interface RTCIceCandidateComplete { -} - -interface RTCIceCandidatePair { - local?: RTCIceCandidate; - remote?: RTCIceCandidate; -} - -interface RTCIceCandidatePairStats extends RTCStats { - transportId?: string; - localCandidateId?: string; - remoteCandidateId?: string; - state?: string; - priority?: number; - nominated?: boolean; - writable?: boolean; - readable?: boolean; - bytesSent?: number; - bytesReceived?: number; - roundTripTime?: number; - availableOutgoingBitrate?: number; - availableIncomingBitrate?: number; -} - -interface RTCIceGatherOptions { - gatherPolicy?: string; - iceservers?: RTCIceServer[]; -} - -interface RTCIceParameters { - usernameFragment?: string; - password?: string; -} - -interface RTCIceServer { - urls?: any; - username?: string; - credential?: string; -} - -interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { - packetsReceived?: number; - bytesReceived?: number; - packetsLost?: number; - jitter?: number; - fractionLost?: number; -} - -interface RTCMediaStreamTrackStats extends RTCStats { - trackIdentifier?: string; - remoteSource?: boolean; - ssrcIds?: string[]; - frameWidth?: number; - frameHeight?: number; - framesPerSecond?: number; - framesSent?: number; - framesReceived?: number; - framesDecoded?: number; - framesDropped?: number; - framesCorrupted?: number; - audioLevel?: number; - echoReturnLoss?: number; - echoReturnLossEnhancement?: number; -} - -interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { - packetsSent?: number; - bytesSent?: number; - targetBitrate?: number; - roundTripTime?: number; -} - -interface RTCRTPStreamStats extends RTCStats { - ssrc?: string; - associateStatsId?: string; - isRemote?: boolean; - mediaTrackId?: string; - transportId?: string; - codecId?: string; - firCount?: number; - pliCount?: number; - nackCount?: number; - sliCount?: number; -} - -interface RTCRtcpFeedback { - type?: string; - parameter?: string; -} - -interface RTCRtcpParameters { - ssrc?: number; - cname?: string; - reducedSize?: boolean; - mux?: boolean; -} - -interface RTCRtpCapabilities { - codecs?: RTCRtpCodecCapability[]; - headerExtensions?: RTCRtpHeaderExtension[]; - fecMechanisms?: string[]; -} - -interface RTCRtpCodecCapability { - name?: string; - kind?: string; - clockRate?: number; - preferredPayloadType?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; - options?: any; - maxTemporalLayers?: number; - maxSpatialLayers?: number; - svcMultiStreamSupport?: boolean; -} - -interface RTCRtpCodecParameters { - name?: string; - payloadType?: any; - clockRate?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; -} - -interface RTCRtpContributingSource { - timestamp?: number; - csrc?: number; - audioLevel?: number; -} - -interface RTCRtpEncodingParameters { - ssrc?: number; - codecPayloadType?: number; - fec?: RTCRtpFecParameters; - rtx?: RTCRtpRtxParameters; - priority?: number; - maxBitrate?: number; - minQuality?: number; - framerateBias?: number; - resolutionScale?: number; - framerateScale?: number; - active?: boolean; - encodingId?: string; - dependencyEncodingIds?: string[]; - ssrcRange?: RTCSsrcRange; -} - -interface RTCRtpFecParameters { - ssrc?: number; - mechanism?: string; -} - -interface RTCRtpHeaderExtension { - kind?: string; - uri?: string; - preferredId?: number; - preferredEncrypt?: boolean; -} - -interface RTCRtpHeaderExtensionParameters { - uri?: string; - id?: number; - encrypt?: boolean; -} - -interface RTCRtpParameters { - muxId?: string; - codecs?: RTCRtpCodecParameters[]; - headerExtensions?: RTCRtpHeaderExtensionParameters[]; - encodings?: RTCRtpEncodingParameters[]; - rtcp?: RTCRtcpParameters; -} - -interface RTCRtpRtxParameters { - ssrc?: number; -} - -interface RTCRtpUnhandled { - ssrc?: number; - payloadType?: number; - muxId?: string; -} - -interface RTCSrtpKeyParam { - keyMethod?: string; - keySalt?: string; - lifetime?: string; - mkiValue?: number; - mkiLength?: number; -} - -interface RTCSrtpSdesParameters { - tag?: number; - cryptoSuite?: string; - keyParams?: RTCSrtpKeyParam[]; - sessionParams?: string[]; -} - -interface RTCSsrcRange { - min?: number; - max?: number; -} - -interface RTCStats { - timestamp?: number; - type?: string; - id?: string; - msType?: string; -} - -interface RTCStatsReport { -} - -interface RTCTransportStats extends RTCStats { - bytesSent?: number; - bytesReceived?: number; - rtcpTransportStatsId?: string; - activeConnection?: boolean; - selectedCandidatePairId?: string; - localCertificateId?: string; - remoteCertificateId?: string; -} - -interface StoreExceptionsInformation extends ExceptionInformation { - siteName?: string; - explanationString?: string; - detailURI?: string; -} - -interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { - arrayOfDomainStrings?: string[]; -} - -interface UIEventInit extends EventInit { - view?: Window; - detail?: number; -} - -interface WebGLContextAttributes { - failIfMajorPerformanceCaveat?: boolean; - alpha?: boolean; - depth?: boolean; - stencil?: boolean; - antialias?: boolean; - premultipliedAlpha?: boolean; - preserveDrawingBuffer?: boolean; -} - -interface WebGLContextEventInit extends EventInit { - statusMessage?: string; -} - -interface WheelEventInit extends MouseEventInit { - deltaX?: number; - deltaY?: number; - deltaZ?: number; - deltaMode?: number; -} - -interface EventListener { - (evt: Event): void; -} - -interface ANGLE_instanced_arrays { - drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; - drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; - vertexAttribDivisorANGLE(index: number, divisor: number): void; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -declare var ANGLE_instanced_arrays: { - prototype: ANGLE_instanced_arrays; - new(): ANGLE_instanced_arrays; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -interface AnalyserNode extends AudioNode { - fftSize: number; - readonly frequencyBinCount: number; - maxDecibels: number; - minDecibels: number; - smoothingTimeConstant: number; - getByteFrequencyData(array: Uint8Array): void; - getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: Float32Array): void; - getFloatTimeDomainData(array: Float32Array): void; -} - -declare var AnalyserNode: { - prototype: AnalyserNode; - new(): AnalyserNode; -} - -interface AnimationEvent extends Event { - readonly animationName: string; - readonly elapsedTime: number; - initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; -} - -declare var AnimationEvent: { - prototype: AnimationEvent; - new(): AnimationEvent; -} - -interface ApplicationCache extends EventTarget { - oncached: (this: this, ev: Event) => any; - onchecking: (this: this, ev: Event) => any; - ondownloading: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onnoupdate: (this: this, ev: Event) => any; - onobsolete: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onupdateready: (this: this, ev: Event) => any; - readonly status: number; - abort(): void; - swapCache(): void; - update(): void; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; - addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ApplicationCache: { - prototype: ApplicationCache; - new(): ApplicationCache; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; -} - -interface AriaRequestEvent extends Event { - readonly attributeName: string; - attributeValue: string | null; -} - -declare var AriaRequestEvent: { - prototype: AriaRequestEvent; - new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; -} - -interface Attr extends Node { - readonly name: string; - readonly ownerElement: Element; - readonly prefix: string | null; - readonly specified: boolean; - value: string; -} - -declare var Attr: { - prototype: Attr; - new(): Attr; -} - -interface AudioBuffer { - readonly duration: number; - readonly length: number; - readonly numberOfChannels: number; - readonly sampleRate: number; - copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; - copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(): AudioBuffer; -} - -interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer | null; - readonly detune: AudioParam; - loop: boolean; - loopEnd: number; - loopStart: number; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - readonly playbackRate: AudioParam; - start(when?: number, offset?: number, duration?: number): void; - stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var AudioBufferSourceNode: { - prototype: AudioBufferSourceNode; - new(): AudioBufferSourceNode; -} - -interface AudioContext extends EventTarget { - readonly currentTime: number; - readonly destination: AudioDestinationNode; - readonly listener: AudioListener; - readonly sampleRate: number; - state: string; - createAnalyser(): AnalyserNode; - createBiquadFilter(): BiquadFilterNode; - createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; - createBufferSource(): AudioBufferSourceNode; - createChannelMerger(numberOfInputs?: number): ChannelMergerNode; - createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; - createConvolver(): ConvolverNode; - createDelay(maxDelayTime?: number): DelayNode; - createDynamicsCompressor(): DynamicsCompressorNode; - createGain(): GainNode; - createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; - createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; - createOscillator(): OscillatorNode; - createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; - createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; - createStereoPanner(): StereoPannerNode; - createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; -} - -declare var AudioContext: { - prototype: AudioContext; - new(): AudioContext; -} - -interface AudioDestinationNode extends AudioNode { - readonly maxChannelCount: number; -} - -declare var AudioDestinationNode: { - prototype: AudioDestinationNode; - new(): AudioDestinationNode; -} - -interface AudioListener { - dopplerFactor: number; - speedOfSound: number; - setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var AudioListener: { - prototype: AudioListener; - new(): AudioListener; -} - -interface AudioNode extends EventTarget { - channelCount: number; - channelCountMode: string; - channelInterpretation: string; - readonly context: AudioContext; - readonly numberOfInputs: number; - readonly numberOfOutputs: number; - connect(destination: AudioNode, output?: number, input?: number): void; - disconnect(output?: number): void; - disconnect(destination: AudioNode, output?: number, input?: number): void; - disconnect(destination: AudioParam, output?: number): void; -} - -declare var AudioNode: { - prototype: AudioNode; - new(): AudioNode; -} - -interface AudioParam { - readonly defaultValue: number; - value: number; - cancelScheduledValues(startTime: number): void; - exponentialRampToValueAtTime(value: number, endTime: number): void; - linearRampToValueAtTime(value: number, endTime: number): void; - setTargetAtTime(target: number, startTime: number, timeConstant: number): void; - setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; -} - -declare var AudioParam: { - prototype: AudioParam; - new(): AudioParam; -} - -interface AudioProcessingEvent extends Event { - readonly inputBuffer: AudioBuffer; - readonly outputBuffer: AudioBuffer; - readonly playbackTime: number; -} - -declare var AudioProcessingEvent: { - prototype: AudioProcessingEvent; - new(): AudioProcessingEvent; -} - -interface AudioTrack { - enabled: boolean; - readonly id: string; - kind: string; - readonly label: string; - language: string; - readonly sourceBuffer: SourceBuffer; -} - -declare var AudioTrack: { - prototype: AudioTrack; - new(): AudioTrack; -} - -interface AudioTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack | null; - item(index: number): AudioTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: AudioTrack; -} - -declare var AudioTrackList: { - prototype: AudioTrackList; - new(): AudioTrackList; -} - -interface BarProp { - readonly visible: boolean; -} - -declare var BarProp: { - prototype: BarProp; - new(): BarProp; -} - -interface BeforeUnloadEvent extends Event { - returnValue: any; -} - -declare var BeforeUnloadEvent: { - prototype: BeforeUnloadEvent; - new(): BeforeUnloadEvent; -} - -interface BiquadFilterNode extends AudioNode { - readonly Q: AudioParam; - readonly detune: AudioParam; - readonly frequency: AudioParam; - readonly gain: AudioParam; - type: string; - getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; -} - -declare var BiquadFilterNode: { - prototype: BiquadFilterNode; - new(): BiquadFilterNode; -} - -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface CDATASection extends Text { -} - -declare var CDATASection: { - prototype: CDATASection; - new(): CDATASection; -} - -interface CSS { - supports(property: string, value?: string): boolean; -} -declare var CSS: CSS; - -interface CSSConditionRule extends CSSGroupingRule { - conditionText: string; -} - -declare var CSSConditionRule: { - prototype: CSSConditionRule; - new(): CSSConditionRule; -} - -interface CSSFontFaceRule extends CSSRule { - readonly style: CSSStyleDeclaration; -} - -declare var CSSFontFaceRule: { - prototype: CSSFontFaceRule; - new(): CSSFontFaceRule; -} - -interface CSSGroupingRule extends CSSRule { - readonly cssRules: CSSRuleList; - deleteRule(index: number): void; - insertRule(rule: string, index: number): number; -} - -declare var CSSGroupingRule: { - prototype: CSSGroupingRule; - new(): CSSGroupingRule; -} - -interface CSSImportRule extends CSSRule { - readonly href: string; - readonly media: MediaList; - readonly styleSheet: CSSStyleSheet; -} - -declare var CSSImportRule: { - prototype: CSSImportRule; - new(): CSSImportRule; -} - -interface CSSKeyframeRule extends CSSRule { - keyText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSKeyframeRule: { - prototype: CSSKeyframeRule; - new(): CSSKeyframeRule; -} - -interface CSSKeyframesRule extends CSSRule { - readonly cssRules: CSSRuleList; - name: string; - appendRule(rule: string): void; - deleteRule(rule: string): void; - findRule(rule: string): CSSKeyframeRule; -} - -declare var CSSKeyframesRule: { - prototype: CSSKeyframesRule; - new(): CSSKeyframesRule; -} - -interface CSSMediaRule extends CSSConditionRule { - readonly media: MediaList; -} - -declare var CSSMediaRule: { - prototype: CSSMediaRule; - new(): CSSMediaRule; -} - -interface CSSNamespaceRule extends CSSRule { - readonly namespaceURI: string; - readonly prefix: string; -} - -declare var CSSNamespaceRule: { - prototype: CSSNamespaceRule; - new(): CSSNamespaceRule; -} - -interface CSSPageRule extends CSSRule { - readonly pseudoClass: string; - readonly selector: string; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSPageRule: { - prototype: CSSPageRule; - new(): CSSPageRule; -} - -interface CSSRule { - cssText: string; - readonly parentRule: CSSRule; - readonly parentStyleSheet: CSSStyleSheet; - readonly type: number; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -declare var CSSRule: { - prototype: CSSRule; - new(): CSSRule; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -interface CSSRuleList { - readonly length: number; - item(index: number): CSSRule; - [index: number]: CSSRule; -} - -declare var CSSRuleList: { - prototype: CSSRuleList; - new(): CSSRuleList; -} - -interface CSSStyleDeclaration { - alignContent: string | null; - alignItems: string | null; - alignSelf: string | null; - alignmentBaseline: string | null; - animation: string | null; - animationDelay: string | null; - animationDirection: string | null; - animationDuration: string | null; - animationFillMode: string | null; - animationIterationCount: string | null; - animationName: string | null; - animationPlayState: string | null; - animationTimingFunction: string | null; - backfaceVisibility: string | null; - background: string | null; - backgroundAttachment: string | null; - backgroundClip: string | null; - backgroundColor: string | null; - backgroundImage: string | null; - backgroundOrigin: string | null; - backgroundPosition: string | null; - backgroundPositionX: string | null; - backgroundPositionY: string | null; - backgroundRepeat: string | null; - backgroundSize: string | null; - baselineShift: string | null; - border: string | null; - borderBottom: string | null; - borderBottomColor: string | null; - borderBottomLeftRadius: string | null; - borderBottomRightRadius: string | null; - borderBottomStyle: string | null; - borderBottomWidth: string | null; - borderCollapse: string | null; - borderColor: string | null; - borderImage: string | null; - borderImageOutset: string | null; - borderImageRepeat: string | null; - borderImageSlice: string | null; - borderImageSource: string | null; - borderImageWidth: string | null; - borderLeft: string | null; - borderLeftColor: string | null; - borderLeftStyle: string | null; - borderLeftWidth: string | null; - borderRadius: string | null; - borderRight: string | null; - borderRightColor: string | null; - borderRightStyle: string | null; - borderRightWidth: string | null; - borderSpacing: string | null; - borderStyle: string | null; - borderTop: string | null; - borderTopColor: string | null; - borderTopLeftRadius: string | null; - borderTopRightRadius: string | null; - borderTopStyle: string | null; - borderTopWidth: string | null; - borderWidth: string | null; - bottom: string | null; - boxShadow: string | null; - boxSizing: string | null; - breakAfter: string | null; - breakBefore: string | null; - breakInside: string | null; - captionSide: string | null; - clear: string | null; - clip: string | null; - clipPath: string | null; - clipRule: string | null; - color: string | null; - colorInterpolationFilters: string | null; - columnCount: any; - columnFill: string | null; - columnGap: any; - columnRule: string | null; - columnRuleColor: any; - columnRuleStyle: string | null; - columnRuleWidth: any; - columnSpan: string | null; - columnWidth: any; - columns: string | null; - content: string | null; - counterIncrement: string | null; - counterReset: string | null; - cssFloat: string | null; - cssText: string; - cursor: string | null; - direction: string | null; - display: string | null; - dominantBaseline: string | null; - emptyCells: string | null; - enableBackground: string | null; - fill: string | null; - fillOpacity: string | null; - fillRule: string | null; - filter: string | null; - flex: string | null; - flexBasis: string | null; - flexDirection: string | null; - flexFlow: string | null; - flexGrow: string | null; - flexShrink: string | null; - flexWrap: string | null; - floodColor: string | null; - floodOpacity: string | null; - font: string | null; - fontFamily: string | null; - fontFeatureSettings: string | null; - fontSize: string | null; - fontSizeAdjust: string | null; - fontStretch: string | null; - fontStyle: string | null; - fontVariant: string | null; - fontWeight: string | null; - glyphOrientationHorizontal: string | null; - glyphOrientationVertical: string | null; - height: string | null; - imeMode: string | null; - justifyContent: string | null; - kerning: string | null; - left: string | null; - readonly length: number; - letterSpacing: string | null; - lightingColor: string | null; - lineHeight: string | null; - listStyle: string | null; - listStyleImage: string | null; - listStylePosition: string | null; - listStyleType: string | null; - margin: string | null; - marginBottom: string | null; - marginLeft: string | null; - marginRight: string | null; - marginTop: string | null; - marker: string | null; - markerEnd: string | null; - markerMid: string | null; - markerStart: string | null; - mask: string | null; - maxHeight: string | null; - maxWidth: string | null; - minHeight: string | null; - minWidth: string | null; - msContentZoomChaining: string | null; - msContentZoomLimit: string | null; - msContentZoomLimitMax: any; - msContentZoomLimitMin: any; - msContentZoomSnap: string | null; - msContentZoomSnapPoints: string | null; - msContentZoomSnapType: string | null; - msContentZooming: string | null; - msFlowFrom: string | null; - msFlowInto: string | null; - msFontFeatureSettings: string | null; - msGridColumn: any; - msGridColumnAlign: string | null; - msGridColumnSpan: any; - msGridColumns: string | null; - msGridRow: any; - msGridRowAlign: string | null; - msGridRowSpan: any; - msGridRows: string | null; - msHighContrastAdjust: string | null; - msHyphenateLimitChars: string | null; - msHyphenateLimitLines: any; - msHyphenateLimitZone: any; - msHyphens: string | null; - msImeAlign: string | null; - msOverflowStyle: string | null; - msScrollChaining: string | null; - msScrollLimit: string | null; - msScrollLimitXMax: any; - msScrollLimitXMin: any; - msScrollLimitYMax: any; - msScrollLimitYMin: any; - msScrollRails: string | null; - msScrollSnapPointsX: string | null; - msScrollSnapPointsY: string | null; - msScrollSnapType: string | null; - msScrollSnapX: string | null; - msScrollSnapY: string | null; - msScrollTranslation: string | null; - msTextCombineHorizontal: string | null; - msTextSizeAdjust: any; - msTouchAction: string | null; - msTouchSelect: string | null; - msUserSelect: string | null; - msWrapFlow: string; - msWrapMargin: any; - msWrapThrough: string; - opacity: string | null; - order: string | null; - orphans: string | null; - outline: string | null; - outlineColor: string | null; - outlineStyle: string | null; - outlineWidth: string | null; - overflow: string | null; - overflowX: string | null; - overflowY: string | null; - padding: string | null; - paddingBottom: string | null; - paddingLeft: string | null; - paddingRight: string | null; - paddingTop: string | null; - pageBreakAfter: string | null; - pageBreakBefore: string | null; - pageBreakInside: string | null; - readonly parentRule: CSSRule; - perspective: string | null; - perspectiveOrigin: string | null; - pointerEvents: string | null; - position: string | null; - quotes: string | null; - right: string | null; - rubyAlign: string | null; - rubyOverhang: string | null; - rubyPosition: string | null; - stopColor: string | null; - stopOpacity: string | null; - stroke: string | null; - strokeDasharray: string | null; - strokeDashoffset: string | null; - strokeLinecap: string | null; - strokeLinejoin: string | null; - strokeMiterlimit: string | null; - strokeOpacity: string | null; - strokeWidth: string | null; - tableLayout: string | null; - textAlign: string | null; - textAlignLast: string | null; - textAnchor: string | null; - textDecoration: string | null; - textIndent: string | null; - textJustify: string | null; - textKashida: string | null; - textKashidaSpace: string | null; - textOverflow: string | null; - textShadow: string | null; - textTransform: string | null; - textUnderlinePosition: string | null; - top: string | null; - touchAction: string | null; - transform: string | null; - transformOrigin: string | null; - transformStyle: string | null; - transition: string | null; - transitionDelay: string | null; - transitionDuration: string | null; - transitionProperty: string | null; - transitionTimingFunction: string | null; - unicodeBidi: string | null; - verticalAlign: string | null; - visibility: string | null; - webkitAlignContent: string | null; - webkitAlignItems: string | null; - webkitAlignSelf: string | null; - webkitAnimation: string | null; - webkitAnimationDelay: string | null; - webkitAnimationDirection: string | null; - webkitAnimationDuration: string | null; - webkitAnimationFillMode: string | null; - webkitAnimationIterationCount: string | null; - webkitAnimationName: string | null; - webkitAnimationPlayState: string | null; - webkitAnimationTimingFunction: string | null; - webkitAppearance: string | null; - webkitBackfaceVisibility: string | null; - webkitBackgroundClip: string | null; - webkitBackgroundOrigin: string | null; - webkitBackgroundSize: string | null; - webkitBorderBottomLeftRadius: string | null; - webkitBorderBottomRightRadius: string | null; - webkitBorderImage: string | null; - webkitBorderRadius: string | null; - webkitBorderTopLeftRadius: string | null; - webkitBorderTopRightRadius: string | null; - webkitBoxAlign: string | null; - webkitBoxDirection: string | null; - webkitBoxFlex: string | null; - webkitBoxOrdinalGroup: string | null; - webkitBoxOrient: string | null; - webkitBoxPack: string | null; - webkitBoxSizing: string | null; - webkitColumnBreakAfter: string | null; - webkitColumnBreakBefore: string | null; - webkitColumnBreakInside: string | null; - webkitColumnCount: any; - webkitColumnGap: any; - webkitColumnRule: string | null; - webkitColumnRuleColor: any; - webkitColumnRuleStyle: string | null; - webkitColumnRuleWidth: any; - webkitColumnSpan: string | null; - webkitColumnWidth: any; - webkitColumns: string | null; - webkitFilter: string | null; - webkitFlex: string | null; - webkitFlexBasis: string | null; - webkitFlexDirection: string | null; - webkitFlexFlow: string | null; - webkitFlexGrow: string | null; - webkitFlexShrink: string | null; - webkitFlexWrap: string | null; - webkitJustifyContent: string | null; - webkitOrder: string | null; - webkitPerspective: string | null; - webkitPerspectiveOrigin: string | null; - webkitTapHighlightColor: string | null; - webkitTextFillColor: string | null; - webkitTextSizeAdjust: any; - webkitTransform: string | null; - webkitTransformOrigin: string | null; - webkitTransformStyle: string | null; - webkitTransition: string | null; - webkitTransitionDelay: string | null; - webkitTransitionDuration: string | null; - webkitTransitionProperty: string | null; - webkitTransitionTimingFunction: string | null; - webkitUserModify: string | null; - webkitUserSelect: string | null; - webkitWritingMode: string | null; - whiteSpace: string | null; - widows: string | null; - width: string | null; - wordBreak: string | null; - wordSpacing: string | null; - wordWrap: string | null; - writingMode: string | null; - zIndex: string | null; - zoom: string | null; - resize: string | null; - getPropertyPriority(propertyName: string): string; - getPropertyValue(propertyName: string): string; - item(index: number): string; - removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string | null, priority?: string): void; - [index: number]: string; -} - -declare var CSSStyleDeclaration: { - prototype: CSSStyleDeclaration; - new(): CSSStyleDeclaration; -} - -interface CSSStyleRule extends CSSRule { - readonly readOnly: boolean; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSStyleRule: { - prototype: CSSStyleRule; - new(): CSSStyleRule; -} - -interface CSSStyleSheet extends StyleSheet { - readonly cssRules: CSSRuleList; - cssText: string; - readonly href: string; - readonly id: string; - readonly imports: StyleSheetList; - readonly isAlternate: boolean; - readonly isPrefAlternate: boolean; - readonly ownerRule: CSSRule; - readonly owningElement: Element; - readonly pages: StyleSheetPageList; - readonly readOnly: boolean; - readonly rules: CSSRuleList; - addImport(bstrURL: string, lIndex?: number): number; - addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; - addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; - removeImport(lIndex: number): void; - removeRule(lIndex: number): void; -} - -declare var CSSStyleSheet: { - prototype: CSSStyleSheet; - new(): CSSStyleSheet; -} - -interface CSSSupportsRule extends CSSConditionRule { -} - -declare var CSSSupportsRule: { - prototype: CSSSupportsRule; - new(): CSSSupportsRule; -} - -interface CanvasGradient { - addColorStop(offset: number, color: string): void; -} - -declare var CanvasGradient: { - prototype: CanvasGradient; - new(): CanvasGradient; -} - -interface CanvasPattern { - setTransform(matrix: SVGMatrix): void; -} - -declare var CanvasPattern: { - prototype: CanvasPattern; - new(): CanvasPattern; -} - -interface CanvasRenderingContext2D extends Object, CanvasPathMethods { - readonly canvas: HTMLCanvasElement; - fillStyle: string | CanvasGradient | CanvasPattern; - font: string; - globalAlpha: number; - globalCompositeOperation: string; - lineCap: string; - lineDashOffset: number; - lineJoin: string; - lineWidth: number; - miterLimit: number; - msFillRule: string; - msImageSmoothingEnabled: boolean; - shadowBlur: number; - shadowColor: string; - shadowOffsetX: number; - shadowOffsetY: number; - strokeStyle: string | CanvasGradient | CanvasPattern; - textAlign: string; - textBaseline: string; - mozImageSmoothingEnabled: boolean; - webkitImageSmoothingEnabled: boolean; - oImageSmoothingEnabled: boolean; - beginPath(): void; - clearRect(x: number, y: number, w: number, h: number): void; - clip(fillRule?: string): void; - createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; - createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; - createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; - drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; - fill(fillRule?: string): void; - fillRect(x: number, y: number, w: number, h: number): void; - fillText(text: string, x: number, y: number, maxWidth?: number): void; - getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; - getLineDash(): number[]; - isPointInPath(x: number, y: number, fillRule?: string): boolean; - measureText(text: string): TextMetrics; - putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - restore(): void; - rotate(angle: number): void; - save(): void; - scale(x: number, y: number): void; - setLineDash(segments: number[]): void; - setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - stroke(): void; - strokeRect(x: number, y: number, w: number, h: number): void; - strokeText(text: string, x: number, y: number, maxWidth?: number): void; - transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - translate(x: number, y: number): void; -} - -declare var CanvasRenderingContext2D: { - prototype: CanvasRenderingContext2D; - new(): CanvasRenderingContext2D; -} - -interface ChannelMergerNode extends AudioNode { -} - -declare var ChannelMergerNode: { - prototype: ChannelMergerNode; - new(): ChannelMergerNode; -} - -interface ChannelSplitterNode extends AudioNode { -} - -declare var ChannelSplitterNode: { - prototype: ChannelSplitterNode; - new(): ChannelSplitterNode; -} - -interface CharacterData extends Node, ChildNode { - data: string; - readonly length: number; - appendData(arg: string): void; - deleteData(offset: number, count: number): void; - insertData(offset: number, arg: string): void; - replaceData(offset: number, count: number, arg: string): void; - substringData(offset: number, count: number): string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var CharacterData: { - prototype: CharacterData; - new(): CharacterData; -} - -interface ClientRect { - bottom: number; - readonly height: number; - left: number; - right: number; - top: number; - readonly width: number; -} - -declare var ClientRect: { - prototype: ClientRect; - new(): ClientRect; -} - -interface ClientRectList { - readonly length: number; - item(index: number): ClientRect; - [index: number]: ClientRect; -} - -declare var ClientRectList: { - prototype: ClientRectList; - new(): ClientRectList; -} - -interface ClipboardEvent extends Event { - readonly clipboardData: DataTransfer; -} - -declare var ClipboardEvent: { - prototype: ClipboardEvent; - new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; -} - -interface CloseEvent extends Event { - readonly code: number; - readonly reason: string; - readonly wasClean: boolean; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(): CloseEvent; -} - -interface CommandEvent extends Event { - readonly commandName: string; - readonly detail: string | null; -} - -declare var CommandEvent: { - prototype: CommandEvent; - new(type: string, eventInitDict?: CommandEventInit): CommandEvent; -} - -interface Comment extends CharacterData { - text: string; -} - -declare var Comment: { - prototype: Comment; - new(): Comment; -} - -interface CompositionEvent extends UIEvent { - readonly data: string; - readonly locale: string; - initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; -} - -declare var CompositionEvent: { - prototype: CompositionEvent; - new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; -} - -interface Console { - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - clear(): void; - count(countTitle?: string): void; - debug(message?: string, ...optionalParams: any[]): void; - dir(value?: any, ...optionalParams: any[]): void; - dirxml(value: any): void; - error(message?: any, ...optionalParams: any[]): void; - exception(message?: string, ...optionalParams: any[]): void; - group(groupTitle?: string): void; - groupCollapsed(groupTitle?: string): void; - groupEnd(): void; - info(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: Element): boolean; - profile(reportName?: string): void; - profileEnd(): void; - select(element: Element): void; - table(...data: any[]): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(message?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; -} - -declare var Console: { - prototype: Console; - new(): Console; -} - -interface ConvolverNode extends AudioNode { - buffer: AudioBuffer | null; - normalize: boolean; -} - -declare var ConvolverNode: { - prototype: ConvolverNode; - new(): ConvolverNode; -} - -interface Coordinates { - readonly accuracy: number; - readonly altitude: number | null; - readonly altitudeAccuracy: number | null; - readonly heading: number | null; - readonly latitude: number; - readonly longitude: number; - readonly speed: number | null; -} - -declare var Coordinates: { - prototype: Coordinates; - new(): Coordinates; -} - -interface Crypto extends Object, RandomSource { - readonly subtle: SubtleCrypto; -} - -declare var Crypto: { - prototype: Crypto; - new(): Crypto; -} - -interface CryptoKey { - readonly algorithm: KeyAlgorithm; - readonly extractable: boolean; - readonly type: string; - readonly usages: string[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -} - -interface CryptoKeyPair { - privateKey: CryptoKey; - publicKey: CryptoKey; -} - -declare var CryptoKeyPair: { - prototype: CryptoKeyPair; - new(): CryptoKeyPair; -} - -interface CustomEvent extends Event { - readonly detail: any; - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; -} - -declare var CustomEvent: { - prototype: CustomEvent; - new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; -} - -interface DOMError { - readonly name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -} - -interface DOMException { - readonly code: number; - readonly message: string; - readonly name: string; - toString(): string; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(): DOMException; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -interface DOMImplementation { - createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; - createHTMLDocument(title: string): Document; - hasFeature(feature: string | null, version: string | null): boolean; -} - -declare var DOMImplementation: { - prototype: DOMImplementation; - new(): DOMImplementation; -} - -interface DOMParser { - parseFromString(source: string, mimeType: string): Document; -} - -declare var DOMParser: { - prototype: DOMParser; - new(): DOMParser; -} - -interface DOMSettableTokenList extends DOMTokenList { - value: string; -} - -declare var DOMSettableTokenList: { - prototype: DOMSettableTokenList; - new(): DOMSettableTokenList; -} - -interface DOMStringList { - readonly length: number; - contains(str: string): boolean; - item(index: number): string | null; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -} - -interface DOMStringMap { - [name: string]: string; -} - -declare var DOMStringMap: { - prototype: DOMStringMap; - new(): DOMStringMap; -} - -interface DOMTokenList { - readonly length: number; - add(...token: string[]): void; - contains(token: string): boolean; - item(index: number): string; - remove(...token: string[]): void; - toString(): string; - toggle(token: string, force?: boolean): boolean; - [index: number]: string; -} - -declare var DOMTokenList: { - prototype: DOMTokenList; - new(): DOMTokenList; -} - -interface DataCue extends TextTrackCue { - data: ArrayBuffer; -} - -declare var DataCue: { - prototype: DataCue; - new(): DataCue; -} - -interface DataTransfer { - dropEffect: string; - effectAllowed: string; - readonly files: FileList; - readonly items: DataTransferItemList; - readonly types: string[]; - clearData(format?: string): boolean; - getData(format: string): string; - setData(format: string, data: string): boolean; -} - -declare var DataTransfer: { - prototype: DataTransfer; - new(): DataTransfer; -} - -interface DataTransferItem { - readonly kind: string; - readonly type: string; - getAsFile(): File | null; - getAsString(_callback: FunctionStringCallback | null): void; -} - -declare var DataTransferItem: { - prototype: DataTransferItem; - new(): DataTransferItem; -} - -interface DataTransferItemList { - readonly length: number; - add(data: File): DataTransferItem | null; - clear(): void; - item(index: number): DataTransferItem; - remove(index: number): void; - [index: number]: DataTransferItem; -} - -declare var DataTransferItemList: { - prototype: DataTransferItemList; - new(): DataTransferItemList; -} - -interface DeferredPermissionRequest { - readonly id: number; - readonly type: string; - readonly uri: string; - allow(): void; - deny(): void; -} - -declare var DeferredPermissionRequest: { - prototype: DeferredPermissionRequest; - new(): DeferredPermissionRequest; -} - -interface DelayNode extends AudioNode { - readonly delayTime: AudioParam; -} - -declare var DelayNode: { - prototype: DelayNode; - new(): DelayNode; -} - -interface DeviceAcceleration { - readonly x: number | null; - readonly y: number | null; - readonly z: number | null; -} - -declare var DeviceAcceleration: { - prototype: DeviceAcceleration; - new(): DeviceAcceleration; -} - -interface DeviceLightEvent extends Event { - readonly value: number; -} - -declare var DeviceLightEvent: { - prototype: DeviceLightEvent; - new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; -} - -interface DeviceMotionEvent extends Event { - readonly acceleration: DeviceAcceleration | null; - readonly accelerationIncludingGravity: DeviceAcceleration | null; - readonly interval: number | null; - readonly rotationRate: DeviceRotationRate | null; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; -} - -declare var DeviceMotionEvent: { - prototype: DeviceMotionEvent; - new(): DeviceMotionEvent; -} - -interface DeviceOrientationEvent extends Event { - readonly absolute: boolean; - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; -} - -declare var DeviceOrientationEvent: { - prototype: DeviceOrientationEvent; - new(): DeviceOrientationEvent; -} - -interface DeviceRotationRate { - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; -} - -declare var DeviceRotationRate: { - prototype: DeviceRotationRate; - new(): DeviceRotationRate; -} - -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode { - /** - * Sets or gets the URL for the current document. - */ - readonly URL: string; - /** - * Gets the URL for the document, stripped of any character encoding. - */ - readonly URLUnencoded: string; - /** - * Gets the object that has the focus when the parent document has focus. - */ - readonly activeElement: Element; - /** - * Sets or gets the color of all active links in the document. - */ - alinkColor: string; - /** - * Returns a reference to the collection of elements contained by the object. - */ - readonly all: HTMLAllCollection; - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. - */ - anchors: HTMLCollectionOf; - /** - * Retrieves a collection of all applet objects in the document. - */ - applets: HTMLCollectionOf; - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. - */ - bgColor: string; - /** - * Specifies the beginning and end of the document body. - */ - body: HTMLElement; - readonly characterSet: string; - /** - * Gets or sets the character set used to encode the object. - */ - charset: string; - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. - */ - readonly compatMode: string; - cookie: string; - readonly currentScript: HTMLScriptElement | SVGScriptElement; - /** - * Gets the default character set from the current regional language settings. - */ - readonly defaultCharset: string; - readonly defaultView: Window; - /** - * Sets or gets a value that indicates whether the document can be edited. - */ - designMode: string; - /** - * Sets or retrieves a value that indicates the reading order of the object. - */ - dir: string; - /** - * Gets an object representing the document type declaration associated with the current document. - */ - readonly doctype: DocumentType; - /** - * Gets a reference to the root node of the document. - */ - documentElement: HTMLElement; - /** - * Sets or gets the security domain of the document. - */ - domain: string; - /** - * Retrieves a collection of all embed objects in the document. - */ - embeds: HTMLCollectionOf; - /** - * Sets or gets the foreground (text) color of the document. - */ - fgColor: string; - /** - * Retrieves a collection, in source order, of all form objects in the document. - */ - forms: HTMLCollectionOf; - readonly fullscreenElement: Element | null; - readonly fullscreenEnabled: boolean; - readonly head: HTMLHeadElement; - readonly hidden: boolean; - /** - * Retrieves a collection, in source order, of img objects in the document. - */ - images: HTMLCollectionOf; - /** - * Gets the implementation object of the current document. - */ - readonly implementation: DOMImplementation; - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. - */ - readonly inputEncoding: string | null; - /** - * Gets the date that the page was last modified, if the page supplies one. - */ - readonly lastModified: string; - /** - * Sets or gets the color of the document links. - */ - linkColor: string; - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. - */ - links: HTMLCollectionOf; - /** - * Contains information about the current URL. - */ - readonly location: Location; - msCSSOMElementFloatMetrics: boolean; - msCapsLockWarningOff: boolean; - /** - * Fires when the user aborts the download. - * @param ev The event. - */ - onabort: (this: this, ev: UIEvent) => any; - /** - * Fires when the object is set as the active element. - * @param ev The event. - */ - onactivate: (this: this, ev: UIEvent) => any; - /** - * Fires immediately before the object is set as the active element. - * @param ev The event. - */ - onbeforeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires immediately before the activeElement is changed from the current object to another object in the parent document. - * @param ev The event. - */ - onbeforedeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. - * @param ev The focus event. - */ - onblur: (this: this, ev: FocusEvent) => any; - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. - */ - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. - */ - onchange: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. - */ - onclick: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. - */ - oncontextmenu: (this: this, ev: PointerEvent) => any; - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. - */ - ondblclick: (this: this, ev: MouseEvent) => any; - /** - * Fires when the activeElement is changed from the current object to another object in the parent document. - * @param ev The UI Event - */ - ondeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. - */ - ondrag: (this: this, ev: DragEvent) => any; - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. - */ - ondragend: (this: this, ev: DragEvent) => any; - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. - */ - ondragenter: (this: this, ev: DragEvent) => any; - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. - */ - ondragleave: (this: this, ev: DragEvent) => any; - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. - */ - ondragover: (this: this, ev: DragEvent) => any; - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. - */ - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - /** - * Occurs when the duration attribute is updated. - * @param ev The event. - */ - ondurationchange: (this: this, ev: Event) => any; - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. - */ - onemptied: (this: this, ev: Event) => any; - /** - * Occurs when the end of playback is reached. - * @param ev The event - */ - onended: (this: this, ev: MediaStreamErrorEvent) => any; - /** - * Fires when an error occurs during object loading. - * @param ev The event. - */ - onerror: (this: this, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - * @param ev The event. - */ - onfocus: (this: this, ev: FocusEvent) => any; - onfullscreenchange: (this: this, ev: Event) => any; - onfullscreenerror: (this: this, ev: Event) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - /** - * Fires when the user presses a key. - * @param ev The keyboard event - */ - onkeydown: (this: this, ev: KeyboardEvent) => any; - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. - */ - onkeypress: (this: this, ev: KeyboardEvent) => any; - /** - * Fires when the user releases a key. - * @param ev The keyboard event - */ - onkeyup: (this: this, ev: KeyboardEvent) => any; - /** - * Fires immediately after the browser loads the object. - * @param ev The event. - */ - onload: (this: this, ev: Event) => any; - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. - */ - onloadeddata: (this: this, ev: Event) => any; - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. - */ - onloadedmetadata: (this: this, ev: Event) => any; - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. - */ - onloadstart: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. - */ - onmousedown: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. - */ - onmousemove: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. - */ - onmouseout: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. - */ - onmouseover: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. - */ - onmouseup: (this: this, ev: MouseEvent) => any; - /** - * Fires when the wheel button is rotated. - * @param ev The mouse event - */ - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. - * @param ev The event. - */ - onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any; - /** - * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. - * @param ev The event. - */ - onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any; - /** - * Occurs when playback is paused. - * @param ev The event. - */ - onpause: (this: this, ev: Event) => any; - /** - * Occurs when the play method is requested. - * @param ev The event. - */ - onplay: (this: this, ev: Event) => any; - /** - * Occurs when the audio or video has started playing. - * @param ev The event. - */ - onplaying: (this: this, ev: Event) => any; - onpointerlockchange: (this: this, ev: Event) => any; - onpointerlockerror: (this: this, ev: Event) => any; - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. - */ - onprogress: (this: this, ev: ProgressEvent) => any; - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. - */ - onratechange: (this: this, ev: Event) => any; - /** - * Fires when the state of the object has changed. - * @param ev The event - */ - onreadystatechange: (this: this, ev: ProgressEvent) => any; - /** - * Fires when the user resets a form. - * @param ev The event. - */ - onreset: (this: this, ev: Event) => any; - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. - */ - onscroll: (this: this, ev: UIEvent) => any; - /** - * Occurs when the seek operation ends. - * @param ev The event. - */ - onseeked: (this: this, ev: Event) => any; - /** - * Occurs when the current playback position is moved. - * @param ev The event. - */ - onseeking: (this: this, ev: Event) => any; - /** - * Fires when the current selection changes. - * @param ev The event. - */ - onselect: (this: this, ev: UIEvent) => any; - /** - * Fires when the selection state of a document changes. - * @param ev The event. - */ - onselectionchange: (this: this, ev: Event) => any; - onselectstart: (this: this, ev: Event) => any; - /** - * Occurs when the download has stopped. - * @param ev The event. - */ - onstalled: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the Stop button or leaves the Web page. - * @param ev The event. - */ - onstop: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. - */ - onsuspend: (this: this, ev: Event) => any; - /** - * Occurs to indicate the current playback position. - * @param ev The event. - */ - ontimeupdate: (this: this, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. - */ - onvolumechange: (this: this, ev: Event) => any; - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. - */ - onwaiting: (this: this, ev: Event) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; - plugins: HTMLCollectionOf; - readonly pointerLockElement: Element; - /** - * Retrieves a value that indicates the current state of the object. - */ - readonly readyState: string; - /** - * Gets the URL of the location that referred the user to the current page. - */ - readonly referrer: string; - /** - * Gets the root svg element in the document hierarchy. - */ - readonly rootElement: SVGSVGElement; - /** - * Retrieves a collection of all script objects in the document. - */ - scripts: HTMLCollectionOf; - readonly scrollingElement: Element | null; - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. - */ - readonly styleSheets: StyleSheetList; - /** - * Contains the title of the document. - */ - title: string; - readonly visibilityState: string; - /** - * Sets or gets the color of the links that the user has visited. - */ - vlinkColor: string; - readonly webkitCurrentFullScreenElement: Element | null; - readonly webkitFullscreenElement: Element | null; - readonly webkitFullscreenEnabled: boolean; - readonly webkitIsFullScreen: boolean; - readonly xmlEncoding: string | null; - xmlStandalone: boolean; - /** - * Gets or sets the version attribute specified in the declaration of an XML document. - */ - xmlVersion: string | null; - adoptNode(source: Node): Node; - captureEvents(): void; - caretRangeFromPoint(x: number, y: number): Range; - clear(): void; - /** - * Closes an output stream and forces the sent data to display. - */ - close(): void; - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. - */ - createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; - createCDATASection(data: string): CDATASection; - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. - */ - createComment(data: string): Comment; - /** - * Creates a new document. - */ - createDocumentFragment(): DocumentFragment; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "applet"): HTMLAppletElement; - createElement(tagName: "area"): HTMLAreaElement; - createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "base"): HTMLBaseElement; - createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "blockquote"): HTMLQuoteElement; - createElement(tagName: "body"): HTMLBodyElement; - createElement(tagName: "br"): HTMLBRElement; - createElement(tagName: "button"): HTMLButtonElement; - createElement(tagName: "canvas"): HTMLCanvasElement; - createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "col"): HTMLTableColElement; - createElement(tagName: "colgroup"): HTMLTableColElement; - createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dir"): HTMLDirectoryElement; - createElement(tagName: "div"): HTMLDivElement; - createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "embed"): HTMLEmbedElement; - createElement(tagName: "fieldset"): HTMLFieldSetElement; - createElement(tagName: "font"): HTMLFontElement; - createElement(tagName: "form"): HTMLFormElement; - createElement(tagName: "frame"): HTMLFrameElement; - createElement(tagName: "frameset"): HTMLFrameSetElement; - createElement(tagName: "h1"): HTMLHeadingElement; - createElement(tagName: "h2"): HTMLHeadingElement; - createElement(tagName: "h3"): HTMLHeadingElement; - createElement(tagName: "h4"): HTMLHeadingElement; - createElement(tagName: "h5"): HTMLHeadingElement; - createElement(tagName: "h6"): HTMLHeadingElement; - createElement(tagName: "head"): HTMLHeadElement; - createElement(tagName: "hr"): HTMLHRElement; - createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "iframe"): HTMLIFrameElement; - createElement(tagName: "img"): HTMLImageElement; - createElement(tagName: "input"): HTMLInputElement; - createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLUnknownElement; - createElement(tagName: "label"): HTMLLabelElement; - createElement(tagName: "legend"): HTMLLegendElement; - createElement(tagName: "li"): HTMLLIElement; - createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLPreElement; - createElement(tagName: "map"): HTMLMapElement; - createElement(tagName: "marquee"): HTMLMarqueeElement; - createElement(tagName: "menu"): HTMLMenuElement; - createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "meter"): HTMLMeterElement; - createElement(tagName: "nextid"): HTMLUnknownElement; - createElement(tagName: "object"): HTMLObjectElement; - createElement(tagName: "ol"): HTMLOListElement; - createElement(tagName: "optgroup"): HTMLOptGroupElement; - createElement(tagName: "option"): HTMLOptionElement; - createElement(tagName: "p"): HTMLParagraphElement; - createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "picture"): HTMLPictureElement; - createElement(tagName: "pre"): HTMLPreElement; - createElement(tagName: "progress"): HTMLProgressElement; - createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "script"): HTMLScriptElement; - createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "source"): HTMLSourceElement; - createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "table"): HTMLTableElement; - createElement(tagName: "tbody"): HTMLTableSectionElement; - createElement(tagName: "td"): HTMLTableDataCellElement; - createElement(tagName: "template"): HTMLTemplateElement; - createElement(tagName: "textarea"): HTMLTextAreaElement; - createElement(tagName: "tfoot"): HTMLTableSectionElement; - createElement(tagName: "th"): HTMLTableHeaderCellElement; - createElement(tagName: "thead"): HTMLTableSectionElement; - createElement(tagName: "title"): HTMLTitleElement; - createElement(tagName: "tr"): HTMLTableRowElement; - createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "video"): HTMLVideoElement; - createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLPreElement; - createElement(tagName: string): HTMLElement; - createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string | null, qualifiedName: string): Element; - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver: Node): XPathNSResolver; - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; - createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. - */ - createRange(): Range; - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. - */ - createTextNode(data: string): Text; - createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; - createTouchList(...touches: Touch[]): TouchList; - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset - */ - elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. - */ - execCommand(commandId: string, showUI?: boolean, value?: any): boolean; - /** - * Displays help information for the given command identifier. - * @param commandId Displays help information for the given command identifier. - */ - execCommandShowHelp(commandId: string): boolean; - exitFullscreen(): void; - exitPointerLock(): void; - /** - * Causes the element to receive the focus and executes the code specified by the onfocus event. - */ - focus(): void; - /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. - */ - getElementById(elementId: string): HTMLElement | null; - getElementsByClassName(classNames: string): HTMLCollectionOf; - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. - */ - getElementsByName(elementName: string): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; - getElementsByTagName(tagname: "applet"): NodeListOf; - getElementsByTagName(tagname: "area"): NodeListOf; - getElementsByTagName(tagname: "article"): NodeListOf; - getElementsByTagName(tagname: "aside"): NodeListOf; - getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; - getElementsByTagName(tagname: "base"): NodeListOf; - getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; - getElementsByTagName(tagname: "body"): NodeListOf; - getElementsByTagName(tagname: "br"): NodeListOf; - getElementsByTagName(tagname: "button"): NodeListOf; - getElementsByTagName(tagname: "canvas"): NodeListOf; - getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; - getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; - getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; - getElementsByTagName(tagname: "col"): NodeListOf; - getElementsByTagName(tagname: "colgroup"): NodeListOf; - getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; - getElementsByTagName(tagname: "defs"): NodeListOf; - getElementsByTagName(tagname: "del"): NodeListOf; - getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; - getElementsByTagName(tagname: "dir"): NodeListOf; - getElementsByTagName(tagname: "div"): NodeListOf; - getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; - getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; - getElementsByTagName(tagname: "embed"): NodeListOf; - getElementsByTagName(tagname: "feblend"): NodeListOf; - getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; - getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(tagname: "fecomposite"): NodeListOf; - getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; - getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; - getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; - getElementsByTagName(tagname: "fedistantlight"): NodeListOf; - getElementsByTagName(tagname: "feflood"): NodeListOf; - getElementsByTagName(tagname: "fefunca"): NodeListOf; - getElementsByTagName(tagname: "fefuncb"): NodeListOf; - getElementsByTagName(tagname: "fefuncg"): NodeListOf; - getElementsByTagName(tagname: "fefuncr"): NodeListOf; - getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; - getElementsByTagName(tagname: "feimage"): NodeListOf; - getElementsByTagName(tagname: "femerge"): NodeListOf; - getElementsByTagName(tagname: "femergenode"): NodeListOf; - getElementsByTagName(tagname: "femorphology"): NodeListOf; - getElementsByTagName(tagname: "feoffset"): NodeListOf; - getElementsByTagName(tagname: "fepointlight"): NodeListOf; - getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; - getElementsByTagName(tagname: "fespotlight"): NodeListOf; - getElementsByTagName(tagname: "fetile"): NodeListOf; - getElementsByTagName(tagname: "feturbulence"): NodeListOf; - getElementsByTagName(tagname: "fieldset"): NodeListOf; - getElementsByTagName(tagname: "figcaption"): NodeListOf; - getElementsByTagName(tagname: "figure"): NodeListOf; - getElementsByTagName(tagname: "filter"): NodeListOf; - getElementsByTagName(tagname: "font"): NodeListOf; - getElementsByTagName(tagname: "footer"): NodeListOf; - getElementsByTagName(tagname: "foreignobject"): NodeListOf; - getElementsByTagName(tagname: "form"): NodeListOf; - getElementsByTagName(tagname: "frame"): NodeListOf; - getElementsByTagName(tagname: "frameset"): NodeListOf; - getElementsByTagName(tagname: "g"): NodeListOf; - getElementsByTagName(tagname: "h1"): NodeListOf; - getElementsByTagName(tagname: "h2"): NodeListOf; - getElementsByTagName(tagname: "h3"): NodeListOf; - getElementsByTagName(tagname: "h4"): NodeListOf; - getElementsByTagName(tagname: "h5"): NodeListOf; - getElementsByTagName(tagname: "h6"): NodeListOf; - getElementsByTagName(tagname: "head"): NodeListOf; - getElementsByTagName(tagname: "header"): NodeListOf; - getElementsByTagName(tagname: "hgroup"): NodeListOf; - getElementsByTagName(tagname: "hr"): NodeListOf; - getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; - getElementsByTagName(tagname: "iframe"): NodeListOf; - getElementsByTagName(tagname: "image"): NodeListOf; - getElementsByTagName(tagname: "img"): NodeListOf; - getElementsByTagName(tagname: "input"): NodeListOf; - getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; - getElementsByTagName(tagname: "label"): NodeListOf; - getElementsByTagName(tagname: "legend"): NodeListOf; - getElementsByTagName(tagname: "li"): NodeListOf; - getElementsByTagName(tagname: "line"): NodeListOf; - getElementsByTagName(tagname: "lineargradient"): NodeListOf; - getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; - getElementsByTagName(tagname: "map"): NodeListOf; - getElementsByTagName(tagname: "mark"): NodeListOf; - getElementsByTagName(tagname: "marker"): NodeListOf; - getElementsByTagName(tagname: "marquee"): NodeListOf; - getElementsByTagName(tagname: "mask"): NodeListOf; - getElementsByTagName(tagname: "menu"): NodeListOf; - getElementsByTagName(tagname: "meta"): NodeListOf; - getElementsByTagName(tagname: "metadata"): NodeListOf; - getElementsByTagName(tagname: "meter"): NodeListOf; - getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; - getElementsByTagName(tagname: "noframes"): NodeListOf; - getElementsByTagName(tagname: "noscript"): NodeListOf; - getElementsByTagName(tagname: "object"): NodeListOf; - getElementsByTagName(tagname: "ol"): NodeListOf; - getElementsByTagName(tagname: "optgroup"): NodeListOf; - getElementsByTagName(tagname: "option"): NodeListOf; - getElementsByTagName(tagname: "p"): NodeListOf; - getElementsByTagName(tagname: "param"): NodeListOf; - getElementsByTagName(tagname: "path"): NodeListOf; - getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "picture"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; - getElementsByTagName(tagname: "polygon"): NodeListOf; - getElementsByTagName(tagname: "polyline"): NodeListOf; - getElementsByTagName(tagname: "pre"): NodeListOf; - getElementsByTagName(tagname: "progress"): NodeListOf; - getElementsByTagName(tagname: "q"): NodeListOf; - getElementsByTagName(tagname: "radialgradient"): NodeListOf; - getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; - getElementsByTagName(tagname: "script"): NodeListOf; - getElementsByTagName(tagname: "section"): NodeListOf; - getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; - getElementsByTagName(tagname: "source"): NodeListOf; - getElementsByTagName(tagname: "span"): NodeListOf; - getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; - getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; - getElementsByTagName(tagname: "svg"): NodeListOf; - getElementsByTagName(tagname: "switch"): NodeListOf; - getElementsByTagName(tagname: "symbol"): NodeListOf; - getElementsByTagName(tagname: "table"): NodeListOf; - getElementsByTagName(tagname: "tbody"): NodeListOf; - getElementsByTagName(tagname: "td"): NodeListOf; - getElementsByTagName(tagname: "template"): NodeListOf; - getElementsByTagName(tagname: "text"): NodeListOf; - getElementsByTagName(tagname: "textpath"): NodeListOf; - getElementsByTagName(tagname: "textarea"): NodeListOf; - getElementsByTagName(tagname: "tfoot"): NodeListOf; - getElementsByTagName(tagname: "th"): NodeListOf; - getElementsByTagName(tagname: "thead"): NodeListOf; - getElementsByTagName(tagname: "title"): NodeListOf; - getElementsByTagName(tagname: "tr"): NodeListOf; - getElementsByTagName(tagname: "track"): NodeListOf; - getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; - getElementsByTagName(tagname: "ul"): NodeListOf; - getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; - getElementsByTagName(tagname: "video"): NodeListOf; - getElementsByTagName(tagname: "view"): NodeListOf; - getElementsByTagName(tagname: "wbr"): NodeListOf; - getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; - getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. - */ - getSelection(): Selection; - /** - * Gets a value indicating whether the object currently has focus. - */ - hasFocus(): boolean; - importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeListOf; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. - */ - queryCommandEnabled(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. - */ - queryCommandIndeterm(commandId: string): boolean; - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. - */ - queryCommandState(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. - */ - queryCommandSupported(commandId: string): boolean; - /** - * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. - */ - queryCommandText(commandId: string): string; - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. - */ - queryCommandValue(commandId: string): string; - releaseEvents(): void; - /** - * Allows updating the print settings for the page. - */ - updateSettings(): void; - webkitCancelFullScreen(): void; - webkitExitFullscreen(): void; - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. - */ - write(...content: string[]): void; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...content: string[]): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var Document: { - prototype: Document; - new(): Document; -} - -interface DocumentFragment extends Node, NodeSelector, ParentNode { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DocumentFragment: { - prototype: DocumentFragment; - new(): DocumentFragment; -} - -interface DocumentType extends Node, ChildNode { - readonly entities: NamedNodeMap; - readonly internalSubset: string | null; - readonly name: string; - readonly notations: NamedNodeMap; - readonly publicId: string | null; - readonly systemId: string | null; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DocumentType: { - prototype: DocumentType; - new(): DocumentType; -} - -interface DragEvent extends MouseEvent { - readonly dataTransfer: DataTransfer; - initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; - msConvertURL(file: File, targetType: string, targetURL?: string): void; -} - -declare var DragEvent: { - prototype: DragEvent; - new(): DragEvent; -} - -interface DynamicsCompressorNode extends AudioNode { - readonly attack: AudioParam; - readonly knee: AudioParam; - readonly ratio: AudioParam; - readonly reduction: AudioParam; - readonly release: AudioParam; - readonly threshold: AudioParam; -} - -declare var DynamicsCompressorNode: { - prototype: DynamicsCompressorNode; - new(): DynamicsCompressorNode; -} - -interface EXT_frag_depth { -} - -declare var EXT_frag_depth: { - prototype: EXT_frag_depth; - new(): EXT_frag_depth; -} - -interface EXT_texture_filter_anisotropic { - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -declare var EXT_texture_filter_anisotropic: { - prototype: EXT_texture_filter_anisotropic; - new(): EXT_texture_filter_anisotropic; - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { - readonly classList: DOMTokenList; - className: string; - readonly clientHeight: number; - readonly clientLeft: number; - readonly clientTop: number; - readonly clientWidth: number; - id: string; - msContentZoomFactor: number; - readonly msRegionOverflow: string; - onariarequest: (this: this, ev: AriaRequestEvent) => any; - oncommand: (this: this, ev: CommandEvent) => any; - ongotpointercapture: (this: this, ev: PointerEvent) => any; - onlostpointercapture: (this: this, ev: PointerEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmslostpointercapture: (this: this, ev: MSPointerEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; - readonly prefix: string | null; - readonly scrollHeight: number; - scrollLeft: number; - scrollTop: number; - readonly scrollWidth: number; - readonly tagName: string; - innerHTML: string; - getAttribute(name: string): string | null; - getAttributeNS(namespaceURI: string, localName: string): string; - getAttributeNode(name: string): Attr; - getAttributeNodeNS(namespaceURI: string, localName: string): Attr; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; - getElementsByTagName(name: "applet"): NodeListOf; - getElementsByTagName(name: "area"): NodeListOf; - getElementsByTagName(name: "article"): NodeListOf; - getElementsByTagName(name: "aside"): NodeListOf; - getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; - getElementsByTagName(name: "base"): NodeListOf; - getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; - getElementsByTagName(name: "body"): NodeListOf; - getElementsByTagName(name: "br"): NodeListOf; - getElementsByTagName(name: "button"): NodeListOf; - getElementsByTagName(name: "canvas"): NodeListOf; - getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; - getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; - getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; - getElementsByTagName(name: "col"): NodeListOf; - getElementsByTagName(name: "colgroup"): NodeListOf; - getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; - getElementsByTagName(name: "defs"): NodeListOf; - getElementsByTagName(name: "del"): NodeListOf; - getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; - getElementsByTagName(name: "dir"): NodeListOf; - getElementsByTagName(name: "div"): NodeListOf; - getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; - getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; - getElementsByTagName(name: "embed"): NodeListOf; - getElementsByTagName(name: "feblend"): NodeListOf; - getElementsByTagName(name: "fecolormatrix"): NodeListOf; - getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(name: "fecomposite"): NodeListOf; - getElementsByTagName(name: "feconvolvematrix"): NodeListOf; - getElementsByTagName(name: "fediffuselighting"): NodeListOf; - getElementsByTagName(name: "fedisplacementmap"): NodeListOf; - getElementsByTagName(name: "fedistantlight"): NodeListOf; - getElementsByTagName(name: "feflood"): NodeListOf; - getElementsByTagName(name: "fefunca"): NodeListOf; - getElementsByTagName(name: "fefuncb"): NodeListOf; - getElementsByTagName(name: "fefuncg"): NodeListOf; - getElementsByTagName(name: "fefuncr"): NodeListOf; - getElementsByTagName(name: "fegaussianblur"): NodeListOf; - getElementsByTagName(name: "feimage"): NodeListOf; - getElementsByTagName(name: "femerge"): NodeListOf; - getElementsByTagName(name: "femergenode"): NodeListOf; - getElementsByTagName(name: "femorphology"): NodeListOf; - getElementsByTagName(name: "feoffset"): NodeListOf; - getElementsByTagName(name: "fepointlight"): NodeListOf; - getElementsByTagName(name: "fespecularlighting"): NodeListOf; - getElementsByTagName(name: "fespotlight"): NodeListOf; - getElementsByTagName(name: "fetile"): NodeListOf; - getElementsByTagName(name: "feturbulence"): NodeListOf; - getElementsByTagName(name: "fieldset"): NodeListOf; - getElementsByTagName(name: "figcaption"): NodeListOf; - getElementsByTagName(name: "figure"): NodeListOf; - getElementsByTagName(name: "filter"): NodeListOf; - getElementsByTagName(name: "font"): NodeListOf; - getElementsByTagName(name: "footer"): NodeListOf; - getElementsByTagName(name: "foreignobject"): NodeListOf; - getElementsByTagName(name: "form"): NodeListOf; - getElementsByTagName(name: "frame"): NodeListOf; - getElementsByTagName(name: "frameset"): NodeListOf; - getElementsByTagName(name: "g"): NodeListOf; - getElementsByTagName(name: "h1"): NodeListOf; - getElementsByTagName(name: "h2"): NodeListOf; - getElementsByTagName(name: "h3"): NodeListOf; - getElementsByTagName(name: "h4"): NodeListOf; - getElementsByTagName(name: "h5"): NodeListOf; - getElementsByTagName(name: "h6"): NodeListOf; - getElementsByTagName(name: "head"): NodeListOf; - getElementsByTagName(name: "header"): NodeListOf; - getElementsByTagName(name: "hgroup"): NodeListOf; - getElementsByTagName(name: "hr"): NodeListOf; - getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; - getElementsByTagName(name: "iframe"): NodeListOf; - getElementsByTagName(name: "image"): NodeListOf; - getElementsByTagName(name: "img"): NodeListOf; - getElementsByTagName(name: "input"): NodeListOf; - getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; - getElementsByTagName(name: "label"): NodeListOf; - getElementsByTagName(name: "legend"): NodeListOf; - getElementsByTagName(name: "li"): NodeListOf; - getElementsByTagName(name: "line"): NodeListOf; - getElementsByTagName(name: "lineargradient"): NodeListOf; - getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; - getElementsByTagName(name: "map"): NodeListOf; - getElementsByTagName(name: "mark"): NodeListOf; - getElementsByTagName(name: "marker"): NodeListOf; - getElementsByTagName(name: "marquee"): NodeListOf; - getElementsByTagName(name: "mask"): NodeListOf; - getElementsByTagName(name: "menu"): NodeListOf; - getElementsByTagName(name: "meta"): NodeListOf; - getElementsByTagName(name: "metadata"): NodeListOf; - getElementsByTagName(name: "meter"): NodeListOf; - getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; - getElementsByTagName(name: "noframes"): NodeListOf; - getElementsByTagName(name: "noscript"): NodeListOf; - getElementsByTagName(name: "object"): NodeListOf; - getElementsByTagName(name: "ol"): NodeListOf; - getElementsByTagName(name: "optgroup"): NodeListOf; - getElementsByTagName(name: "option"): NodeListOf; - getElementsByTagName(name: "p"): NodeListOf; - getElementsByTagName(name: "param"): NodeListOf; - getElementsByTagName(name: "path"): NodeListOf; - getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "picture"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; - getElementsByTagName(name: "polygon"): NodeListOf; - getElementsByTagName(name: "polyline"): NodeListOf; - getElementsByTagName(name: "pre"): NodeListOf; - getElementsByTagName(name: "progress"): NodeListOf; - getElementsByTagName(name: "q"): NodeListOf; - getElementsByTagName(name: "radialgradient"): NodeListOf; - getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; - getElementsByTagName(name: "script"): NodeListOf; - getElementsByTagName(name: "section"): NodeListOf; - getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; - getElementsByTagName(name: "source"): NodeListOf; - getElementsByTagName(name: "span"): NodeListOf; - getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; - getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; - getElementsByTagName(name: "svg"): NodeListOf; - getElementsByTagName(name: "switch"): NodeListOf; - getElementsByTagName(name: "symbol"): NodeListOf; - getElementsByTagName(name: "table"): NodeListOf; - getElementsByTagName(name: "tbody"): NodeListOf; - getElementsByTagName(name: "td"): NodeListOf; - getElementsByTagName(name: "template"): NodeListOf; - getElementsByTagName(name: "text"): NodeListOf; - getElementsByTagName(name: "textpath"): NodeListOf; - getElementsByTagName(name: "textarea"): NodeListOf; - getElementsByTagName(name: "tfoot"): NodeListOf; - getElementsByTagName(name: "th"): NodeListOf; - getElementsByTagName(name: "thead"): NodeListOf; - getElementsByTagName(name: "title"): NodeListOf; - getElementsByTagName(name: "tr"): NodeListOf; - getElementsByTagName(name: "track"): NodeListOf; - getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; - getElementsByTagName(name: "ul"): NodeListOf; - getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; - getElementsByTagName(name: "video"): NodeListOf; - getElementsByTagName(name: "view"): NodeListOf; - getElementsByTagName(name: "wbr"): NodeListOf; - getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; - getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - hasAttribute(name: string): boolean; - hasAttributeNS(namespaceURI: string, localName: string): boolean; - msGetRegionContent(): MSRangeCollection; - msGetUntransformedBounds(): ClientRect; - msMatchesSelector(selectors: string): boolean; - msReleasePointerCapture(pointerId: number): void; - msSetPointerCapture(pointerId: number): void; - msZoomTo(args: MsZoomToOptions): void; - releasePointerCapture(pointerId: number): void; - removeAttribute(name?: string): void; - removeAttributeNS(namespaceURI: string, localName: string): void; - removeAttributeNode(oldAttr: Attr): Attr; - requestFullscreen(): void; - requestPointerLock(): void; - setAttribute(name: string, value: string): void; - setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; - setAttributeNode(newAttr: Attr): Attr; - setAttributeNodeNS(newAttr: Attr): Attr; - setPointerCapture(pointerId: number): void; - webkitMatchesSelector(selectors: string): boolean; - webkitRequestFullScreen(): void; - webkitRequestFullscreen(): void; - getElementsByClassName(classNames: string): NodeListOf; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var Element: { - prototype: Element; - new(): Element; -} - -interface ErrorEvent extends Event { - readonly colno: number; - readonly error: any; - readonly filename: string; - readonly lineno: number; - readonly message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(): ErrorEvent; -} - -interface Event { - readonly bubbles: boolean; - cancelBubble: boolean; - readonly cancelable: boolean; - readonly currentTarget: EventTarget; - readonly defaultPrevented: boolean; - readonly eventPhase: number; - readonly isTrusted: boolean; - returnValue: boolean; - readonly srcElement: Element | null; - readonly target: EventTarget; - readonly timeStamp: number; - readonly type: string; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - preventDefault(): void; - stopImmediatePropagation(): void; - stopPropagation(): void; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -interface EventTarget { - addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -} - -interface External { -} - -declare var External: { - prototype: External; - new(): External; -} - -interface File extends Blob { - readonly lastModifiedDate: any; - readonly name: string; - readonly webkitRelativePath: string; -} - -declare var File: { - prototype: File; - new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; -} - -interface FileList { - readonly length: number; - item(index: number): File; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -} - -interface FileReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; -} - -interface FocusEvent extends UIEvent { - readonly relatedTarget: EventTarget; - initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; -} - -declare var FocusEvent: { - prototype: FocusEvent; - new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; -} - -interface FormData { - append(name: any, value: any, blobName?: string): void; -} - -declare var FormData: { - prototype: FormData; - new (form?: HTMLFormElement): FormData; -} - -interface GainNode extends AudioNode { - readonly gain: AudioParam; -} - -declare var GainNode: { - prototype: GainNode; - new(): GainNode; -} - -interface Gamepad { - readonly axes: number[]; - readonly buttons: GamepadButton[]; - readonly connected: boolean; - readonly id: string; - readonly index: number; - readonly mapping: string; - readonly timestamp: number; -} - -declare var Gamepad: { - prototype: Gamepad; - new(): Gamepad; -} - -interface GamepadButton { - readonly pressed: boolean; - readonly value: number; -} - -declare var GamepadButton: { - prototype: GamepadButton; - new(): GamepadButton; -} - -interface GamepadEvent extends Event { - readonly gamepad: Gamepad; -} - -declare var GamepadEvent: { - prototype: GamepadEvent; - new(): GamepadEvent; -} - -interface Geolocation { - clearWatch(watchId: number): void; - getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; - watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; -} - -declare var Geolocation: { - prototype: Geolocation; - new(): Geolocation; -} - -interface HTMLAllCollection extends HTMLCollection { - namedItem(name: string): Element; -} - -declare var HTMLAllCollection: { - prototype: HTMLAllCollection; - new(): HTMLAllCollection; -} - -interface HTMLAnchorElement extends HTMLElement { - Methods: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Contains the anchor portion of the URL including the hash sign (#). - */ - hash: string; - /** - * Contains the hostname and port values of the URL. - */ - host: string; - /** - * Contains the hostname of a URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - readonly mimeType: string; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - readonly nameProp: string; - /** - * Contains the pathname of the URL. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Contains the protocol of the URL. - */ - protocol: string; - readonly protocolLong: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - type: string; - urn: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} - -declare var HTMLAnchorElement: { - prototype: HTMLAnchorElement; - new(): HTMLAnchorElement; -} - -interface HTMLAppletElement extends HTMLElement { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - /** - * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. - */ - declare: boolean; - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - object: string | null; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - vspace: number; - width: number; -} - -declare var HTMLAppletElement: { - prototype: HTMLAppletElement; - new(): HTMLAppletElement; -} - -interface HTMLAreaElement extends HTMLElement { - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Sets or retrieves the subsection of the href property that follows the number sign (#). - */ - hash: string; - /** - * Sets or retrieves the hostname and port number of the location or URL. - */ - host: string; - /** - * Sets or retrieves the host name part of the location or URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or gets whether clicks in this region cause action. - */ - noHref: boolean; - /** - * Sets or retrieves the file name or path specified by the object. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Sets or retrieves the protocol portion of a URL. - */ - protocol: string; - rel: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} - -declare var HTMLAreaElement: { - prototype: HTMLAreaElement; - new(): HTMLAreaElement; -} - -interface HTMLAreasCollection extends HTMLCollection { - /** - * Adds an element to the areas, controlRange, or options collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Removes an element from the collection. - */ - remove(index?: number): void; -} - -declare var HTMLAreasCollection: { - prototype: HTMLAreasCollection; - new(): HTMLAreasCollection; -} - -interface HTMLAudioElement extends HTMLMediaElement { -} - -declare var HTMLAudioElement: { - prototype: HTMLAudioElement; - new(): HTMLAudioElement; -} - -interface HTMLBRElement extends HTMLElement { - /** - * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. - */ - clear: string; -} - -declare var HTMLBRElement: { - prototype: HTMLBRElement; - new(): HTMLBRElement; -} - -interface HTMLBaseElement extends HTMLElement { - /** - * Gets or sets the baseline URL on which relative links are based. - */ - href: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; -} - -declare var HTMLBaseElement: { - prototype: HTMLBaseElement; - new(): HTMLBaseElement; -} - -interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - /** - * Sets or retrieves the font size of the object. - */ - size: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseFontElement: { - prototype: HTMLBaseFontElement; - new(): HTMLBaseFontElement; -} - -interface HTMLBodyElement extends HTMLElement { - aLink: any; - background: string; - bgColor: any; - bgProperties: string; - link: any; - noWrap: boolean; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; - text: any; - vLink: any; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLBodyElement: { - prototype: HTMLBodyElement; - new(): HTMLBodyElement; -} - -interface HTMLButtonElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - status: any; - /** - * Gets the classification and default behavior of the button. - */ - type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the default or selected value of the control. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -declare var HTMLButtonElement: { - prototype: HTMLButtonElement; - new(): HTMLButtonElement; -} - -interface HTMLCanvasElement extends HTMLElement { - /** - * Gets or sets the height of a canvas element on a document. - */ - height: number; - /** - * Gets or sets the width of a canvas element on a document. - */ - width: number; - /** - * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. - * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); - */ - getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; - getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; - getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; - /** - * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. - */ - msToBlob(): Blob; - /** - * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. - * @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, type?: string, ...arguments: any[]): void; -} - -declare var HTMLCanvasElement: { - prototype: HTMLCanvasElement; - new(): HTMLCanvasElement; -} - -interface HTMLCollection { - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Retrieves an object from various collections. - */ - item(index: number): Element; - /** - * Retrieves a select object or an object from an options collection. - */ - namedItem(name: string): Element; - [index: number]: Element; -} - -declare var HTMLCollection: { - prototype: HTMLCollection; - new(): HTMLCollection; -} - -interface HTMLDListElement extends HTMLElement { - compact: boolean; -} - -declare var HTMLDListElement: { - prototype: HTMLDListElement; - new(): HTMLDListElement; -} - -interface HTMLDataListElement extends HTMLElement { - options: HTMLCollectionOf; -} - -declare var HTMLDataListElement: { - prototype: HTMLDataListElement; - new(): HTMLDataListElement; -} - -interface HTMLDirectoryElement extends HTMLElement { - compact: boolean; -} - -declare var HTMLDirectoryElement: { - prototype: HTMLDirectoryElement; - new(): HTMLDirectoryElement; -} - -interface HTMLDivElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDivElement: { - prototype: HTMLDivElement; - new(): HTMLDivElement; -} - -interface HTMLDocument extends Document { -} - -declare var HTMLDocument: { - prototype: HTMLDocument; - new(): HTMLDocument; -} - -interface HTMLElement extends Element { - accessKey: string; - readonly children: HTMLCollection; - contentEditable: string; - readonly dataset: DOMStringMap; - dir: string; - draggable: boolean; - hidden: boolean; - hideFocus: boolean; - innerHTML: string; - innerText: string; - readonly isContentEditable: boolean; - lang: string; - readonly offsetHeight: number; - readonly offsetLeft: number; - readonly offsetParent: Element; - readonly offsetTop: number; - readonly offsetWidth: number; - onabort: (this: this, ev: UIEvent) => any; - onactivate: (this: this, ev: UIEvent) => any; - onbeforeactivate: (this: this, ev: UIEvent) => any; - onbeforecopy: (this: this, ev: ClipboardEvent) => any; - onbeforecut: (this: this, ev: ClipboardEvent) => any; - onbeforedeactivate: (this: this, ev: UIEvent) => any; - onbeforepaste: (this: this, ev: ClipboardEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - oncopy: (this: this, ev: ClipboardEvent) => any; - oncuechange: (this: this, ev: Event) => any; - oncut: (this: this, ev: ClipboardEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondeactivate: (this: this, ev: UIEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onpaste: (this: this, ev: ClipboardEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreset: (this: this, ev: Event) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onselectstart: (this: this, ev: Event) => any; - onstalled: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; - outerHTML: string; - outerText: string; - spellcheck: boolean; - readonly style: CSSStyleDeclaration; - tabIndex: number; - title: string; - blur(): void; - click(): void; - dragDrop(): boolean; - focus(): void; - msGetInputContext(): MSInputMethodContext; - 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLElement: { - prototype: HTMLElement; - new(): HTMLElement; -} - -interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves the height of the object. - */ - height: string; - hidden: any; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the palette used for the embedded document. - */ - readonly palette: string; - /** - * Retrieves the URL of the plug-in used to view an embedded document. - */ - readonly pluginspage: string; - readonly readyState: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the height and width units of the embed object. - */ - units: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLEmbedElement: { - prototype: HTMLEmbedElement; - new(): HTMLEmbedElement; -} - -interface HTMLFieldSetElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -declare var HTMLFieldSetElement: { - prototype: HTMLFieldSetElement; - new(): HTMLFieldSetElement; -} - -interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFontElement: { - prototype: HTMLFontElement; - new(): HTMLFontElement; -} - -interface HTMLFormElement extends HTMLElement { - /** - * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. - */ - acceptCharset: string; - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Retrieves a collection, in source order, of all controls in a given form. - */ - readonly elements: HTMLCollection; - /** - * Sets or retrieves the MIME encoding for the form. - */ - encoding: string; - /** - * Sets or retrieves the encoding type for the form. - */ - enctype: string; - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Sets or retrieves how to send the form data to the server. - */ - method: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Designates a form that is not validated when submitted. - */ - noValidate: boolean; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a form object or an object from an elements collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a form object or an object from an elements collection. - */ - namedItem(name: string): any; - /** - * Fires when the user resets a form. - */ - reset(): void; - /** - * Fires when a FORM is about to be submitted. - */ - submit(): void; - [name: string]: any; -} - -declare var HTMLFormElement: { - prototype: HTMLFormElement; - new(): HTMLFormElement; -} - -interface HTMLFrameElement extends HTMLElement, GetSVGDocument { - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string | number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: this, ev: Event) => any; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the width of the object. - */ - width: string | number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLFrameElement: { - prototype: HTMLFrameElement; - new(): HTMLFrameElement; -} - -interface HTMLFrameSetElement extends HTMLElement { - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the frame widths of the object. - */ - cols: string; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - name: string; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object loses the input focus. - */ - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - */ - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; - /** - * Sets or retrieves the frame heights of the object. - */ - rows: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLFrameSetElement: { - prototype: HTMLFrameSetElement; - new(): HTMLFrameSetElement; -} - -interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. - */ - noShade: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHRElement: { - prototype: HTMLHRElement; - new(): HTMLHRElement; -} - -interface HTMLHeadElement extends HTMLElement { - profile: string; -} - -declare var HTMLHeadElement: { - prototype: HTMLHeadElement; - new(): HTMLHeadElement; -} - -interface HTMLHeadingElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; -} - -declare var HTMLHeadingElement: { - prototype: HTMLHeadingElement; - new(): HTMLHeadingElement; -} - -interface HTMLHtmlElement extends HTMLElement { - /** - * Sets or retrieves the DTD version that governs the current document. - */ - version: string; -} - -declare var HTMLHtmlElement: { - prototype: HTMLHtmlElement; - new(): HTMLHtmlElement; -} - -interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - allowFullscreen: boolean; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the horizontal margin for the object. - */ - hspace: number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: this, ev: Event) => any; - readonly sandbox: DOMSettableTokenList; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLIFrameElement: { - prototype: HTMLIFrameElement; - new(): HTMLIFrameElement; -} - -interface HTMLImageElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - crossOrigin: string; - readonly currentSrc: string; - /** - * Sets or retrieves the height of the object. - */ - height: number; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - /** - * Sets or retrieves whether the image is a server-side image map. - */ - isMap: boolean; - /** - * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. - */ - longDesc: string; - lowsrc: string; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * The original height of the image resource before sizing. - */ - readonly naturalHeight: number; - /** - * The original width of the image resource before sizing. - */ - readonly naturalWidth: number; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: number; - readonly x: number; - readonly y: number; - msGetAsCastingSource(): any; -} - -declare var HTMLImageElement: { - prototype: HTMLImageElement; - new(): HTMLImageElement; - create(): HTMLImageElement; -} - -interface HTMLInputElement extends HTMLElement { - /** - * Sets or retrieves a comma-separated list of content types. - */ - accept: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the state of the check box or radio button. - */ - checked: boolean; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - /** - * Sets or retrieves the state of the check box or radio button. - */ - defaultChecked: boolean; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Returns a FileList object on a file type input object. - */ - readonly files: FileList | null; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - indeterminate: boolean; - /** - * Specifies the ID of a pre-defined datalist of options for an input element. - */ - readonly list: HTMLElement; - /** - * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. - */ - max: string; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. - */ - min: string; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a string containing a regular expression that the user's input must match. - */ - pattern: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - selectionDirection: string; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - size: number; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - status: boolean; - /** - * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. - */ - step: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns the value of the data at the cursor's current position. - */ - value: string; - valueAsDate: Date; - /** - * Returns the input field value as a number. - */ - valueAsNumber: number; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - webkitdirectory: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Makes the selection equal to the current object. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start?: number, end?: number, direction?: string): void; - /** - * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. - * @param n Value to decrement the value by. - */ - stepDown(n?: number): void; - /** - * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. - * @param n Value to increment the value by. - */ - stepUp(n?: number): void; -} - -declare var HTMLInputElement: { - prototype: HTMLInputElement; - new(): HTMLInputElement; -} - -interface HTMLLIElement extends HTMLElement { - type: string; - /** - * Sets or retrieves the value of a list item. - */ - value: number; -} - -declare var HTMLLIElement: { - prototype: HTMLLIElement; - new(): HTMLLIElement; -} - -interface HTMLLabelElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the object to which the given label object is assigned. - */ - htmlFor: string; -} - -declare var HTMLLabelElement: { - prototype: HTMLLabelElement; - new(): HTMLLabelElement; -} - -interface HTMLLegendElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - align: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; -} - -declare var HTMLLegendElement: { - prototype: HTMLLegendElement; - new(): HTMLLegendElement; -} - -interface HTMLLinkElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - disabled: boolean; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - import?: Document; - integrity: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLinkElement: { - prototype: HTMLLinkElement; - new(): HTMLLinkElement; -} - -interface HTMLMapElement extends HTMLElement { - /** - * Retrieves a collection of the area objects defined for the given map object. - */ - readonly areas: HTMLAreasCollection; - /** - * Sets or retrieves the name of the object. - */ - name: string; -} - -declare var HTMLMapElement: { - prototype: HTMLMapElement; - new(): HTMLMapElement; -} - -interface HTMLMarqueeElement extends HTMLElement { - behavior: string; - bgColor: any; - direction: string; - height: string; - hspace: number; - loop: number; - onbounce: (this: this, ev: Event) => any; - onfinish: (this: this, ev: Event) => any; - onstart: (this: this, ev: Event) => any; - scrollAmount: number; - scrollDelay: number; - trueSpeed: boolean; - vspace: number; - width: string; - start(): void; - stop(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLMarqueeElement: { - prototype: HTMLMarqueeElement; - new(): HTMLMarqueeElement; -} - -interface HTMLMediaElement extends HTMLElement { - /** - * Returns an AudioTrackList object with the audio tracks for a given video element. - */ - readonly audioTracks: AudioTrackList; - /** - * Gets or sets a value that indicates whether to start playing the media automatically. - */ - autoplay: boolean; - /** - * Gets a collection of buffered time ranges. - */ - readonly buffered: TimeRanges; - /** - * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). - */ - controls: boolean; - crossOrigin: string; - /** - * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. - */ - readonly currentSrc: string; - /** - * Gets or sets the current playback position, in seconds. - */ - currentTime: number; - defaultMuted: boolean; - /** - * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. - */ - defaultPlaybackRate: number; - /** - * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. - */ - readonly duration: number; - /** - * Gets information about whether the playback has ended or not. - */ - readonly ended: boolean; - /** - * Returns an object representing the current error state of the audio or video element. - */ - readonly error: MediaError; - /** - * Gets or sets a flag to specify whether playback should restart after it completes. - */ - loop: boolean; - readonly mediaKeys: MediaKeys | null; - /** - * Specifies the purpose of the audio or video media, such as background audio or alerts. - */ - msAudioCategory: string; - /** - * Specifies the output device id that the audio will be sent to. - */ - msAudioDeviceType: string; - readonly msGraphicsTrustStatus: MSGraphicsTrust; - /** - * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. - */ - readonly msKeys: MSMediaKeys; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Specifies whether or not to enable low-latency playback on the media element. - */ - msRealTime: boolean; - /** - * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. - */ - muted: boolean; - /** - * Gets the current network activity for the element. - */ - readonly networkState: number; - onencrypted: (this: this, ev: MediaEncryptedEvent) => any; - onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any; - /** - * Gets a flag that specifies whether playback is paused. - */ - readonly paused: boolean; - /** - * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. - */ - playbackRate: number; - /** - * Gets TimeRanges for the current media resource that has been played. - */ - readonly played: TimeRanges; - /** - * Gets or sets the current playback position, in seconds. - */ - preload: string; - readyState: number; - /** - * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. - */ - readonly seekable: TimeRanges; - /** - * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. - */ - readonly seeking: boolean; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcObject: MediaStream | null; - readonly textTracks: TextTrackList; - readonly videoTracks: VideoTrackList; - /** - * Gets or sets the volume level for audio portions of the media element. - */ - volume: number; - addTextTrack(kind: string, label?: string, language?: string): TextTrack; - /** - * Returns a string that specifies whether the client can play a given media resource type. - */ - canPlayType(type: string): string; - /** - * Resets the audio or video object and loads a new media resource. - */ - load(): void; - /** - * Clears all effects from the media pipeline. - */ - msClearEffects(): void; - msGetAsCastingSource(): any; - /** - * Inserts the specified audio effect into media pipeline. - */ - msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetMediaKeys(mediaKeys: MSMediaKeys): void; - /** - * Specifies the media protection manager for a given media pipeline. - */ - msSetMediaProtectionManager(mediaProtectionManager?: any): void; - /** - * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. - */ - pause(): void; - /** - * Loads and starts playback of a media resource. - */ - play(): void; - setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLMediaElement: { - prototype: HTMLMediaElement; - new(): HTMLMediaElement; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; -} - -interface HTMLMenuElement extends HTMLElement { - compact: boolean; - type: string; -} - -declare var HTMLMenuElement: { - prototype: HTMLMenuElement; - new(): HTMLMenuElement; -} - -interface HTMLMetaElement extends HTMLElement { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Gets or sets meta-information to associate with httpEquiv or name. - */ - content: string; - /** - * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. - */ - httpEquiv: string; - /** - * Sets or retrieves the value specified in the content attribute of the meta object. - */ - name: string; - /** - * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. - */ - scheme: string; - /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. - */ - url: string; -} - -declare var HTMLMetaElement: { - prototype: HTMLMetaElement; - new(): HTMLMetaElement; -} - -interface HTMLMeterElement extends HTMLElement { - high: number; - low: number; - max: number; - min: number; - optimum: number; - value: number; -} - -declare var HTMLMeterElement: { - prototype: HTMLMeterElement; - new(): HTMLMeterElement; -} - -interface HTMLModElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; -} - -declare var HTMLModElement: { - prototype: HTMLModElement; - new(): HTMLModElement; -} - -interface HTMLOListElement extends HTMLElement { - compact: boolean; - /** - * The starting number. - */ - start: number; - type: string; -} - -declare var HTMLOListElement: { - prototype: HTMLOListElement; - new(): HTMLOListElement; -} - -interface HTMLObjectElement extends HTMLElement, GetSVGDocument { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - /** - * Sets or retrieves the URL of the file containing the compiled Java class. - */ - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - declare: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the contained object. - */ - readonly object: any; - readonly readyState: number; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLObjectElement: { - prototype: HTMLObjectElement; - new(): HTMLObjectElement; -} - -interface HTMLOptGroupElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - readonly text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; -} - -declare var HTMLOptGroupElement: { - prototype: HTMLOptGroupElement; - new(): HTMLOptGroupElement; -} - -interface HTMLOptionElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; -} - -declare var HTMLOptionElement: { - prototype: HTMLOptionElement; - new(): HTMLOptionElement; - create(): HTMLOptionElement; -} - -interface HTMLOptionsCollection extends HTMLCollectionOf { - length: number; - selectedIndex: number; - add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; - remove(index: number): void; -} - -declare var HTMLOptionsCollection: { - prototype: HTMLOptionsCollection; - new(): HTMLOptionsCollection; -} - -interface HTMLParagraphElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - clear: string; -} - -declare var HTMLParagraphElement: { - prototype: HTMLParagraphElement; - new(): HTMLParagraphElement; -} - -interface HTMLParamElement extends HTMLElement { - /** - * Sets or retrieves the name of an input parameter for an element. - */ - name: string; - /** - * Sets or retrieves the content type of the resource designated by the value attribute. - */ - type: string; - /** - * Sets or retrieves the value of an input parameter for an element. - */ - value: string; - /** - * Sets or retrieves the data type of the value attribute. - */ - valueType: string; -} - -declare var HTMLParamElement: { - prototype: HTMLParamElement; - new(): HTMLParamElement; -} - -interface HTMLPictureElement extends HTMLElement { -} - -declare var HTMLPictureElement: { - prototype: HTMLPictureElement; - new(): HTMLPictureElement; -} - -interface HTMLPreElement extends HTMLElement { - /** - * Sets or gets a value that you can use to implement your own width functionality for the object. - */ - width: number; -} - -declare var HTMLPreElement: { - prototype: HTMLPreElement; - new(): HTMLPreElement; -} - -interface HTMLProgressElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Defines the maximum, or "done" value for a progress element. - */ - max: number; - /** - * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). - */ - readonly position: number; - /** - * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. - */ - value: number; -} - -declare var HTMLProgressElement: { - prototype: HTMLProgressElement; - new(): HTMLProgressElement; -} - -interface HTMLQuoteElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; -} - -declare var HTMLQuoteElement: { - prototype: HTMLQuoteElement; - new(): HTMLQuoteElement; -} - -interface HTMLScriptElement extends HTMLElement { - async: boolean; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the status of the script. - */ - defer: boolean; - /** - * Sets or retrieves the event for which the script is written. - */ - event: string; - /** - * Sets or retrieves the object that is bound to the event script. - */ - htmlFor: string; - /** - * Retrieves the URL to an external file that contains the source code or data. - */ - src: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - /** - * Sets or retrieves the MIME type for the associated scripting engine. - */ - type: string; - integrity: string; -} - -declare var HTMLScriptElement: { - prototype: HTMLScriptElement; - new(): HTMLScriptElement; -} - -interface HTMLSelectElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - readonly options: HTMLOptionsCollection; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the index of the selected option in a select object. - */ - selectedIndex: number; - selectedOptions: HTMLCollectionOf; - /** - * Sets or retrieves the number of rows in the list box. - */ - size: number; - /** - * Retrieves the type of select control based on the value of the MULTIPLE attribute. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Adds an element to the areas, controlRange, or options collection. - * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a select object or an object from an options collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a select object or an object from an options collection. - * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. - */ - namedItem(name: string): any; - /** - * Removes an element from the collection. - * @param index Number that specifies the zero-based index of the element to remove from the collection. - */ - remove(index?: number): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - [name: string]: any; -} - -declare var HTMLSelectElement: { - prototype: HTMLSelectElement; - new(): HTMLSelectElement; -} - -interface HTMLSourceElement extends HTMLElement { - /** - * Gets or sets the intended media type of the media source. - */ - media: string; - msKeySystem: string; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Gets or sets the MIME type of a media resource. - */ - type: string; -} - -declare var HTMLSourceElement: { - prototype: HTMLSourceElement; - new(): HTMLSourceElement; -} - -interface HTMLSpanElement extends HTMLElement { -} - -declare var HTMLSpanElement: { - prototype: HTMLSpanElement; - new(): HTMLSpanElement; -} - -interface HTMLStyleElement extends HTMLElement, LinkStyle { - disabled: boolean; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Retrieves the CSS language in which the style sheet is written. - */ - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLStyleElement: { - prototype: HTMLStyleElement; - new(): HTMLStyleElement; -} - -interface HTMLTableCaptionElement extends HTMLElement { - /** - * Sets or retrieves the alignment of the caption or legend. - */ - align: string; - /** - * Sets or retrieves whether the caption appears at the top or bottom of the table. - */ - vAlign: string; -} - -declare var HTMLTableCaptionElement: { - prototype: HTMLTableCaptionElement; - new(): HTMLTableCaptionElement; -} - -interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves abbreviated text for the object. - */ - abbr: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. - */ - axis: string; - bgColor: any; - /** - * Retrieves the position of the object in the cells collection of a row. - */ - readonly cellIndex: number; - /** - * Sets or retrieves the number columns in the table that the object should span. - */ - colSpan: number; - /** - * Sets or retrieves a list of header cells that provide information for the object. - */ - headers: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - /** - * Sets or retrieves how many rows in a table the cell should span. - */ - rowSpan: number; - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCellElement: { - prototype: HTMLTableCellElement; - new(): HTMLTableCellElement; -} - -interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves the alignment of the object relative to the display or table. - */ - align: string; - /** - * Sets or retrieves the number of columns in the group. - */ - span: number; - /** - * Sets or retrieves the width of the object. - */ - width: any; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableColElement: { - prototype: HTMLTableColElement; - new(): HTMLTableColElement; -} - -interface HTMLTableDataCellElement extends HTMLTableCellElement { -} - -declare var HTMLTableDataCellElement: { - prototype: HTMLTableDataCellElement; - new(): HTMLTableDataCellElement; -} - -interface HTMLTableElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - bgColor: any; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the caption object of a table. - */ - caption: HTMLTableCaptionElement; - /** - * Sets or retrieves the amount of space between the border of the cell and the content of the cell. - */ - cellPadding: string; - /** - * Sets or retrieves the amount of space between cells in a table. - */ - cellSpacing: string; - /** - * Sets or retrieves the number of columns in the table. - */ - cols: number; - /** - * Sets or retrieves the way the border frame around the table is displayed. - */ - frame: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Sets or retrieves which dividing lines (inner borders) are displayed. - */ - rules: string; - /** - * Sets or retrieves a description and/or structure of the object. - */ - summary: string; - /** - * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. - */ - tBodies: HTMLCollectionOf; - /** - * Retrieves the tFoot object of the table. - */ - tFoot: HTMLTableSectionElement; - /** - * Retrieves the tHead object of the table. - */ - tHead: HTMLTableSectionElement; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Creates an empty caption element in the table. - */ - createCaption(): HTMLTableCaptionElement; - /** - * Creates an empty tBody element in the table. - */ - createTBody(): HTMLTableSectionElement; - /** - * Creates an empty tFoot element in the table. - */ - createTFoot(): HTMLTableSectionElement; - /** - * Returns the tHead element object if successful, or null otherwise. - */ - createTHead(): HTMLTableSectionElement; - /** - * Deletes the caption element and its contents from the table. - */ - deleteCaption(): void; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Deletes the tFoot element and its contents from the table. - */ - deleteTFoot(): void; - /** - * Deletes the tHead element and its contents from the table. - */ - deleteTHead(): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; -} - -declare var HTMLTableElement: { - prototype: HTMLTableElement; - new(): HTMLTableElement; -} - -interface HTMLTableHeaderCellElement extends HTMLTableCellElement { - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; -} - -declare var HTMLTableHeaderCellElement: { - prototype: HTMLTableHeaderCellElement; - new(): HTMLTableHeaderCellElement; -} - -interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - bgColor: any; - /** - * Retrieves a collection of all cells in the table row. - */ - cells: HTMLCollectionOf; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Retrieves the position of the object in the rows collection for the table. - */ - readonly rowIndex: number; - /** - * Retrieves the position of the object in the collection. - */ - readonly sectionRowIndex: number; - /** - * Removes the specified cell from the table row, as well as from the cells collection. - * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. - */ - deleteCell(index?: number): void; - /** - * Creates a new cell in the table row, and adds the cell to the cells collection. - * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. - */ - insertCell(index?: number): HTMLTableDataCellElement; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableRowElement: { - prototype: HTMLTableRowElement; - new(): HTMLTableRowElement; -} - -interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableSectionElement: { - prototype: HTMLTableSectionElement; - new(): HTMLTableSectionElement; -} - -interface HTMLTemplateElement extends HTMLElement { - readonly content: DocumentFragment; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - -interface HTMLTextAreaElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the object. - */ - cols: number; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - /** - * Sets or retrieves the value indicated whether the content of the object is read-only. - */ - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: number; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - /** - * Sets or retrieves the value indicating whether the control is selected. - */ - status: any; - /** - * Retrieves the type of control. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Retrieves or sets the text in the entry field of the textArea element. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Sets or retrieves how to handle wordwrapping in the object. - */ - wrap: string; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Highlights the input area of a form element. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; -} - -declare var HTMLTextAreaElement: { - prototype: HTMLTextAreaElement; - new(): HTMLTextAreaElement; -} - -interface HTMLTitleElement extends HTMLElement { - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; -} - -declare var HTMLTitleElement: { - prototype: HTMLTitleElement; - new(): HTMLTitleElement; -} - -interface HTMLTrackElement extends HTMLElement { - default: boolean; - kind: string; - label: string; - readonly readyState: number; - src: string; - srclang: string; - readonly track: TextTrack; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -declare var HTMLTrackElement: { - prototype: HTMLTrackElement; - new(): HTMLTrackElement; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -interface HTMLUListElement extends HTMLElement { - compact: boolean; - type: string; -} - -declare var HTMLUListElement: { - prototype: HTMLUListElement; - new(): HTMLUListElement; -} - -interface HTMLUnknownElement extends HTMLElement { -} - -declare var HTMLUnknownElement: { - prototype: HTMLUnknownElement; - new(): HTMLUnknownElement; -} - -interface HTMLVideoElement extends HTMLMediaElement { - /** - * Gets or sets the height of the video element. - */ - height: number; - msHorizontalMirror: boolean; - readonly msIsLayoutOptimalForPlayback: boolean; - readonly msIsStereo3D: boolean; - msStereo3DPackingMode: string; - msStereo3DRenderMode: string; - msZoom: boolean; - onMSVideoFormatChanged: (this: this, ev: Event) => any; - onMSVideoFrameStepCompleted: (this: this, ev: Event) => any; - onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any; - /** - * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. - */ - poster: string; - /** - * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoHeight: number; - /** - * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoWidth: number; - readonly webkitDisplayingFullscreen: boolean; - readonly webkitSupportsFullscreen: boolean; - /** - * Gets or sets the width of the video element. - */ - width: number; - getVideoPlaybackQuality(): VideoPlaybackQuality; - msFrameStep(forward: boolean): void; - msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; - webkitEnterFullScreen(): void; - webkitEnterFullscreen(): void; - webkitExitFullScreen(): void; - webkitExitFullscreen(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var HTMLVideoElement: { - prototype: HTMLVideoElement; - new(): HTMLVideoElement; -} - -interface HashChangeEvent extends Event { - readonly newURL: string | null; - readonly oldURL: string | null; -} - -declare var HashChangeEvent: { - prototype: HashChangeEvent; - new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; -} - -interface History { - readonly length: number; - readonly state: any; - 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: { - prototype: History; - new(): History; -} - -interface IDBCursor { - readonly direction: string; - key: IDBKeyRange | IDBValidKey; - readonly primaryKey: any; - source: IDBObjectStore | IDBIndex; - advance(count: number): void; - continue(key?: IDBKeyRange | IDBValidKey): void; - delete(): IDBRequest; - update(value: any): IDBRequest; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -declare var IDBCursor: { - prototype: IDBCursor; - new(): IDBCursor; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -interface IDBCursorWithValue extends IDBCursor { - readonly value: any; -} - -declare var IDBCursorWithValue: { - prototype: IDBCursorWithValue; - new(): IDBCursorWithValue; -} - -interface IDBDatabase extends EventTarget { - readonly name: string; - readonly objectStoreNames: DOMStringList; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - version: number; - onversionchange: (ev: IDBVersionChangeEvent) => any; - close(): void; - createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; - deleteObjectStore(name: string): void; - transaction(storeNames: string | string[], mode?: string): IDBTransaction; - addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBDatabase: { - prototype: IDBDatabase; - new(): IDBDatabase; -} - -interface IDBFactory { - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; - open(name: string, version?: number): IDBOpenDBRequest; -} - -declare var IDBFactory: { - prototype: IDBFactory; - new(): IDBFactory; -} - -interface IDBIndex { - keyPath: string | string[]; - readonly name: string; - readonly objectStore: IDBObjectStore; - readonly unique: boolean; - multiEntry: boolean; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - get(key: IDBKeyRange | IDBValidKey): IDBRequest; - getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; -} - -declare var IDBIndex: { - prototype: IDBIndex; - new(): IDBIndex; -} - -interface IDBKeyRange { - readonly lower: any; - readonly lowerOpen: boolean; - readonly upper: any; - readonly upperOpen: boolean; -} - -declare var IDBKeyRange: { - prototype: IDBKeyRange; - new(): IDBKeyRange; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(lower: any, open?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - upperBound(upper: any, open?: boolean): IDBKeyRange; -} - -interface IDBObjectStore { - readonly indexNames: DOMStringList; - keyPath: string | string[]; - readonly name: string; - readonly transaction: IDBTransaction; - autoIncrement: boolean; - add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; - clear(): IDBRequest; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: IDBKeyRange | IDBValidKey): IDBRequest; - deleteIndex(indexName: string): void; - get(key: any): IDBRequest; - index(name: string): IDBIndex; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; -} - -declare var IDBObjectStore: { - prototype: IDBObjectStore; - new(): IDBObjectStore; -} - -interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: this, ev: Event) => any; - onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; - addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBOpenDBRequest: { - prototype: IDBOpenDBRequest; - new(): IDBOpenDBRequest; -} - -interface IDBRequest extends EventTarget { - readonly error: DOMError; - onerror: (this: this, ev: ErrorEvent) => any; - onsuccess: (this: this, ev: Event) => any; - readonly readyState: string; - readonly result: any; - source: IDBObjectStore | IDBIndex | IDBCursor; - readonly transaction: IDBTransaction; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBRequest: { - prototype: IDBRequest; - new(): IDBRequest; -} - -interface IDBTransaction extends EventTarget { - readonly db: IDBDatabase; - readonly error: DOMError; - readonly mode: string; - onabort: (this: this, ev: Event) => any; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBTransaction: { - prototype: IDBTransaction; - new(): IDBTransaction; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; -} - -interface IDBVersionChangeEvent extends Event { - readonly newVersion: number | null; - readonly oldVersion: number; -} - -declare var IDBVersionChangeEvent: { - prototype: IDBVersionChangeEvent; - new(): IDBVersionChangeEvent; -} - -interface ImageData { - data: Uint8ClampedArray; - readonly height: number; - readonly width: number; -} - -declare var ImageData: { - prototype: ImageData; - new(width: number, height: number): ImageData; - new(array: Uint8ClampedArray, width: number, height: number): ImageData; -} - -interface KeyboardEvent extends UIEvent { - readonly altKey: boolean; - readonly char: string | null; - readonly charCode: number; - readonly ctrlKey: boolean; - readonly key: string; - readonly keyCode: number; - readonly locale: string; - readonly location: number; - readonly metaKey: boolean; - 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; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -declare var KeyboardEvent: { - prototype: KeyboardEvent; - new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -interface ListeningStateChangedEvent extends Event { - readonly label: string; - readonly state: string; -} - -declare var ListeningStateChangedEvent: { - prototype: ListeningStateChangedEvent; - new(): ListeningStateChangedEvent; -} - -interface Location { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - pathname: string; - port: string; - protocol: string; - search: string; - assign(url: string): void; - reload(forcedReload?: boolean): void; - replace(url: string): void; - toString(): string; -} - -declare var Location: { - prototype: Location; - new(): Location; -} - -interface LongRunningScriptDetectedEvent extends Event { - readonly executionTime: number; - stopPageScriptExecution: boolean; -} - -declare var LongRunningScriptDetectedEvent: { - prototype: LongRunningScriptDetectedEvent; - new(): LongRunningScriptDetectedEvent; -} - -interface MSApp { - clearTemporaryWebDataAsync(): MSAppAsyncOperation; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createDataPackage(object: any): any; - createDataPackageFromSelection(): any; - createFileFromStorageFile(storageFile: any): File; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; - getViewId(view: any): any; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - pageHandlesAllApplicationActivations(enabled: boolean): void; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - terminateApp(exceptionObject: any): void; - readonly CURRENT: string; - readonly HIGH: string; - readonly IDLE: string; - readonly NORMAL: string; -} -declare var MSApp: MSApp; - -interface MSAppAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSAppAsyncOperation: { - prototype: MSAppAsyncOperation; - new(): MSAppAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; -} - -interface MSAssertion { - readonly id: string; - readonly type: string; -} - -declare var MSAssertion: { - prototype: MSAssertion; - new(): MSAssertion; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} - -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new(): MSBlobBuilder; -} - -interface MSCredentials { - getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; - makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; -} - -declare var MSCredentials: { - prototype: MSCredentials; - new(): MSCredentials; -} - -interface MSFIDOCredentialAssertion extends MSAssertion { - readonly algorithm: string | Algorithm; - readonly attestation: any; - readonly publicKey: string; - readonly transportHints: string[]; -} - -declare var MSFIDOCredentialAssertion: { - prototype: MSFIDOCredentialAssertion; - new(): MSFIDOCredentialAssertion; -} - -interface MSFIDOSignature { - readonly authnrData: string; - readonly clientData: string; - readonly signature: string; -} - -declare var MSFIDOSignature: { - prototype: MSFIDOSignature; - new(): MSFIDOSignature; -} - -interface MSFIDOSignatureAssertion extends MSAssertion { - readonly signature: MSFIDOSignature; -} - -declare var MSFIDOSignatureAssertion: { - prototype: MSFIDOSignatureAssertion; - new(): MSFIDOSignatureAssertion; -} - -interface MSGesture { - target: Element; - addPointer(pointerId: number): void; - stop(): void; -} - -declare var MSGesture: { - prototype: MSGesture; - new(): MSGesture; -} - -interface MSGestureEvent extends UIEvent { - readonly clientX: number; - readonly clientY: number; - readonly expansion: number; - readonly gestureObject: any; - readonly hwTimestamp: number; - readonly offsetX: number; - readonly offsetY: number; - readonly rotation: number; - readonly scale: number; - readonly screenX: number; - readonly screenY: number; - readonly translationX: number; - readonly translationY: number; - readonly velocityAngular: number; - readonly velocityExpansion: number; - readonly velocityX: number; - readonly velocityY: number; - initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -declare var MSGestureEvent: { - prototype: MSGestureEvent; - new(): MSGestureEvent; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -interface MSGraphicsTrust { - readonly constrictionActive: boolean; - readonly status: string; -} - -declare var MSGraphicsTrust: { - prototype: MSGraphicsTrust; - new(): MSGraphicsTrust; -} - -interface MSHTMLWebViewElement extends HTMLElement { - readonly canGoBack: boolean; - readonly canGoForward: boolean; - readonly containsFullScreenElement: boolean; - readonly documentTitle: string; - height: number; - readonly settings: MSWebViewSettings; - src: string; - width: number; - addWebAllowedObject(name: string, applicationObject: any): void; - buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; - capturePreviewToBlobAsync(): MSWebViewAsyncOperation; - captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; - getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; - getDeferredPermissionRequests(): DeferredPermissionRequest[]; - goBack(): void; - goForward(): void; - invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; - navigate(uri: string): void; - navigateToLocalStreamUri(source: string, streamResolver: any): void; - navigateToString(contents: string): void; - navigateWithHttpRequestMessage(requestMessage: any): void; - refresh(): void; - stop(): void; -} - -declare var MSHTMLWebViewElement: { - prototype: MSHTMLWebViewElement; - new(): MSHTMLWebViewElement; -} - -interface MSInputMethodContext extends EventTarget { - readonly compositionEndOffset: number; - readonly compositionStartOffset: number; - oncandidatewindowhide: (this: this, ev: Event) => any; - oncandidatewindowshow: (this: this, ev: Event) => any; - oncandidatewindowupdate: (this: this, ev: Event) => any; - readonly target: HTMLElement; - getCandidateWindowClientRect(): ClientRect; - getCompositionAlternatives(): string[]; - hasComposition(): boolean; - isCandidateWindowVisible(): boolean; - addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSInputMethodContext: { - prototype: MSInputMethodContext; - new(): MSInputMethodContext; -} - -interface MSManipulationEvent extends UIEvent { - readonly currentState: number; - readonly inertiaDestinationX: number; - readonly inertiaDestinationY: number; - readonly lastState: number; - initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -declare var MSManipulationEvent: { - prototype: MSManipulationEvent; - new(): MSManipulationEvent; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -interface MSMediaKeyError { - readonly code: number; - readonly systemCode: number; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -declare var MSMediaKeyError: { - prototype: MSMediaKeyError; - new(): MSMediaKeyError; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -interface MSMediaKeyMessageEvent extends Event { - readonly destinationURL: string | null; - readonly message: Uint8Array; -} - -declare var MSMediaKeyMessageEvent: { - prototype: MSMediaKeyMessageEvent; - new(): MSMediaKeyMessageEvent; -} - -interface MSMediaKeyNeededEvent extends Event { - readonly initData: Uint8Array | null; -} - -declare var MSMediaKeyNeededEvent: { - prototype: MSMediaKeyNeededEvent; - new(): MSMediaKeyNeededEvent; -} - -interface MSMediaKeySession extends EventTarget { - readonly error: MSMediaKeyError | null; - readonly keySystem: string; - readonly sessionId: string; - close(): void; - update(key: Uint8Array): void; -} - -declare var MSMediaKeySession: { - prototype: MSMediaKeySession; - new(): MSMediaKeySession; -} - -interface MSMediaKeys { - readonly keySystem: string; - createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; -} - -declare var MSMediaKeys: { - prototype: MSMediaKeys; - new(keySystem: string): MSMediaKeys; - isTypeSupported(keySystem: string, type?: string): boolean; - isTypeSupportedWithFeatures(keySystem: string, type?: string): string; -} - -interface MSPointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var MSPointerEvent: { - prototype: MSPointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; -} - -interface MSRangeCollection { - readonly length: number; - item(index: number): Range; - [index: number]: Range; -} - -declare var MSRangeCollection: { - prototype: MSRangeCollection; - new(): MSRangeCollection; -} - -interface MSSiteModeEvent extends Event { - readonly actionURL: string; - readonly buttonID: number; -} - -declare var MSSiteModeEvent: { - prototype: MSSiteModeEvent; - new(): MSSiteModeEvent; -} - -interface MSStream { - readonly type: string; - msClose(): void; - msDetachStream(): any; -} - -declare var MSStream: { - prototype: MSStream; - new(): MSStream; -} - -interface MSStreamReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBinaryString(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSStreamReader: { - prototype: MSStreamReader; - new(): MSStreamReader; -} - -interface MSWebViewAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - readonly target: MSHTMLWebViewElement; - readonly type: number; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSWebViewAsyncOperation: { - prototype: MSWebViewAsyncOperation; - new(): MSWebViewAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; -} - -interface MSWebViewSettings { - isIndexedDBEnabled: boolean; - isJavaScriptEnabled: boolean; -} - -declare var MSWebViewSettings: { - prototype: MSWebViewSettings; - new(): MSWebViewSettings; -} - -interface MediaDeviceInfo { - readonly deviceId: string; - readonly groupId: string; - readonly kind: string; - readonly label: string; -} - -declare var MediaDeviceInfo: { - prototype: MediaDeviceInfo; - new(): MediaDeviceInfo; -} - -interface MediaDevices extends EventTarget { - ondevicechange: (this: this, ev: Event) => any; - enumerateDevices(): any; - getSupportedConstraints(): MediaTrackSupportedConstraints; - getUserMedia(constraints: MediaStreamConstraints): PromiseLike; - addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaDevices: { - prototype: MediaDevices; - new(): MediaDevices; -} - -interface MediaElementAudioSourceNode extends AudioNode { -} - -declare var MediaElementAudioSourceNode: { - prototype: MediaElementAudioSourceNode; - new(): MediaElementAudioSourceNode; -} - -interface MediaEncryptedEvent extends Event { - readonly initData: ArrayBuffer | null; - readonly initDataType: string; -} - -declare var MediaEncryptedEvent: { - prototype: MediaEncryptedEvent; - new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; -} - -interface MediaError { - readonly code: number; - readonly msExtendedCode: number; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -declare var MediaError: { - prototype: MediaError; - new(): MediaError; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -interface MediaKeyMessageEvent extends Event { - readonly message: ArrayBuffer; - readonly messageType: string; -} - -declare var MediaKeyMessageEvent: { - prototype: MediaKeyMessageEvent; - new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; -} - -interface MediaKeySession extends EventTarget { - readonly closed: PromiseLike; - readonly expiration: number; - readonly keyStatuses: MediaKeyStatusMap; - readonly sessionId: string; - close(): PromiseLike; - generateRequest(initDataType: string, initData: any): PromiseLike; - load(sessionId: string): PromiseLike; - remove(): PromiseLike; - update(response: any): PromiseLike; -} - -declare var MediaKeySession: { - prototype: MediaKeySession; - new(): MediaKeySession; -} - -interface MediaKeyStatusMap { - readonly size: number; - forEach(callback: ForEachCallback): void; - get(keyId: any): string; - has(keyId: any): boolean; -} - -declare var MediaKeyStatusMap: { - prototype: MediaKeyStatusMap; - new(): MediaKeyStatusMap; -} - -interface MediaKeySystemAccess { - readonly keySystem: string; - createMediaKeys(): PromiseLike; - getConfiguration(): MediaKeySystemConfiguration; -} - -declare var MediaKeySystemAccess: { - prototype: MediaKeySystemAccess; - new(): MediaKeySystemAccess; -} - -interface MediaKeys { - createSession(sessionType?: string): MediaKeySession; - setServerCertificate(serverCertificate: any): PromiseLike; -} - -declare var MediaKeys: { - prototype: MediaKeys; - new(): MediaKeys; -} - -interface MediaList { - readonly length: number; - mediaText: string; - appendMedium(newMedium: string): void; - deleteMedium(oldMedium: string): void; - item(index: number): string; - toString(): string; - [index: number]: string; -} - -declare var MediaList: { - prototype: MediaList; - new(): MediaList; -} - -interface MediaQueryList { - readonly matches: boolean; - readonly media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -declare var MediaQueryList: { - prototype: MediaQueryList; - new(): MediaQueryList; -} - -interface MediaSource extends EventTarget { - readonly activeSourceBuffers: SourceBufferList; - duration: number; - readonly readyState: string; - readonly sourceBuffers: SourceBufferList; - addSourceBuffer(type: string): SourceBuffer; - endOfStream(error?: number): void; - removeSourceBuffer(sourceBuffer: SourceBuffer): void; -} - -declare var MediaSource: { - prototype: MediaSource; - new(): MediaSource; - isTypeSupported(type: string): boolean; -} - -interface MediaStream extends EventTarget { - readonly active: boolean; - readonly id: string; - onactive: (this: this, ev: Event) => any; - onaddtrack: (this: this, ev: TrackEvent) => any; - oninactive: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - addTrack(track: MediaStreamTrack): void; - clone(): MediaStream; - getAudioTracks(): MediaStreamTrack[]; - getTrackById(trackId: string): MediaStreamTrack | null; - getTracks(): MediaStreamTrack[]; - getVideoTracks(): MediaStreamTrack[]; - removeTrack(track: MediaStreamTrack): void; - stop(): void; - addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStream: { - prototype: MediaStream; - new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; -} - -interface MediaStreamAudioSourceNode extends AudioNode { -} - -declare var MediaStreamAudioSourceNode: { - prototype: MediaStreamAudioSourceNode; - new(): MediaStreamAudioSourceNode; -} - -interface MediaStreamError { - readonly constraintName: string | null; - readonly message: string | null; - readonly name: string; -} - -declare var MediaStreamError: { - prototype: MediaStreamError; - new(): MediaStreamError; -} - -interface MediaStreamErrorEvent extends Event { - readonly error: MediaStreamError | null; -} - -declare var MediaStreamErrorEvent: { - prototype: MediaStreamErrorEvent; - new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; -} - -interface MediaStreamTrack extends EventTarget { - enabled: boolean; - readonly id: string; - readonly kind: string; - readonly label: string; - readonly muted: boolean; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onmute: (this: this, ev: Event) => any; - onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any; - onunmute: (this: this, ev: Event) => any; - readonly readonly: boolean; - readonly readyState: string; - readonly remote: boolean; - applyConstraints(constraints: MediaTrackConstraints): PromiseLike; - clone(): MediaStreamTrack; - getCapabilities(): MediaTrackCapabilities; - getConstraints(): MediaTrackConstraints; - getSettings(): MediaTrackSettings; - stop(): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStreamTrack: { - prototype: MediaStreamTrack; - new(): MediaStreamTrack; -} - -interface MediaStreamTrackEvent extends Event { - readonly track: MediaStreamTrack; -} - -declare var MediaStreamTrackEvent: { - prototype: MediaStreamTrackEvent; - new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; -} - -interface MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; -} - -declare var MessageChannel: { - prototype: MessageChannel; - new(): MessageChannel; -} - -interface MessageEvent extends Event { - readonly data: any; - readonly origin: string; - readonly ports: any; - readonly source: Window; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; -} - -declare var MessageEvent: { - prototype: MessageEvent; - new(type: string, eventInitDict?: MessageEventInit): MessageEvent; -} - -interface MessagePort extends EventTarget { - onmessage: (this: this, ev: MessageEvent) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MessagePort: { - prototype: MessagePort; - new(): MessagePort; -} - -interface MimeType { - readonly description: string; - readonly enabledPlugin: Plugin; - readonly suffixes: string; - readonly type: string; -} - -declare var MimeType: { - prototype: MimeType; - new(): MimeType; -} - -interface MimeTypeArray { - readonly length: number; - item(index: number): Plugin; - namedItem(type: string): Plugin; - [index: number]: Plugin; -} - -declare var MimeTypeArray: { - prototype: MimeTypeArray; - new(): MimeTypeArray; -} - -interface MouseEvent extends UIEvent { - readonly altKey: boolean; - readonly button: number; - readonly buttons: number; - readonly clientX: number; - readonly clientY: number; - readonly ctrlKey: boolean; - readonly fromElement: Element; - readonly layerX: number; - readonly layerY: number; - readonly metaKey: boolean; - readonly movementX: number; - readonly movementY: number; - readonly offsetX: number; - readonly offsetY: number; - readonly pageX: number; - readonly pageY: number; - readonly relatedTarget: EventTarget; - readonly screenX: number; - readonly screenY: number; - readonly shiftKey: boolean; - readonly toElement: Element; - readonly which: number; - readonly x: number; - readonly y: number; - getModifierState(keyArg: string): boolean; - initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; -} - -declare var MouseEvent: { - prototype: MouseEvent; - new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; -} - -interface MutationEvent extends Event { - readonly attrChange: number; - readonly attrName: string; - readonly newValue: string; - readonly prevValue: string; - readonly relatedNode: Node; - initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -declare var MutationEvent: { - prototype: MutationEvent; - new(): MutationEvent; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -interface MutationObserver { - disconnect(): void; - observe(target: Node, options: MutationObserverInit): void; - takeRecords(): MutationRecord[]; -} - -declare var MutationObserver: { - prototype: MutationObserver; - new(callback: MutationCallback): MutationObserver; -} - -interface MutationRecord { - readonly addedNodes: NodeList; - readonly attributeName: string | null; - readonly attributeNamespace: string | null; - readonly nextSibling: Node | null; - readonly oldValue: string | null; - readonly previousSibling: Node | null; - readonly removedNodes: NodeList; - readonly target: Node; - readonly type: string; -} - -declare var MutationRecord: { - prototype: MutationRecord; - new(): MutationRecord; -} - -interface NamedNodeMap { - readonly length: number; - getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - item(index: number): Attr; - removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - setNamedItem(arg: Attr): Attr; - setNamedItemNS(arg: Attr): Attr; - [index: number]: Attr; -} - -declare var NamedNodeMap: { - prototype: NamedNodeMap; - new(): NamedNodeMap; -} - -interface NavigationCompletedEvent extends NavigationEvent { - readonly isSuccess: boolean; - readonly webErrorStatus: number; -} - -declare var NavigationCompletedEvent: { - prototype: NavigationCompletedEvent; - new(): NavigationCompletedEvent; -} - -interface NavigationEvent extends Event { - readonly uri: string; -} - -declare var NavigationEvent: { - prototype: NavigationEvent; - new(): NavigationEvent; -} - -interface NavigationEventWithReferrer extends NavigationEvent { - readonly referer: string; -} - -declare var NavigationEventWithReferrer: { - prototype: NavigationEventWithReferrer; - new(): NavigationEventWithReferrer; -} - -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { - readonly appCodeName: string; - readonly cookieEnabled: boolean; - readonly language: string; - readonly maxTouchPoints: number; - readonly mimeTypes: MimeTypeArray; - readonly msManipulationViewsEnabled: boolean; - readonly msMaxTouchPoints: number; - readonly msPointerEnabled: boolean; - readonly plugins: PluginArray; - readonly pointerEnabled: boolean; - readonly webdriver: boolean; - readonly hardwareConcurrency: number; - getGamepads(): Gamepad[]; - javaEnabled(): boolean; - msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; - vibrate(pattern: number | number[]): boolean; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Navigator: { - prototype: Navigator; - new(): Navigator; -} - -interface Node extends EventTarget { - readonly attributes: NamedNodeMap; - readonly baseURI: string | null; - readonly childNodes: NodeList; - readonly firstChild: Node | null; - readonly lastChild: Node | null; - readonly localName: string | null; - readonly namespaceURI: string | null; - readonly nextSibling: Node | null; - readonly nodeName: string; - readonly nodeType: number; - nodeValue: string | null; - readonly ownerDocument: Document; - readonly parentElement: HTMLElement | null; - readonly parentNode: Node | null; - readonly previousSibling: Node | null; - textContent: string | null; - appendChild(newChild: Node): Node; - cloneNode(deep?: boolean): Node; - compareDocumentPosition(other: Node): number; - contains(child: Node): boolean; - hasAttributes(): boolean; - hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild: Node | null): Node; - isDefaultNamespace(namespaceURI: string | null): boolean; - isEqualNode(arg: Node): boolean; - isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string | null): string | null; - lookupPrefix(namespaceURI: string | null): string | null; - normalize(): void; - removeChild(oldChild: Node): Node; - replaceChild(newChild: Node, oldChild: Node): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -declare var Node: { - prototype: Node; - new(): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -interface NodeFilter { - acceptNode(n: Node): number; -} - -declare var NodeFilter: { - readonly FILTER_ACCEPT: number; - readonly FILTER_REJECT: number; - readonly FILTER_SKIP: number; - readonly SHOW_ALL: number; - readonly SHOW_ATTRIBUTE: number; - readonly SHOW_CDATA_SECTION: number; - readonly SHOW_COMMENT: number; - readonly SHOW_DOCUMENT: number; - readonly SHOW_DOCUMENT_FRAGMENT: number; - readonly SHOW_DOCUMENT_TYPE: number; - readonly SHOW_ELEMENT: number; - readonly SHOW_ENTITY: number; - readonly SHOW_ENTITY_REFERENCE: number; - readonly SHOW_NOTATION: number; - readonly SHOW_PROCESSING_INSTRUCTION: number; - readonly SHOW_TEXT: number; -} - -interface NodeIterator { - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - detach(): void; - nextNode(): Node; - previousNode(): Node; -} - -declare var NodeIterator: { - prototype: NodeIterator; - new(): NodeIterator; -} - -interface NodeList { - readonly length: number; - item(index: number): Node; - [index: number]: Node; -} - -declare var NodeList: { - prototype: NodeList; - new(): NodeList; -} - -interface OES_element_index_uint { -} - -declare var OES_element_index_uint: { - prototype: OES_element_index_uint; - new(): OES_element_index_uint; -} - -interface OES_standard_derivatives { - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -declare var OES_standard_derivatives: { - prototype: OES_standard_derivatives; - new(): OES_standard_derivatives; - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -interface OES_texture_float { -} - -declare var OES_texture_float: { - prototype: OES_texture_float; - new(): OES_texture_float; -} - -interface OES_texture_float_linear { -} - -declare var OES_texture_float_linear: { - prototype: OES_texture_float_linear; - new(): OES_texture_float_linear; -} - -interface OfflineAudioCompletionEvent extends Event { - readonly renderedBuffer: AudioBuffer; -} - -declare var OfflineAudioCompletionEvent: { - prototype: OfflineAudioCompletionEvent; - new(): OfflineAudioCompletionEvent; -} - -interface OfflineAudioContext extends AudioContext { - oncomplete: (this: this, ev: Event) => any; - startRendering(): PromiseLike; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OfflineAudioContext: { - prototype: OfflineAudioContext; - new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; -} - -interface OscillatorNode extends AudioNode { - readonly detune: AudioParam; - readonly frequency: AudioParam; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - type: string; - setPeriodicWave(periodicWave: PeriodicWave): void; - start(when?: number): void; - stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OscillatorNode: { - prototype: OscillatorNode; - new(): OscillatorNode; -} - -interface OverflowEvent extends UIEvent { - readonly horizontalOverflow: boolean; - readonly orient: number; - readonly verticalOverflow: boolean; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -declare var OverflowEvent: { - prototype: OverflowEvent; - new(): OverflowEvent; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -interface PageTransitionEvent extends Event { - readonly persisted: boolean; -} - -declare var PageTransitionEvent: { - prototype: PageTransitionEvent; - new(): PageTransitionEvent; -} - -interface PannerNode extends AudioNode { - coneInnerAngle: number; - coneOuterAngle: number; - coneOuterGain: number; - distanceModel: string; - maxDistance: number; - panningModel: string; - refDistance: number; - rolloffFactor: number; - setOrientation(x: number, y: number, z: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var PannerNode: { - prototype: PannerNode; - new(): PannerNode; -} - -interface PerfWidgetExternal { - readonly activeNetworkRequestCount: number; - readonly averageFrameTime: number; - readonly averagePaintTime: number; - readonly extraInformationEnabled: boolean; - readonly independentRenderingEnabled: boolean; - readonly irDisablingContentString: string; - readonly irStatusAvailable: boolean; - readonly maxCpuSpeed: number; - readonly paintRequestsPerSecond: number; - readonly performanceCounter: number; - readonly performanceCounterFrequency: number; - addEventListener(eventType: string, callback: Function): void; - getMemoryUsage(): number; - getProcessCpuUsage(): number; - getRecentCpuUsage(last: number | null): any; - getRecentFrames(last: number | null): any; - getRecentMemoryUsage(last: number | null): any; - getRecentPaintRequests(last: number | null): any; - removeEventListener(eventType: string, callback: Function): void; - repositionWindow(x: number, y: number): void; - resizeWindow(width: number, height: number): void; -} - -declare var PerfWidgetExternal: { - prototype: PerfWidgetExternal; - new(): PerfWidgetExternal; -} - -interface Performance { - readonly navigation: PerformanceNavigation; - readonly timing: PerformanceTiming; - clearMarks(markName?: string): void; - clearMeasures(measureName?: string): void; - clearResourceTimings(): void; - getEntries(): any; - getEntriesByName(name: string, entryType?: string): any; - getEntriesByType(entryType: string): any; - getMarks(markName?: string): any; - getMeasures(measureName?: string): any; - mark(markName: string): void; - measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - now(): number; - setResourceTimingBufferSize(maxSize: number): void; - toJSON(): any; -} - -declare var Performance: { - prototype: Performance; - new(): Performance; -} - -interface PerformanceEntry { - readonly duration: number; - readonly entryType: string; - readonly name: string; - readonly startTime: number; -} - -declare var PerformanceEntry: { - prototype: PerformanceEntry; - new(): PerformanceEntry; -} - -interface PerformanceMark extends PerformanceEntry { -} - -declare var PerformanceMark: { - prototype: PerformanceMark; - new(): PerformanceMark; -} - -interface PerformanceMeasure extends PerformanceEntry { -} - -declare var PerformanceMeasure: { - prototype: PerformanceMeasure; - new(): PerformanceMeasure; -} - -interface PerformanceNavigation { - readonly redirectCount: number; - readonly type: number; - toJSON(): any; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -declare var PerformanceNavigation: { - prototype: PerformanceNavigation; - new(): PerformanceNavigation; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -interface PerformanceNavigationTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly navigationStart: number; - readonly redirectCount: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly type: string; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; -} - -declare var PerformanceNavigationTiming: { - prototype: PerformanceNavigationTiming; - new(): PerformanceNavigationTiming; -} - -interface PerformanceResourceTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly initiatorType: string; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; -} - -declare var PerformanceResourceTiming: { - prototype: PerformanceResourceTiming; - new(): PerformanceResourceTiming; -} - -interface PerformanceTiming { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly msFirstPaint: number; - readonly navigationStart: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; - readonly secureConnectionStart: number; - toJSON(): any; -} - -declare var PerformanceTiming: { - prototype: PerformanceTiming; - new(): PerformanceTiming; -} - -interface PeriodicWave { -} - -declare var PeriodicWave: { - prototype: PeriodicWave; - new(): PeriodicWave; -} - -interface PermissionRequest extends DeferredPermissionRequest { - readonly state: string; - defer(): void; -} - -declare var PermissionRequest: { - prototype: PermissionRequest; - new(): PermissionRequest; -} - -interface PermissionRequestedEvent extends Event { - readonly permissionRequest: PermissionRequest; -} - -declare var PermissionRequestedEvent: { - prototype: PermissionRequestedEvent; - new(): PermissionRequestedEvent; -} - -interface Plugin { - readonly description: string; - readonly filename: string; - readonly length: number; - readonly name: string; - readonly version: string; - item(index: number): MimeType; - namedItem(type: string): MimeType; - [index: number]: MimeType; -} - -declare var Plugin: { - prototype: Plugin; - new(): Plugin; -} - -interface PluginArray { - readonly length: number; - item(index: number): Plugin; - namedItem(name: string): Plugin; - refresh(reload?: boolean): void; - [index: number]: Plugin; -} - -declare var PluginArray: { - prototype: PluginArray; - new(): PluginArray; -} - -interface PointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var PointerEvent: { - prototype: PointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; -} - -interface PopStateEvent extends Event { - readonly state: any; - initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; -} - -declare var PopStateEvent: { - prototype: PopStateEvent; - new(): PopStateEvent; -} - -interface Position { - readonly coords: Coordinates; - readonly timestamp: number; -} - -declare var Position: { - prototype: Position; - new(): Position; -} - -interface PositionError { - readonly code: number; - readonly message: string; - toString(): string; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -declare var PositionError: { - prototype: PositionError; - new(): PositionError; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -interface ProcessingInstruction extends CharacterData { - readonly target: string; -} - -declare var ProcessingInstruction: { - prototype: ProcessingInstruction; - new(): ProcessingInstruction; -} - -interface ProgressEvent extends Event { - readonly lengthComputable: boolean; - readonly loaded: number; - readonly total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -declare var ProgressEvent: { - prototype: ProgressEvent; - new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; -} - -interface RTCDTMFToneChangeEvent extends Event { - readonly tone: string; -} - -declare var RTCDTMFToneChangeEvent: { - prototype: RTCDTMFToneChangeEvent; - new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; -} - -interface RTCDtlsTransport extends RTCStatsProvider { - ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly state: string; - readonly transport: RTCIceTransport; - getLocalParameters(): RTCDtlsParameters; - getRemoteCertificates(): ArrayBuffer[]; - getRemoteParameters(): RTCDtlsParameters | null; - start(remoteParameters: RTCDtlsParameters): void; - stop(): void; - addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtlsTransport: { - prototype: RTCDtlsTransport; - new(transport: RTCIceTransport): RTCDtlsTransport; -} - -interface RTCDtlsTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCDtlsTransportStateChangedEvent: { - prototype: RTCDtlsTransportStateChangedEvent; - new(): RTCDtlsTransportStateChangedEvent; -} - -interface RTCDtmfSender extends EventTarget { - readonly canInsertDTMF: boolean; - readonly duration: number; - readonly interToneGap: number; - ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any; - readonly sender: RTCRtpSender; - readonly toneBuffer: string; - insertDTMF(tones: string, duration?: number, interToneGap?: number): void; - addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtmfSender: { - prototype: RTCDtmfSender; - new(sender: RTCRtpSender): RTCDtmfSender; -} - -interface RTCIceCandidatePairChangedEvent extends Event { - readonly pair: RTCIceCandidatePair; -} - -declare var RTCIceCandidatePairChangedEvent: { - prototype: RTCIceCandidatePairChangedEvent; - new(): RTCIceCandidatePairChangedEvent; -} - -interface RTCIceGatherer extends RTCStatsProvider { - readonly component: string; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null; - createAssociatedGatherer(): RTCIceGatherer; - getLocalCandidates(): RTCIceCandidate[]; - getLocalParameters(): RTCIceParameters; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceGatherer: { - prototype: RTCIceGatherer; - new(options: RTCIceGatherOptions): RTCIceGatherer; -} - -interface RTCIceGathererEvent extends Event { - readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; -} - -declare var RTCIceGathererEvent: { - prototype: RTCIceGathererEvent; - new(): RTCIceGathererEvent; -} - -interface RTCIceTransport extends RTCStatsProvider { - readonly component: string; - readonly iceGatherer: RTCIceGatherer | null; - oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null; - onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null; - readonly role: string; - readonly state: string; - addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; - createAssociatedTransport(): RTCIceTransport; - getNominatedCandidatePair(): RTCIceCandidatePair | null; - getRemoteCandidates(): RTCIceCandidate[]; - getRemoteParameters(): RTCIceParameters | null; - setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; - start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; - stop(): void; - addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceTransport: { - prototype: RTCIceTransport; - new(): RTCIceTransport; -} - -interface RTCIceTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCIceTransportStateChangedEvent: { - prototype: RTCIceTransportStateChangedEvent; - new(): RTCIceTransportStateChangedEvent; -} - -interface RTCRtpReceiver extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack | null; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - getContributingSources(): RTCRtpContributingSource[]; - receive(parameters: RTCRtpParameters): void; - requestSendCSRC(csrc: number): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpReceiver: { - prototype: RTCRtpReceiver; - new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCRtpSender extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - send(parameters: RTCRtpParameters): void; - setTrack(track: MediaStreamTrack): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpSender: { - prototype: RTCRtpSender; - new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCSrtpSdesTransport extends EventTarget { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly transport: RTCIceTransport; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCSrtpSdesTransport: { - prototype: RTCSrtpSdesTransport; - new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; - getLocalParameters(): RTCSrtpSdesParameters[]; -} - -interface RTCSsrcConflictEvent extends Event { - readonly ssrc: number; -} - -declare var RTCSsrcConflictEvent: { - prototype: RTCSsrcConflictEvent; - new(): RTCSsrcConflictEvent; -} - -interface RTCStatsProvider extends EventTarget { - getStats(): PromiseLike; - msGetStats(): PromiseLike; -} - -declare var RTCStatsProvider: { - prototype: RTCStatsProvider; - new(): RTCStatsProvider; -} - -interface Range { - readonly collapsed: boolean; - readonly commonAncestorContainer: Node; - readonly endContainer: Node; - readonly endOffset: number; - readonly startContainer: Node; - readonly startOffset: number; - cloneContents(): DocumentFragment; - cloneRange(): Range; - collapse(toStart: boolean): void; - compareBoundaryPoints(how: number, sourceRange: Range): number; - createContextualFragment(fragment: string): DocumentFragment; - deleteContents(): void; - detach(): void; - expand(Unit: string): boolean; - extractContents(): DocumentFragment; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - insertNode(newNode: Node): void; - selectNode(refNode: Node): void; - selectNodeContents(refNode: Node): void; - setEnd(refNode: Node, offset: number): void; - setEndAfter(refNode: Node): void; - setEndBefore(refNode: Node): void; - setStart(refNode: Node, offset: number): void; - setStartAfter(refNode: Node): void; - setStartBefore(refNode: Node): void; - surroundContents(newParent: Node): void; - toString(): string; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -declare var Range: { - prototype: Range; - new(): Range; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly target: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGAElement: { - prototype: SVGAElement; - new(): SVGAElement; -} - -interface SVGAngle { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -declare var SVGAngle: { - prototype: SVGAngle; - new(): SVGAngle; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -interface SVGAnimatedAngle { - readonly animVal: SVGAngle; - readonly baseVal: SVGAngle; -} - -declare var SVGAnimatedAngle: { - prototype: SVGAnimatedAngle; - new(): SVGAnimatedAngle; -} - -interface SVGAnimatedBoolean { - readonly animVal: boolean; - baseVal: boolean; -} - -declare var SVGAnimatedBoolean: { - prototype: SVGAnimatedBoolean; - new(): SVGAnimatedBoolean; -} - -interface SVGAnimatedEnumeration { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedEnumeration: { - prototype: SVGAnimatedEnumeration; - new(): SVGAnimatedEnumeration; -} - -interface SVGAnimatedInteger { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedInteger: { - prototype: SVGAnimatedInteger; - new(): SVGAnimatedInteger; -} - -interface SVGAnimatedLength { - readonly animVal: SVGLength; - readonly baseVal: SVGLength; -} - -declare var SVGAnimatedLength: { - prototype: SVGAnimatedLength; - new(): SVGAnimatedLength; -} - -interface SVGAnimatedLengthList { - readonly animVal: SVGLengthList; - readonly baseVal: SVGLengthList; -} - -declare var SVGAnimatedLengthList: { - prototype: SVGAnimatedLengthList; - new(): SVGAnimatedLengthList; -} - -interface SVGAnimatedNumber { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedNumber: { - prototype: SVGAnimatedNumber; - new(): SVGAnimatedNumber; -} - -interface SVGAnimatedNumberList { - readonly animVal: SVGNumberList; - readonly baseVal: SVGNumberList; -} - -declare var SVGAnimatedNumberList: { - prototype: SVGAnimatedNumberList; - new(): SVGAnimatedNumberList; -} - -interface SVGAnimatedPreserveAspectRatio { - readonly animVal: SVGPreserveAspectRatio; - readonly baseVal: SVGPreserveAspectRatio; -} - -declare var SVGAnimatedPreserveAspectRatio: { - prototype: SVGAnimatedPreserveAspectRatio; - new(): SVGAnimatedPreserveAspectRatio; -} - -interface SVGAnimatedRect { - readonly animVal: SVGRect; - readonly baseVal: SVGRect; -} - -declare var SVGAnimatedRect: { - prototype: SVGAnimatedRect; - new(): SVGAnimatedRect; -} - -interface SVGAnimatedString { - readonly animVal: string; - baseVal: string; -} - -declare var SVGAnimatedString: { - prototype: SVGAnimatedString; - new(): SVGAnimatedString; -} - -interface SVGAnimatedTransformList { - readonly animVal: SVGTransformList; - readonly baseVal: SVGTransformList; -} - -declare var SVGAnimatedTransformList: { - prototype: SVGAnimatedTransformList; - new(): SVGAnimatedTransformList; -} - -interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGCircleElement: { - prototype: SVGCircleElement; - new(): SVGCircleElement; -} - -interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly clipPathUnits: SVGAnimatedEnumeration; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGClipPathElement: { - prototype: SVGClipPathElement; - new(): SVGClipPathElement; -} - -interface SVGComponentTransferFunctionElement extends SVGElement { - readonly amplitude: SVGAnimatedNumber; - readonly exponent: SVGAnimatedNumber; - readonly intercept: SVGAnimatedNumber; - readonly offset: SVGAnimatedNumber; - readonly slope: SVGAnimatedNumber; - readonly tableValues: SVGAnimatedNumberList; - readonly type: SVGAnimatedEnumeration; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -declare var SVGComponentTransferFunctionElement: { - prototype: SVGComponentTransferFunctionElement; - new(): SVGComponentTransferFunctionElement; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDefsElement: { - prototype: SVGDefsElement; - new(): SVGDefsElement; -} - -interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDescElement: { - prototype: SVGDescElement; - new(): SVGDescElement; -} - -interface SVGElement extends Element { - onclick: (this: this, ev: MouseEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - onfocusin: (this: this, ev: FocusEvent) => any; - onfocusout: (this: this, ev: FocusEvent) => any; - onload: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - readonly ownerSVGElement: SVGSVGElement; - readonly viewportElement: SVGElement; - xmlbase: string; - className: any; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var SVGElement: { - prototype: SVGElement; - new(): SVGElement; -} - -interface SVGElementInstance extends EventTarget { - readonly childNodes: SVGElementInstanceList; - readonly correspondingElement: SVGElement; - readonly correspondingUseElement: SVGUseElement; - readonly firstChild: SVGElementInstance; - readonly lastChild: SVGElementInstance; - readonly nextSibling: SVGElementInstance; - readonly parentNode: SVGElementInstance; - readonly previousSibling: SVGElementInstance; -} - -declare var SVGElementInstance: { - prototype: SVGElementInstance; - new(): SVGElementInstance; -} - -interface SVGElementInstanceList { - readonly length: number; - item(index: number): SVGElementInstance; -} - -declare var SVGElementInstanceList: { - prototype: SVGElementInstanceList; - new(): SVGElementInstanceList; -} - -interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGEllipseElement: { - prototype: SVGEllipseElement; - new(): SVGEllipseElement; -} - -interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly mode: SVGAnimatedEnumeration; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEBlendElement: { - prototype: SVGFEBlendElement; - new(): SVGFEBlendElement; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; -} - -interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly type: SVGAnimatedEnumeration; - readonly values: SVGAnimatedNumberList; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEColorMatrixElement: { - prototype: SVGFEColorMatrixElement; - new(): SVGFEColorMatrixElement; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; -} - -interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEComponentTransferElement: { - prototype: SVGFEComponentTransferElement; - new(): SVGFEComponentTransferElement; -} - -interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly k1: SVGAnimatedNumber; - readonly k2: SVGAnimatedNumber; - readonly k3: SVGAnimatedNumber; - readonly k4: SVGAnimatedNumber; - readonly operator: SVGAnimatedEnumeration; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFECompositeElement: { - prototype: SVGFECompositeElement; - new(): SVGFECompositeElement; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; -} - -interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly bias: SVGAnimatedNumber; - readonly divisor: SVGAnimatedNumber; - readonly edgeMode: SVGAnimatedEnumeration; - readonly in1: SVGAnimatedString; - readonly kernelMatrix: SVGAnimatedNumberList; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly orderX: SVGAnimatedInteger; - readonly orderY: SVGAnimatedInteger; - readonly preserveAlpha: SVGAnimatedBoolean; - readonly targetX: SVGAnimatedInteger; - readonly targetY: SVGAnimatedInteger; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEConvolveMatrixElement: { - prototype: SVGFEConvolveMatrixElement; - new(): SVGFEConvolveMatrixElement; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; -} - -interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly diffuseConstant: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDiffuseLightingElement: { - prototype: SVGFEDiffuseLightingElement; - new(): SVGFEDiffuseLightingElement; -} - -interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly scale: SVGAnimatedNumber; - readonly xChannelSelector: SVGAnimatedEnumeration; - readonly yChannelSelector: SVGAnimatedEnumeration; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDisplacementMapElement: { - prototype: SVGFEDisplacementMapElement; - new(): SVGFEDisplacementMapElement; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; -} - -interface SVGFEDistantLightElement extends SVGElement { - readonly azimuth: SVGAnimatedNumber; - readonly elevation: SVGAnimatedNumber; -} - -declare var SVGFEDistantLightElement: { - prototype: SVGFEDistantLightElement; - new(): SVGFEDistantLightElement; -} - -interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEFloodElement: { - prototype: SVGFEFloodElement; - new(): SVGFEFloodElement; -} - -interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncAElement: { - prototype: SVGFEFuncAElement; - new(): SVGFEFuncAElement; -} - -interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncBElement: { - prototype: SVGFEFuncBElement; - new(): SVGFEFuncBElement; -} - -interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncGElement: { - prototype: SVGFEFuncGElement; - new(): SVGFEFuncGElement; -} - -interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncRElement: { - prototype: SVGFEFuncRElement; - new(): SVGFEFuncRElement; -} - -interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly stdDeviationX: SVGAnimatedNumber; - readonly stdDeviationY: SVGAnimatedNumber; - setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEGaussianBlurElement: { - prototype: SVGFEGaussianBlurElement; - new(): SVGFEGaussianBlurElement; -} - -interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEImageElement: { - prototype: SVGFEImageElement; - new(): SVGFEImageElement; -} - -interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeElement: { - prototype: SVGFEMergeElement; - new(): SVGFEMergeElement; -} - -interface SVGFEMergeNodeElement extends SVGElement { - readonly in1: SVGAnimatedString; -} - -declare var SVGFEMergeNodeElement: { - prototype: SVGFEMergeNodeElement; - new(): SVGFEMergeNodeElement; -} - -interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly operator: SVGAnimatedEnumeration; - readonly radiusX: SVGAnimatedNumber; - readonly radiusY: SVGAnimatedNumber; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMorphologyElement: { - prototype: SVGFEMorphologyElement; - new(): SVGFEMorphologyElement; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; -} - -interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly dx: SVGAnimatedNumber; - readonly dy: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEOffsetElement: { - prototype: SVGFEOffsetElement; - new(): SVGFEOffsetElement; -} - -interface SVGFEPointLightElement extends SVGElement { - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; -} - -declare var SVGFEPointLightElement: { - prototype: SVGFEPointLightElement; - new(): SVGFEPointLightElement; -} - -interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly specularConstant: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpecularLightingElement: { - prototype: SVGFESpecularLightingElement; - new(): SVGFESpecularLightingElement; -} - -interface SVGFESpotLightElement extends SVGElement { - readonly limitingConeAngle: SVGAnimatedNumber; - readonly pointsAtX: SVGAnimatedNumber; - readonly pointsAtY: SVGAnimatedNumber; - readonly pointsAtZ: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; -} - -declare var SVGFESpotLightElement: { - prototype: SVGFESpotLightElement; - new(): SVGFESpotLightElement; -} - -interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETileElement: { - prototype: SVGFETileElement; - new(): SVGFETileElement; -} - -interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly baseFrequencyX: SVGAnimatedNumber; - readonly baseFrequencyY: SVGAnimatedNumber; - readonly numOctaves: SVGAnimatedInteger; - readonly seed: SVGAnimatedNumber; - readonly stitchTiles: SVGAnimatedEnumeration; - readonly type: SVGAnimatedEnumeration; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETurbulenceElement: { - prototype: SVGFETurbulenceElement; - new(): SVGFETurbulenceElement; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; -} - -interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly filterResX: SVGAnimatedInteger; - readonly filterResY: SVGAnimatedInteger; - readonly filterUnits: SVGAnimatedEnumeration; - readonly height: SVGAnimatedLength; - readonly primitiveUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - setFilterRes(filterResX: number, filterResY: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFilterElement: { - prototype: SVGFilterElement; - new(): SVGFilterElement; -} - -interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGForeignObjectElement: { - prototype: SVGForeignObjectElement; - new(): SVGForeignObjectElement; -} - -interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGElement: { - prototype: SVGGElement; - new(): SVGGElement; -} - -interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - readonly gradientTransform: SVGAnimatedTransformList; - readonly gradientUnits: SVGAnimatedEnumeration; - readonly spreadMethod: SVGAnimatedEnumeration; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGradientElement: { - prototype: SVGGradientElement; - new(): SVGGradientElement; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; -} - -interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly height: SVGAnimatedLength; - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGImageElement: { - prototype: SVGImageElement; - new(): SVGImageElement; -} - -interface SVGLength { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -declare var SVGLength: { - prototype: SVGLength; - new(): SVGLength; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -interface SVGLengthList { - readonly numberOfItems: number; - appendItem(newItem: SVGLength): SVGLength; - clear(): void; - getItem(index: number): SVGLength; - initialize(newItem: SVGLength): SVGLength; - insertItemBefore(newItem: SVGLength, index: number): SVGLength; - removeItem(index: number): SVGLength; - replaceItem(newItem: SVGLength, index: number): SVGLength; -} - -declare var SVGLengthList: { - prototype: SVGLengthList; - new(): SVGLengthList; -} - -interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGLineElement: { - prototype: SVGLineElement; - new(): SVGLineElement; -} - -interface SVGLinearGradientElement extends SVGGradientElement { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; -} - -declare var SVGLinearGradientElement: { - prototype: SVGLinearGradientElement; - new(): SVGLinearGradientElement; -} - -interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - readonly markerHeight: SVGAnimatedLength; - readonly markerUnits: SVGAnimatedEnumeration; - readonly markerWidth: SVGAnimatedLength; - readonly orientAngle: SVGAnimatedAngle; - readonly orientType: SVGAnimatedEnumeration; - readonly refX: SVGAnimatedLength; - readonly refY: SVGAnimatedLength; - setOrientToAngle(angle: SVGAngle): void; - setOrientToAuto(): void; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMarkerElement: { - prototype: SVGMarkerElement; - new(): SVGMarkerElement; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; -} - -interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly maskContentUnits: SVGAnimatedEnumeration; - readonly maskUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMaskElement: { - prototype: SVGMaskElement; - new(): SVGMaskElement; -} - -interface SVGMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - flipX(): SVGMatrix; - flipY(): SVGMatrix; - inverse(): SVGMatrix; - multiply(secondMatrix: SVGMatrix): SVGMatrix; - rotate(angle: number): SVGMatrix; - rotateFromVector(x: number, y: number): SVGMatrix; - scale(scaleFactor: number): SVGMatrix; - scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; - skewX(angle: number): SVGMatrix; - skewY(angle: number): SVGMatrix; - translate(x: number, y: number): SVGMatrix; -} - -declare var SVGMatrix: { - prototype: SVGMatrix; - new(): SVGMatrix; -} - -interface SVGMetadataElement extends SVGElement { -} - -declare var SVGMetadataElement: { - prototype: SVGMetadataElement; - new(): SVGMetadataElement; -} - -interface SVGNumber { - value: number; -} - -declare var SVGNumber: { - prototype: SVGNumber; - new(): SVGNumber; -} - -interface SVGNumberList { - readonly numberOfItems: number; - appendItem(newItem: SVGNumber): SVGNumber; - clear(): void; - getItem(index: number): SVGNumber; - initialize(newItem: SVGNumber): SVGNumber; - insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; - removeItem(index: number): SVGNumber; - replaceItem(newItem: SVGNumber, index: number): SVGNumber; -} - -declare var SVGNumberList: { - prototype: SVGNumberList; - new(): SVGNumberList; -} - -interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { - createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; - createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; - createSVGPathSegClosePath(): SVGPathSegClosePath; - createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; - createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; - createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; - createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; - createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; - createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; - createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; - createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; - createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; - createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; - createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; - createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; - createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; - createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; - createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; - createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; - getPathSegAtLength(distance: number): number; - getPointAtLength(distance: number): SVGPoint; - getTotalLength(): number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPathElement: { - prototype: SVGPathElement; - new(): SVGPathElement; -} - -interface SVGPathSeg { - readonly pathSegType: number; - readonly pathSegTypeAsLetter: string; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -declare var SVGPathSeg: { - prototype: SVGPathSeg; - new(): SVGPathSeg; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -interface SVGPathSegArcAbs extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcAbs: { - prototype: SVGPathSegArcAbs; - new(): SVGPathSegArcAbs; -} - -interface SVGPathSegArcRel extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcRel: { - prototype: SVGPathSegArcRel; - new(): SVGPathSegArcRel; -} - -interface SVGPathSegClosePath extends SVGPathSeg { -} - -declare var SVGPathSegClosePath: { - prototype: SVGPathSegClosePath; - new(): SVGPathSegClosePath; -} - -interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicAbs: { - prototype: SVGPathSegCurvetoCubicAbs; - new(): SVGPathSegCurvetoCubicAbs; -} - -interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicRel: { - prototype: SVGPathSegCurvetoCubicRel; - new(): SVGPathSegCurvetoCubicRel; -} - -interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothAbs: { - prototype: SVGPathSegCurvetoCubicSmoothAbs; - new(): SVGPathSegCurvetoCubicSmoothAbs; -} - -interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothRel: { - prototype: SVGPathSegCurvetoCubicSmoothRel; - new(): SVGPathSegCurvetoCubicSmoothRel; -} - -interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticAbs: { - prototype: SVGPathSegCurvetoQuadraticAbs; - new(): SVGPathSegCurvetoQuadraticAbs; -} - -interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticRel: { - prototype: SVGPathSegCurvetoQuadraticRel; - new(): SVGPathSegCurvetoQuadraticRel; -} - -interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothAbs: { - prototype: SVGPathSegCurvetoQuadraticSmoothAbs; - new(): SVGPathSegCurvetoQuadraticSmoothAbs; -} - -interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothRel: { - prototype: SVGPathSegCurvetoQuadraticSmoothRel; - new(): SVGPathSegCurvetoQuadraticSmoothRel; -} - -interface SVGPathSegLinetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoAbs: { - prototype: SVGPathSegLinetoAbs; - new(): SVGPathSegLinetoAbs; -} - -interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalAbs: { - prototype: SVGPathSegLinetoHorizontalAbs; - new(): SVGPathSegLinetoHorizontalAbs; -} - -interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalRel: { - prototype: SVGPathSegLinetoHorizontalRel; - new(): SVGPathSegLinetoHorizontalRel; -} - -interface SVGPathSegLinetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoRel: { - prototype: SVGPathSegLinetoRel; - new(): SVGPathSegLinetoRel; -} - -interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalAbs: { - prototype: SVGPathSegLinetoVerticalAbs; - new(): SVGPathSegLinetoVerticalAbs; -} - -interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalRel: { - prototype: SVGPathSegLinetoVerticalRel; - new(): SVGPathSegLinetoVerticalRel; -} - -interface SVGPathSegList { - readonly numberOfItems: number; - appendItem(newItem: SVGPathSeg): SVGPathSeg; - clear(): void; - getItem(index: number): SVGPathSeg; - initialize(newItem: SVGPathSeg): SVGPathSeg; - insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; - removeItem(index: number): SVGPathSeg; - replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; -} - -declare var SVGPathSegList: { - prototype: SVGPathSegList; - new(): SVGPathSegList; -} - -interface SVGPathSegMovetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoAbs: { - prototype: SVGPathSegMovetoAbs; - new(): SVGPathSegMovetoAbs; -} - -interface SVGPathSegMovetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoRel: { - prototype: SVGPathSegMovetoRel; - new(): SVGPathSegMovetoRel; -} - -interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly patternContentUnits: SVGAnimatedEnumeration; - readonly patternTransform: SVGAnimatedTransformList; - readonly patternUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPatternElement: { - prototype: SVGPatternElement; - new(): SVGPatternElement; -} - -interface SVGPoint { - x: number; - y: number; - matrixTransform(matrix: SVGMatrix): SVGPoint; -} - -declare var SVGPoint: { - prototype: SVGPoint; - new(): SVGPoint; -} - -interface SVGPointList { - readonly numberOfItems: number; - appendItem(newItem: SVGPoint): SVGPoint; - clear(): void; - getItem(index: number): SVGPoint; - initialize(newItem: SVGPoint): SVGPoint; - insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; - removeItem(index: number): SVGPoint; - replaceItem(newItem: SVGPoint, index: number): SVGPoint; -} - -declare var SVGPointList: { - prototype: SVGPointList; - new(): SVGPointList; -} - -interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolygonElement: { - prototype: SVGPolygonElement; - new(): SVGPolygonElement; -} - -interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolylineElement: { - prototype: SVGPolylineElement; - new(): SVGPolylineElement; -} - -interface SVGPreserveAspectRatio { - align: number; - meetOrSlice: number; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -declare var SVGPreserveAspectRatio: { - prototype: SVGPreserveAspectRatio; - new(): SVGPreserveAspectRatio; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -interface SVGRadialGradientElement extends SVGGradientElement { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly fx: SVGAnimatedLength; - readonly fy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; -} - -declare var SVGRadialGradientElement: { - prototype: SVGRadialGradientElement; - new(): SVGRadialGradientElement; -} - -interface SVGRect { - height: number; - width: number; - x: number; - y: number; -} - -declare var SVGRect: { - prototype: SVGRect; - new(): SVGRect; -} - -interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGRectElement: { - prototype: SVGRectElement; - new(): SVGRectElement; -} - -interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - contentScriptType: string; - contentStyleType: string; - currentScale: number; - readonly currentTranslate: SVGPoint; - readonly height: SVGAnimatedLength; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onunload: (this: this, ev: Event) => any; - onzoom: (this: this, ev: SVGZoomEvent) => any; - readonly pixelUnitToMillimeterX: number; - readonly pixelUnitToMillimeterY: number; - readonly screenPixelToMillimeterX: number; - readonly screenPixelToMillimeterY: number; - readonly viewport: SVGRect; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - checkEnclosure(element: SVGElement, rect: SVGRect): boolean; - checkIntersection(element: SVGElement, rect: SVGRect): boolean; - createSVGAngle(): SVGAngle; - createSVGLength(): SVGLength; - createSVGMatrix(): SVGMatrix; - createSVGNumber(): SVGNumber; - createSVGPoint(): SVGPoint; - createSVGRect(): SVGRect; - createSVGTransform(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - deselectAll(): void; - forceRedraw(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getCurrentTime(): number; - getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - pauseAnimations(): void; - setCurrentTime(seconds: number): void; - suspendRedraw(maxWaitMilliseconds: number): number; - unpauseAnimations(): void; - unsuspendRedraw(suspendHandleID: number): void; - unsuspendRedrawAll(): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", 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; -} - -declare var SVGSVGElement: { - prototype: SVGSVGElement; - new(): SVGSVGElement; -} - -interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGScriptElement: { - prototype: SVGScriptElement; - new(): SVGScriptElement; -} - -interface SVGStopElement extends SVGElement, SVGStylable { - readonly offset: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStopElement: { - prototype: SVGStopElement; - new(): SVGStopElement; -} - -interface SVGStringList { - readonly numberOfItems: number; - appendItem(newItem: string): string; - clear(): void; - getItem(index: number): string; - initialize(newItem: string): string; - insertItemBefore(newItem: string, index: number): string; - removeItem(index: number): string; - replaceItem(newItem: string, index: number): string; -} - -declare var SVGStringList: { - prototype: SVGStringList; - new(): SVGStringList; -} - -interface SVGStyleElement extends SVGElement, SVGLangSpace { - disabled: boolean; - media: string; - title: string; - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStyleElement: { - prototype: SVGStyleElement; - new(): SVGStyleElement; -} - -interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSwitchElement: { - prototype: SVGSwitchElement; - new(): SVGSwitchElement; -} - -interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSymbolElement: { - prototype: SVGSymbolElement; - new(): SVGSymbolElement; -} - -interface SVGTSpanElement extends SVGTextPositioningElement { -} - -declare var SVGTSpanElement: { - prototype: SVGTSpanElement; - new(): SVGTSpanElement; -} - -interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly lengthAdjust: SVGAnimatedEnumeration; - readonly textLength: SVGAnimatedLength; - getCharNumAtPosition(point: SVGPoint): number; - getComputedTextLength(): number; - getEndPositionOfChar(charnum: number): SVGPoint; - getExtentOfChar(charnum: number): SVGRect; - getNumberOfChars(): number; - getRotationOfChar(charnum: number): number; - getStartPositionOfChar(charnum: number): SVGPoint; - getSubStringLength(charnum: number, nchars: number): number; - selectSubString(charnum: number, nchars: number): void; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextContentElement: { - prototype: SVGTextContentElement; - new(): SVGTextContentElement; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; -} - -interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextElement: { - prototype: SVGTextElement; - new(): SVGTextElement; -} - -interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - readonly method: SVGAnimatedEnumeration; - readonly spacing: SVGAnimatedEnumeration; - readonly startOffset: SVGAnimatedLength; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextPathElement: { - prototype: SVGTextPathElement; - new(): SVGTextPathElement; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -interface SVGTextPositioningElement extends SVGTextContentElement { - readonly dx: SVGAnimatedLengthList; - readonly dy: SVGAnimatedLengthList; - readonly rotate: SVGAnimatedNumberList; - readonly x: SVGAnimatedLengthList; - readonly y: SVGAnimatedLengthList; -} - -declare var SVGTextPositioningElement: { - prototype: SVGTextPositioningElement; - new(): SVGTextPositioningElement; -} - -interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTitleElement: { - prototype: SVGTitleElement; - new(): SVGTitleElement; -} - -interface SVGTransform { - readonly angle: number; - readonly matrix: SVGMatrix; - readonly type: number; - setMatrix(matrix: SVGMatrix): void; - setRotate(angle: number, cx: number, cy: number): void; - setScale(sx: number, sy: number): void; - setSkewX(angle: number): void; - setSkewY(angle: number): void; - setTranslate(tx: number, ty: number): void; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -declare var SVGTransform: { - prototype: SVGTransform; - new(): SVGTransform; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -interface SVGTransformList { - readonly numberOfItems: number; - appendItem(newItem: SVGTransform): SVGTransform; - clear(): void; - consolidate(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - getItem(index: number): SVGTransform; - initialize(newItem: SVGTransform): SVGTransform; - insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; - removeItem(index: number): SVGTransform; - replaceItem(newItem: SVGTransform, index: number): SVGTransform; -} - -declare var SVGTransformList: { - prototype: SVGTransformList; - new(): SVGTransformList; -} - -interface SVGUnitTypes { - readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - readonly SVG_UNIT_TYPE_UNKNOWN: number; - readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; -} -declare var SVGUnitTypes: SVGUnitTypes; - -interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly animatedInstanceRoot: SVGElementInstance; - readonly height: SVGAnimatedLength; - readonly instanceRoot: SVGElementInstance; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGUseElement: { - prototype: SVGUseElement; - new(): SVGUseElement; -} - -interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - readonly viewTarget: SVGStringList; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGViewElement: { - prototype: SVGViewElement; - new(): SVGViewElement; -} - -interface SVGZoomAndPan { - readonly zoomAndPan: number; -} - -declare var SVGZoomAndPan: { - readonly SVG_ZOOMANDPAN_DISABLE: number; - readonly SVG_ZOOMANDPAN_MAGNIFY: number; - readonly SVG_ZOOMANDPAN_UNKNOWN: number; -} - -interface SVGZoomEvent extends UIEvent { - readonly newScale: number; - readonly newTranslate: SVGPoint; - readonly previousScale: number; - readonly previousTranslate: SVGPoint; - readonly zoomRectScreen: SVGRect; -} - -declare var SVGZoomEvent: { - prototype: SVGZoomEvent; - new(): SVGZoomEvent; -} - -interface Screen extends EventTarget { - readonly availHeight: number; - readonly availWidth: number; - bufferDepth: number; - readonly colorDepth: number; - readonly deviceXDPI: number; - readonly deviceYDPI: number; - readonly fontSmoothingEnabled: boolean; - readonly height: number; - readonly logicalXDPI: number; - readonly logicalYDPI: number; - readonly msOrientation: string; - onmsorientationchange: (this: this, ev: Event) => any; - readonly pixelDepth: number; - readonly systemXDPI: number; - readonly systemYDPI: number; - readonly width: number; - msLockOrientation(orientations: string | string[]): boolean; - msUnlockOrientation(): void; - addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Screen: { - prototype: Screen; - new(): Screen; -} - -interface ScriptNotifyEvent extends Event { - readonly callingUri: string; - readonly value: string; -} - -declare var ScriptNotifyEvent: { - prototype: ScriptNotifyEvent; - new(): ScriptNotifyEvent; -} - -interface ScriptProcessorNode extends AudioNode { - readonly bufferSize: number; - onaudioprocess: (this: this, ev: AudioProcessingEvent) => any; - addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ScriptProcessorNode: { - prototype: ScriptProcessorNode; - new(): ScriptProcessorNode; -} - -interface Selection { - readonly anchorNode: Node; - readonly anchorOffset: number; - readonly focusNode: Node; - readonly focusOffset: number; - readonly isCollapsed: boolean; - readonly rangeCount: number; - readonly type: string; - addRange(range: Range): void; - collapse(parentNode: Node, offset: number): void; - collapseToEnd(): void; - collapseToStart(): void; - containsNode(node: Node, partlyContained: boolean): boolean; - deleteFromDocument(): void; - empty(): void; - extend(newNode: Node, offset: number): void; - getRangeAt(index: number): Range; - removeAllRanges(): void; - removeRange(range: Range): void; - selectAllChildren(parentNode: Node): void; - setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; - toString(): string; -} - -declare var Selection: { - prototype: Selection; - new(): Selection; -} - -interface SourceBuffer extends EventTarget { - appendWindowEnd: number; - appendWindowStart: number; - readonly audioTracks: AudioTrackList; - readonly buffered: TimeRanges; - mode: string; - timestampOffset: number; - readonly updating: boolean; - readonly videoTracks: VideoTrackList; - abort(): void; - appendBuffer(data: ArrayBuffer | ArrayBufferView): void; - appendStream(stream: MSStream, maxSize?: number): void; - remove(start: number, end: number): void; -} - -declare var SourceBuffer: { - prototype: SourceBuffer; - new(): SourceBuffer; -} - -interface SourceBufferList extends EventTarget { - readonly length: number; - item(index: number): SourceBuffer; - [index: number]: SourceBuffer; -} - -declare var SourceBufferList: { - prototype: SourceBufferList; - new(): SourceBufferList; -} - -interface StereoPannerNode extends AudioNode { - readonly pan: AudioParam; -} - -declare var StereoPannerNode: { - prototype: StereoPannerNode; - new(): StereoPannerNode; -} - -interface Storage { - readonly length: number; - clear(): void; - getItem(key: string): string | null; - key(index: number): string | null; - removeItem(key: string): void; - setItem(key: string, data: string): void; - [key: string]: any; - [index: number]: string; -} - -declare var Storage: { - prototype: Storage; - new(): Storage; -} - -interface StorageEvent extends Event { - readonly url: string; - key?: string; - oldValue?: string; - newValue?: string; - storageArea?: Storage; -} - -declare var StorageEvent: { - prototype: StorageEvent; - new (type: string, eventInitDict?: StorageEventInit): StorageEvent; -} - -interface StyleMedia { - readonly type: string; - matchMedium(mediaquery: string): boolean; -} - -declare var StyleMedia: { - prototype: StyleMedia; - new(): StyleMedia; -} - -interface StyleSheet { - disabled: boolean; - readonly href: string; - readonly media: MediaList; - readonly ownerNode: Node; - readonly parentStyleSheet: StyleSheet; - readonly title: string; - readonly type: string; -} - -declare var StyleSheet: { - prototype: StyleSheet; - new(): StyleSheet; -} - -interface StyleSheetList { - readonly length: number; - item(index?: number): StyleSheet; - [index: number]: StyleSheet; -} - -declare var StyleSheetList: { - prototype: StyleSheetList; - new(): StyleSheetList; -} - -interface StyleSheetPageList { - readonly length: number; - item(index: number): CSSPageRule; - [index: number]: CSSPageRule; -} - -declare var StyleSheetPageList: { - prototype: StyleSheetPageList; - new(): StyleSheetPageList; -} - -interface SubtleCrypto { - decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; - deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; - encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - exportKey(format: "jwk", key: CryptoKey): PromiseLike; - exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; - exportKey(format: string, key: CryptoKey): PromiseLike; - generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; - unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; - verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; -} - -declare var SubtleCrypto: { - prototype: SubtleCrypto; - new(): SubtleCrypto; -} - -interface Text extends CharacterData { - readonly wholeText: string; - splitText(offset: number): Text; -} - -declare var Text: { - prototype: Text; - new(): Text; -} - -interface TextEvent extends UIEvent { - readonly data: string; - readonly inputMethod: number; - readonly locale: string; - initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -declare var TextEvent: { - prototype: TextEvent; - new(): TextEvent; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -interface TextMetrics { - readonly width: number; -} - -declare var TextMetrics: { - prototype: TextMetrics; - new(): TextMetrics; -} - -interface TextTrack extends EventTarget { - readonly activeCues: TextTrackCueList; - readonly cues: TextTrackCueList; - readonly inBandMetadataTrackDispatchType: string; - readonly kind: string; - readonly label: string; - readonly language: string; - mode: any; - oncuechange: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - readonly readyState: number; - addCue(cue: TextTrackCue): void; - removeCue(cue: TextTrackCue): void; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; - addEventListener(type: "cuechange", 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrack: { - prototype: TextTrack; - new(): TextTrack; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; -} - -interface TextTrackCue extends EventTarget { - endTime: number; - id: string; - onenter: (this: this, ev: Event) => any; - onexit: (this: this, ev: Event) => any; - pauseOnExit: boolean; - startTime: number; - text: string; - readonly track: TextTrack; - getCueAsHTML(): DocumentFragment; - addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrackCue: { - prototype: TextTrackCue; - new(startTime: number, endTime: number, text: string): TextTrackCue; -} - -interface TextTrackCueList { - readonly length: number; - getCueById(id: string): TextTrackCue; - item(index: number): TextTrackCue; - [index: number]: TextTrackCue; -} - -declare var TextTrackCueList: { - prototype: TextTrackCueList; - new(): TextTrackCueList; -} - -interface TextTrackList extends EventTarget { - readonly length: number; - onaddtrack: ((this: this, ev: TrackEvent) => any) | null; - item(index: number): TextTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: TextTrack; -} - -declare var TextTrackList: { - prototype: TextTrackList; - new(): TextTrackList; -} - -interface TimeRanges { - readonly length: number; - end(index: number): number; - start(index: number): number; -} - -declare var TimeRanges: { - prototype: TimeRanges; - new(): TimeRanges; -} - -interface Touch { - readonly clientX: number; - readonly clientY: number; - readonly identifier: number; - readonly pageX: number; - readonly pageY: number; - readonly screenX: number; - readonly screenY: number; - readonly target: EventTarget; -} - -declare var Touch: { - prototype: Touch; - new(): Touch; -} - -interface TouchEvent extends UIEvent { - readonly altKey: boolean; - readonly changedTouches: TouchList; - readonly ctrlKey: boolean; - readonly metaKey: boolean; - readonly shiftKey: boolean; - readonly targetTouches: TouchList; - readonly touches: TouchList; -} - -declare var TouchEvent: { - prototype: TouchEvent; - new(): TouchEvent; -} - -interface TouchList { - readonly length: number; - item(index: number): Touch | null; - [index: number]: Touch; -} - -declare var TouchList: { - prototype: TouchList; - new(): TouchList; -} - -interface TrackEvent extends Event { - readonly track: any; -} - -declare var TrackEvent: { - prototype: TrackEvent; - new(): TrackEvent; -} - -interface TransitionEvent extends Event { - readonly elapsedTime: number; - readonly propertyName: string; - initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; -} - -declare var TransitionEvent: { - prototype: TransitionEvent; - new(): TransitionEvent; -} - -interface TreeWalker { - currentNode: Node; - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - firstChild(): Node; - lastChild(): Node; - nextNode(): Node; - nextSibling(): Node; - parentNode(): Node; - previousNode(): Node; - previousSibling(): Node; -} - -declare var TreeWalker: { - prototype: TreeWalker; - new(): TreeWalker; -} - -interface UIEvent extends Event { - readonly detail: number; - readonly view: Window; - initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; -} - -declare var UIEvent: { - prototype: UIEvent; - new(type: string, eventInitDict?: UIEventInit): UIEvent; -} - -interface URL { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - username: string; - toString(): string; -} - -declare var URL: { - prototype: URL; - new(url: string, base?: string): URL; - createObjectURL(object: any, options?: ObjectURLOptions): string; - revokeObjectURL(url: string): void; -} - -interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - readonly mediaType: string; -} - -declare var UnviewableContentIdentifiedEvent: { - prototype: UnviewableContentIdentifiedEvent; - new(): UnviewableContentIdentifiedEvent; -} - -interface ValidityState { - readonly badInput: boolean; - readonly customError: boolean; - readonly patternMismatch: boolean; - readonly rangeOverflow: boolean; - readonly rangeUnderflow: boolean; - readonly stepMismatch: boolean; - readonly tooLong: boolean; - readonly typeMismatch: boolean; - readonly valid: boolean; - readonly valueMissing: boolean; -} - -declare var ValidityState: { - prototype: ValidityState; - new(): ValidityState; -} - -interface VideoPlaybackQuality { - readonly corruptedVideoFrames: number; - readonly creationTime: number; - readonly droppedVideoFrames: number; - readonly totalFrameDelay: number; - readonly totalVideoFrames: number; -} - -declare var VideoPlaybackQuality: { - prototype: VideoPlaybackQuality; - new(): VideoPlaybackQuality; -} - -interface VideoTrack { - readonly id: string; - kind: string; - readonly label: string; - language: string; - selected: boolean; - readonly sourceBuffer: SourceBuffer; -} - -declare var VideoTrack: { - prototype: VideoTrack; - new(): VideoTrack; -} - -interface VideoTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - readonly selectedIndex: number; - getTrackById(id: string): VideoTrack | null; - item(index: number): VideoTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: VideoTrack; -} - -declare var VideoTrackList: { - prototype: VideoTrackList; - new(): VideoTrackList; -} - -interface WEBGL_compressed_texture_s3tc { - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -declare var WEBGL_compressed_texture_s3tc: { - prototype: WEBGL_compressed_texture_s3tc; - new(): WEBGL_compressed_texture_s3tc; - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -interface WEBGL_debug_renderer_info { - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -declare var WEBGL_debug_renderer_info: { - prototype: WEBGL_debug_renderer_info; - new(): WEBGL_debug_renderer_info; - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -interface WEBGL_depth_texture { - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -declare var WEBGL_depth_texture: { - prototype: WEBGL_depth_texture; - new(): WEBGL_depth_texture; - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -interface WaveShaperNode extends AudioNode { - curve: Float32Array | null; - oversample: string; -} - -declare var WaveShaperNode: { - prototype: WaveShaperNode; - new(): WaveShaperNode; -} - -interface WebGLActiveInfo { - readonly name: string; - readonly size: number; - readonly type: number; -} - -declare var WebGLActiveInfo: { - prototype: WebGLActiveInfo; - new(): WebGLActiveInfo; -} - -interface WebGLBuffer extends WebGLObject { -} - -declare var WebGLBuffer: { - prototype: WebGLBuffer; - new(): WebGLBuffer; -} - -interface WebGLContextEvent extends Event { - readonly statusMessage: string; -} - -declare var WebGLContextEvent: { - prototype: WebGLContextEvent; - new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; -} - -interface WebGLFramebuffer extends WebGLObject { -} - -declare var WebGLFramebuffer: { - prototype: WebGLFramebuffer; - new(): WebGLFramebuffer; -} - -interface WebGLObject { -} - -declare var WebGLObject: { - prototype: WebGLObject; - new(): WebGLObject; -} - -interface WebGLProgram extends WebGLObject { -} - -declare var WebGLProgram: { - prototype: WebGLProgram; - new(): WebGLProgram; -} - -interface WebGLRenderbuffer extends WebGLObject { -} - -declare var WebGLRenderbuffer: { - prototype: WebGLRenderbuffer; - new(): WebGLRenderbuffer; -} - -interface WebGLRenderingContext { - readonly canvas: HTMLCanvasElement; - readonly drawingBufferHeight: number; - readonly drawingBufferWidth: number; - activeTexture(texture: number): void; - attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer | null): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; - bindTexture(target: number, texture: WebGLTexture | null): void; - blendColor(red: number, green: number, blue: number, alpha: number): void; - blendEquation(mode: number): void; - blendEquationSeparate(modeRGB: number, modeAlpha: number): void; - blendFunc(sfactor: number, dfactor: number): void; - blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; - bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; - bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; - checkFramebufferStatus(target: number): number; - clear(mask: number): void; - clearColor(red: number, green: number, blue: number, alpha: number): void; - clearDepth(depth: number): void; - clearStencil(s: number): void; - colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader | null): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; - copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; - copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer | null; - createFramebuffer(): WebGLFramebuffer | null; - createProgram(): WebGLProgram | null; - createRenderbuffer(): WebGLRenderbuffer | null; - createShader(type: number): WebGLShader | null; - createTexture(): WebGLTexture | null; - cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer | null): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; - deleteProgram(program: WebGLProgram | null): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; - deleteShader(shader: WebGLShader | null): void; - deleteTexture(texture: WebGLTexture | null): void; - depthFunc(func: number): void; - depthMask(flag: boolean): void; - depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - disable(cap: number): void; - disableVertexAttribArray(index: number): void; - drawArrays(mode: number, first: number, count: number): void; - drawElements(mode: number, count: number, type: number, offset: number): void; - enable(cap: number): void; - enableVertexAttribArray(index: number): void; - finish(): void; - flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; - frontFace(mode: number): void; - generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; - getAttribLocation(program: WebGLProgram | null, name: string): number; - getBufferParameter(target: number, pname: number): any; - getContextAttributes(): WebGLContextAttributes; - getError(): number; - getExtension(name: string): any; - getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; - getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram | null): string | null; - getProgramParameter(program: WebGLProgram | null, pname: number): any; - getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader | null): string | null; - getShaderParameter(shader: WebGLShader | null, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; - getShaderSource(shader: WebGLShader | null): string | null; - getSupportedExtensions(): string[] | null; - getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; - getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; - getVertexAttrib(index: number, pname: number): any; - getVertexAttribOffset(index: number, pname: number): number; - hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer | null): boolean; - isContextLost(): boolean; - isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; - isProgram(program: WebGLProgram | null): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; - isShader(shader: WebGLShader | null): boolean; - isTexture(texture: WebGLTexture | null): boolean; - lineWidth(width: number): void; - linkProgram(program: WebGLProgram | null): void; - pixelStorei(pname: number, param: number): void; - polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; - renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; - sampleCoverage(value: number, invert: boolean): void; - scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader | null, source: string): void; - stencilFunc(func: number, ref: number, mask: number): void; - stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; - stencilMask(mask: number): void; - stencilMaskSeparate(face: number, mask: number): void; - stencilOp(fail: number, zfail: number, zpass: number): void; - stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - texParameterf(target: number, pname: number, param: number): void; - texParameteri(target: number, pname: number, param: number): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - useProgram(program: WebGLProgram | null): void; - validateProgram(program: WebGLProgram | null): void; - vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; - vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; - viewport(x: number, y: number, width: number, height: number): void; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -declare var WebGLRenderingContext: { - prototype: WebGLRenderingContext; - new(): WebGLRenderingContext; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -interface WebGLShader extends WebGLObject { -} - -declare var WebGLShader: { - prototype: WebGLShader; - new(): WebGLShader; -} - -interface WebGLShaderPrecisionFormat { - readonly precision: number; - readonly rangeMax: number; - readonly rangeMin: number; -} - -declare var WebGLShaderPrecisionFormat: { - prototype: WebGLShaderPrecisionFormat; - new(): WebGLShaderPrecisionFormat; -} - -interface WebGLTexture extends WebGLObject { -} - -declare var WebGLTexture: { - prototype: WebGLTexture; - new(): WebGLTexture; -} - -interface WebGLUniformLocation { -} - -declare var WebGLUniformLocation: { - prototype: WebGLUniformLocation; - new(): WebGLUniformLocation; -} - -interface WebKitCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): WebKitCSSMatrix; - multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): WebKitCSSMatrix; - skewY(angle: number): WebKitCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): WebKitCSSMatrix; -} - -declare var WebKitCSSMatrix: { - prototype: WebKitCSSMatrix; - new(text?: string): WebKitCSSMatrix; -} - -interface WebKitPoint { - x: number; - y: number; -} - -declare var WebKitPoint: { - prototype: WebKitPoint; - new(x?: number, y?: number): WebKitPoint; -} - -interface WebSocket extends EventTarget { - binaryType: string; - readonly bufferedAmount: number; - readonly extensions: string; - onclose: (this: this, ev: CloseEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onopen: (this: this, ev: Event) => any; - readonly protocol: string; - readonly readyState: number; - readonly url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WebSocket: { - prototype: WebSocket; - new(url: string, protocols?: string | string[]): WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; -} - -interface WheelEvent extends MouseEvent { - readonly deltaMode: number; - readonly deltaX: number; - readonly deltaY: number; - readonly deltaZ: number; - readonly wheelDelta: number; - readonly wheelDeltaX: number; - readonly wheelDeltaY: number; - getCurrentPoint(element: Element): void; - initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -declare var WheelEvent: { - prototype: WheelEvent; - new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - readonly applicationCache: ApplicationCache; - readonly clientInformation: Navigator; - readonly closed: boolean; - readonly crypto: Crypto; - defaultStatus: string; - readonly devicePixelRatio: number; - readonly doNotTrack: string; - readonly document: Document; - event: Event | undefined; - readonly external: External; - readonly frameElement: Element; - readonly frames: Window; - readonly history: History; - readonly innerHeight: number; - readonly innerWidth: number; - readonly length: number; - readonly location: Location; - readonly locationbar: BarProp; - readonly menubar: BarProp; - readonly msCredentials: MSCredentials; - name: string; - readonly navigator: Navigator; - offscreenBuffering: string | boolean; - onabort: (this: this, ev: UIEvent) => any; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncompassneedscalibration: (this: this, ev: Event) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondevicelight: (this: this, ev: DeviceLightEvent) => any; - ondevicemotion: (this: this, ev: DeviceMotionEvent) => any; - ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: ErrorEventHandler; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreadystatechange: (this: this, ev: ProgressEvent) => any; - onreset: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onstalled: (this: this, ev: Event) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onunload: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; - opener: any; - orientation: string | number; - readonly outerHeight: number; - readonly outerWidth: number; - readonly pageXOffset: number; - readonly pageYOffset: number; - readonly parent: Window; - readonly performance: Performance; - readonly personalbar: BarProp; - readonly screen: Screen; - readonly screenLeft: number; - readonly screenTop: number; - readonly screenX: number; - readonly screenY: number; - readonly scrollX: number; - readonly scrollY: number; - readonly scrollbars: BarProp; - readonly self: Window; - status: string; - readonly statusbar: BarProp; - readonly styleMedia: StyleMedia; - readonly toolbar: BarProp; - readonly top: Window; - readonly window: Window; - URL: typeof URL; - Blob: typeof Blob; - alert(message?: any): void; - blur(): void; - cancelAnimationFrame(handle: number): void; - captureEvents(): void; - close(): void; - confirm(message?: string): boolean; - focus(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; - getSelection(): Selection; - matchMedia(mediaQuery: string): MediaQueryList; - moveBy(x?: number, y?: number): void; - moveTo(x?: number, y?: number): void; - msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, transfer?: any[]): void; - print(): void; - prompt(message?: string, _default?: string): string | null; - releaseEvents(): void; - requestAnimationFrame(callback: FrameRequestCallback): number; - resizeBy(x?: number, y?: number): void; - resizeTo(x?: number, y?: number): void; - scroll(x?: number, y?: number): void; - scrollBy(x?: number, y?: number): void; - scrollTo(x?: number, y?: number): void; - webkitCancelAnimationFrame(handle: number): void; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - 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; -} - -declare var Window: { - prototype: Window; - new(): Window; -} - -interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: this, ev: MessageEvent) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Worker: { - prototype: Worker; - new(stringUrl: string): Worker; -} - -interface XMLDocument extends Document { -} - -declare var XMLDocument: { - prototype: XMLDocument; - new(): XMLDocument; -} - -interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: this, ev: Event) => any; - readonly readyState: number; - readonly response: any; - readonly responseText: string; - responseType: string; - readonly responseXML: any; - readonly status: number; - readonly statusText: string; - timeout: number; - readonly upload: XMLHttpRequestUpload; - withCredentials: boolean; - msCaching?: string; - readonly responseURL: string; - abort(): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string | null; - msCachingEnabled(): boolean; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - overrideMimeType(mime: string): void; - send(data?: Document): void; - send(data?: string): void; - send(data?: any): void; - setRequestHeader(header: string, value: string): void; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - 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: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", 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; -} - -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new(): XMLHttpRequest; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - create(): XMLHttpRequest; -} - -interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequestUpload: { - prototype: XMLHttpRequestUpload; - new(): XMLHttpRequestUpload; -} - -interface XMLSerializer { - serializeToString(target: Node): string; -} - -declare var XMLSerializer: { - prototype: XMLSerializer; - new(): XMLSerializer; -} - -interface XPathEvaluator { - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; -} - -declare var XPathEvaluator: { - prototype: XPathEvaluator; - new(): XPathEvaluator; -} - -interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; -} - -declare var XPathExpression: { - prototype: XPathExpression; - new(): XPathExpression; -} - -interface XPathNSResolver { - lookupNamespaceURI(prefix: string): string; -} - -declare var XPathNSResolver: { - prototype: XPathNSResolver; - new(): XPathNSResolver; -} - -interface XPathResult { - readonly booleanValue: boolean; - readonly invalidIteratorState: boolean; - readonly numberValue: number; - readonly resultType: number; - readonly singleNodeValue: Node; - readonly snapshotLength: number; - readonly stringValue: string; - iterateNext(): Node; - snapshotItem(index: number): Node; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -declare var XPathResult: { - prototype: XPathResult; - new(): XPathResult; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -interface XSLTProcessor { - clearParameters(): void; - getParameter(namespaceURI: string, localName: string): any; - importStylesheet(style: Node): void; - removeParameter(namespaceURI: string, localName: string): void; - reset(): void; - setParameter(namespaceURI: string, localName: string, value: any): void; - transformToDocument(source: Node): Document; - transformToFragment(source: Node, document: Document): DocumentFragment; -} - -declare var XSLTProcessor: { - prototype: XSLTProcessor; - new(): XSLTProcessor; -} - -interface AbstractWorker { - onerror: (this: this, ev: ErrorEvent) => any; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface CanvasPathMethods { - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; - closePath(): void; - ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - lineTo(x: number, y: number): void; - moveTo(x: number, y: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; -} - -interface ChildNode { - remove(): void; -} - -interface DOML2DeprecatedColorProperty { - color: string; -} - -interface DOML2DeprecatedSizeProperty { - size: number; -} - -interface DocumentEvent { - createEvent(eventInterface:"AnimationEvent"): AnimationEvent; - createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; - createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; - createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; - createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; - createEvent(eventInterface:"CloseEvent"): CloseEvent; - createEvent(eventInterface:"CommandEvent"): CommandEvent; - createEvent(eventInterface:"CompositionEvent"): CompositionEvent; - createEvent(eventInterface:"CustomEvent"): CustomEvent; - createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; - createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; - createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; - createEvent(eventInterface:"DragEvent"): DragEvent; - createEvent(eventInterface:"ErrorEvent"): ErrorEvent; - createEvent(eventInterface:"Event"): Event; - createEvent(eventInterface:"Events"): Event; - createEvent(eventInterface:"FocusEvent"): FocusEvent; - createEvent(eventInterface:"GamepadEvent"): GamepadEvent; - createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; - createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; - createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; - createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; - createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; - createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; - createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; - createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; - createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; - createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; - createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; - createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; - createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; - createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; - createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; - createEvent(eventInterface:"MessageEvent"): MessageEvent; - createEvent(eventInterface:"MouseEvent"): MouseEvent; - createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MutationEvent"): MutationEvent; - createEvent(eventInterface:"MutationEvents"): MutationEvent; - createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; - createEvent(eventInterface:"NavigationEvent"): NavigationEvent; - createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; - createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; - createEvent(eventInterface:"OverflowEvent"): OverflowEvent; - createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; - createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; - createEvent(eventInterface:"PointerEvent"): PointerEvent; - createEvent(eventInterface:"PopStateEvent"): PopStateEvent; - createEvent(eventInterface:"ProgressEvent"): ProgressEvent; - createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; - createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; - createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; - createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; - createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; - createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; - createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; - createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; - createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; - createEvent(eventInterface:"StorageEvent"): StorageEvent; - createEvent(eventInterface:"TextEvent"): TextEvent; - createEvent(eventInterface:"TouchEvent"): TouchEvent; - createEvent(eventInterface:"TrackEvent"): TrackEvent; - createEvent(eventInterface:"TransitionEvent"): TransitionEvent; - createEvent(eventInterface:"UIEvent"): UIEvent; - createEvent(eventInterface:"UIEvents"): UIEvent; - createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; - createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; - createEvent(eventInterface:"WheelEvent"): WheelEvent; - createEvent(eventInterface: string): Event; -} - -interface ElementTraversal { - readonly childElementCount: number; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly nextElementSibling: Element; - readonly previousElementSibling: Element; -} - -interface GetSVGDocument { - getSVGDocument(): Document; -} - -interface GlobalEventHandlers { - onpointercancel: (this: this, ev: PointerEvent) => any; - onpointerdown: (this: this, ev: PointerEvent) => any; - onpointerenter: (this: this, ev: PointerEvent) => any; - onpointerleave: (this: this, ev: PointerEvent) => any; - onpointermove: (this: this, ev: PointerEvent) => any; - onpointerout: (this: this, ev: PointerEvent) => any; - onpointerover: (this: this, ev: PointerEvent) => any; - onpointerup: (this: this, ev: PointerEvent) => any; - onwheel: (this: this, ev: WheelEvent) => any; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface HTMLTableAlignment { - /** - * Sets or retrieves a value that you can use to implement your own ch functionality for the object. - */ - ch: string; - /** - * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. - */ - chOff: string; - /** - * Sets or retrieves how text and other content are vertically aligned within the object that contains them. - */ - vAlign: string; -} - -interface IDBEnvironment { - readonly indexedDB: IDBFactory; -} - -interface LinkStyle { - readonly sheet: StyleSheet; -} - -interface MSBaseReader { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - readonly readyState: number; - readonly result: any; - abort(): void; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface MSFileSaver { - msSaveBlob(blob: any, defaultName?: string): boolean; - msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; -} - -interface MSNavigatorDoNotTrack { - confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; - confirmWebWideTrackingException(args: ExceptionInformation): boolean; - removeSiteSpecificTrackingException(args: ExceptionInformation): void; - removeWebWideTrackingException(args: ExceptionInformation): void; - storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; - storeWebWideTrackingException(args: StoreExceptionsInformation): void; -} - -interface NavigatorContentUtils { -} - -interface NavigatorGeolocation { - readonly geolocation: Geolocation; -} - -interface NavigatorID { - readonly appName: string; - readonly appVersion: string; - readonly platform: string; - readonly product: string; - readonly productSub: string; - readonly userAgent: string; - readonly vendor: string; - readonly vendorSub: string; -} - -interface NavigatorOnLine { - readonly onLine: boolean; -} - -interface NavigatorStorageUtils { -} - -interface NavigatorUserMedia { - readonly mediaDevices: MediaDevices; - getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; -} - -interface NodeSelector { - 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; - querySelectorAll(selectors: "abbr"): NodeListOf; - querySelectorAll(selectors: "acronym"): NodeListOf; - querySelectorAll(selectors: "address"): NodeListOf; - querySelectorAll(selectors: "applet"): NodeListOf; - querySelectorAll(selectors: "area"): NodeListOf; - querySelectorAll(selectors: "article"): NodeListOf; - querySelectorAll(selectors: "aside"): NodeListOf; - querySelectorAll(selectors: "audio"): NodeListOf; - querySelectorAll(selectors: "b"): NodeListOf; - querySelectorAll(selectors: "base"): NodeListOf; - querySelectorAll(selectors: "basefont"): NodeListOf; - querySelectorAll(selectors: "bdo"): NodeListOf; - querySelectorAll(selectors: "big"): NodeListOf; - querySelectorAll(selectors: "blockquote"): NodeListOf; - querySelectorAll(selectors: "body"): NodeListOf; - querySelectorAll(selectors: "br"): NodeListOf; - querySelectorAll(selectors: "button"): NodeListOf; - querySelectorAll(selectors: "canvas"): NodeListOf; - querySelectorAll(selectors: "caption"): NodeListOf; - querySelectorAll(selectors: "center"): NodeListOf; - querySelectorAll(selectors: "circle"): NodeListOf; - querySelectorAll(selectors: "cite"): NodeListOf; - querySelectorAll(selectors: "clippath"): NodeListOf; - querySelectorAll(selectors: "code"): NodeListOf; - querySelectorAll(selectors: "col"): NodeListOf; - querySelectorAll(selectors: "colgroup"): NodeListOf; - querySelectorAll(selectors: "datalist"): NodeListOf; - querySelectorAll(selectors: "dd"): NodeListOf; - querySelectorAll(selectors: "defs"): NodeListOf; - querySelectorAll(selectors: "del"): NodeListOf; - querySelectorAll(selectors: "desc"): NodeListOf; - querySelectorAll(selectors: "dfn"): NodeListOf; - querySelectorAll(selectors: "dir"): NodeListOf; - querySelectorAll(selectors: "div"): NodeListOf; - querySelectorAll(selectors: "dl"): NodeListOf; - querySelectorAll(selectors: "dt"): NodeListOf; - querySelectorAll(selectors: "ellipse"): NodeListOf; - querySelectorAll(selectors: "em"): NodeListOf; - querySelectorAll(selectors: "embed"): NodeListOf; - querySelectorAll(selectors: "feblend"): NodeListOf; - querySelectorAll(selectors: "fecolormatrix"): NodeListOf; - querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf; - querySelectorAll(selectors: "fecomposite"): NodeListOf; - querySelectorAll(selectors: "feconvolvematrix"): NodeListOf; - querySelectorAll(selectors: "fediffuselighting"): NodeListOf; - querySelectorAll(selectors: "fedisplacementmap"): NodeListOf; - querySelectorAll(selectors: "fedistantlight"): NodeListOf; - querySelectorAll(selectors: "feflood"): NodeListOf; - querySelectorAll(selectors: "fefunca"): NodeListOf; - querySelectorAll(selectors: "fefuncb"): NodeListOf; - querySelectorAll(selectors: "fefuncg"): NodeListOf; - querySelectorAll(selectors: "fefuncr"): NodeListOf; - querySelectorAll(selectors: "fegaussianblur"): NodeListOf; - querySelectorAll(selectors: "feimage"): NodeListOf; - querySelectorAll(selectors: "femerge"): NodeListOf; - querySelectorAll(selectors: "femergenode"): NodeListOf; - querySelectorAll(selectors: "femorphology"): NodeListOf; - querySelectorAll(selectors: "feoffset"): NodeListOf; - querySelectorAll(selectors: "fepointlight"): NodeListOf; - querySelectorAll(selectors: "fespecularlighting"): NodeListOf; - querySelectorAll(selectors: "fespotlight"): NodeListOf; - querySelectorAll(selectors: "fetile"): NodeListOf; - querySelectorAll(selectors: "feturbulence"): NodeListOf; - querySelectorAll(selectors: "fieldset"): NodeListOf; - querySelectorAll(selectors: "figcaption"): NodeListOf; - querySelectorAll(selectors: "figure"): NodeListOf; - querySelectorAll(selectors: "filter"): NodeListOf; - querySelectorAll(selectors: "font"): NodeListOf; - querySelectorAll(selectors: "footer"): NodeListOf; - querySelectorAll(selectors: "foreignobject"): NodeListOf; - querySelectorAll(selectors: "form"): NodeListOf; - querySelectorAll(selectors: "frame"): NodeListOf; - querySelectorAll(selectors: "frameset"): NodeListOf; - querySelectorAll(selectors: "g"): NodeListOf; - querySelectorAll(selectors: "h1"): NodeListOf; - querySelectorAll(selectors: "h2"): NodeListOf; - querySelectorAll(selectors: "h3"): NodeListOf; - querySelectorAll(selectors: "h4"): NodeListOf; - querySelectorAll(selectors: "h5"): NodeListOf; - querySelectorAll(selectors: "h6"): NodeListOf; - querySelectorAll(selectors: "head"): NodeListOf; - querySelectorAll(selectors: "header"): NodeListOf; - querySelectorAll(selectors: "hgroup"): NodeListOf; - querySelectorAll(selectors: "hr"): NodeListOf; - querySelectorAll(selectors: "html"): NodeListOf; - querySelectorAll(selectors: "i"): NodeListOf; - querySelectorAll(selectors: "iframe"): NodeListOf; - querySelectorAll(selectors: "image"): NodeListOf; - querySelectorAll(selectors: "img"): NodeListOf; - querySelectorAll(selectors: "input"): NodeListOf; - querySelectorAll(selectors: "ins"): NodeListOf; - querySelectorAll(selectors: "isindex"): NodeListOf; - querySelectorAll(selectors: "kbd"): NodeListOf; - querySelectorAll(selectors: "keygen"): NodeListOf; - querySelectorAll(selectors: "label"): NodeListOf; - querySelectorAll(selectors: "legend"): NodeListOf; - querySelectorAll(selectors: "li"): NodeListOf; - querySelectorAll(selectors: "line"): NodeListOf; - querySelectorAll(selectors: "lineargradient"): NodeListOf; - querySelectorAll(selectors: "link"): NodeListOf; - querySelectorAll(selectors: "listing"): NodeListOf; - querySelectorAll(selectors: "map"): NodeListOf; - querySelectorAll(selectors: "mark"): NodeListOf; - querySelectorAll(selectors: "marker"): NodeListOf; - querySelectorAll(selectors: "marquee"): NodeListOf; - querySelectorAll(selectors: "mask"): NodeListOf; - querySelectorAll(selectors: "menu"): NodeListOf; - querySelectorAll(selectors: "meta"): NodeListOf; - querySelectorAll(selectors: "metadata"): NodeListOf; - querySelectorAll(selectors: "meter"): NodeListOf; - querySelectorAll(selectors: "nav"): NodeListOf; - querySelectorAll(selectors: "nextid"): NodeListOf; - querySelectorAll(selectors: "nobr"): NodeListOf; - querySelectorAll(selectors: "noframes"): NodeListOf; - querySelectorAll(selectors: "noscript"): NodeListOf; - querySelectorAll(selectors: "object"): NodeListOf; - querySelectorAll(selectors: "ol"): NodeListOf; - querySelectorAll(selectors: "optgroup"): NodeListOf; - querySelectorAll(selectors: "option"): NodeListOf; - querySelectorAll(selectors: "p"): NodeListOf; - querySelectorAll(selectors: "param"): NodeListOf; - querySelectorAll(selectors: "path"): NodeListOf; - querySelectorAll(selectors: "pattern"): NodeListOf; - querySelectorAll(selectors: "picture"): NodeListOf; - querySelectorAll(selectors: "plaintext"): NodeListOf; - querySelectorAll(selectors: "polygon"): NodeListOf; - querySelectorAll(selectors: "polyline"): NodeListOf; - querySelectorAll(selectors: "pre"): NodeListOf; - querySelectorAll(selectors: "progress"): NodeListOf; - querySelectorAll(selectors: "q"): NodeListOf; - querySelectorAll(selectors: "radialgradient"): NodeListOf; - querySelectorAll(selectors: "rect"): NodeListOf; - querySelectorAll(selectors: "rt"): NodeListOf; - querySelectorAll(selectors: "ruby"): NodeListOf; - querySelectorAll(selectors: "s"): NodeListOf; - querySelectorAll(selectors: "samp"): NodeListOf; - querySelectorAll(selectors: "script"): NodeListOf; - querySelectorAll(selectors: "section"): NodeListOf; - querySelectorAll(selectors: "select"): NodeListOf; - querySelectorAll(selectors: "small"): NodeListOf; - querySelectorAll(selectors: "source"): NodeListOf; - querySelectorAll(selectors: "span"): NodeListOf; - querySelectorAll(selectors: "stop"): NodeListOf; - querySelectorAll(selectors: "strike"): NodeListOf; - querySelectorAll(selectors: "strong"): NodeListOf; - querySelectorAll(selectors: "style"): NodeListOf; - querySelectorAll(selectors: "sub"): NodeListOf; - querySelectorAll(selectors: "sup"): NodeListOf; - querySelectorAll(selectors: "svg"): NodeListOf; - querySelectorAll(selectors: "switch"): NodeListOf; - querySelectorAll(selectors: "symbol"): NodeListOf; - querySelectorAll(selectors: "table"): NodeListOf; - querySelectorAll(selectors: "tbody"): NodeListOf; - querySelectorAll(selectors: "td"): NodeListOf; - querySelectorAll(selectors: "template"): NodeListOf; - querySelectorAll(selectors: "text"): NodeListOf; - querySelectorAll(selectors: "textpath"): NodeListOf; - querySelectorAll(selectors: "textarea"): NodeListOf; - querySelectorAll(selectors: "tfoot"): NodeListOf; - querySelectorAll(selectors: "th"): NodeListOf; - querySelectorAll(selectors: "thead"): NodeListOf; - querySelectorAll(selectors: "title"): NodeListOf; - querySelectorAll(selectors: "tr"): NodeListOf; - querySelectorAll(selectors: "track"): NodeListOf; - querySelectorAll(selectors: "tspan"): NodeListOf; - querySelectorAll(selectors: "tt"): NodeListOf; - querySelectorAll(selectors: "u"): NodeListOf; - querySelectorAll(selectors: "ul"): NodeListOf; - querySelectorAll(selectors: "use"): NodeListOf; - querySelectorAll(selectors: "var"): NodeListOf; - querySelectorAll(selectors: "video"): NodeListOf; - querySelectorAll(selectors: "view"): NodeListOf; - querySelectorAll(selectors: "wbr"): NodeListOf; - querySelectorAll(selectors: "x-ms-webview"): NodeListOf; - querySelectorAll(selectors: "xmp"): NodeListOf; - querySelectorAll(selectors: string): NodeListOf; -} - -interface RandomSource { - getRandomValues(array: ArrayBufferView): ArrayBufferView; -} - -interface SVGAnimatedPathData { - readonly pathSegList: SVGPathSegList; -} - -interface SVGAnimatedPoints { - readonly animatedPoints: SVGPointList; - readonly points: SVGPointList; -} - -interface SVGExternalResourcesRequired { - readonly externalResourcesRequired: SVGAnimatedBoolean; -} - -interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - readonly height: SVGAnimatedLength; - readonly result: SVGAnimatedString; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; -} - -interface SVGFitToViewBox { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly viewBox: SVGAnimatedRect; -} - -interface SVGLangSpace { - xmllang: string; - xmlspace: string; -} - -interface SVGLocatable { - readonly farthestViewportElement: SVGElement; - readonly nearestViewportElement: SVGElement; - getBBox(): SVGRect; - getCTM(): SVGMatrix; - getScreenCTM(): SVGMatrix; - getTransformToElement(element: SVGElement): SVGMatrix; -} - -interface SVGStylable { - className: any; - readonly style: CSSStyleDeclaration; -} - -interface SVGTests { - readonly requiredExtensions: SVGStringList; - readonly requiredFeatures: SVGStringList; - readonly systemLanguage: SVGStringList; - hasExtension(extension: string): boolean; -} - -interface SVGTransformable extends SVGLocatable { - readonly transform: SVGAnimatedTransformList; -} - -interface SVGURIReference { - readonly href: SVGAnimatedString; -} - -interface WindowBase64 { - atob(encodedString: string): string; - btoa(rawString: string): string; -} - -interface WindowConsole { - readonly console: Console; -} - -interface WindowLocalStorage { - readonly localStorage: Storage; -} - -interface WindowSessionStorage { - readonly sessionStorage: Storage; -} - -interface WindowTimers extends Object, WindowTimersExtension { - clearInterval(handle: number): void; - clearTimeout(handle: number): void; - setInterval(handler: (...args: any[]) => void, timeout: number): number; - setInterval(handler: any, timeout?: any, ...args: any[]): number; - setTimeout(handler: (...args: any[]) => void, timeout: number): number; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; -} - -interface WindowTimersExtension { - clearImmediate(handle: number): void; - setImmediate(handler: (...args: any[]) => void): number; - setImmediate(handler: any, ...args: any[]): number; -} - -interface XMLHttpRequestEventTarget { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - ontimeout: (this: this, ev: ProgressEvent) => any; - 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface StorageEventInit extends EventInit { - key?: string; - oldValue?: string; - newValue?: string; - url: string; - storageArea?: Storage; -} - -interface Canvas2DContextAttributes { - alpha?: boolean; - willReadFrequently?: boolean; - storage?: boolean; - [attribute: string]: boolean | string | undefined; -} - -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - -interface HTMLCollectionOf extends HTMLCollection { - item(index: number): T; - namedItem(name: string): T; - [index: number]: T; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface FilePropertyBag { - type?: string; - lastModified?: number; -} - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface MessageEventInit extends EventInit { - data?: any; - origin?: string; - lastEventId?: string; - channel?: string; - source?: any; - ports?: MessagePort[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - 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; -} - -interface IDBArrayKey extends Array { -} - -interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: AlgorithmIdentifier; -} - -interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: AlgorithmIdentifier; -} - -interface RsaHashedImportParams { - hash: AlgorithmIdentifier; -} - -interface RsaPssParams { - saltLength: number; -} - -interface RsaOaepParams extends Algorithm { - label?: BufferSource; -} - -interface EcdsaParams extends Algorithm { - hash: AlgorithmIdentifier; -} - -interface EcKeyGenParams extends Algorithm { - namedCurve: string; -} - -interface EcKeyAlgorithm extends KeyAlgorithm { - typedCurve: string; -} - -interface EcKeyImportParams { - namedCurve: string; -} - -interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; -} - -interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; -} - -interface AesKeyGenParams extends Algorithm { - length: number; -} - -interface AesDerivedKeyParams extends Algorithm { - length: number; -} - -interface AesCbcParams extends Algorithm { - iv: BufferSource; -} - -interface AesCmacParams extends Algorithm { - length: number; -} - -interface AesGcmParams extends Algorithm { - iv: BufferSource; - additionalData?: BufferSource; - tagLength?: number; -} - -interface AesCfbParams extends Algorithm { - iv: BufferSource; -} - -interface HmacImportParams extends Algorithm { - hash?: AlgorithmIdentifier; - length?: number; -} - -interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: AlgorithmIdentifier; - length: number; -} - -interface HmacKeyGenParams extends Algorithm { - hash: AlgorithmIdentifier; - length?: number; -} - -interface DhKeyGenParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyAlgorithm extends KeyAlgorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface DhImportKeyParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface ConcatParams extends Algorithm { - hash?: AlgorithmIdentifier; - algorithmId: Uint8Array; - partyUInfo: Uint8Array; - partyVInfo: Uint8Array; - publicInfo?: Uint8Array; - privateInfo?: Uint8Array; -} - -interface HkdfCtrParams extends Algorithm { - hash: AlgorithmIdentifier; - label: BufferSource; - context: BufferSource; -} - -interface Pbkdf2Params extends Algorithm { - salt: BufferSource; - iterations: number; - hash: AlgorithmIdentifier; -} - -interface RsaOtherPrimesInfo { - r: string; - d: string; - t: string; -} - -interface JsonWebKey { - kty: string; - use?: string; - key_ops?: string[]; - alg?: string; - kid?: string; - x5u?: string; - x5c?: string; - x5t?: string; - ext?: boolean; - crv?: string; - x?: string; - y?: string; - d?: string; - n?: string; - e?: string; - p?: string; - q?: string; - dp?: string; - dq?: string; - qi?: string; - oth?: RsaOtherPrimesInfo[]; - k?: string; -} - -interface ParentNode { - readonly children: HTMLCollection; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly childElementCount: number; -} - -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - -interface ErrorEventHandler { - (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; -} -interface PositionCallback { - (position: Position): void; -} -interface PositionErrorCallback { - (error: PositionError): void; -} -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} -interface MSLaunchUriCallback { - (): void; -} -interface FrameRequestCallback { - (time: number): void; -} -interface MSUnsafeFunctionCallback { - (): any; -} -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; -} -interface DecodeSuccessCallback { - (decodedData: AudioBuffer): void; -} -interface DecodeErrorCallback { - (error: DOMException): void; -} -interface FunctionStringCallback { - (data: string): void; -} -interface NavigatorUserMediaSuccessCallback { - (stream: MediaStream): void; -} -interface NavigatorUserMediaErrorCallback { - (error: MediaStreamError): void; -} -interface ForEachCallback { - (keyId: any, status: string): void; -} -declare var Audio: {new(src?: string): HTMLAudioElement; }; -declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; -declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var applicationCache: ApplicationCache; -declare var clientInformation: Navigator; -declare var closed: boolean; -declare var crypto: Crypto; -declare var defaultStatus: string; -declare var devicePixelRatio: number; -declare var doNotTrack: string; -declare var document: Document; -declare var event: Event | undefined; -declare var external: External; -declare var frameElement: Element; -declare var frames: Window; -declare var history: History; -declare var innerHeight: number; -declare var innerWidth: number; -declare var length: number; -declare var location: Location; -declare var locationbar: BarProp; -declare var menubar: BarProp; -declare var msCredentials: MSCredentials; -declare const name: never; -declare var navigator: Navigator; -declare var offscreenBuffering: string | boolean; -declare var onabort: (this: Window, ev: UIEvent) => any; -declare var onafterprint: (this: Window, ev: Event) => any; -declare var onbeforeprint: (this: Window, ev: Event) => any; -declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; -declare var onblur: (this: Window, ev: FocusEvent) => any; -declare var oncanplay: (this: Window, ev: Event) => any; -declare var oncanplaythrough: (this: Window, ev: Event) => any; -declare var onchange: (this: Window, ev: Event) => any; -declare var onclick: (this: Window, ev: MouseEvent) => any; -declare var oncompassneedscalibration: (this: Window, ev: Event) => any; -declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; -declare var ondblclick: (this: Window, ev: MouseEvent) => any; -declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; -declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; -declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; -declare var ondrag: (this: Window, ev: DragEvent) => any; -declare var ondragend: (this: Window, ev: DragEvent) => any; -declare var ondragenter: (this: Window, ev: DragEvent) => any; -declare var ondragleave: (this: Window, ev: DragEvent) => any; -declare var ondragover: (this: Window, ev: DragEvent) => any; -declare var ondragstart: (this: Window, ev: DragEvent) => any; -declare var ondrop: (this: Window, ev: DragEvent) => any; -declare var ondurationchange: (this: Window, ev: Event) => any; -declare var onemptied: (this: Window, ev: Event) => any; -declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; -declare var onerror: ErrorEventHandler; -declare var onfocus: (this: Window, ev: FocusEvent) => any; -declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; -declare var oninput: (this: Window, ev: Event) => any; -declare var oninvalid: (this: Window, ev: Event) => any; -declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; -declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; -declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; -declare var onload: (this: Window, ev: Event) => any; -declare var onloadeddata: (this: Window, ev: Event) => any; -declare var onloadedmetadata: (this: Window, ev: Event) => any; -declare var onloadstart: (this: Window, ev: Event) => any; -declare var onmessage: (this: Window, ev: MessageEvent) => any; -declare var onmousedown: (this: Window, ev: MouseEvent) => any; -declare var onmouseenter: (this: Window, ev: MouseEvent) => any; -declare var onmouseleave: (this: Window, ev: MouseEvent) => any; -declare var onmousemove: (this: Window, ev: MouseEvent) => any; -declare var onmouseout: (this: Window, ev: MouseEvent) => any; -declare var onmouseover: (this: Window, ev: MouseEvent) => any; -declare var onmouseup: (this: Window, ev: MouseEvent) => any; -declare var onmousewheel: (this: Window, ev: WheelEvent) => any; -declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; -declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; -declare var onoffline: (this: Window, ev: Event) => any; -declare var ononline: (this: Window, ev: Event) => any; -declare var onorientationchange: (this: Window, ev: Event) => any; -declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; -declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; -declare var onpause: (this: Window, ev: Event) => any; -declare var onplay: (this: Window, ev: Event) => any; -declare var onplaying: (this: Window, ev: Event) => any; -declare var onpopstate: (this: Window, ev: PopStateEvent) => any; -declare var onprogress: (this: Window, ev: ProgressEvent) => any; -declare var onratechange: (this: Window, ev: Event) => any; -declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; -declare var onreset: (this: Window, ev: Event) => any; -declare var onresize: (this: Window, ev: UIEvent) => any; -declare var onscroll: (this: Window, ev: UIEvent) => any; -declare var onseeked: (this: Window, ev: Event) => any; -declare var onseeking: (this: Window, ev: Event) => any; -declare var onselect: (this: Window, ev: UIEvent) => any; -declare var onstalled: (this: Window, ev: Event) => any; -declare var onstorage: (this: Window, ev: StorageEvent) => any; -declare var onsubmit: (this: Window, ev: Event) => any; -declare var onsuspend: (this: Window, ev: Event) => any; -declare var ontimeupdate: (this: Window, ev: Event) => any; -declare var ontouchcancel: (ev: TouchEvent) => any; -declare var ontouchend: (ev: TouchEvent) => any; -declare var ontouchmove: (ev: TouchEvent) => any; -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: any; -declare var orientation: string | number; -declare var outerHeight: number; -declare var outerWidth: number; -declare var pageXOffset: number; -declare var pageYOffset: number; -declare var parent: Window; -declare var performance: Performance; -declare var personalbar: BarProp; -declare var screen: Screen; -declare var screenLeft: number; -declare var screenTop: number; -declare var screenX: number; -declare var screenY: number; -declare var scrollX: number; -declare var scrollY: number; -declare var scrollbars: BarProp; -declare var self: Window; -declare var status: string; -declare var statusbar: BarProp; -declare var styleMedia: StyleMedia; -declare var toolbar: BarProp; -declare var top: Window; -declare var window: Window; -declare function alert(message?: any): void; -declare function blur(): void; -declare function cancelAnimationFrame(handle: number): void; -declare function captureEvents(): void; -declare function close(): void; -declare function confirm(message?: string): boolean; -declare function focus(): void; -declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; -declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; -declare function getSelection(): Selection; -declare function matchMedia(mediaQuery: string): MediaQueryList; -declare function moveBy(x?: number, y?: number): void; -declare function moveTo(x?: number, y?: number): void; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; -declare function print(): void; -declare function prompt(message?: string, _default?: string): string | null; -declare function releaseEvents(): void; -declare function requestAnimationFrame(callback: FrameRequestCallback): number; -declare function resizeBy(x?: number, y?: number): void; -declare function resizeTo(x?: number, y?: number): void; -declare function scroll(x?: number, y?: number): void; -declare function scrollBy(x?: number, y?: number): void; -declare function scrollTo(x?: number, y?: number): void; -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; -declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function clearInterval(handle: number): void; -declare function clearTimeout(handle: number): void; -declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; -declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function clearImmediate(handle: number): void; -declare function setImmediate(handler: (...args: any[]) => void): number; -declare function setImmediate(handler: any, ...args: any[]): number; -declare var sessionStorage: Storage; -declare var localStorage: Storage; -declare var console: Console; -declare var onpointercancel: (this: Window, ev: PointerEvent) => any; -declare var onpointerdown: (this: Window, ev: PointerEvent) => any; -declare var onpointerenter: (this: Window, ev: PointerEvent) => any; -declare var onpointerleave: (this: Window, ev: PointerEvent) => any; -declare var onpointermove: (this: Window, ev: PointerEvent) => any; -declare var onpointerout: (this: Window, ev: PointerEvent) => any; -declare var onpointerover: (this: Window, ev: PointerEvent) => any; -declare var onpointerup: (this: Window, ev: PointerEvent) => any; -declare var onwheel: (this: Window, ev: WheelEvent) => any; -declare var indexedDB: IDBFactory; -declare function atob(encodedString: string): string; -declare function btoa(rawString: string): string; -declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -type AAGUID = string; -type AlgorithmIdentifier = string | Algorithm; -type ConstrainBoolean = boolean | ConstrainBooleanParameters; -type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; -type ConstrainDouble = number | ConstrainDoubleRange; -type ConstrainLong = number | ConstrainLongRange; -type CryptoOperationData = ArrayBufferView; -type GLbitfield = number; -type GLboolean = boolean; -type GLbyte = number; -type GLclampf = number; -type GLenum = number; -type GLfloat = number; -type GLint = number; -type GLintptr = number; -type GLshort = number; -type GLsizei = number; -type GLsizeiptr = number; -type GLubyte = number; -type GLuint = number; -type GLushort = number; -type IDBKeyPath = string; -type KeyFormat = string; -type KeyType = string; -type KeyUsage = string; -type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; -type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; -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; +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap{ + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface Set { + readonly [Symbol.toStringTag]: "Set"; +} + +interface WeakSet { + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction extends Function { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + readonly [Symbol.toStringTag]: "Int8Array"; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + readonly [Symbol.toStringTag]: "Int16Array"; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + readonly [Symbol.toStringTag]: "Int32Array"; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + readonly [Symbol.toStringTag]: "Float32Array"; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + readonly [Symbol.toStringTag]: "Float64Array"; +} + + +///////////////////////////// +/// IE DOM APIs +///////////////////////////// + +interface Algorithm { + name: string; +} + +interface AriaRequestEventInit extends EventInit { + attributeName?: string; + attributeValue?: string; +} + +interface CommandEventInit extends EventInit { + commandName?: string; + detail?: string; +} + +interface CompositionEventInit extends UIEventInit { + data?: string; +} + +interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { + arrayOfDomainStrings?: string[]; +} + +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface CustomEventInit extends EventInit { + detail?: any; +} + +interface DeviceAccelerationDict { + x?: number; + y?: number; + z?: number; +} + +interface DeviceLightEventInit extends EventInit { + value?: number; +} + +interface DeviceRotationRateDict { + alpha?: number; + beta?: number; + gamma?: number; +} + +interface DoubleRange { + max?: number; + min?: number; +} + +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; +} + +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + +interface ExceptionInformation { + domain?: string; +} + +interface FocusEventInit extends UIEventInit { + relatedTarget?: EventTarget; +} + +interface HashChangeEventInit extends EventInit { + newURL?: string; + oldURL?: string; +} + +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + +interface KeyAlgorithm { + name?: string; +} + +interface KeyboardEventInit extends EventModifierInit { + code?: string; + key?: string; + location?: number; + repeat?: boolean; +} + +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: string; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: string; +} + +interface MSCredentialSpec { + type?: string; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: string; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: string; + localInterface?: MSNetworkInterfaceType; + localAddrType?: string; + remoteAddrType?: string; + iceRole?: string; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resoluton?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: string; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: string; + persistentState?: string; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MouseEventInit extends EventModifierInit { + screenX?: number; + screenY?: number; + clientX?: number; + clientY?: number; + button?: number; + buttons?: number; + relatedTarget?: EventTarget; +} + +interface MsZoomToOptions { + contentX?: number; + contentY?: number; + viewportX?: string; + viewportY?: string; + scaleFactor?: number; + animate?: string; +} + +interface MutationObserverInit { + childList?: boolean; + attributes?: boolean; + characterData?: boolean; + subtree?: boolean; + attributeOldValue?: boolean; + characterDataOldValue?: boolean; + attributeFilter?: string[]; +} + +interface ObjectURLOptions { + oneTimeOnly?: boolean; +} + +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + +interface PointerEventInit extends MouseEventInit { + pointerId?: number; + width?: number; + height?: number; + pressure?: number; + tiltX?: number; + tiltY?: number; + pointerType?: string; + isPrimary?: boolean; +} + +interface PositionOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; +} + +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: string; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidate { + foundation?: string; + priority?: number; + ip?: string; + protocol?: string; + port?: number; + type?: string; + tcpType?: string; + relatedAddress?: string; + relatedPort?: number; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: string; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: string; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: string; + iceservers?: RTCIceServer[]; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + framerateBias?: number; + resolutionScale?: number; + framerateScale?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: string; + id?: string; + msType?: string; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; +} + +interface StoreExceptionsInformation extends ExceptionInformation { + siteName?: string; + explanationString?: string; + detailURI?: string; +} + +interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { + arrayOfDomainStrings?: string[]; +} + +interface UIEventInit extends EventInit { + view?: Window; + detail?: number; +} + +interface WebGLContextAttributes { + failIfMajorPerformanceCaveat?: boolean; + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; +} + +interface WebGLContextEventInit extends EventInit { + statusMessage?: string; +} + +interface WheelEventInit extends MouseEventInit { + deltaX?: number; + deltaY?: number; + deltaZ?: number; + deltaMode?: number; +} + +interface EventListener { + (evt: Event): void; +} + +interface ANGLE_instanced_arrays { + drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; + drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; + vertexAttribDivisorANGLE(index: number, divisor: number): void; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +declare var ANGLE_instanced_arrays: { + prototype: ANGLE_instanced_arrays; + new(): ANGLE_instanced_arrays; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +interface AnalyserNode extends AudioNode { + fftSize: number; + readonly frequencyBinCount: number; + maxDecibels: number; + minDecibels: number; + smoothingTimeConstant: number; + getByteFrequencyData(array: Uint8Array): void; + getByteTimeDomainData(array: Uint8Array): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; +} + +declare var AnalyserNode: { + prototype: AnalyserNode; + new(): AnalyserNode; +} + +interface AnimationEvent extends Event { + readonly animationName: string; + readonly elapsedTime: number; + initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; +} + +declare var AnimationEvent: { + prototype: AnimationEvent; + new(): AnimationEvent; +} + +interface ApplicationCache extends EventTarget { + oncached: (this: this, ev: Event) => any; + onchecking: (this: this, ev: Event) => any; + ondownloading: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onnoupdate: (this: this, ev: Event) => any; + onobsolete: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + onupdateready: (this: this, ev: Event) => any; + readonly status: number; + abort(): void; + swapCache(): void; + update(): void; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; + addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ApplicationCache: { + prototype: ApplicationCache; + new(): ApplicationCache; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; +} + +interface AriaRequestEvent extends Event { + readonly attributeName: string; + attributeValue: string | null; +} + +declare var AriaRequestEvent: { + prototype: AriaRequestEvent; + new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; +} + +interface Attr extends Node { + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string | null; + readonly specified: boolean; + value: string; +} + +declare var Attr: { + prototype: Attr; + new(): Attr; +} + +interface AudioBuffer { + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; + getChannelData(channel: number): Float32Array; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(): AudioBuffer; +} + +interface AudioBufferSourceNode extends AudioNode { + buffer: AudioBuffer | null; + readonly detune: AudioParam; + loop: boolean; + loopEnd: number; + loopStart: number; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; + start(when?: number, offset?: number, duration?: number): void; + stop(when?: number): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var AudioBufferSourceNode: { + prototype: AudioBufferSourceNode; + new(): AudioBufferSourceNode; +} + +interface AudioContext extends EventTarget { + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + readonly sampleRate: number; + state: string; + createAnalyser(): AnalyserNode; + createBiquadFilter(): BiquadFilterNode; + createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; + createBufferSource(): AudioBufferSourceNode; + createChannelMerger(numberOfInputs?: number): ChannelMergerNode; + createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; + createConvolver(): ConvolverNode; + createDelay(maxDelayTime?: number): DelayNode; + createDynamicsCompressor(): DynamicsCompressorNode; + createGain(): GainNode; + createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; + createOscillator(): OscillatorNode; + createPanner(): PannerNode; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; + createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; + createStereoPanner(): StereoPannerNode; + createWaveShaper(): WaveShaperNode; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; +} + +declare var AudioContext: { + prototype: AudioContext; + new(): AudioContext; +} + +interface AudioDestinationNode extends AudioNode { + readonly maxChannelCount: number; +} + +declare var AudioDestinationNode: { + prototype: AudioDestinationNode; + new(): AudioDestinationNode; +} + +interface AudioListener { + dopplerFactor: number; + speedOfSound: number; + setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var AudioListener: { + prototype: AudioListener; + new(): AudioListener; +} + +interface AudioNode extends EventTarget { + channelCount: number; + channelCountMode: string; + channelInterpretation: string; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; + connect(destination: AudioNode, output?: number, input?: number): void; + disconnect(output?: number): void; + disconnect(destination: AudioNode, output?: number, input?: number): void; + disconnect(destination: AudioParam, output?: number): void; +} + +declare var AudioNode: { + prototype: AudioNode; + new(): AudioNode; +} + +interface AudioParam { + readonly defaultValue: number; + value: number; + cancelScheduledValues(startTime: number): void; + exponentialRampToValueAtTime(value: number, endTime: number): void; + linearRampToValueAtTime(value: number, endTime: number): void; + setTargetAtTime(target: number, startTime: number, timeConstant: number): void; + setValueAtTime(value: number, startTime: number): void; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; +} + +declare var AudioParam: { + prototype: AudioParam; + new(): AudioParam; +} + +interface AudioProcessingEvent extends Event { + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; +} + +declare var AudioProcessingEvent: { + prototype: AudioProcessingEvent; + new(): AudioProcessingEvent; +} + +interface AudioTrack { + enabled: boolean; + readonly id: string; + kind: string; + readonly label: string; + language: string; + readonly sourceBuffer: SourceBuffer; +} + +declare var AudioTrack: { + prototype: AudioTrack; + new(): AudioTrack; +} + +interface AudioTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: this, ev: TrackEvent) => any; + onchange: (this: this, ev: Event) => any; + onremovetrack: (this: this, ev: TrackEvent) => any; + getTrackById(id: string): AudioTrack | null; + item(index: number): AudioTrack; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: AudioTrack; +} + +declare var AudioTrackList: { + prototype: AudioTrackList; + new(): AudioTrackList; +} + +interface BarProp { + readonly visible: boolean; +} + +declare var BarProp: { + prototype: BarProp; + new(): BarProp; +} + +interface BeforeUnloadEvent extends Event { + returnValue: any; +} + +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +} + +interface BiquadFilterNode extends AudioNode { + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; + type: string; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var BiquadFilterNode: { + prototype: BiquadFilterNode; + new(): BiquadFilterNode; +} + +interface Blob { + readonly size: number; + readonly type: string; + msClose(): void; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; +} + +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface CDATASection extends Text { +} + +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +} + +interface CSS { + supports(property: string, value?: string): boolean; +} +declare var CSS: CSS; + +interface CSSConditionRule extends CSSGroupingRule { + conditionText: string; +} + +declare var CSSConditionRule: { + prototype: CSSConditionRule; + new(): CSSConditionRule; +} + +interface CSSFontFaceRule extends CSSRule { + readonly style: CSSStyleDeclaration; +} + +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +} + +interface CSSGroupingRule extends CSSRule { + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; +} + +declare var CSSGroupingRule: { + prototype: CSSGroupingRule; + new(): CSSGroupingRule; +} + +interface CSSImportRule extends CSSRule { + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; +} + +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +} + +interface CSSKeyframeRule extends CSSRule { + keyText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +} + +interface CSSKeyframesRule extends CSSRule { + readonly cssRules: CSSRuleList; + name: string; + appendRule(rule: string): void; + deleteRule(rule: string): void; + findRule(rule: string): CSSKeyframeRule; +} + +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +} + +interface CSSMediaRule extends CSSConditionRule { + readonly media: MediaList; +} + +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +} + +interface CSSNamespaceRule extends CSSRule { + readonly namespaceURI: string; + readonly prefix: string; +} + +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +} + +interface CSSPageRule extends CSSRule { + readonly pseudoClass: string; + readonly selector: string; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +} + +interface CSSRule { + cssText: string; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +interface CSSRuleList { + readonly length: number; + item(index: number): CSSRule; + [index: number]: CSSRule; +} + +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +} + +interface CSSStyleDeclaration { + alignContent: string | null; + alignItems: string | null; + alignSelf: string | null; + alignmentBaseline: string | null; + animation: string | null; + animationDelay: string | null; + animationDirection: string | null; + animationDuration: string | null; + animationFillMode: string | null; + animationIterationCount: string | null; + animationName: string | null; + animationPlayState: string | null; + animationTimingFunction: string | null; + backfaceVisibility: string | null; + background: string | null; + backgroundAttachment: string | null; + backgroundClip: string | null; + backgroundColor: string | null; + backgroundImage: string | null; + backgroundOrigin: string | null; + backgroundPosition: string | null; + backgroundPositionX: string | null; + backgroundPositionY: string | null; + backgroundRepeat: string | null; + backgroundSize: string | null; + baselineShift: string | null; + border: string | null; + borderBottom: string | null; + borderBottomColor: string | null; + borderBottomLeftRadius: string | null; + borderBottomRightRadius: string | null; + borderBottomStyle: string | null; + borderBottomWidth: string | null; + borderCollapse: string | null; + borderColor: string | null; + borderImage: string | null; + borderImageOutset: string | null; + borderImageRepeat: string | null; + borderImageSlice: string | null; + borderImageSource: string | null; + borderImageWidth: string | null; + borderLeft: string | null; + borderLeftColor: string | null; + borderLeftStyle: string | null; + borderLeftWidth: string | null; + borderRadius: string | null; + borderRight: string | null; + borderRightColor: string | null; + borderRightStyle: string | null; + borderRightWidth: string | null; + borderSpacing: string | null; + borderStyle: string | null; + borderTop: string | null; + borderTopColor: string | null; + borderTopLeftRadius: string | null; + borderTopRightRadius: string | null; + borderTopStyle: string | null; + borderTopWidth: string | null; + borderWidth: string | null; + bottom: string | null; + boxShadow: string | null; + boxSizing: string | null; + breakAfter: string | null; + breakBefore: string | null; + breakInside: string | null; + captionSide: string | null; + clear: string | null; + clip: string | null; + clipPath: string | null; + clipRule: string | null; + color: string | null; + colorInterpolationFilters: string | null; + columnCount: any; + columnFill: string | null; + columnGap: any; + columnRule: string | null; + columnRuleColor: any; + columnRuleStyle: string | null; + columnRuleWidth: any; + columnSpan: string | null; + columnWidth: any; + columns: string | null; + content: string | null; + counterIncrement: string | null; + counterReset: string | null; + cssFloat: string | null; + cssText: string; + cursor: string | null; + direction: string | null; + display: string | null; + dominantBaseline: string | null; + emptyCells: string | null; + enableBackground: string | null; + fill: string | null; + fillOpacity: string | null; + fillRule: string | null; + filter: string | null; + flex: string | null; + flexBasis: string | null; + flexDirection: string | null; + flexFlow: string | null; + flexGrow: string | null; + flexShrink: string | null; + flexWrap: string | null; + floodColor: string | null; + floodOpacity: string | null; + font: string | null; + fontFamily: string | null; + fontFeatureSettings: string | null; + fontSize: string | null; + fontSizeAdjust: string | null; + fontStretch: string | null; + fontStyle: string | null; + fontVariant: string | null; + fontWeight: string | null; + glyphOrientationHorizontal: string | null; + glyphOrientationVertical: string | null; + height: string | null; + imeMode: string | null; + justifyContent: string | null; + kerning: string | null; + left: string | null; + readonly length: number; + letterSpacing: string | null; + lightingColor: string | null; + lineHeight: string | null; + listStyle: string | null; + listStyleImage: string | null; + listStylePosition: string | null; + listStyleType: string | null; + margin: string | null; + marginBottom: string | null; + marginLeft: string | null; + marginRight: string | null; + marginTop: string | null; + marker: string | null; + markerEnd: string | null; + markerMid: string | null; + markerStart: string | null; + mask: string | null; + maxHeight: string | null; + maxWidth: string | null; + minHeight: string | null; + minWidth: string | null; + msContentZoomChaining: string | null; + msContentZoomLimit: string | null; + msContentZoomLimitMax: any; + msContentZoomLimitMin: any; + msContentZoomSnap: string | null; + msContentZoomSnapPoints: string | null; + msContentZoomSnapType: string | null; + msContentZooming: string | null; + msFlowFrom: string | null; + msFlowInto: string | null; + msFontFeatureSettings: string | null; + msGridColumn: any; + msGridColumnAlign: string | null; + msGridColumnSpan: any; + msGridColumns: string | null; + msGridRow: any; + msGridRowAlign: string | null; + msGridRowSpan: any; + msGridRows: string | null; + msHighContrastAdjust: string | null; + msHyphenateLimitChars: string | null; + msHyphenateLimitLines: any; + msHyphenateLimitZone: any; + msHyphens: string | null; + msImeAlign: string | null; + msOverflowStyle: string | null; + msScrollChaining: string | null; + msScrollLimit: string | null; + msScrollLimitXMax: any; + msScrollLimitXMin: any; + msScrollLimitYMax: any; + msScrollLimitYMin: any; + msScrollRails: string | null; + msScrollSnapPointsX: string | null; + msScrollSnapPointsY: string | null; + msScrollSnapType: string | null; + msScrollSnapX: string | null; + msScrollSnapY: string | null; + msScrollTranslation: string | null; + msTextCombineHorizontal: string | null; + msTextSizeAdjust: any; + msTouchAction: string | null; + msTouchSelect: string | null; + msUserSelect: string | null; + msWrapFlow: string; + msWrapMargin: any; + msWrapThrough: string; + opacity: string | null; + order: string | null; + orphans: string | null; + outline: string | null; + outlineColor: string | null; + outlineStyle: string | null; + outlineWidth: string | null; + overflow: string | null; + overflowX: string | null; + overflowY: string | null; + padding: string | null; + paddingBottom: string | null; + paddingLeft: string | null; + paddingRight: string | null; + paddingTop: string | null; + pageBreakAfter: string | null; + pageBreakBefore: string | null; + pageBreakInside: string | null; + readonly parentRule: CSSRule; + perspective: string | null; + perspectiveOrigin: string | null; + pointerEvents: string | null; + position: string | null; + quotes: string | null; + right: string | null; + rubyAlign: string | null; + rubyOverhang: string | null; + rubyPosition: string | null; + stopColor: string | null; + stopOpacity: string | null; + stroke: string | null; + strokeDasharray: string | null; + strokeDashoffset: string | null; + strokeLinecap: string | null; + strokeLinejoin: string | null; + strokeMiterlimit: string | null; + strokeOpacity: string | null; + strokeWidth: string | null; + tableLayout: string | null; + textAlign: string | null; + textAlignLast: string | null; + textAnchor: string | null; + textDecoration: string | null; + textIndent: string | null; + textJustify: string | null; + textKashida: string | null; + textKashidaSpace: string | null; + textOverflow: string | null; + textShadow: string | null; + textTransform: string | null; + textUnderlinePosition: string | null; + top: string | null; + touchAction: string | null; + transform: string | null; + transformOrigin: string | null; + transformStyle: string | null; + transition: string | null; + transitionDelay: string | null; + transitionDuration: string | null; + transitionProperty: string | null; + transitionTimingFunction: string | null; + unicodeBidi: string | null; + verticalAlign: string | null; + visibility: string | null; + webkitAlignContent: string | null; + webkitAlignItems: string | null; + webkitAlignSelf: string | null; + webkitAnimation: string | null; + webkitAnimationDelay: string | null; + webkitAnimationDirection: string | null; + webkitAnimationDuration: string | null; + webkitAnimationFillMode: string | null; + webkitAnimationIterationCount: string | null; + webkitAnimationName: string | null; + webkitAnimationPlayState: string | null; + webkitAnimationTimingFunction: string | null; + webkitAppearance: string | null; + webkitBackfaceVisibility: string | null; + webkitBackgroundClip: string | null; + webkitBackgroundOrigin: string | null; + webkitBackgroundSize: string | null; + webkitBorderBottomLeftRadius: string | null; + webkitBorderBottomRightRadius: string | null; + webkitBorderImage: string | null; + webkitBorderRadius: string | null; + webkitBorderTopLeftRadius: string | null; + webkitBorderTopRightRadius: string | null; + webkitBoxAlign: string | null; + webkitBoxDirection: string | null; + webkitBoxFlex: string | null; + webkitBoxOrdinalGroup: string | null; + webkitBoxOrient: string | null; + webkitBoxPack: string | null; + webkitBoxSizing: string | null; + webkitColumnBreakAfter: string | null; + webkitColumnBreakBefore: string | null; + webkitColumnBreakInside: string | null; + webkitColumnCount: any; + webkitColumnGap: any; + webkitColumnRule: string | null; + webkitColumnRuleColor: any; + webkitColumnRuleStyle: string | null; + webkitColumnRuleWidth: any; + webkitColumnSpan: string | null; + webkitColumnWidth: any; + webkitColumns: string | null; + webkitFilter: string | null; + webkitFlex: string | null; + webkitFlexBasis: string | null; + webkitFlexDirection: string | null; + webkitFlexFlow: string | null; + webkitFlexGrow: string | null; + webkitFlexShrink: string | null; + webkitFlexWrap: string | null; + webkitJustifyContent: string | null; + webkitOrder: string | null; + webkitPerspective: string | null; + webkitPerspectiveOrigin: string | null; + webkitTapHighlightColor: string | null; + webkitTextFillColor: string | null; + webkitTextSizeAdjust: any; + webkitTransform: string | null; + webkitTransformOrigin: string | null; + webkitTransformStyle: string | null; + webkitTransition: string | null; + webkitTransitionDelay: string | null; + webkitTransitionDuration: string | null; + webkitTransitionProperty: string | null; + webkitTransitionTimingFunction: string | null; + webkitUserModify: string | null; + webkitUserSelect: string | null; + webkitWritingMode: string | null; + whiteSpace: string | null; + widows: string | null; + width: string | null; + wordBreak: string | null; + wordSpacing: string | null; + wordWrap: string | null; + writingMode: string | null; + zIndex: string | null; + zoom: string | null; + resize: string | null; + getPropertyPriority(propertyName: string): string; + getPropertyValue(propertyName: string): string; + item(index: number): string; + removeProperty(propertyName: string): string; + setProperty(propertyName: string, value: string | null, priority?: string): void; + [index: number]: string; +} + +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +} + +interface CSSStyleRule extends CSSRule { + readonly readOnly: boolean; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +} + +interface CSSStyleSheet extends StyleSheet { + readonly cssRules: CSSRuleList; + cssText: string; + readonly href: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; + addImport(bstrURL: string, lIndex?: number): number; + addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; + addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; + deleteRule(index?: number): void; + insertRule(rule: string, index?: number): number; + removeImport(lIndex: number): void; + removeRule(lIndex: number): void; +} + +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(): CSSStyleSheet; +} + +interface CSSSupportsRule extends CSSConditionRule { +} + +declare var CSSSupportsRule: { + prototype: CSSSupportsRule; + new(): CSSSupportsRule; +} + +interface CanvasGradient { + addColorStop(offset: number, color: string): void; +} + +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +} + +interface CanvasPattern { + setTransform(matrix: SVGMatrix): void; +} + +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +} + +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; + fillStyle: string | CanvasGradient | CanvasPattern; + font: string; + globalAlpha: number; + globalCompositeOperation: string; + lineCap: string; + lineDashOffset: number; + lineJoin: string; + lineWidth: number; + miterLimit: number; + msFillRule: string; + msImageSmoothingEnabled: boolean; + shadowBlur: number; + shadowColor: string; + shadowOffsetX: number; + shadowOffsetY: number; + strokeStyle: string | CanvasGradient | CanvasPattern; + textAlign: string; + textBaseline: string; + mozImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; + beginPath(): void; + clearRect(x: number, y: number, w: number, h: number): void; + clip(fillRule?: string): void; + createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; + createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; + fill(fillRule?: string): void; + fillRect(x: number, y: number, w: number, h: number): void; + fillText(text: string, x: number, y: number, maxWidth?: number): void; + getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; + getLineDash(): number[]; + isPointInPath(x: number, y: number, fillRule?: string): boolean; + measureText(text: string): TextMetrics; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; + restore(): void; + rotate(angle: number): void; + save(): void; + scale(x: number, y: number): void; + setLineDash(segments: number[]): void; + setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + stroke(): void; + strokeRect(x: number, y: number, w: number, h: number): void; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; + transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + translate(x: number, y: number): void; +} + +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +} + +interface ChannelMergerNode extends AudioNode { +} + +declare var ChannelMergerNode: { + prototype: ChannelMergerNode; + new(): ChannelMergerNode; +} + +interface ChannelSplitterNode extends AudioNode { +} + +declare var ChannelSplitterNode: { + prototype: ChannelSplitterNode; + new(): ChannelSplitterNode; +} + +interface CharacterData extends Node, ChildNode { + data: string; + readonly length: number; + appendData(arg: string): void; + deleteData(offset: number, count: number): void; + insertData(offset: number, arg: string): void; + replaceData(offset: number, count: number, arg: string): void; + substringData(offset: number, count: number): string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +} + +interface ClientRect { + bottom: number; + readonly height: number; + left: number; + right: number; + top: number; + readonly width: number; +} + +declare var ClientRect: { + prototype: ClientRect; + new(): ClientRect; +} + +interface ClientRectList { + readonly length: number; + item(index: number): ClientRect; + [index: number]: ClientRect; +} + +declare var ClientRectList: { + prototype: ClientRectList; + new(): ClientRectList; +} + +interface ClipboardEvent extends Event { + readonly clipboardData: DataTransfer; +} + +declare var ClipboardEvent: { + prototype: ClipboardEvent; + new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; +} + +interface CloseEvent extends Event { + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} + +declare var CloseEvent: { + prototype: CloseEvent; + new(): CloseEvent; +} + +interface CommandEvent extends Event { + readonly commandName: string; + readonly detail: string | null; +} + +declare var CommandEvent: { + prototype: CommandEvent; + new(type: string, eventInitDict?: CommandEventInit): CommandEvent; +} + +interface Comment extends CharacterData { + text: string; +} + +declare var Comment: { + prototype: Comment; + new(): Comment; +} + +interface CompositionEvent extends UIEvent { + readonly data: string; + readonly locale: string; + initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; +} + +declare var CompositionEvent: { + prototype: CompositionEvent; + new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; +} + +interface Console { + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + clear(): void; + count(countTitle?: string): void; + debug(message?: string, ...optionalParams: any[]): void; + dir(value?: any, ...optionalParams: any[]): void; + dirxml(value: any): void; + error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; + group(groupTitle?: string): void; + groupCollapsed(groupTitle?: string): void; + groupEnd(): void; + info(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: Element): boolean; + profile(reportName?: string): void; + profileEnd(): void; + select(element: Element): void; + table(...data: any[]): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; +} + +declare var Console: { + prototype: Console; + new(): Console; +} + +interface ConvolverNode extends AudioNode { + buffer: AudioBuffer | null; + normalize: boolean; +} + +declare var ConvolverNode: { + prototype: ConvolverNode; + new(): ConvolverNode; +} + +interface Coordinates { + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; +} + +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface Crypto extends Object, RandomSource { + readonly subtle: SubtleCrypto; +} + +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +} + +interface CryptoKey { + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; +} + +declare var CryptoKey: { + prototype: CryptoKey; + new(): CryptoKey; +} + +interface CryptoKeyPair { + privateKey: CryptoKey; + publicKey: CryptoKey; +} + +declare var CryptoKeyPair: { + prototype: CryptoKeyPair; + new(): CryptoKeyPair; +} + +interface CustomEvent extends Event { + readonly detail: any; + initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; +} + +declare var CustomEvent: { + prototype: CustomEvent; + new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; +} + +interface DOMError { + readonly name: string; + toString(): string; +} + +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface DOMException { + readonly code: number; + readonly message: string; + readonly name: string; + toString(): string; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +interface DOMImplementation { + createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; + createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; + createHTMLDocument(title: string): Document; + hasFeature(feature: string | null, version: string | null): boolean; +} + +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +} + +interface DOMParser { + parseFromString(source: string, mimeType: string): Document; +} + +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +} + +interface DOMSettableTokenList extends DOMTokenList { + value: string; +} + +declare var DOMSettableTokenList: { + prototype: DOMSettableTokenList; + new(): DOMSettableTokenList; +} + +interface DOMStringList { + readonly length: number; + contains(str: string): boolean; + item(index: number): string | null; + [index: number]: string; +} + +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface DOMStringMap { + [name: string]: string; +} + +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +} + +interface DOMTokenList { + readonly length: number; + add(...token: string[]): void; + contains(token: string): boolean; + item(index: number): string; + remove(...token: string[]): void; + toString(): string; + toggle(token: string, force?: boolean): boolean; + [index: number]: string; +} + +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +} + +interface DataCue extends TextTrackCue { + data: ArrayBuffer; +} + +declare var DataCue: { + prototype: DataCue; + new(): DataCue; +} + +interface DataTransfer { + dropEffect: string; + effectAllowed: string; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: string[]; + clearData(format?: string): boolean; + getData(format: string): string; + setData(format: string, data: string): boolean; +} + +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +} + +interface DataTransferItem { + readonly kind: string; + readonly type: string; + getAsFile(): File | null; + getAsString(_callback: FunctionStringCallback | null): void; +} + +declare var DataTransferItem: { + prototype: DataTransferItem; + new(): DataTransferItem; +} + +interface DataTransferItemList { + readonly length: number; + add(data: File): DataTransferItem | null; + clear(): void; + item(index: number): DataTransferItem; + remove(index: number): void; + [index: number]: DataTransferItem; +} + +declare var DataTransferItemList: { + prototype: DataTransferItemList; + new(): DataTransferItemList; +} + +interface DeferredPermissionRequest { + readonly id: number; + readonly type: string; + readonly uri: string; + allow(): void; + deny(): void; +} + +declare var DeferredPermissionRequest: { + prototype: DeferredPermissionRequest; + new(): DeferredPermissionRequest; +} + +interface DelayNode extends AudioNode { + readonly delayTime: AudioParam; +} + +declare var DelayNode: { + prototype: DelayNode; + new(): DelayNode; +} + +interface DeviceAcceleration { + readonly x: number | null; + readonly y: number | null; + readonly z: number | null; +} + +declare var DeviceAcceleration: { + prototype: DeviceAcceleration; + new(): DeviceAcceleration; +} + +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + +interface DeviceMotionEvent extends Event { + readonly acceleration: DeviceAcceleration | null; + readonly accelerationIncludingGravity: DeviceAcceleration | null; + readonly interval: number | null; + readonly rotationRate: DeviceRotationRate | null; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; +} + +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(): DeviceMotionEvent; +} + +interface DeviceOrientationEvent extends Event { + readonly absolute: boolean; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; +} + +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(): DeviceOrientationEvent; +} + +interface DeviceRotationRate { + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; +} + +declare var DeviceRotationRate: { + prototype: DeviceRotationRate; + new(): DeviceRotationRate; +} + +interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode { + /** + * Sets or gets the URL for the current document. + */ + readonly URL: string; + /** + * Gets the URL for the document, stripped of any character encoding. + */ + readonly URLUnencoded: string; + /** + * Gets the object that has the focus when the parent document has focus. + */ + readonly activeElement: Element; + /** + * Sets or gets the color of all active links in the document. + */ + alinkColor: string; + /** + * Returns a reference to the collection of elements contained by the object. + */ + readonly all: HTMLAllCollection; + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + */ + anchors: HTMLCollectionOf; + /** + * Retrieves a collection of all applet objects in the document. + */ + applets: HTMLCollectionOf; + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + */ + bgColor: string; + /** + * Specifies the beginning and end of the document body. + */ + body: HTMLElement; + readonly characterSet: string; + /** + * Gets or sets the character set used to encode the object. + */ + charset: string; + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. + */ + readonly compatMode: string; + cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; + /** + * Gets the default character set from the current regional language settings. + */ + readonly defaultCharset: string; + readonly defaultView: Window; + /** + * Sets or gets a value that indicates whether the document can be edited. + */ + designMode: string; + /** + * Sets or retrieves a value that indicates the reading order of the object. + */ + dir: string; + /** + * Gets an object representing the document type declaration associated with the current document. + */ + readonly doctype: DocumentType; + /** + * Gets a reference to the root node of the document. + */ + documentElement: HTMLElement; + /** + * Sets or gets the security domain of the document. + */ + domain: string; + /** + * Retrieves a collection of all embed objects in the document. + */ + embeds: HTMLCollectionOf; + /** + * Sets or gets the foreground (text) color of the document. + */ + fgColor: string; + /** + * Retrieves a collection, in source order, of all form objects in the document. + */ + forms: HTMLCollectionOf; + readonly fullscreenElement: Element | null; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; + /** + * Retrieves a collection, in source order, of img objects in the document. + */ + images: HTMLCollectionOf; + /** + * Gets the implementation object of the current document. + */ + readonly implementation: DOMImplementation; + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. + */ + readonly inputEncoding: string | null; + /** + * Gets the date that the page was last modified, if the page supplies one. + */ + readonly lastModified: string; + /** + * Sets or gets the color of the document links. + */ + linkColor: string; + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + */ + links: HTMLCollectionOf; + /** + * Contains information about the current URL. + */ + readonly location: Location; + msCSSOMElementFloatMetrics: boolean; + msCapsLockWarningOff: boolean; + /** + * Fires when the user aborts the download. + * @param ev The event. + */ + onabort: (this: this, ev: UIEvent) => any; + /** + * Fires when the object is set as the active element. + * @param ev The event. + */ + onactivate: (this: this, ev: UIEvent) => any; + /** + * Fires immediately before the object is set as the active element. + * @param ev The event. + */ + onbeforeactivate: (this: this, ev: UIEvent) => any; + /** + * Fires immediately before the activeElement is changed from the current object to another object in the parent document. + * @param ev The event. + */ + onbeforedeactivate: (this: this, ev: UIEvent) => any; + /** + * Fires when the object loses the input focus. + * @param ev The focus event. + */ + onblur: (this: this, ev: FocusEvent) => any; + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. + */ + oncanplay: (this: this, ev: Event) => any; + oncanplaythrough: (this: this, ev: Event) => any; + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. + */ + onchange: (this: this, ev: Event) => any; + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. + */ + onclick: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. + */ + oncontextmenu: (this: this, ev: PointerEvent) => any; + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. + */ + ondblclick: (this: this, ev: MouseEvent) => any; + /** + * Fires when the activeElement is changed from the current object to another object in the parent document. + * @param ev The UI Event + */ + ondeactivate: (this: this, ev: UIEvent) => any; + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. + */ + ondrag: (this: this, ev: DragEvent) => any; + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. + */ + ondragend: (this: this, ev: DragEvent) => any; + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. + */ + ondragenter: (this: this, ev: DragEvent) => any; + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. + */ + ondragleave: (this: this, ev: DragEvent) => any; + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. + */ + ondragover: (this: this, ev: DragEvent) => any; + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. + */ + ondragstart: (this: this, ev: DragEvent) => any; + ondrop: (this: this, ev: DragEvent) => any; + /** + * Occurs when the duration attribute is updated. + * @param ev The event. + */ + ondurationchange: (this: this, ev: Event) => any; + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. + */ + onemptied: (this: this, ev: Event) => any; + /** + * Occurs when the end of playback is reached. + * @param ev The event + */ + onended: (this: this, ev: MediaStreamErrorEvent) => any; + /** + * Fires when an error occurs during object loading. + * @param ev The event. + */ + onerror: (this: this, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + * @param ev The event. + */ + onfocus: (this: this, ev: FocusEvent) => any; + onfullscreenchange: (this: this, ev: Event) => any; + onfullscreenerror: (this: this, ev: Event) => any; + oninput: (this: this, ev: Event) => any; + oninvalid: (this: this, ev: Event) => any; + /** + * Fires when the user presses a key. + * @param ev The keyboard event + */ + onkeydown: (this: this, ev: KeyboardEvent) => any; + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. + */ + onkeypress: (this: this, ev: KeyboardEvent) => any; + /** + * Fires when the user releases a key. + * @param ev The keyboard event + */ + onkeyup: (this: this, ev: KeyboardEvent) => any; + /** + * Fires immediately after the browser loads the object. + * @param ev The event. + */ + onload: (this: this, ev: Event) => any; + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. + */ + onloadeddata: (this: this, ev: Event) => any; + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. + */ + onloadedmetadata: (this: this, ev: Event) => any; + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. + */ + onloadstart: (this: this, ev: Event) => any; + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. + */ + onmousedown: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. + */ + onmousemove: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. + */ + onmouseout: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. + */ + onmouseover: (this: this, ev: MouseEvent) => any; + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. + */ + onmouseup: (this: this, ev: MouseEvent) => any; + /** + * Fires when the wheel button is rotated. + * @param ev The mouse event + */ + onmousewheel: (this: this, ev: WheelEvent) => any; + onmscontentzoom: (this: this, ev: UIEvent) => any; + onmsgesturechange: (this: this, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; + onmsgestureend: (this: this, ev: MSGestureEvent) => any; + onmsgesturehold: (this: this, ev: MSGestureEvent) => any; + onmsgesturestart: (this: this, ev: MSGestureEvent) => any; + onmsgesturetap: (this: this, ev: MSGestureEvent) => any; + onmsinertiastart: (this: this, ev: MSGestureEvent) => any; + onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; + onmspointercancel: (this: this, ev: MSPointerEvent) => any; + onmspointerdown: (this: this, ev: MSPointerEvent) => any; + onmspointerenter: (this: this, ev: MSPointerEvent) => any; + onmspointerleave: (this: this, ev: MSPointerEvent) => any; + onmspointermove: (this: this, ev: MSPointerEvent) => any; + onmspointerout: (this: this, ev: MSPointerEvent) => any; + onmspointerover: (this: this, ev: MSPointerEvent) => any; + onmspointerup: (this: this, ev: MSPointerEvent) => any; + /** + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * @param ev The event. + */ + onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any; + /** + * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. + * @param ev The event. + */ + onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any; + /** + * Occurs when playback is paused. + * @param ev The event. + */ + onpause: (this: this, ev: Event) => any; + /** + * Occurs when the play method is requested. + * @param ev The event. + */ + onplay: (this: this, ev: Event) => any; + /** + * Occurs when the audio or video has started playing. + * @param ev The event. + */ + onplaying: (this: this, ev: Event) => any; + onpointerlockchange: (this: this, ev: Event) => any; + onpointerlockerror: (this: this, ev: Event) => any; + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. + */ + onprogress: (this: this, ev: ProgressEvent) => any; + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. + */ + onratechange: (this: this, ev: Event) => any; + /** + * Fires when the state of the object has changed. + * @param ev The event + */ + onreadystatechange: (this: this, ev: ProgressEvent) => any; + /** + * Fires when the user resets a form. + * @param ev The event. + */ + onreset: (this: this, ev: Event) => any; + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. + */ + onscroll: (this: this, ev: UIEvent) => any; + /** + * Occurs when the seek operation ends. + * @param ev The event. + */ + onseeked: (this: this, ev: Event) => any; + /** + * Occurs when the current playback position is moved. + * @param ev The event. + */ + onseeking: (this: this, ev: Event) => any; + /** + * Fires when the current selection changes. + * @param ev The event. + */ + onselect: (this: this, ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (this: this, ev: Event) => any; + onselectstart: (this: this, ev: Event) => any; + /** + * Occurs when the download has stopped. + * @param ev The event. + */ + onstalled: (this: this, ev: Event) => any; + /** + * Fires when the user clicks the Stop button or leaves the Web page. + * @param ev The event. + */ + onstop: (this: this, ev: Event) => any; + onsubmit: (this: this, ev: Event) => any; + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. + */ + onsuspend: (this: this, ev: Event) => any; + /** + * Occurs to indicate the current playback position. + * @param ev The event. + */ + ontimeupdate: (this: this, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. + */ + onvolumechange: (this: this, ev: Event) => any; + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. + */ + onwaiting: (this: this, ev: Event) => any; + onwebkitfullscreenchange: (this: this, ev: Event) => any; + onwebkitfullscreenerror: (this: this, ev: Event) => any; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; + /** + * Retrieves a value that indicates the current state of the object. + */ + readonly readyState: string; + /** + * Gets the URL of the location that referred the user to the current page. + */ + readonly referrer: string; + /** + * Gets the root svg element in the document hierarchy. + */ + readonly rootElement: SVGSVGElement; + /** + * Retrieves a collection of all script objects in the document. + */ + scripts: HTMLCollectionOf; + readonly scrollingElement: Element | null; + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + */ + readonly styleSheets: StyleSheetList; + /** + * Contains the title of the document. + */ + title: string; + readonly visibilityState: string; + /** + * Sets or gets the color of the links that the user has visited. + */ + vlinkColor: string; + readonly webkitCurrentFullScreenElement: Element | null; + readonly webkitFullscreenElement: Element | null; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string | null; + xmlStandalone: boolean; + /** + * Gets or sets the version attribute specified in the declaration of an XML document. + */ + xmlVersion: string | null; + adoptNode(source: Node): Node; + captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; + clear(): void; + /** + * Closes an output stream and forces the sent data to display. + */ + close(): void; + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. + */ + createAttribute(name: string): Attr; + createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; + createCDATASection(data: string): CDATASection; + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. + */ + createComment(data: string): Comment; + /** + * Creates a new document. + */ + createDocumentFragment(): DocumentFragment; + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + */ + createElement(tagName: "a"): HTMLAnchorElement; + createElement(tagName: "applet"): HTMLAppletElement; + createElement(tagName: "area"): HTMLAreaElement; + createElement(tagName: "audio"): HTMLAudioElement; + createElement(tagName: "base"): HTMLBaseElement; + createElement(tagName: "basefont"): HTMLBaseFontElement; + createElement(tagName: "blockquote"): HTMLQuoteElement; + createElement(tagName: "body"): HTMLBodyElement; + createElement(tagName: "br"): HTMLBRElement; + createElement(tagName: "button"): HTMLButtonElement; + createElement(tagName: "canvas"): HTMLCanvasElement; + createElement(tagName: "caption"): HTMLTableCaptionElement; + createElement(tagName: "col"): HTMLTableColElement; + createElement(tagName: "colgroup"): HTMLTableColElement; + createElement(tagName: "datalist"): HTMLDataListElement; + createElement(tagName: "del"): HTMLModElement; + createElement(tagName: "dir"): HTMLDirectoryElement; + createElement(tagName: "div"): HTMLDivElement; + createElement(tagName: "dl"): HTMLDListElement; + createElement(tagName: "embed"): HTMLEmbedElement; + createElement(tagName: "fieldset"): HTMLFieldSetElement; + createElement(tagName: "font"): HTMLFontElement; + createElement(tagName: "form"): HTMLFormElement; + createElement(tagName: "frame"): HTMLFrameElement; + createElement(tagName: "frameset"): HTMLFrameSetElement; + createElement(tagName: "h1"): HTMLHeadingElement; + createElement(tagName: "h2"): HTMLHeadingElement; + createElement(tagName: "h3"): HTMLHeadingElement; + createElement(tagName: "h4"): HTMLHeadingElement; + createElement(tagName: "h5"): HTMLHeadingElement; + createElement(tagName: "h6"): HTMLHeadingElement; + createElement(tagName: "head"): HTMLHeadElement; + createElement(tagName: "hr"): HTMLHRElement; + createElement(tagName: "html"): HTMLHtmlElement; + createElement(tagName: "iframe"): HTMLIFrameElement; + createElement(tagName: "img"): HTMLImageElement; + createElement(tagName: "input"): HTMLInputElement; + createElement(tagName: "ins"): HTMLModElement; + createElement(tagName: "isindex"): HTMLUnknownElement; + createElement(tagName: "label"): HTMLLabelElement; + createElement(tagName: "legend"): HTMLLegendElement; + createElement(tagName: "li"): HTMLLIElement; + createElement(tagName: "link"): HTMLLinkElement; + createElement(tagName: "listing"): HTMLPreElement; + createElement(tagName: "map"): HTMLMapElement; + createElement(tagName: "marquee"): HTMLMarqueeElement; + createElement(tagName: "menu"): HTMLMenuElement; + createElement(tagName: "meta"): HTMLMetaElement; + createElement(tagName: "meter"): HTMLMeterElement; + createElement(tagName: "nextid"): HTMLUnknownElement; + createElement(tagName: "object"): HTMLObjectElement; + createElement(tagName: "ol"): HTMLOListElement; + createElement(tagName: "optgroup"): HTMLOptGroupElement; + createElement(tagName: "option"): HTMLOptionElement; + createElement(tagName: "p"): HTMLParagraphElement; + createElement(tagName: "param"): HTMLParamElement; + createElement(tagName: "picture"): HTMLPictureElement; + createElement(tagName: "pre"): HTMLPreElement; + createElement(tagName: "progress"): HTMLProgressElement; + createElement(tagName: "q"): HTMLQuoteElement; + createElement(tagName: "script"): HTMLScriptElement; + createElement(tagName: "select"): HTMLSelectElement; + createElement(tagName: "source"): HTMLSourceElement; + createElement(tagName: "span"): HTMLSpanElement; + createElement(tagName: "style"): HTMLStyleElement; + createElement(tagName: "table"): HTMLTableElement; + createElement(tagName: "tbody"): HTMLTableSectionElement; + createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "template"): HTMLTemplateElement; + createElement(tagName: "textarea"): HTMLTextAreaElement; + createElement(tagName: "tfoot"): HTMLTableSectionElement; + createElement(tagName: "th"): HTMLTableHeaderCellElement; + createElement(tagName: "thead"): HTMLTableSectionElement; + createElement(tagName: "title"): HTMLTitleElement; + createElement(tagName: "tr"): HTMLTableRowElement; + createElement(tagName: "track"): HTMLTrackElement; + createElement(tagName: "ul"): HTMLUListElement; + createElement(tagName: "video"): HTMLVideoElement; + createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; + createElement(tagName: "xmp"): HTMLPreElement; + createElement(tagName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement + createElementNS(namespaceURI: string | null, qualifiedName: string): Element; + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver: Node): XPathNSResolver; + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + */ + createRange(): Range; + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. + */ + createTextNode(data: string): Text; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouchList(...touches: Touch[]): TouchList; + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset + */ + elementFromPoint(x: number, y: number): Element; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. + */ + execCommand(commandId: string, showUI?: boolean, value?: any): boolean; + /** + * Displays help information for the given command identifier. + * @param commandId Displays help information for the given command identifier. + */ + execCommandShowHelp(commandId: string): boolean; + exitFullscreen(): void; + exitPointerLock(): void; + /** + * Causes the element to receive the focus and executes the code specified by the onfocus event. + */ + focus(): void; + /** + * Returns a reference to the first object with the specified value of the ID or NAME attribute. + * @param elementId String that specifies the ID value. Case-insensitive. + */ + getElementById(elementId: string): HTMLElement | null; + getElementsByClassName(classNames: string): HTMLCollectionOf; + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + */ + getElementsByName(elementName: string): NodeListOf; + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. + */ + getElementsByTagName(tagname: "a"): NodeListOf; + getElementsByTagName(tagname: "abbr"): NodeListOf; + getElementsByTagName(tagname: "acronym"): NodeListOf; + getElementsByTagName(tagname: "address"): NodeListOf; + getElementsByTagName(tagname: "applet"): NodeListOf; + getElementsByTagName(tagname: "area"): NodeListOf; + getElementsByTagName(tagname: "article"): NodeListOf; + getElementsByTagName(tagname: "aside"): NodeListOf; + getElementsByTagName(tagname: "audio"): NodeListOf; + getElementsByTagName(tagname: "b"): NodeListOf; + getElementsByTagName(tagname: "base"): NodeListOf; + getElementsByTagName(tagname: "basefont"): NodeListOf; + getElementsByTagName(tagname: "bdo"): NodeListOf; + getElementsByTagName(tagname: "big"): NodeListOf; + getElementsByTagName(tagname: "blockquote"): NodeListOf; + getElementsByTagName(tagname: "body"): NodeListOf; + getElementsByTagName(tagname: "br"): NodeListOf; + getElementsByTagName(tagname: "button"): NodeListOf; + getElementsByTagName(tagname: "canvas"): NodeListOf; + getElementsByTagName(tagname: "caption"): NodeListOf; + getElementsByTagName(tagname: "center"): NodeListOf; + getElementsByTagName(tagname: "circle"): NodeListOf; + getElementsByTagName(tagname: "cite"): NodeListOf; + getElementsByTagName(tagname: "clippath"): NodeListOf; + getElementsByTagName(tagname: "code"): NodeListOf; + getElementsByTagName(tagname: "col"): NodeListOf; + getElementsByTagName(tagname: "colgroup"): NodeListOf; + getElementsByTagName(tagname: "datalist"): NodeListOf; + getElementsByTagName(tagname: "dd"): NodeListOf; + getElementsByTagName(tagname: "defs"): NodeListOf; + getElementsByTagName(tagname: "del"): NodeListOf; + getElementsByTagName(tagname: "desc"): NodeListOf; + getElementsByTagName(tagname: "dfn"): NodeListOf; + getElementsByTagName(tagname: "dir"): NodeListOf; + getElementsByTagName(tagname: "div"): NodeListOf; + getElementsByTagName(tagname: "dl"): NodeListOf; + getElementsByTagName(tagname: "dt"): NodeListOf; + getElementsByTagName(tagname: "ellipse"): NodeListOf; + getElementsByTagName(tagname: "em"): NodeListOf; + getElementsByTagName(tagname: "embed"): NodeListOf; + getElementsByTagName(tagname: "feblend"): NodeListOf; + getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; + getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; + getElementsByTagName(tagname: "fecomposite"): NodeListOf; + getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; + getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; + getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; + getElementsByTagName(tagname: "fedistantlight"): NodeListOf; + getElementsByTagName(tagname: "feflood"): NodeListOf; + getElementsByTagName(tagname: "fefunca"): NodeListOf; + getElementsByTagName(tagname: "fefuncb"): NodeListOf; + getElementsByTagName(tagname: "fefuncg"): NodeListOf; + getElementsByTagName(tagname: "fefuncr"): NodeListOf; + getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; + getElementsByTagName(tagname: "feimage"): NodeListOf; + getElementsByTagName(tagname: "femerge"): NodeListOf; + getElementsByTagName(tagname: "femergenode"): NodeListOf; + getElementsByTagName(tagname: "femorphology"): NodeListOf; + getElementsByTagName(tagname: "feoffset"): NodeListOf; + getElementsByTagName(tagname: "fepointlight"): NodeListOf; + getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; + getElementsByTagName(tagname: "fespotlight"): NodeListOf; + getElementsByTagName(tagname: "fetile"): NodeListOf; + getElementsByTagName(tagname: "feturbulence"): NodeListOf; + getElementsByTagName(tagname: "fieldset"): NodeListOf; + getElementsByTagName(tagname: "figcaption"): NodeListOf; + getElementsByTagName(tagname: "figure"): NodeListOf; + getElementsByTagName(tagname: "filter"): NodeListOf; + getElementsByTagName(tagname: "font"): NodeListOf; + getElementsByTagName(tagname: "footer"): NodeListOf; + getElementsByTagName(tagname: "foreignobject"): NodeListOf; + getElementsByTagName(tagname: "form"): NodeListOf; + getElementsByTagName(tagname: "frame"): NodeListOf; + getElementsByTagName(tagname: "frameset"): NodeListOf; + getElementsByTagName(tagname: "g"): NodeListOf; + getElementsByTagName(tagname: "h1"): NodeListOf; + getElementsByTagName(tagname: "h2"): NodeListOf; + getElementsByTagName(tagname: "h3"): NodeListOf; + getElementsByTagName(tagname: "h4"): NodeListOf; + getElementsByTagName(tagname: "h5"): NodeListOf; + getElementsByTagName(tagname: "h6"): NodeListOf; + getElementsByTagName(tagname: "head"): NodeListOf; + getElementsByTagName(tagname: "header"): NodeListOf; + getElementsByTagName(tagname: "hgroup"): NodeListOf; + getElementsByTagName(tagname: "hr"): NodeListOf; + getElementsByTagName(tagname: "html"): NodeListOf; + getElementsByTagName(tagname: "i"): NodeListOf; + getElementsByTagName(tagname: "iframe"): NodeListOf; + getElementsByTagName(tagname: "image"): NodeListOf; + getElementsByTagName(tagname: "img"): NodeListOf; + getElementsByTagName(tagname: "input"): NodeListOf; + getElementsByTagName(tagname: "ins"): NodeListOf; + getElementsByTagName(tagname: "isindex"): NodeListOf; + getElementsByTagName(tagname: "kbd"): NodeListOf; + getElementsByTagName(tagname: "keygen"): NodeListOf; + getElementsByTagName(tagname: "label"): NodeListOf; + getElementsByTagName(tagname: "legend"): NodeListOf; + getElementsByTagName(tagname: "li"): NodeListOf; + getElementsByTagName(tagname: "line"): NodeListOf; + getElementsByTagName(tagname: "lineargradient"): NodeListOf; + getElementsByTagName(tagname: "link"): NodeListOf; + getElementsByTagName(tagname: "listing"): NodeListOf; + getElementsByTagName(tagname: "map"): NodeListOf; + getElementsByTagName(tagname: "mark"): NodeListOf; + getElementsByTagName(tagname: "marker"): NodeListOf; + getElementsByTagName(tagname: "marquee"): NodeListOf; + getElementsByTagName(tagname: "mask"): NodeListOf; + getElementsByTagName(tagname: "menu"): NodeListOf; + getElementsByTagName(tagname: "meta"): NodeListOf; + getElementsByTagName(tagname: "metadata"): NodeListOf; + getElementsByTagName(tagname: "meter"): NodeListOf; + getElementsByTagName(tagname: "nav"): NodeListOf; + getElementsByTagName(tagname: "nextid"): NodeListOf; + getElementsByTagName(tagname: "nobr"): NodeListOf; + getElementsByTagName(tagname: "noframes"): NodeListOf; + getElementsByTagName(tagname: "noscript"): NodeListOf; + getElementsByTagName(tagname: "object"): NodeListOf; + getElementsByTagName(tagname: "ol"): NodeListOf; + getElementsByTagName(tagname: "optgroup"): NodeListOf; + getElementsByTagName(tagname: "option"): NodeListOf; + getElementsByTagName(tagname: "p"): NodeListOf; + getElementsByTagName(tagname: "param"): NodeListOf; + getElementsByTagName(tagname: "path"): NodeListOf; + getElementsByTagName(tagname: "pattern"): NodeListOf; + getElementsByTagName(tagname: "picture"): NodeListOf; + getElementsByTagName(tagname: "plaintext"): NodeListOf; + getElementsByTagName(tagname: "polygon"): NodeListOf; + getElementsByTagName(tagname: "polyline"): NodeListOf; + getElementsByTagName(tagname: "pre"): NodeListOf; + getElementsByTagName(tagname: "progress"): NodeListOf; + getElementsByTagName(tagname: "q"): NodeListOf; + getElementsByTagName(tagname: "radialgradient"): NodeListOf; + getElementsByTagName(tagname: "rect"): NodeListOf; + getElementsByTagName(tagname: "rt"): NodeListOf; + getElementsByTagName(tagname: "ruby"): NodeListOf; + getElementsByTagName(tagname: "s"): NodeListOf; + getElementsByTagName(tagname: "samp"): NodeListOf; + getElementsByTagName(tagname: "script"): NodeListOf; + getElementsByTagName(tagname: "section"): NodeListOf; + getElementsByTagName(tagname: "select"): NodeListOf; + getElementsByTagName(tagname: "small"): NodeListOf; + getElementsByTagName(tagname: "source"): NodeListOf; + getElementsByTagName(tagname: "span"): NodeListOf; + getElementsByTagName(tagname: "stop"): NodeListOf; + getElementsByTagName(tagname: "strike"): NodeListOf; + getElementsByTagName(tagname: "strong"): NodeListOf; + getElementsByTagName(tagname: "style"): NodeListOf; + getElementsByTagName(tagname: "sub"): NodeListOf; + getElementsByTagName(tagname: "sup"): NodeListOf; + getElementsByTagName(tagname: "svg"): NodeListOf; + getElementsByTagName(tagname: "switch"): NodeListOf; + getElementsByTagName(tagname: "symbol"): NodeListOf; + getElementsByTagName(tagname: "table"): NodeListOf; + getElementsByTagName(tagname: "tbody"): NodeListOf; + getElementsByTagName(tagname: "td"): NodeListOf; + getElementsByTagName(tagname: "template"): NodeListOf; + getElementsByTagName(tagname: "text"): NodeListOf; + getElementsByTagName(tagname: "textpath"): NodeListOf; + getElementsByTagName(tagname: "textarea"): NodeListOf; + getElementsByTagName(tagname: "tfoot"): NodeListOf; + getElementsByTagName(tagname: "th"): NodeListOf; + getElementsByTagName(tagname: "thead"): NodeListOf; + getElementsByTagName(tagname: "title"): NodeListOf; + getElementsByTagName(tagname: "tr"): NodeListOf; + getElementsByTagName(tagname: "track"): NodeListOf; + getElementsByTagName(tagname: "tspan"): NodeListOf; + getElementsByTagName(tagname: "tt"): NodeListOf; + getElementsByTagName(tagname: "u"): NodeListOf; + getElementsByTagName(tagname: "ul"): NodeListOf; + getElementsByTagName(tagname: "use"): NodeListOf; + getElementsByTagName(tagname: "var"): NodeListOf; + getElementsByTagName(tagname: "video"): NodeListOf; + getElementsByTagName(tagname: "view"): NodeListOf; + getElementsByTagName(tagname: "wbr"): NodeListOf; + getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; + getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + */ + getSelection(): Selection; + /** + * Gets a value indicating whether the object currently has focus. + */ + hasFocus(): boolean; + importNode(importedNode: Node, deep: boolean): Node; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(url?: string, name?: string, features?: string, replace?: boolean): Document; + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. + */ + queryCommandEnabled(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. + */ + queryCommandIndeterm(commandId: string): boolean; + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. + */ + queryCommandState(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. + */ + queryCommandSupported(commandId: string): boolean; + /** + * Retrieves the string associated with a command. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + */ + queryCommandText(commandId: string): string; + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. + */ + queryCommandValue(commandId: string): string; + releaseEvents(): void; + /** + * Allows updating the print settings for the page. + */ + updateSettings(): void; + webkitCancelFullScreen(): void; + webkitExitFullscreen(): void; + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. + */ + write(...content: string[]): void; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...content: string[]): 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var Document: { + prototype: Document; + new(): Document; +} + +interface DocumentFragment extends Node, NodeSelector, ParentNode { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +} + +interface DocumentType extends Node, ChildNode { + readonly entities: NamedNodeMap; + readonly internalSubset: string | null; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string | null; + readonly systemId: string | null; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +} + +interface DragEvent extends MouseEvent { + readonly dataTransfer: DataTransfer; + initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; + msConvertURL(file: File, targetType: string, targetURL?: string): void; +} + +declare var DragEvent: { + prototype: DragEvent; + new(): DragEvent; +} + +interface DynamicsCompressorNode extends AudioNode { + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: AudioParam; + readonly release: AudioParam; + readonly threshold: AudioParam; +} + +declare var DynamicsCompressorNode: { + prototype: DynamicsCompressorNode; + new(): DynamicsCompressorNode; +} + +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + +interface EXT_texture_filter_anisotropic { + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +declare var EXT_texture_filter_anisotropic: { + prototype: EXT_texture_filter_anisotropic; + new(): EXT_texture_filter_anisotropic; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; + msContentZoomFactor: number; + readonly msRegionOverflow: string; + onariarequest: (this: this, ev: AriaRequestEvent) => any; + oncommand: (this: this, ev: CommandEvent) => any; + ongotpointercapture: (this: this, ev: PointerEvent) => any; + onlostpointercapture: (this: this, ev: PointerEvent) => any; + onmsgesturechange: (this: this, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; + onmsgestureend: (this: this, ev: MSGestureEvent) => any; + onmsgesturehold: (this: this, ev: MSGestureEvent) => any; + onmsgesturestart: (this: this, ev: MSGestureEvent) => any; + onmsgesturetap: (this: this, ev: MSGestureEvent) => any; + onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any; + onmsinertiastart: (this: this, ev: MSGestureEvent) => any; + onmslostpointercapture: (this: this, ev: MSPointerEvent) => any; + onmspointercancel: (this: this, ev: MSPointerEvent) => any; + onmspointerdown: (this: this, ev: MSPointerEvent) => any; + onmspointerenter: (this: this, ev: MSPointerEvent) => any; + onmspointerleave: (this: this, ev: MSPointerEvent) => any; + onmspointermove: (this: this, ev: MSPointerEvent) => any; + onmspointerout: (this: this, ev: MSPointerEvent) => any; + onmspointerover: (this: this, ev: MSPointerEvent) => any; + onmspointerup: (this: this, ev: MSPointerEvent) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onwebkitfullscreenchange: (this: this, ev: Event) => any; + onwebkitfullscreenerror: (this: this, ev: Event) => any; + readonly prefix: string | null; + readonly scrollHeight: number; + scrollLeft: number; + scrollTop: number; + readonly scrollWidth: number; + readonly tagName: string; + innerHTML: string; + getAttribute(name: string): string | null; + getAttributeNS(namespaceURI: string, localName: string): string; + getAttributeNode(name: string): Attr; + getAttributeNodeNS(namespaceURI: string, localName: string): Attr; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + getElementsByTagName(name: "a"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "applet"): NodeListOf; + getElementsByTagName(name: "area"): NodeListOf; + getElementsByTagName(name: "article"): NodeListOf; + getElementsByTagName(name: "aside"): NodeListOf; + getElementsByTagName(name: "audio"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "base"): NodeListOf; + getElementsByTagName(name: "basefont"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "body"): NodeListOf; + getElementsByTagName(name: "br"): NodeListOf; + getElementsByTagName(name: "button"): NodeListOf; + getElementsByTagName(name: "canvas"): NodeListOf; + getElementsByTagName(name: "caption"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "circle"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "clippath"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "col"): NodeListOf; + getElementsByTagName(name: "colgroup"): NodeListOf; + getElementsByTagName(name: "datalist"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "defs"): NodeListOf; + getElementsByTagName(name: "del"): NodeListOf; + getElementsByTagName(name: "desc"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dir"): NodeListOf; + getElementsByTagName(name: "div"): NodeListOf; + getElementsByTagName(name: "dl"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "ellipse"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "embed"): NodeListOf; + getElementsByTagName(name: "feblend"): NodeListOf; + getElementsByTagName(name: "fecolormatrix"): NodeListOf; + getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; + getElementsByTagName(name: "fecomposite"): NodeListOf; + getElementsByTagName(name: "feconvolvematrix"): NodeListOf; + getElementsByTagName(name: "fediffuselighting"): NodeListOf; + getElementsByTagName(name: "fedisplacementmap"): NodeListOf; + getElementsByTagName(name: "fedistantlight"): NodeListOf; + getElementsByTagName(name: "feflood"): NodeListOf; + getElementsByTagName(name: "fefunca"): NodeListOf; + getElementsByTagName(name: "fefuncb"): NodeListOf; + getElementsByTagName(name: "fefuncg"): NodeListOf; + getElementsByTagName(name: "fefuncr"): NodeListOf; + getElementsByTagName(name: "fegaussianblur"): NodeListOf; + getElementsByTagName(name: "feimage"): NodeListOf; + getElementsByTagName(name: "femerge"): NodeListOf; + getElementsByTagName(name: "femergenode"): NodeListOf; + getElementsByTagName(name: "femorphology"): NodeListOf; + getElementsByTagName(name: "feoffset"): NodeListOf; + getElementsByTagName(name: "fepointlight"): NodeListOf; + getElementsByTagName(name: "fespecularlighting"): NodeListOf; + getElementsByTagName(name: "fespotlight"): NodeListOf; + getElementsByTagName(name: "fetile"): NodeListOf; + getElementsByTagName(name: "feturbulence"): NodeListOf; + getElementsByTagName(name: "fieldset"): NodeListOf; + getElementsByTagName(name: "figcaption"): NodeListOf; + getElementsByTagName(name: "figure"): NodeListOf; + getElementsByTagName(name: "filter"): NodeListOf; + getElementsByTagName(name: "font"): NodeListOf; + getElementsByTagName(name: "footer"): NodeListOf; + getElementsByTagName(name: "foreignobject"): NodeListOf; + getElementsByTagName(name: "form"): NodeListOf; + getElementsByTagName(name: "frame"): NodeListOf; + getElementsByTagName(name: "frameset"): NodeListOf; + getElementsByTagName(name: "g"): NodeListOf; + getElementsByTagName(name: "h1"): NodeListOf; + getElementsByTagName(name: "h2"): NodeListOf; + getElementsByTagName(name: "h3"): NodeListOf; + getElementsByTagName(name: "h4"): NodeListOf; + getElementsByTagName(name: "h5"): NodeListOf; + getElementsByTagName(name: "h6"): NodeListOf; + getElementsByTagName(name: "head"): NodeListOf; + getElementsByTagName(name: "header"): NodeListOf; + getElementsByTagName(name: "hgroup"): NodeListOf; + getElementsByTagName(name: "hr"): NodeListOf; + getElementsByTagName(name: "html"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "iframe"): NodeListOf; + getElementsByTagName(name: "image"): NodeListOf; + getElementsByTagName(name: "img"): NodeListOf; + getElementsByTagName(name: "input"): NodeListOf; + getElementsByTagName(name: "ins"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "label"): NodeListOf; + getElementsByTagName(name: "legend"): NodeListOf; + getElementsByTagName(name: "li"): NodeListOf; + getElementsByTagName(name: "line"): NodeListOf; + getElementsByTagName(name: "lineargradient"): NodeListOf; + getElementsByTagName(name: "link"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "map"): NodeListOf; + getElementsByTagName(name: "mark"): NodeListOf; + getElementsByTagName(name: "marker"): NodeListOf; + getElementsByTagName(name: "marquee"): NodeListOf; + getElementsByTagName(name: "mask"): NodeListOf; + getElementsByTagName(name: "menu"): NodeListOf; + getElementsByTagName(name: "meta"): NodeListOf; + getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "meter"): NodeListOf; + getElementsByTagName(name: "nav"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "noframes"): NodeListOf; + getElementsByTagName(name: "noscript"): NodeListOf; + getElementsByTagName(name: "object"): NodeListOf; + getElementsByTagName(name: "ol"): NodeListOf; + getElementsByTagName(name: "optgroup"): NodeListOf; + getElementsByTagName(name: "option"): NodeListOf; + getElementsByTagName(name: "p"): NodeListOf; + getElementsByTagName(name: "param"): NodeListOf; + getElementsByTagName(name: "path"): NodeListOf; + getElementsByTagName(name: "pattern"): NodeListOf; + getElementsByTagName(name: "picture"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "polygon"): NodeListOf; + getElementsByTagName(name: "polyline"): NodeListOf; + getElementsByTagName(name: "pre"): NodeListOf; + getElementsByTagName(name: "progress"): NodeListOf; + getElementsByTagName(name: "q"): NodeListOf; + getElementsByTagName(name: "radialgradient"): NodeListOf; + getElementsByTagName(name: "rect"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "script"): NodeListOf; + getElementsByTagName(name: "section"): NodeListOf; + getElementsByTagName(name: "select"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "source"): NodeListOf; + getElementsByTagName(name: "span"): NodeListOf; + getElementsByTagName(name: "stop"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "style"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "svg"): NodeListOf; + getElementsByTagName(name: "switch"): NodeListOf; + getElementsByTagName(name: "symbol"): NodeListOf; + getElementsByTagName(name: "table"): NodeListOf; + getElementsByTagName(name: "tbody"): NodeListOf; + getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "template"): NodeListOf; + getElementsByTagName(name: "text"): NodeListOf; + getElementsByTagName(name: "textpath"): NodeListOf; + getElementsByTagName(name: "textarea"): NodeListOf; + getElementsByTagName(name: "tfoot"): NodeListOf; + getElementsByTagName(name: "th"): NodeListOf; + getElementsByTagName(name: "thead"): NodeListOf; + getElementsByTagName(name: "title"): NodeListOf; + getElementsByTagName(name: "tr"): NodeListOf; + getElementsByTagName(name: "track"): NodeListOf; + getElementsByTagName(name: "tspan"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "ul"): NodeListOf; + getElementsByTagName(name: "use"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "video"): NodeListOf; + getElementsByTagName(name: "view"): NodeListOf; + getElementsByTagName(name: "wbr"): NodeListOf; + getElementsByTagName(name: "x-ms-webview"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + hasAttribute(name: string): boolean; + hasAttributeNS(namespaceURI: string, localName: string): boolean; + msGetRegionContent(): MSRangeCollection; + msGetUntransformedBounds(): ClientRect; + msMatchesSelector(selectors: string): boolean; + msReleasePointerCapture(pointerId: number): void; + msSetPointerCapture(pointerId: number): void; + msZoomTo(args: MsZoomToOptions): void; + releasePointerCapture(pointerId: number): void; + removeAttribute(name?: string): void; + removeAttributeNS(namespaceURI: string, localName: string): void; + removeAttributeNode(oldAttr: Attr): Attr; + requestFullscreen(): void; + requestPointerLock(): void; + setAttribute(name: string, value: string): void; + setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; + setAttributeNode(newAttr: Attr): Attr; + setAttributeNodeNS(newAttr: Attr): Attr; + setPointerCapture(pointerId: number): void; + webkitMatchesSelector(selectors: string): boolean; + webkitRequestFullScreen(): void; + webkitRequestFullscreen(): void; + getElementsByClassName(classNames: string): NodeListOf; + 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var Element: { + prototype: Element; + new(): Element; +} + +interface ErrorEvent extends Event { + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} + +declare var ErrorEvent: { + prototype: ErrorEvent; + new(): ErrorEvent; +} + +interface Event { + readonly bubbles: boolean; + cancelBubble: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; + returnValue: boolean; + readonly srcElement: Element | null; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + preventDefault(): void; + stopImmediatePropagation(): void; + stopPropagation(): void; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +declare var Event: { + prototype: Event; + new(type: string, eventInitDict?: EventInit): Event; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +interface EventTarget { + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; + dispatchEvent(evt: Event): boolean; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var EventTarget: { + prototype: EventTarget; + new(): EventTarget; +} + +interface External { +} + +declare var External: { + prototype: External; + new(): External; +} + +interface File extends Blob { + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; +} + +declare var File: { + prototype: File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; +} + +interface FileList { + readonly length: number; + item(index: number): File; + [index: number]: File; +} + +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface FileReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface FocusEvent extends UIEvent { + readonly relatedTarget: EventTarget; + initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; +} + +declare var FocusEvent: { + prototype: FocusEvent; + new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; +} + +interface FormData { + append(name: any, value: any, blobName?: string): void; +} + +declare var FormData: { + prototype: FormData; + new (form?: HTMLFormElement): FormData; +} + +interface GainNode extends AudioNode { + readonly gain: AudioParam; +} + +declare var GainNode: { + prototype: GainNode; + new(): GainNode; +} + +interface Gamepad { + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; +} + +declare var Gamepad: { + prototype: Gamepad; + new(): Gamepad; +} + +interface GamepadButton { + readonly pressed: boolean; + readonly value: number; +} + +declare var GamepadButton: { + prototype: GamepadButton; + new(): GamepadButton; +} + +interface GamepadEvent extends Event { + readonly gamepad: Gamepad; +} + +declare var GamepadEvent: { + prototype: GamepadEvent; + new(): GamepadEvent; +} + +interface Geolocation { + clearWatch(watchId: number): void; + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; +} + +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +} + +interface HTMLAllCollection extends HTMLCollection { + namedItem(name: string): Element; +} + +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +} + +interface HTMLAnchorElement extends HTMLElement { + Methods: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Contains the anchor portion of the URL including the hash sign (#). + */ + hash: string; + /** + * Contains the hostname and port values of the URL. + */ + host: string; + /** + * Contains the hostname of a URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + readonly mimeType: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + readonly nameProp: string; + /** + * Contains the pathname of the URL. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Contains the protocol of the URL. + */ + protocol: string; + readonly protocolLong: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + type: string; + urn: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} + +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +} + +interface HTMLAppletElement extends HTMLElement { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. + */ + declare: boolean; + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + object: string | null; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + vspace: number; + width: number; +} + +declare var HTMLAppletElement: { + prototype: HTMLAppletElement; + new(): HTMLAppletElement; +} + +interface HTMLAreaElement extends HTMLElement { + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Sets or retrieves the subsection of the href property that follows the number sign (#). + */ + hash: string; + /** + * Sets or retrieves the hostname and port number of the location or URL. + */ + host: string; + /** + * Sets or retrieves the host name part of the location or URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or gets whether clicks in this region cause action. + */ + noHref: boolean; + /** + * Sets or retrieves the file name or path specified by the object. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Sets or retrieves the protocol portion of a URL. + */ + protocol: string; + rel: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns a string representation of an object. + */ + toString(): string; +} + +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +} + +interface HTMLAreasCollection extends HTMLCollection { + /** + * Adds an element to the areas, controlRange, or options collection. + */ + add(element: HTMLElement, before?: HTMLElement | number): void; + /** + * Removes an element from the collection. + */ + remove(index?: number): void; +} + +declare var HTMLAreasCollection: { + prototype: HTMLAreasCollection; + new(): HTMLAreasCollection; +} + +interface HTMLAudioElement extends HTMLMediaElement { +} + +declare var HTMLAudioElement: { + prototype: HTMLAudioElement; + new(): HTMLAudioElement; +} + +interface HTMLBRElement extends HTMLElement { + /** + * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. + */ + clear: string; +} + +declare var HTMLBRElement: { + prototype: HTMLBRElement; + new(): HTMLBRElement; +} + +interface HTMLBaseElement extends HTMLElement { + /** + * Gets or sets the baseline URL on which relative links are based. + */ + href: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; +} + +declare var HTMLBaseElement: { + prototype: HTMLBaseElement; + new(): HTMLBaseElement; +} + +interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + /** + * Sets or retrieves the font size of the object. + */ + size: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBaseFontElement: { + prototype: HTMLBaseFontElement; + new(): HTMLBaseFontElement; +} + +interface HTMLBodyElement extends HTMLElement { + aLink: any; + background: string; + bgColor: any; + bgProperties: string; + link: any; + noWrap: boolean; + onafterprint: (this: this, ev: Event) => any; + onbeforeprint: (this: this, ev: Event) => any; + onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + onblur: (this: this, ev: FocusEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onfocus: (this: this, ev: FocusEvent) => any; + onhashchange: (this: this, ev: HashChangeEvent) => any; + onload: (this: this, ev: Event) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onoffline: (this: this, ev: Event) => any; + ononline: (this: this, ev: Event) => any; + onorientationchange: (this: this, ev: Event) => any; + onpagehide: (this: this, ev: PageTransitionEvent) => any; + onpageshow: (this: this, ev: PageTransitionEvent) => any; + onpopstate: (this: this, ev: PopStateEvent) => any; + onresize: (this: this, ev: UIEvent) => any; + onstorage: (this: this, ev: StorageEvent) => any; + onunload: (this: this, ev: Event) => any; + text: any; + vLink: any; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLBodyElement: { + prototype: HTMLBodyElement; + new(): HTMLBodyElement; +} + +interface HTMLButtonElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + status: any; + /** + * Gets the classification and default behavior of the button. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the default or selected value of the control. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} + +declare var HTMLButtonElement: { + prototype: HTMLButtonElement; + new(): HTMLButtonElement; +} + +interface HTMLCanvasElement extends HTMLElement { + /** + * Gets or sets the height of a canvas element on a document. + */ + height: number; + /** + * Gets or sets the width of a canvas element on a document. + */ + width: number; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; + getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; + /** + * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. + */ + msToBlob(): Blob; + /** + * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. + * @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, type?: string, ...arguments: any[]): void; +} + +declare var HTMLCanvasElement: { + prototype: HTMLCanvasElement; + new(): HTMLCanvasElement; +} + +interface HTMLCollection { + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Retrieves an object from various collections. + */ + item(index: number): Element; + /** + * Retrieves a select object or an object from an options collection. + */ + namedItem(name: string): Element; + [index: number]: Element; +} + +declare var HTMLCollection: { + prototype: HTMLCollection; + new(): HTMLCollection; +} + +interface HTMLDListElement extends HTMLElement { + compact: boolean; +} + +declare var HTMLDListElement: { + prototype: HTMLDListElement; + new(): HTMLDListElement; +} + +interface HTMLDataListElement extends HTMLElement { + options: HTMLCollectionOf; +} + +declare var HTMLDataListElement: { + prototype: HTMLDataListElement; + new(): HTMLDataListElement; +} + +interface HTMLDirectoryElement extends HTMLElement { + compact: boolean; +} + +declare var HTMLDirectoryElement: { + prototype: HTMLDirectoryElement; + new(): HTMLDirectoryElement; +} + +interface HTMLDivElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; +} + +declare var HTMLDivElement: { + prototype: HTMLDivElement; + new(): HTMLDivElement; +} + +interface HTMLDocument extends Document { +} + +declare var HTMLDocument: { + prototype: HTMLDocument; + new(): HTMLDocument; +} + +interface HTMLElement extends Element { + accessKey: string; + readonly children: HTMLCollection; + contentEditable: string; + readonly dataset: DOMStringMap; + dir: string; + draggable: boolean; + hidden: boolean; + hideFocus: boolean; + innerHTML: string; + innerText: string; + readonly isContentEditable: boolean; + lang: string; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; + onabort: (this: this, ev: UIEvent) => any; + onactivate: (this: this, ev: UIEvent) => any; + onbeforeactivate: (this: this, ev: UIEvent) => any; + onbeforecopy: (this: this, ev: ClipboardEvent) => any; + onbeforecut: (this: this, ev: ClipboardEvent) => any; + onbeforedeactivate: (this: this, ev: UIEvent) => any; + onbeforepaste: (this: this, ev: ClipboardEvent) => any; + onblur: (this: this, ev: FocusEvent) => any; + oncanplay: (this: this, ev: Event) => any; + oncanplaythrough: (this: this, ev: Event) => any; + onchange: (this: this, ev: Event) => any; + onclick: (this: this, ev: MouseEvent) => any; + oncontextmenu: (this: this, ev: PointerEvent) => any; + oncopy: (this: this, ev: ClipboardEvent) => any; + oncuechange: (this: this, ev: Event) => any; + oncut: (this: this, ev: ClipboardEvent) => any; + ondblclick: (this: this, ev: MouseEvent) => any; + ondeactivate: (this: this, ev: UIEvent) => any; + ondrag: (this: this, ev: DragEvent) => any; + ondragend: (this: this, ev: DragEvent) => any; + ondragenter: (this: this, ev: DragEvent) => any; + ondragleave: (this: this, ev: DragEvent) => any; + ondragover: (this: this, ev: DragEvent) => any; + ondragstart: (this: this, ev: DragEvent) => any; + ondrop: (this: this, ev: DragEvent) => any; + ondurationchange: (this: this, ev: Event) => any; + onemptied: (this: this, ev: Event) => any; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onfocus: (this: this, ev: FocusEvent) => any; + oninput: (this: this, ev: Event) => any; + oninvalid: (this: this, ev: Event) => any; + onkeydown: (this: this, ev: KeyboardEvent) => any; + onkeypress: (this: this, ev: KeyboardEvent) => any; + onkeyup: (this: this, ev: KeyboardEvent) => any; + onload: (this: this, ev: Event) => any; + onloadeddata: (this: this, ev: Event) => any; + onloadedmetadata: (this: this, ev: Event) => any; + onloadstart: (this: this, ev: Event) => any; + onmousedown: (this: this, ev: MouseEvent) => any; + onmouseenter: (this: this, ev: MouseEvent) => any; + onmouseleave: (this: this, ev: MouseEvent) => any; + onmousemove: (this: this, ev: MouseEvent) => any; + onmouseout: (this: this, ev: MouseEvent) => any; + onmouseover: (this: this, ev: MouseEvent) => any; + onmouseup: (this: this, ev: MouseEvent) => any; + onmousewheel: (this: this, ev: WheelEvent) => any; + onmscontentzoom: (this: this, ev: UIEvent) => any; + onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; + onpaste: (this: this, ev: ClipboardEvent) => any; + onpause: (this: this, ev: Event) => any; + onplay: (this: this, ev: Event) => any; + onplaying: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + onratechange: (this: this, ev: Event) => any; + onreset: (this: this, ev: Event) => any; + onscroll: (this: this, ev: UIEvent) => any; + onseeked: (this: this, ev: Event) => any; + onseeking: (this: this, ev: Event) => any; + onselect: (this: this, ev: UIEvent) => any; + onselectstart: (this: this, ev: Event) => any; + onstalled: (this: this, ev: Event) => any; + onsubmit: (this: this, ev: Event) => any; + onsuspend: (this: this, ev: Event) => any; + ontimeupdate: (this: this, ev: Event) => any; + onvolumechange: (this: this, ev: Event) => any; + onwaiting: (this: this, ev: Event) => any; + outerHTML: string; + outerText: string; + spellcheck: boolean; + readonly style: CSSStyleDeclaration; + tabIndex: number; + title: string; + blur(): void; + click(): void; + dragDrop(): boolean; + focus(): void; + msGetInputContext(): MSInputMethodContext; + 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLElement: { + prototype: HTMLElement; + new(): HTMLElement; +} + +interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves the height of the object. + */ + height: string; + hidden: any; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves the palette used for the embedded document. + */ + readonly palette: string; + /** + * Retrieves the URL of the plug-in used to view an embedded document. + */ + readonly pluginspage: string; + readonly readyState: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the height and width units of the embed object. + */ + units: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLEmbedElement: { + prototype: HTMLEmbedElement; + new(): HTMLEmbedElement; +} + +interface HTMLFieldSetElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; +} + +declare var HTMLFieldSetElement: { + prototype: HTMLFieldSetElement; + new(): HTMLFieldSetElement; +} + +interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFontElement: { + prototype: HTMLFontElement; + new(): HTMLFontElement; +} + +interface HTMLFormElement extends HTMLElement { + /** + * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. + */ + acceptCharset: string; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Retrieves a collection, in source order, of all controls in a given form. + */ + readonly elements: HTMLCollection; + /** + * Sets or retrieves the MIME encoding for the form. + */ + encoding: string; + /** + * Sets or retrieves the encoding type for the form. + */ + enctype: string; + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Sets or retrieves how to send the form data to the server. + */ + method: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Designates a form that is not validated when submitted. + */ + noValidate: boolean; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a form object or an object from an elements collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a form object or an object from an elements collection. + */ + namedItem(name: string): any; + /** + * Fires when the user resets a form. + */ + reset(): void; + /** + * Fires when a FORM is about to be submitted. + */ + submit(): void; + [name: string]: any; +} + +declare var HTMLFormElement: { + prototype: HTMLFormElement; + new(): HTMLFormElement; +} + +interface HTMLFrameElement extends HTMLElement, GetSVGDocument { + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string | number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: this, ev: Event) => any; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the width of the object. + */ + width: string | number; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLFrameElement: { + prototype: HTMLFrameElement; + new(): HTMLFrameElement; +} + +interface HTMLFrameSetElement extends HTMLElement { + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the frame widths of the object. + */ + cols: string; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + name: string; + onafterprint: (this: this, ev: Event) => any; + onbeforeprint: (this: this, ev: Event) => any; + onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + /** + * Fires when the object loses the input focus. + */ + onblur: (this: this, ev: FocusEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + */ + onfocus: (this: this, ev: FocusEvent) => any; + onhashchange: (this: this, ev: HashChangeEvent) => any; + onload: (this: this, ev: Event) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onoffline: (this: this, ev: Event) => any; + ononline: (this: this, ev: Event) => any; + onorientationchange: (this: this, ev: Event) => any; + onpagehide: (this: this, ev: PageTransitionEvent) => any; + onpageshow: (this: this, ev: PageTransitionEvent) => any; + onresize: (this: this, ev: UIEvent) => any; + onstorage: (this: this, ev: StorageEvent) => any; + onunload: (this: this, ev: Event) => any; + /** + * Sets or retrieves the frame heights of the object. + */ + rows: string; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLFrameSetElement: { + prototype: HTMLFrameSetElement; + new(): HTMLFrameSetElement; +} + +interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. + */ + noShade: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHRElement: { + prototype: HTMLHRElement; + new(): HTMLHRElement; +} + +interface HTMLHeadElement extends HTMLElement { + profile: string; +} + +declare var HTMLHeadElement: { + prototype: HTMLHeadElement; + new(): HTMLHeadElement; +} + +interface HTMLHeadingElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; +} + +declare var HTMLHeadingElement: { + prototype: HTMLHeadingElement; + new(): HTMLHeadingElement; +} + +interface HTMLHtmlElement extends HTMLElement { + /** + * Sets or retrieves the DTD version that governs the current document. + */ + version: string; +} + +declare var HTMLHtmlElement: { + prototype: HTMLHtmlElement; + new(): HTMLHtmlElement; +} + +interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + allowFullscreen: boolean; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the horizontal margin for the object. + */ + hspace: number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: this, ev: Event) => any; + readonly sandbox: DOMSettableTokenList; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLIFrameElement: { + prototype: HTMLIFrameElement; + new(): HTMLIFrameElement; +} + +interface HTMLImageElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + crossOrigin: string; + readonly currentSrc: string; + /** + * Sets or retrieves the height of the object. + */ + height: number; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves whether the image is a server-side image map. + */ + isMap: boolean; + /** + * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. + */ + longDesc: string; + lowsrc: string; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * The original height of the image resource before sizing. + */ + readonly naturalHeight: number; + /** + * The original width of the image resource before sizing. + */ + readonly naturalWidth: number; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: number; + readonly x: number; + readonly y: number; + msGetAsCastingSource(): any; +} + +declare var HTMLImageElement: { + prototype: HTMLImageElement; + new(): HTMLImageElement; + create(): HTMLImageElement; +} + +interface HTMLInputElement extends HTMLElement { + /** + * Sets or retrieves a comma-separated list of content types. + */ + accept: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + checked: boolean; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + /** + * Sets or retrieves the state of the check box or radio button. + */ + defaultChecked: boolean; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Returns a FileList object on a file type input object. + */ + readonly files: FileList | null; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + indeterminate: boolean; + /** + * Specifies the ID of a pre-defined datalist of options for an input element. + */ + readonly list: HTMLElement; + /** + * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. + */ + max: string; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. + */ + min: string; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a string containing a regular expression that the user's input must match. + */ + pattern: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + selectionDirection: string; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + size: number; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + status: boolean; + /** + * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. + */ + step: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns the value of the data at the cursor's current position. + */ + value: string; + valueAsDate: Date; + /** + * Returns the input field value as a number. + */ + valueAsNumber: number; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + webkitdirectory: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Makes the selection equal to the current object. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start?: number, end?: number, direction?: string): void; + /** + * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. + * @param n Value to decrement the value by. + */ + stepDown(n?: number): void; + /** + * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. + * @param n Value to increment the value by. + */ + stepUp(n?: number): void; +} + +declare var HTMLInputElement: { + prototype: HTMLInputElement; + new(): HTMLInputElement; +} + +interface HTMLLIElement extends HTMLElement { + type: string; + /** + * Sets or retrieves the value of a list item. + */ + value: number; +} + +declare var HTMLLIElement: { + prototype: HTMLLIElement; + new(): HTMLLIElement; +} + +interface HTMLLabelElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the object to which the given label object is assigned. + */ + htmlFor: string; +} + +declare var HTMLLabelElement: { + prototype: HTMLLabelElement; + new(): HTMLLabelElement; +} + +interface HTMLLegendElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; +} + +declare var HTMLLegendElement: { + prototype: HTMLLegendElement; + new(): HTMLLegendElement; +} + +interface HTMLLinkElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + disabled: boolean; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + import?: Document; + integrity: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLinkElement: { + prototype: HTMLLinkElement; + new(): HTMLLinkElement; +} + +interface HTMLMapElement extends HTMLElement { + /** + * Retrieves a collection of the area objects defined for the given map object. + */ + readonly areas: HTMLAreasCollection; + /** + * Sets or retrieves the name of the object. + */ + name: string; +} + +declare var HTMLMapElement: { + prototype: HTMLMapElement; + new(): HTMLMapElement; +} + +interface HTMLMarqueeElement extends HTMLElement { + behavior: string; + bgColor: any; + direction: string; + height: string; + hspace: number; + loop: number; + onbounce: (this: this, ev: Event) => any; + onfinish: (this: this, ev: Event) => any; + onstart: (this: this, ev: Event) => any; + scrollAmount: number; + scrollDelay: number; + trueSpeed: boolean; + vspace: number; + width: string; + start(): void; + stop(): 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLMarqueeElement: { + prototype: HTMLMarqueeElement; + new(): HTMLMarqueeElement; +} + +interface HTMLMediaElement extends HTMLElement { + /** + * Returns an AudioTrackList object with the audio tracks for a given video element. + */ + readonly audioTracks: AudioTrackList; + /** + * Gets or sets a value that indicates whether to start playing the media automatically. + */ + autoplay: boolean; + /** + * Gets a collection of buffered time ranges. + */ + readonly buffered: TimeRanges; + /** + * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). + */ + controls: boolean; + crossOrigin: string; + /** + * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. + */ + readonly currentSrc: string; + /** + * Gets or sets the current playback position, in seconds. + */ + currentTime: number; + defaultMuted: boolean; + /** + * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. + */ + defaultPlaybackRate: number; + /** + * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. + */ + readonly duration: number; + /** + * Gets information about whether the playback has ended or not. + */ + readonly ended: boolean; + /** + * Returns an object representing the current error state of the audio or video element. + */ + readonly error: MediaError; + /** + * Gets or sets a flag to specify whether playback should restart after it completes. + */ + loop: boolean; + readonly mediaKeys: MediaKeys | null; + /** + * Specifies the purpose of the audio or video media, such as background audio or alerts. + */ + msAudioCategory: string; + /** + * Specifies the output device id that the audio will be sent to. + */ + msAudioDeviceType: string; + readonly msGraphicsTrustStatus: MSGraphicsTrust; + /** + * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. + */ + readonly msKeys: MSMediaKeys; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Specifies whether or not to enable low-latency playback on the media element. + */ + msRealTime: boolean; + /** + * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. + */ + muted: boolean; + /** + * Gets the current network activity for the element. + */ + readonly networkState: number; + onencrypted: (this: this, ev: MediaEncryptedEvent) => any; + onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any; + /** + * Gets a flag that specifies whether playback is paused. + */ + readonly paused: boolean; + /** + * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. + */ + playbackRate: number; + /** + * Gets TimeRanges for the current media resource that has been played. + */ + readonly played: TimeRanges; + /** + * Gets or sets the current playback position, in seconds. + */ + preload: string; + readyState: number; + /** + * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. + */ + readonly seekable: TimeRanges; + /** + * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. + */ + readonly seeking: boolean; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcObject: MediaStream | null; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; + /** + * Gets or sets the volume level for audio portions of the media element. + */ + volume: number; + addTextTrack(kind: string, label?: string, language?: string): TextTrack; + /** + * Returns a string that specifies whether the client can play a given media resource type. + */ + canPlayType(type: string): string; + /** + * Resets the audio or video object and loads a new media resource. + */ + load(): void; + /** + * Clears all effects from the media pipeline. + */ + msClearEffects(): void; + msGetAsCastingSource(): any; + /** + * Inserts the specified audio effect into media pipeline. + */ + msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetMediaKeys(mediaKeys: MSMediaKeys): void; + /** + * Specifies the media protection manager for a given media pipeline. + */ + msSetMediaProtectionManager(mediaProtectionManager?: any): void; + /** + * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. + */ + pause(): void; + /** + * Loads and starts playback of a media resource. + */ + play(): void; + setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; + addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLMediaElement: { + prototype: HTMLMediaElement; + new(): HTMLMediaElement; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; +} + +interface HTMLMenuElement extends HTMLElement { + compact: boolean; + type: string; +} + +declare var HTMLMenuElement: { + prototype: HTMLMenuElement; + new(): HTMLMenuElement; +} + +interface HTMLMetaElement extends HTMLElement { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Gets or sets meta-information to associate with httpEquiv or name. + */ + content: string; + /** + * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. + */ + httpEquiv: string; + /** + * Sets or retrieves the value specified in the content attribute of the meta object. + */ + name: string; + /** + * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. + */ + scheme: string; + /** + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + */ + url: string; +} + +declare var HTMLMetaElement: { + prototype: HTMLMetaElement; + new(): HTMLMetaElement; +} + +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + +interface HTMLModElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; +} + +declare var HTMLModElement: { + prototype: HTMLModElement; + new(): HTMLModElement; +} + +interface HTMLOListElement extends HTMLElement { + compact: boolean; + /** + * The starting number. + */ + start: number; + type: string; +} + +declare var HTMLOListElement: { + prototype: HTMLOListElement; + new(): HTMLOListElement; +} + +interface HTMLObjectElement extends HTMLElement, GetSVGDocument { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + /** + * Sets or retrieves the URL of the file containing the compiled Java class. + */ + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + declare: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves the contained object. + */ + readonly object: any; + readonly readyState: number; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLObjectElement: { + prototype: HTMLObjectElement; + new(): HTMLObjectElement; +} + +interface HTMLOptGroupElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + readonly text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; +} + +declare var HTMLOptGroupElement: { + prototype: HTMLOptGroupElement; + new(): HTMLOptGroupElement; +} + +interface HTMLOptionElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; +} + +declare var HTMLOptionElement: { + prototype: HTMLOptionElement; + new(): HTMLOptionElement; + create(): HTMLOptionElement; +} + +interface HTMLOptionsCollection extends HTMLCollectionOf { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + +interface HTMLParagraphElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + clear: string; +} + +declare var HTMLParagraphElement: { + prototype: HTMLParagraphElement; + new(): HTMLParagraphElement; +} + +interface HTMLParamElement extends HTMLElement { + /** + * Sets or retrieves the name of an input parameter for an element. + */ + name: string; + /** + * Sets or retrieves the content type of the resource designated by the value attribute. + */ + type: string; + /** + * Sets or retrieves the value of an input parameter for an element. + */ + value: string; + /** + * Sets or retrieves the data type of the value attribute. + */ + valueType: string; +} + +declare var HTMLParamElement: { + prototype: HTMLParamElement; + new(): HTMLParamElement; +} + +interface HTMLPictureElement extends HTMLElement { +} + +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; +} + +interface HTMLPreElement extends HTMLElement { + /** + * Sets or gets a value that you can use to implement your own width functionality for the object. + */ + width: number; +} + +declare var HTMLPreElement: { + prototype: HTMLPreElement; + new(): HTMLPreElement; +} + +interface HTMLProgressElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Defines the maximum, or "done" value for a progress element. + */ + max: number; + /** + * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). + */ + readonly position: number; + /** + * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. + */ + value: number; +} + +declare var HTMLProgressElement: { + prototype: HTMLProgressElement; + new(): HTMLProgressElement; +} + +interface HTMLQuoteElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; +} + +declare var HTMLQuoteElement: { + prototype: HTMLQuoteElement; + new(): HTMLQuoteElement; +} + +interface HTMLScriptElement extends HTMLElement { + async: boolean; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the status of the script. + */ + defer: boolean; + /** + * Sets or retrieves the event for which the script is written. + */ + event: string; + /** + * Sets or retrieves the object that is bound to the event script. + */ + htmlFor: string; + /** + * Retrieves the URL to an external file that contains the source code or data. + */ + src: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Sets or retrieves the MIME type for the associated scripting engine. + */ + type: string; + integrity: string; +} + +declare var HTMLScriptElement: { + prototype: HTMLScriptElement; + new(): HTMLScriptElement; +} + +interface HTMLSelectElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + readonly options: HTMLOptionsCollection; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the index of the selected option in a select object. + */ + selectedIndex: number; + selectedOptions: HTMLCollectionOf; + /** + * Sets or retrieves the number of rows in the list box. + */ + size: number; + /** + * Retrieves the type of select control based on the value of the MULTIPLE attribute. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Adds an element to the areas, controlRange, or options collection. + * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + */ + add(element: HTMLElement, before?: HTMLElement | number): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a select object or an object from an options collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a select object or an object from an options collection. + * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. + */ + namedItem(name: string): any; + /** + * Removes an element from the collection. + * @param index Number that specifies the zero-based index of the element to remove from the collection. + */ + remove(index?: number): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + [name: string]: any; +} + +declare var HTMLSelectElement: { + prototype: HTMLSelectElement; + new(): HTMLSelectElement; +} + +interface HTMLSourceElement extends HTMLElement { + /** + * Gets or sets the intended media type of the media source. + */ + media: string; + msKeySystem: string; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Gets or sets the MIME type of a media resource. + */ + type: string; +} + +declare var HTMLSourceElement: { + prototype: HTMLSourceElement; + new(): HTMLSourceElement; +} + +interface HTMLSpanElement extends HTMLElement { +} + +declare var HTMLSpanElement: { + prototype: HTMLSpanElement; + new(): HTMLSpanElement; +} + +interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Retrieves the CSS language in which the style sheet is written. + */ + type: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLStyleElement: { + prototype: HTMLStyleElement; + new(): HTMLStyleElement; +} + +interface HTMLTableCaptionElement extends HTMLElement { + /** + * Sets or retrieves the alignment of the caption or legend. + */ + align: string; + /** + * Sets or retrieves whether the caption appears at the top or bottom of the table. + */ + vAlign: string; +} + +declare var HTMLTableCaptionElement: { + prototype: HTMLTableCaptionElement; + new(): HTMLTableCaptionElement; +} + +interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves abbreviated text for the object. + */ + abbr: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. + */ + axis: string; + bgColor: any; + /** + * Retrieves the position of the object in the cells collection of a row. + */ + readonly cellIndex: number; + /** + * Sets or retrieves the number columns in the table that the object should span. + */ + colSpan: number; + /** + * Sets or retrieves a list of header cells that provide information for the object. + */ + headers: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + /** + * Sets or retrieves how many rows in a table the cell should span. + */ + rowSpan: number; + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableCellElement: { + prototype: HTMLTableCellElement; + new(): HTMLTableCellElement; +} + +interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves the alignment of the object relative to the display or table. + */ + align: string; + /** + * Sets or retrieves the number of columns in the group. + */ + span: number; + /** + * Sets or retrieves the width of the object. + */ + width: any; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableColElement: { + prototype: HTMLTableColElement; + new(): HTMLTableColElement; +} + +interface HTMLTableDataCellElement extends HTMLTableCellElement { +} + +declare var HTMLTableDataCellElement: { + prototype: HTMLTableDataCellElement; + new(): HTMLTableDataCellElement; +} + +interface HTMLTableElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + bgColor: any; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the caption object of a table. + */ + caption: HTMLTableCaptionElement; + /** + * Sets or retrieves the amount of space between the border of the cell and the content of the cell. + */ + cellPadding: string; + /** + * Sets or retrieves the amount of space between cells in a table. + */ + cellSpacing: string; + /** + * Sets or retrieves the number of columns in the table. + */ + cols: number; + /** + * Sets or retrieves the way the border frame around the table is displayed. + */ + frame: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Sets or retrieves which dividing lines (inner borders) are displayed. + */ + rules: string; + /** + * Sets or retrieves a description and/or structure of the object. + */ + summary: string; + /** + * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. + */ + tBodies: HTMLCollectionOf; + /** + * Retrieves the tFoot object of the table. + */ + tFoot: HTMLTableSectionElement; + /** + * Retrieves the tHead object of the table. + */ + tHead: HTMLTableSectionElement; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Creates an empty caption element in the table. + */ + createCaption(): HTMLTableCaptionElement; + /** + * Creates an empty tBody element in the table. + */ + createTBody(): HTMLTableSectionElement; + /** + * Creates an empty tFoot element in the table. + */ + createTFoot(): HTMLTableSectionElement; + /** + * Returns the tHead element object if successful, or null otherwise. + */ + createTHead(): HTMLTableSectionElement; + /** + * Deletes the caption element and its contents from the table. + */ + deleteCaption(): void; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Deletes the tFoot element and its contents from the table. + */ + deleteTFoot(): void; + /** + * Deletes the tHead element and its contents from the table. + */ + deleteTHead(): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; +} + +declare var HTMLTableElement: { + prototype: HTMLTableElement; + new(): HTMLTableElement; +} + +interface HTMLTableHeaderCellElement extends HTMLTableCellElement { + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; +} + +declare var HTMLTableHeaderCellElement: { + prototype: HTMLTableHeaderCellElement; + new(): HTMLTableHeaderCellElement; +} + +interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + bgColor: any; + /** + * Retrieves a collection of all cells in the table row. + */ + cells: HTMLCollectionOf; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Retrieves the position of the object in the rows collection for the table. + */ + readonly rowIndex: number; + /** + * Retrieves the position of the object in the collection. + */ + readonly sectionRowIndex: number; + /** + * Removes the specified cell from the table row, as well as from the cells collection. + * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. + */ + deleteCell(index?: number): void; + /** + * Creates a new cell in the table row, and adds the cell to the cells collection. + * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. + */ + insertCell(index?: number): HTMLTableDataCellElement; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableRowElement: { + prototype: HTMLTableRowElement; + new(): HTMLTableRowElement; +} + +interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableSectionElement: { + prototype: HTMLTableSectionElement; + new(): HTMLTableSectionElement; +} + +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + +interface HTMLTextAreaElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the object. + */ + cols: number; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Sets or retrieves the value indicated whether the content of the object is read-only. + */ + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: number; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + /** + * Sets or retrieves the value indicating whether the control is selected. + */ + status: any; + /** + * Retrieves the type of control. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Retrieves or sets the text in the entry field of the textArea element. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Sets or retrieves how to handle wordwrapping in the object. + */ + wrap: string; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Highlights the input area of a form element. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; +} + +declare var HTMLTextAreaElement: { + prototype: HTMLTextAreaElement; + new(): HTMLTextAreaElement; +} + +interface HTMLTitleElement extends HTMLElement { + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; +} + +declare var HTMLTitleElement: { + prototype: HTMLTitleElement; + new(): HTMLTitleElement; +} + +interface HTMLTrackElement extends HTMLElement { + default: boolean; + kind: string; + label: string; + readonly readyState: number; + src: string; + srclang: string; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; +} + +declare var HTMLTrackElement: { + prototype: HTMLTrackElement; + new(): HTMLTrackElement; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; +} + +interface HTMLUListElement extends HTMLElement { + compact: boolean; + type: string; +} + +declare var HTMLUListElement: { + prototype: HTMLUListElement; + new(): HTMLUListElement; +} + +interface HTMLUnknownElement extends HTMLElement { +} + +declare var HTMLUnknownElement: { + prototype: HTMLUnknownElement; + new(): HTMLUnknownElement; +} + +interface HTMLVideoElement extends HTMLMediaElement { + /** + * Gets or sets the height of the video element. + */ + height: number; + msHorizontalMirror: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; + msStereo3DPackingMode: string; + msStereo3DRenderMode: string; + msZoom: boolean; + onMSVideoFormatChanged: (this: this, ev: Event) => any; + onMSVideoFrameStepCompleted: (this: this, ev: Event) => any; + onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any; + /** + * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. + */ + poster: string; + /** + * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoHeight: number; + /** + * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; + /** + * Gets or sets the width of the video element. + */ + width: number; + getVideoPlaybackQuality(): VideoPlaybackQuality; + msFrameStep(forward: boolean): void; + msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; + webkitEnterFullScreen(): void; + webkitEnterFullscreen(): void; + webkitExitFullScreen(): void; + webkitExitFullscreen(): 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; + addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var HTMLVideoElement: { + prototype: HTMLVideoElement; + new(): HTMLVideoElement; +} + +interface HashChangeEvent extends Event { + readonly newURL: string | null; + readonly oldURL: string | null; +} + +declare var HashChangeEvent: { + prototype: HashChangeEvent; + new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; +} + +interface History { + readonly length: number; + readonly state: any; + 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: { + prototype: History; + new(): History; +} + +interface IDBCursor { + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; + advance(count: number): void; + continue(key?: IDBKeyRange | IDBValidKey): void; + delete(): IDBRequest; + update(value: any): IDBRequest; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +interface IDBCursorWithValue extends IDBCursor { + readonly value: any; +} + +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface IDBDatabase extends EventTarget { + readonly name: string; + readonly objectStoreNames: DOMStringList; + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; + close(): void; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; + deleteObjectStore(name: string): void; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface IDBFactory { + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; + open(name: string, version?: number): IDBOpenDBRequest; +} + +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface IDBIndex { + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; +} + +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface IDBKeyRange { + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; +} + +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; +} + +interface IDBObjectStore { + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; + clear(): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; + deleteIndex(indexName: string): void; + get(key: any): IDBRequest; + index(name: string): IDBIndex; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; +} + +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface IDBOpenDBRequest extends IDBRequest { + onblocked: (this: this, ev: Event) => any; + onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; + addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface IDBRequest extends EventTarget { + readonly error: DOMError; + onerror: (this: this, ev: ErrorEvent) => any; + onsuccess: (this: this, ev: Event) => any; + readonly readyState: string; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface IDBTransaction extends EventTarget { + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; + onabort: (this: this, ev: Event) => any; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; + addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; +} + +interface IDBVersionChangeEvent extends Event { + readonly newVersion: number | null; + readonly oldVersion: number; +} + +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface ImageData { + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; +} + +declare var ImageData: { + prototype: ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; +} + +interface KeyboardEvent extends UIEvent { + readonly altKey: boolean; + readonly char: string | null; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + 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; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +declare var KeyboardEvent: { + prototype: KeyboardEvent; + new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: string; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; +} + +interface Location { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + pathname: string; + port: string; + protocol: string; + search: string; + assign(url: string): void; + reload(forcedReload?: boolean): void; + replace(url: string): void; + toString(): string; +} + +declare var Location: { + prototype: Location; + new(): Location; +} + +interface LongRunningScriptDetectedEvent extends Event { + readonly executionTime: number; + stopPageScriptExecution: boolean; +} + +declare var LongRunningScriptDetectedEvent: { + prototype: LongRunningScriptDetectedEvent; + new(): LongRunningScriptDetectedEvent; +} + +interface MSApp { + clearTemporaryWebDataAsync(): MSAppAsyncOperation; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createDataPackage(object: any): any; + createDataPackageFromSelection(): any; + createFileFromStorageFile(storageFile: any): File; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + getCurrentPriority(): string; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; + getViewId(view: any): any; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + pageHandlesAllApplicationActivations(enabled: boolean): void; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + terminateApp(exceptionObject: any): void; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; +} +declare var MSApp: MSApp; + +interface MSAppAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + readonly readyState: number; + readonly result: any; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSAppAsyncOperation: { + prototype: MSAppAsyncOperation; + new(): MSAppAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: string; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} + +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; +} + +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: string[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; +} + +interface MSGesture { + target: Element; + addPointer(pointerId: number): void; + stop(): void; +} + +declare var MSGesture: { + prototype: MSGesture; + new(): MSGesture; +} + +interface MSGestureEvent extends UIEvent { + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; + initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +declare var MSGestureEvent: { + prototype: MSGestureEvent; + new(): MSGestureEvent; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +interface MSGraphicsTrust { + readonly constrictionActive: boolean; + readonly status: string; +} + +declare var MSGraphicsTrust: { + prototype: MSGraphicsTrust; + new(): MSGraphicsTrust; +} + +interface MSHTMLWebViewElement extends HTMLElement { + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; + height: number; + readonly settings: MSWebViewSettings; + src: string; + width: number; + addWebAllowedObject(name: string, applicationObject: any): void; + buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; + capturePreviewToBlobAsync(): MSWebViewAsyncOperation; + captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; + getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; + getDeferredPermissionRequests(): DeferredPermissionRequest[]; + goBack(): void; + goForward(): void; + invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; + navigate(uri: string): void; + navigateToLocalStreamUri(source: string, streamResolver: any): void; + navigateToString(contents: string): void; + navigateWithHttpRequestMessage(requestMessage: any): void; + refresh(): void; + stop(): void; +} + +declare var MSHTMLWebViewElement: { + prototype: MSHTMLWebViewElement; + new(): MSHTMLWebViewElement; +} + +interface MSInputMethodContext extends EventTarget { + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; + oncandidatewindowhide: (this: this, ev: Event) => any; + oncandidatewindowshow: (this: this, ev: Event) => any; + oncandidatewindowupdate: (this: this, ev: Event) => any; + readonly target: HTMLElement; + getCandidateWindowClientRect(): ClientRect; + getCompositionAlternatives(): string[]; + hasComposition(): boolean; + isCandidateWindowVisible(): boolean; + addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSInputMethodContext: { + prototype: MSInputMethodContext; + new(): MSInputMethodContext; +} + +interface MSManipulationEvent extends UIEvent { + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; + initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +declare var MSManipulationEvent: { + prototype: MSManipulationEvent; + new(): MSManipulationEvent; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +interface MSMediaKeyError { + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +declare var MSMediaKeyError: { + prototype: MSMediaKeyError; + new(): MSMediaKeyError; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +interface MSMediaKeyMessageEvent extends Event { + readonly destinationURL: string | null; + readonly message: Uint8Array; +} + +declare var MSMediaKeyMessageEvent: { + prototype: MSMediaKeyMessageEvent; + new(): MSMediaKeyMessageEvent; +} + +interface MSMediaKeyNeededEvent extends Event { + readonly initData: Uint8Array | null; +} + +declare var MSMediaKeyNeededEvent: { + prototype: MSMediaKeyNeededEvent; + new(): MSMediaKeyNeededEvent; +} + +interface MSMediaKeySession extends EventTarget { + readonly error: MSMediaKeyError | null; + readonly keySystem: string; + readonly sessionId: string; + close(): void; + update(key: Uint8Array): void; +} + +declare var MSMediaKeySession: { + prototype: MSMediaKeySession; + new(): MSMediaKeySession; +} + +interface MSMediaKeys { + readonly keySystem: string; + createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; +} + +declare var MSMediaKeys: { + prototype: MSMediaKeys; + new(keySystem: string): MSMediaKeys; + isTypeSupported(keySystem: string, type?: string): boolean; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; +} + +interface MSPointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var MSPointerEvent: { + prototype: MSPointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; +} + +interface MSRangeCollection { + readonly length: number; + item(index: number): Range; + [index: number]: Range; +} + +declare var MSRangeCollection: { + prototype: MSRangeCollection; + new(): MSRangeCollection; +} + +interface MSSiteModeEvent extends Event { + readonly actionURL: string; + readonly buttonID: number; +} + +declare var MSSiteModeEvent: { + prototype: MSSiteModeEvent; + new(): MSSiteModeEvent; +} + +interface MSStream { + readonly type: string; + msClose(): void; + msDetachStream(): any; +} + +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSStreamReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBinaryString(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface MSWebViewAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSWebViewAsyncOperation: { + prototype: MSWebViewAsyncOperation; + new(): MSWebViewAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; +} + +interface MSWebViewSettings { + isIndexedDBEnabled: boolean; + isJavaScriptEnabled: boolean; +} + +declare var MSWebViewSettings: { + prototype: MSWebViewSettings; + new(): MSWebViewSettings; +} + +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: string; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (this: this, ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + +interface MediaElementAudioSourceNode extends AudioNode { +} + +declare var MediaElementAudioSourceNode: { + prototype: MediaElementAudioSourceNode; + new(): MediaElementAudioSourceNode; +} + +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer | null; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + +interface MediaError { + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +declare var MediaError: { + prototype: MediaError; + new(): MediaError; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: string; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: PromiseLike; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): PromiseLike; + generateRequest(initDataType: string, initData: any): PromiseLike; + load(sessionId: string): PromiseLike; + remove(): PromiseLike; + update(response: any): PromiseLike; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): string; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): PromiseLike; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: string): MediaKeySession; + setServerCertificate(serverCertificate: any): PromiseLike; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; +} + +interface MediaList { + readonly length: number; + mediaText: string; + appendMedium(newMedium: string): void; + deleteMedium(oldMedium: string): void; + item(index: number): string; + toString(): string; + [index: number]: string; +} + +declare var MediaList: { + prototype: MediaList; + new(): MediaList; +} + +interface MediaQueryList { + readonly matches: boolean; + readonly media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} + +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + +interface MediaSource extends EventTarget { + readonly activeSourceBuffers: SourceBufferList; + duration: number; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; + addSourceBuffer(type: string): SourceBuffer; + endOfStream(error?: number): void; + removeSourceBuffer(sourceBuffer: SourceBuffer): void; +} + +declare var MediaSource: { + prototype: MediaSource; + new(): MediaSource; + isTypeSupported(type: string): boolean; +} + +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (this: this, ev: Event) => any; + onaddtrack: (this: this, ev: TrackEvent) => any; + oninactive: (this: this, ev: Event) => any; + onremovetrack: (this: this, ev: TrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack | null; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string | null; + readonly message: string | null; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError | null; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + onmute: (this: this, ev: Event) => any; + onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any; + onunmute: (this: this, ev: Event) => any; + readonly readonly: boolean; + readonly readyState: string; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + +interface MessageChannel { + readonly port1: MessagePort; + readonly port2: MessagePort; +} + +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface MessageEvent extends Event { + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; +} + +declare var MessageEvent: { + prototype: MessageEvent; + new(type: string, eventInitDict?: MessageEventInit): MessageEvent; +} + +interface MessagePort extends EventTarget { + onmessage: (this: this, ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, ports?: any): void; + start(): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface MimeType { + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; +} + +declare var MimeType: { + prototype: MimeType; + new(): MimeType; +} + +interface MimeTypeArray { + readonly length: number; + item(index: number): Plugin; + namedItem(type: string): Plugin; + [index: number]: Plugin; +} + +declare var MimeTypeArray: { + prototype: MimeTypeArray; + new(): MimeTypeArray; +} + +interface MouseEvent extends UIEvent { + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; + getModifierState(keyArg: string): boolean; + initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; +} + +declare var MouseEvent: { + prototype: MouseEvent; + new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; +} + +interface MutationEvent extends Event { + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; + initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +declare var MutationEvent: { + prototype: MutationEvent; + new(): MutationEvent; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +interface MutationObserver { + disconnect(): void; + observe(target: Node, options: MutationObserverInit): void; + takeRecords(): MutationRecord[]; +} + +declare var MutationObserver: { + prototype: MutationObserver; + new(callback: MutationCallback): MutationObserver; +} + +interface MutationRecord { + readonly addedNodes: NodeList; + readonly attributeName: string | null; + readonly attributeNamespace: string | null; + readonly nextSibling: Node | null; + readonly oldValue: string | null; + readonly previousSibling: Node | null; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; +} + +declare var MutationRecord: { + prototype: MutationRecord; + new(): MutationRecord; +} + +interface NamedNodeMap { + readonly length: number; + getNamedItem(name: string): Attr; + getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + item(index: number): Attr; + removeNamedItem(name: string): Attr; + removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + setNamedItem(arg: Attr): Attr; + setNamedItemNS(arg: Attr): Attr; + [index: number]: Attr; +} + +declare var NamedNodeMap: { + prototype: NamedNodeMap; + new(): NamedNodeMap; +} + +interface NavigationCompletedEvent extends NavigationEvent { + readonly isSuccess: boolean; + readonly webErrorStatus: number; +} + +declare var NavigationCompletedEvent: { + prototype: NavigationCompletedEvent; + new(): NavigationCompletedEvent; +} + +interface NavigationEvent extends Event { + readonly uri: string; +} + +declare var NavigationEvent: { + prototype: NavigationEvent; + new(): NavigationEvent; +} + +interface NavigationEventWithReferrer extends NavigationEvent { + readonly referer: string; +} + +declare var NavigationEventWithReferrer: { + prototype: NavigationEventWithReferrer; + new(): NavigationEventWithReferrer; +} + +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { + readonly appCodeName: string; + readonly cookieEnabled: boolean; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly webdriver: boolean; + readonly hardwareConcurrency: number; + getGamepads(): Gamepad[]; + javaEnabled(): boolean; + msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; + vibrate(pattern: number | number[]): boolean; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Navigator: { + prototype: Navigator; + new(): Navigator; +} + +interface Node extends EventTarget { + readonly attributes: NamedNodeMap; + readonly baseURI: string | null; + readonly childNodes: NodeList; + readonly firstChild: Node | null; + readonly lastChild: Node | null; + readonly localName: string | null; + readonly namespaceURI: string | null; + readonly nextSibling: Node | null; + readonly nodeName: string; + readonly nodeType: number; + nodeValue: string | null; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement | null; + readonly parentNode: Node | null; + readonly previousSibling: Node | null; + textContent: string | null; + appendChild(newChild: Node): Node; + cloneNode(deep?: boolean): Node; + compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; + hasAttributes(): boolean; + hasChildNodes(): boolean; + insertBefore(newChild: Node, refChild: Node | null): Node; + isDefaultNamespace(namespaceURI: string | null): boolean; + isEqualNode(arg: Node): boolean; + isSameNode(other: Node): boolean; + lookupNamespaceURI(prefix: string | null): string | null; + lookupPrefix(namespaceURI: string | null): string | null; + normalize(): void; + removeChild(oldChild: Node): Node; + replaceChild(newChild: Node, oldChild: Node): Node; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +declare var Node: { + prototype: Node; + new(): Node; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; +} + +interface NodeIterator { + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + detach(): void; + nextNode(): Node; + previousNode(): Node; +} + +declare var NodeIterator: { + prototype: NodeIterator; + new(): NodeIterator; +} + +interface NodeList { + readonly length: number; + item(index: number): Node; + [index: number]: Node; +} + +declare var NodeList: { + prototype: NodeList; + new(): NodeList; +} + +interface OES_element_index_uint { +} + +declare var OES_element_index_uint: { + prototype: OES_element_index_uint; + new(): OES_element_index_uint; +} + +interface OES_standard_derivatives { + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +declare var OES_standard_derivatives: { + prototype: OES_standard_derivatives; + new(): OES_standard_derivatives; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +interface OES_texture_float { +} + +declare var OES_texture_float: { + prototype: OES_texture_float; + new(): OES_texture_float; +} + +interface OES_texture_float_linear { +} + +declare var OES_texture_float_linear: { + prototype: OES_texture_float_linear; + new(): OES_texture_float_linear; +} + +interface OfflineAudioCompletionEvent extends Event { + readonly renderedBuffer: AudioBuffer; +} + +declare var OfflineAudioCompletionEvent: { + prototype: OfflineAudioCompletionEvent; + new(): OfflineAudioCompletionEvent; +} + +interface OfflineAudioContext extends AudioContext { + oncomplete: (this: this, ev: Event) => any; + startRendering(): PromiseLike; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OfflineAudioContext: { + prototype: OfflineAudioContext; + new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; +} + +interface OscillatorNode extends AudioNode { + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + type: string; + setPeriodicWave(periodicWave: PeriodicWave): void; + start(when?: number): void; + stop(when?: number): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OscillatorNode: { + prototype: OscillatorNode; + new(): OscillatorNode; +} + +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +interface PageTransitionEvent extends Event { + readonly persisted: boolean; +} + +declare var PageTransitionEvent: { + prototype: PageTransitionEvent; + new(): PageTransitionEvent; +} + +interface PannerNode extends AudioNode { + coneInnerAngle: number; + coneOuterAngle: number; + coneOuterGain: number; + distanceModel: string; + maxDistance: number; + panningModel: string; + refDistance: number; + rolloffFactor: number; + setOrientation(x: number, y: number, z: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var PannerNode: { + prototype: PannerNode; + new(): PannerNode; +} + +interface PerfWidgetExternal { + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; + addEventListener(eventType: string, callback: Function): void; + getMemoryUsage(): number; + getProcessCpuUsage(): number; + getRecentCpuUsage(last: number | null): any; + getRecentFrames(last: number | null): any; + getRecentMemoryUsage(last: number | null): any; + getRecentPaintRequests(last: number | null): any; + removeEventListener(eventType: string, callback: Function): void; + repositionWindow(x: number, y: number): void; + resizeWindow(width: number, height: number): void; +} + +declare var PerfWidgetExternal: { + prototype: PerfWidgetExternal; + new(): PerfWidgetExternal; +} + +interface Performance { + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; + clearMarks(markName?: string): void; + clearMeasures(measureName?: string): void; + clearResourceTimings(): void; + getEntries(): any; + getEntriesByName(name: string, entryType?: string): any; + getEntriesByType(entryType: string): any; + getMarks(markName?: string): any; + getMeasures(measureName?: string): any; + mark(markName: string): void; + measure(measureName: string, startMarkName?: string, endMarkName?: string): void; + now(): number; + setResourceTimingBufferSize(maxSize: number): void; + toJSON(): any; +} + +declare var Performance: { + prototype: Performance; + new(): Performance; +} + +interface PerformanceEntry { + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; +} + +declare var PerformanceEntry: { + prototype: PerformanceEntry; + new(): PerformanceEntry; +} + +interface PerformanceMark extends PerformanceEntry { +} + +declare var PerformanceMark: { + prototype: PerformanceMark; + new(): PerformanceMark; +} + +interface PerformanceMeasure extends PerformanceEntry { +} + +declare var PerformanceMeasure: { + prototype: PerformanceMeasure; + new(): PerformanceMeasure; +} + +interface PerformanceNavigation { + readonly redirectCount: number; + readonly type: number; + toJSON(): any; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +declare var PerformanceNavigation: { + prototype: PerformanceNavigation; + new(): PerformanceNavigation; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +interface PerformanceNavigationTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: string; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; +} + +declare var PerformanceNavigationTiming: { + prototype: PerformanceNavigationTiming; + new(): PerformanceNavigationTiming; +} + +interface PerformanceResourceTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; +} + +declare var PerformanceResourceTiming: { + prototype: PerformanceResourceTiming; + new(): PerformanceResourceTiming; +} + +interface PerformanceTiming { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; + readonly secureConnectionStart: number; + toJSON(): any; +} + +declare var PerformanceTiming: { + prototype: PerformanceTiming; + new(): PerformanceTiming; +} + +interface PeriodicWave { +} + +declare var PeriodicWave: { + prototype: PeriodicWave; + new(): PeriodicWave; +} + +interface PermissionRequest extends DeferredPermissionRequest { + readonly state: string; + defer(): void; +} + +declare var PermissionRequest: { + prototype: PermissionRequest; + new(): PermissionRequest; +} + +interface PermissionRequestedEvent extends Event { + readonly permissionRequest: PermissionRequest; +} + +declare var PermissionRequestedEvent: { + prototype: PermissionRequestedEvent; + new(): PermissionRequestedEvent; +} + +interface Plugin { + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; + item(index: number): MimeType; + namedItem(type: string): MimeType; + [index: number]: MimeType; +} + +declare var Plugin: { + prototype: Plugin; + new(): Plugin; +} + +interface PluginArray { + readonly length: number; + item(index: number): Plugin; + namedItem(name: string): Plugin; + refresh(reload?: boolean): void; + [index: number]: Plugin; +} + +declare var PluginArray: { + prototype: PluginArray; + new(): PluginArray; +} + +interface PointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var PointerEvent: { + prototype: PointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; +} + +interface PopStateEvent extends Event { + readonly state: any; + initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; +} + +declare var PopStateEvent: { + prototype: PopStateEvent; + new(): PopStateEvent; +} + +interface Position { + readonly coords: Coordinates; + readonly timestamp: number; +} + +declare var Position: { + prototype: Position; + new(): Position; +} + +interface PositionError { + readonly code: number; + readonly message: string; + toString(): string; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +interface ProcessingInstruction extends CharacterData { + readonly target: string; +} + +declare var ProcessingInstruction: { + prototype: ProcessingInstruction; + new(): ProcessingInstruction; +} + +interface ProgressEvent extends Event { + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} + +declare var ProgressEvent: { + prototype: ProgressEvent; + new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; +} + +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((this: this, ev: ErrorEvent) => any) | null; + readonly state: string; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters | null; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: string; + onerror: ((this: this, ev: ErrorEvent) => any) | null; + onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: string; + readonly iceGatherer: RTCIceGatherer | null; + oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null; + readonly role: string; + readonly state: string; + addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair | null; + getRemoteCandidates(): RTCIceCandidate[]; + getRemoteParameters(): RTCIceParameters | null; + setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; + stop(): void; + addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: ((this: this, ev: ErrorEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack | null; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: ((this: this, ev: ErrorEvent) => any) | null; + onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: ((this: this, ev: ErrorEvent) => any) | null; + readonly transport: RTCIceTransport; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): PromiseLike; + msGetStats(): PromiseLike; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + +interface Range { + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; + cloneContents(): DocumentFragment; + cloneRange(): Range; + collapse(toStart: boolean): void; + compareBoundaryPoints(how: number, sourceRange: Range): number; + createContextualFragment(fragment: string): DocumentFragment; + deleteContents(): void; + detach(): void; + expand(Unit: string): boolean; + extractContents(): DocumentFragment; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + insertNode(newNode: Node): void; + selectNode(refNode: Node): void; + selectNodeContents(refNode: Node): void; + setEnd(refNode: Node, offset: number): void; + setEndAfter(refNode: Node): void; + setEndBefore(refNode: Node): void; + setStart(refNode: Node, offset: number): void; + setStartAfter(refNode: Node): void; + setStartBefore(refNode: Node): void; + surroundContents(newParent: Node): void; + toString(): string; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +declare var Range: { + prototype: Range; + new(): Range; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { + readonly target: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGAElement: { + prototype: SVGAElement; + new(): SVGAElement; +} + +interface SVGAngle { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +declare var SVGAngle: { + prototype: SVGAngle; + new(): SVGAngle; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +interface SVGAnimatedAngle { + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; +} + +declare var SVGAnimatedAngle: { + prototype: SVGAnimatedAngle; + new(): SVGAnimatedAngle; +} + +interface SVGAnimatedBoolean { + readonly animVal: boolean; + baseVal: boolean; +} + +declare var SVGAnimatedBoolean: { + prototype: SVGAnimatedBoolean; + new(): SVGAnimatedBoolean; +} + +interface SVGAnimatedEnumeration { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedEnumeration: { + prototype: SVGAnimatedEnumeration; + new(): SVGAnimatedEnumeration; +} + +interface SVGAnimatedInteger { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedInteger: { + prototype: SVGAnimatedInteger; + new(): SVGAnimatedInteger; +} + +interface SVGAnimatedLength { + readonly animVal: SVGLength; + readonly baseVal: SVGLength; +} + +declare var SVGAnimatedLength: { + prototype: SVGAnimatedLength; + new(): SVGAnimatedLength; +} + +interface SVGAnimatedLengthList { + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; +} + +declare var SVGAnimatedLengthList: { + prototype: SVGAnimatedLengthList; + new(): SVGAnimatedLengthList; +} + +interface SVGAnimatedNumber { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedNumber: { + prototype: SVGAnimatedNumber; + new(): SVGAnimatedNumber; +} + +interface SVGAnimatedNumberList { + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; +} + +declare var SVGAnimatedNumberList: { + prototype: SVGAnimatedNumberList; + new(): SVGAnimatedNumberList; +} + +interface SVGAnimatedPreserveAspectRatio { + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; +} + +declare var SVGAnimatedPreserveAspectRatio: { + prototype: SVGAnimatedPreserveAspectRatio; + new(): SVGAnimatedPreserveAspectRatio; +} + +interface SVGAnimatedRect { + readonly animVal: SVGRect; + readonly baseVal: SVGRect; +} + +declare var SVGAnimatedRect: { + prototype: SVGAnimatedRect; + new(): SVGAnimatedRect; +} + +interface SVGAnimatedString { + readonly animVal: string; + baseVal: string; +} + +declare var SVGAnimatedString: { + prototype: SVGAnimatedString; + new(): SVGAnimatedString; +} + +interface SVGAnimatedTransformList { + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; +} + +declare var SVGAnimatedTransformList: { + prototype: SVGAnimatedTransformList; + new(): SVGAnimatedTransformList; +} + +interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGCircleElement: { + prototype: SVGCircleElement; + new(): SVGCircleElement; +} + +interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { + readonly clipPathUnits: SVGAnimatedEnumeration; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGClipPathElement: { + prototype: SVGClipPathElement; + new(): SVGClipPathElement; +} + +interface SVGComponentTransferFunctionElement extends SVGElement { + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; +} + +declare var SVGComponentTransferFunctionElement: { + prototype: SVGComponentTransferFunctionElement; + new(): SVGComponentTransferFunctionElement; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; +} + +interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDefsElement: { + prototype: SVGDefsElement; + new(): SVGDefsElement; +} + +interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDescElement: { + prototype: SVGDescElement; + new(): SVGDescElement; +} + +interface SVGElement extends Element { + onclick: (this: this, ev: MouseEvent) => any; + ondblclick: (this: this, ev: MouseEvent) => any; + onfocusin: (this: this, ev: FocusEvent) => any; + onfocusout: (this: this, ev: FocusEvent) => any; + onload: (this: this, ev: Event) => any; + onmousedown: (this: this, ev: MouseEvent) => any; + onmousemove: (this: this, ev: MouseEvent) => any; + onmouseout: (this: this, ev: MouseEvent) => any; + onmouseover: (this: this, ev: MouseEvent) => any; + onmouseup: (this: this, ev: MouseEvent) => any; + readonly ownerSVGElement: SVGSVGElement; + readonly viewportElement: SVGElement; + xmlbase: string; + className: any; + 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var SVGElement: { + prototype: SVGElement; + new(): SVGElement; +} + +interface SVGElementInstance extends EventTarget { + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; +} + +declare var SVGElementInstance: { + prototype: SVGElementInstance; + new(): SVGElementInstance; +} + +interface SVGElementInstanceList { + readonly length: number; + item(index: number): SVGElementInstance; +} + +declare var SVGElementInstanceList: { + prototype: SVGElementInstanceList; + new(): SVGElementInstanceList; +} + +interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGEllipseElement: { + prototype: SVGEllipseElement; + new(): SVGEllipseElement; +} + +interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEBlendElement: { + prototype: SVGFEBlendElement; + new(): SVGFEBlendElement; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; +} + +interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEColorMatrixElement: { + prototype: SVGFEColorMatrixElement; + new(): SVGFEColorMatrixElement; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; +} + +interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEComponentTransferElement: { + prototype: SVGFEComponentTransferElement; + new(): SVGFEComponentTransferElement; +} + +interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFECompositeElement: { + prototype: SVGFECompositeElement; + new(): SVGFECompositeElement; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; +} + +interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEConvolveMatrixElement: { + prototype: SVGFEConvolveMatrixElement; + new(): SVGFEConvolveMatrixElement; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; +} + +interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDiffuseLightingElement: { + prototype: SVGFEDiffuseLightingElement; + new(): SVGFEDiffuseLightingElement; +} + +interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDisplacementMapElement: { + prototype: SVGFEDisplacementMapElement; + new(): SVGFEDisplacementMapElement; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; +} + +interface SVGFEDistantLightElement extends SVGElement { + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; +} + +declare var SVGFEDistantLightElement: { + prototype: SVGFEDistantLightElement; + new(): SVGFEDistantLightElement; +} + +interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFloodElement: { + prototype: SVGFEFloodElement; + new(): SVGFEFloodElement; +} + +interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncAElement: { + prototype: SVGFEFuncAElement; + new(): SVGFEFuncAElement; +} + +interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncBElement: { + prototype: SVGFEFuncBElement; + new(): SVGFEFuncBElement; +} + +interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncGElement: { + prototype: SVGFEFuncGElement; + new(): SVGFEFuncGElement; +} + +interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { +} + +declare var SVGFEFuncRElement: { + prototype: SVGFEFuncRElement; + new(): SVGFEFuncRElement; +} + +interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEGaussianBlurElement: { + prototype: SVGFEGaussianBlurElement; + new(): SVGFEGaussianBlurElement; +} + +interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEImageElement: { + prototype: SVGFEImageElement; + new(): SVGFEImageElement; +} + +interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMergeElement: { + prototype: SVGFEMergeElement; + new(): SVGFEMergeElement; +} + +interface SVGFEMergeNodeElement extends SVGElement { + readonly in1: SVGAnimatedString; +} + +declare var SVGFEMergeNodeElement: { + prototype: SVGFEMergeNodeElement; + new(): SVGFEMergeNodeElement; +} + +interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMorphologyElement: { + prototype: SVGFEMorphologyElement; + new(): SVGFEMorphologyElement; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; +} + +interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEOffsetElement: { + prototype: SVGFEOffsetElement; + new(): SVGFEOffsetElement; +} + +interface SVGFEPointLightElement extends SVGElement { + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; +} + +declare var SVGFEPointLightElement: { + prototype: SVGFEPointLightElement; + new(): SVGFEPointLightElement; +} + +interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFESpecularLightingElement: { + prototype: SVGFESpecularLightingElement; + new(): SVGFESpecularLightingElement; +} + +interface SVGFESpotLightElement extends SVGElement { + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; +} + +declare var SVGFESpotLightElement: { + prototype: SVGFESpotLightElement; + new(): SVGFESpotLightElement; +} + +interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETileElement: { + prototype: SVGFETileElement; + new(): SVGFETileElement; +} + +interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETurbulenceElement: { + prototype: SVGFETurbulenceElement; + new(): SVGFETurbulenceElement; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; +} + +interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + setFilterRes(filterResX: number, filterResY: number): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFilterElement: { + prototype: SVGFilterElement; + new(): SVGFilterElement; +} + +interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGForeignObjectElement: { + prototype: SVGForeignObjectElement; + new(): SVGForeignObjectElement; +} + +interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGElement: { + prototype: SVGGElement; + new(): SVGGElement; +} + +interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGradientElement: { + prototype: SVGGradientElement; + new(): SVGGradientElement; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; +} + +interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGImageElement: { + prototype: SVGImageElement; + new(): SVGImageElement; +} + +interface SVGLength { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +declare var SVGLength: { + prototype: SVGLength; + new(): SVGLength; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +interface SVGLengthList { + readonly numberOfItems: number; + appendItem(newItem: SVGLength): SVGLength; + clear(): void; + getItem(index: number): SVGLength; + initialize(newItem: SVGLength): SVGLength; + insertItemBefore(newItem: SVGLength, index: number): SVGLength; + removeItem(index: number): SVGLength; + replaceItem(newItem: SVGLength, index: number): SVGLength; +} + +declare var SVGLengthList: { + prototype: SVGLengthList; + new(): SVGLengthList; +} + +interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGLineElement: { + prototype: SVGLineElement; + new(): SVGLineElement; +} + +interface SVGLinearGradientElement extends SVGGradientElement { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; +} + +declare var SVGLinearGradientElement: { + prototype: SVGLinearGradientElement; + new(): SVGLinearGradientElement; +} + +interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; + setOrientToAngle(angle: SVGAngle): void; + setOrientToAuto(): void; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMarkerElement: { + prototype: SVGMarkerElement; + new(): SVGMarkerElement; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; +} + +interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMaskElement: { + prototype: SVGMaskElement; + new(): SVGMaskElement; +} + +interface SVGMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + flipX(): SVGMatrix; + flipY(): SVGMatrix; + inverse(): SVGMatrix; + multiply(secondMatrix: SVGMatrix): SVGMatrix; + rotate(angle: number): SVGMatrix; + rotateFromVector(x: number, y: number): SVGMatrix; + scale(scaleFactor: number): SVGMatrix; + scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; + skewX(angle: number): SVGMatrix; + skewY(angle: number): SVGMatrix; + translate(x: number, y: number): SVGMatrix; +} + +declare var SVGMatrix: { + prototype: SVGMatrix; + new(): SVGMatrix; +} + +interface SVGMetadataElement extends SVGElement { +} + +declare var SVGMetadataElement: { + prototype: SVGMetadataElement; + new(): SVGMetadataElement; +} + +interface SVGNumber { + value: number; +} + +declare var SVGNumber: { + prototype: SVGNumber; + new(): SVGNumber; +} + +interface SVGNumberList { + readonly numberOfItems: number; + appendItem(newItem: SVGNumber): SVGNumber; + clear(): void; + getItem(index: number): SVGNumber; + initialize(newItem: SVGNumber): SVGNumber; + insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; + removeItem(index: number): SVGNumber; + replaceItem(newItem: SVGNumber, index: number): SVGNumber; +} + +declare var SVGNumberList: { + prototype: SVGNumberList; + new(): SVGNumberList; +} + +interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { + createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; + createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; + createSVGPathSegClosePath(): SVGPathSegClosePath; + createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; + createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; + createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; + createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; + createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; + createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; + createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; + createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; + createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; + createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; + createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; + createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; + createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; + createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; + createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; + createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; + getPathSegAtLength(distance: number): number; + getPointAtLength(distance: number): SVGPoint; + getTotalLength(): number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPathElement: { + prototype: SVGPathElement; + new(): SVGPathElement; +} + +interface SVGPathSeg { + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +declare var SVGPathSeg: { + prototype: SVGPathSeg; + new(): SVGPathSeg; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +interface SVGPathSegArcAbs extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcAbs: { + prototype: SVGPathSegArcAbs; + new(): SVGPathSegArcAbs; +} + +interface SVGPathSegArcRel extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcRel: { + prototype: SVGPathSegArcRel; + new(): SVGPathSegArcRel; +} + +interface SVGPathSegClosePath extends SVGPathSeg { +} + +declare var SVGPathSegClosePath: { + prototype: SVGPathSegClosePath; + new(): SVGPathSegClosePath; +} + +interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicAbs: { + prototype: SVGPathSegCurvetoCubicAbs; + new(): SVGPathSegCurvetoCubicAbs; +} + +interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicRel: { + prototype: SVGPathSegCurvetoCubicRel; + new(): SVGPathSegCurvetoCubicRel; +} + +interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothAbs: { + prototype: SVGPathSegCurvetoCubicSmoothAbs; + new(): SVGPathSegCurvetoCubicSmoothAbs; +} + +interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothRel: { + prototype: SVGPathSegCurvetoCubicSmoothRel; + new(): SVGPathSegCurvetoCubicSmoothRel; +} + +interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticAbs: { + prototype: SVGPathSegCurvetoQuadraticAbs; + new(): SVGPathSegCurvetoQuadraticAbs; +} + +interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticRel: { + prototype: SVGPathSegCurvetoQuadraticRel; + new(): SVGPathSegCurvetoQuadraticRel; +} + +interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothAbs: { + prototype: SVGPathSegCurvetoQuadraticSmoothAbs; + new(): SVGPathSegCurvetoQuadraticSmoothAbs; +} + +interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothRel: { + prototype: SVGPathSegCurvetoQuadraticSmoothRel; + new(): SVGPathSegCurvetoQuadraticSmoothRel; +} + +interface SVGPathSegLinetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoAbs: { + prototype: SVGPathSegLinetoAbs; + new(): SVGPathSegLinetoAbs; +} + +interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalAbs: { + prototype: SVGPathSegLinetoHorizontalAbs; + new(): SVGPathSegLinetoHorizontalAbs; +} + +interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalRel: { + prototype: SVGPathSegLinetoHorizontalRel; + new(): SVGPathSegLinetoHorizontalRel; +} + +interface SVGPathSegLinetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoRel: { + prototype: SVGPathSegLinetoRel; + new(): SVGPathSegLinetoRel; +} + +interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalAbs: { + prototype: SVGPathSegLinetoVerticalAbs; + new(): SVGPathSegLinetoVerticalAbs; +} + +interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalRel: { + prototype: SVGPathSegLinetoVerticalRel; + new(): SVGPathSegLinetoVerticalRel; +} + +interface SVGPathSegList { + readonly numberOfItems: number; + appendItem(newItem: SVGPathSeg): SVGPathSeg; + clear(): void; + getItem(index: number): SVGPathSeg; + initialize(newItem: SVGPathSeg): SVGPathSeg; + insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; + removeItem(index: number): SVGPathSeg; + replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; +} + +declare var SVGPathSegList: { + prototype: SVGPathSegList; + new(): SVGPathSegList; +} + +interface SVGPathSegMovetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoAbs: { + prototype: SVGPathSegMovetoAbs; + new(): SVGPathSegMovetoAbs; +} + +interface SVGPathSegMovetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoRel: { + prototype: SVGPathSegMovetoRel; + new(): SVGPathSegMovetoRel; +} + +interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPatternElement: { + prototype: SVGPatternElement; + new(): SVGPatternElement; +} + +interface SVGPoint { + x: number; + y: number; + matrixTransform(matrix: SVGMatrix): SVGPoint; +} + +declare var SVGPoint: { + prototype: SVGPoint; + new(): SVGPoint; +} + +interface SVGPointList { + readonly numberOfItems: number; + appendItem(newItem: SVGPoint): SVGPoint; + clear(): void; + getItem(index: number): SVGPoint; + initialize(newItem: SVGPoint): SVGPoint; + insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; + removeItem(index: number): SVGPoint; + replaceItem(newItem: SVGPoint, index: number): SVGPoint; +} + +declare var SVGPointList: { + prototype: SVGPointList; + new(): SVGPointList; +} + +interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolygonElement: { + prototype: SVGPolygonElement; + new(): SVGPolygonElement; +} + +interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolylineElement: { + prototype: SVGPolylineElement; + new(): SVGPolylineElement; +} + +interface SVGPreserveAspectRatio { + align: number; + meetOrSlice: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +declare var SVGPreserveAspectRatio: { + prototype: SVGPreserveAspectRatio; + new(): SVGPreserveAspectRatio; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +interface SVGRadialGradientElement extends SVGGradientElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; +} + +declare var SVGRadialGradientElement: { + prototype: SVGRadialGradientElement; + new(): SVGRadialGradientElement; +} + +interface SVGRect { + height: number; + width: number; + x: number; + y: number; +} + +declare var SVGRect: { + prototype: SVGRect; + new(): SVGRect; +} + +interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGRectElement: { + prototype: SVGRectElement; + new(): SVGRectElement; +} + +interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { + contentScriptType: string; + contentStyleType: string; + currentScale: number; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: Event) => any; + onresize: (this: this, ev: UIEvent) => any; + onscroll: (this: this, ev: UIEvent) => any; + onunload: (this: this, ev: Event) => any; + onzoom: (this: this, ev: SVGZoomEvent) => any; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + checkEnclosure(element: SVGElement, rect: SVGRect): boolean; + checkIntersection(element: SVGElement, rect: SVGRect): boolean; + createSVGAngle(): SVGAngle; + createSVGLength(): SVGLength; + createSVGMatrix(): SVGMatrix; + createSVGNumber(): SVGNumber; + createSVGPoint(): SVGPoint; + createSVGRect(): SVGRect; + createSVGTransform(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + deselectAll(): void; + forceRedraw(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getCurrentTime(): number; + getElementById(elementId: string): Element; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + pauseAnimations(): void; + setCurrentTime(seconds: number): void; + suspendRedraw(maxWaitMilliseconds: number): number; + unpauseAnimations(): void; + unsuspendRedraw(suspendHandleID: number): void; + unsuspendRedrawAll(): 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "webkitfullscreenerror", 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; +} + +declare var SVGSVGElement: { + prototype: SVGSVGElement; + new(): SVGSVGElement; +} + +interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { + type: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGScriptElement: { + prototype: SVGScriptElement; + new(): SVGScriptElement; +} + +interface SVGStopElement extends SVGElement, SVGStylable { + readonly offset: SVGAnimatedNumber; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStopElement: { + prototype: SVGStopElement; + new(): SVGStopElement; +} + +interface SVGStringList { + readonly numberOfItems: number; + appendItem(newItem: string): string; + clear(): void; + getItem(index: number): string; + initialize(newItem: string): string; + insertItemBefore(newItem: string, index: number): string; + removeItem(index: number): string; + replaceItem(newItem: string, index: number): string; +} + +declare var SVGStringList: { + prototype: SVGStringList; + new(): SVGStringList; +} + +interface SVGStyleElement extends SVGElement, SVGLangSpace { + disabled: boolean; + media: string; + title: string; + type: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStyleElement: { + prototype: SVGStyleElement; + new(): SVGStyleElement; +} + +interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSwitchElement: { + prototype: SVGSwitchElement; + new(): SVGSwitchElement; +} + +interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSymbolElement: { + prototype: SVGSymbolElement; + new(): SVGSymbolElement; +} + +interface SVGTSpanElement extends SVGTextPositioningElement { +} + +declare var SVGTSpanElement: { + prototype: SVGTSpanElement; + new(): SVGTSpanElement; +} + +interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; + getCharNumAtPosition(point: SVGPoint): number; + getComputedTextLength(): number; + getEndPositionOfChar(charnum: number): SVGPoint; + getExtentOfChar(charnum: number): SVGRect; + getNumberOfChars(): number; + getRotationOfChar(charnum: number): number; + getStartPositionOfChar(charnum: number): SVGPoint; + getSubStringLength(charnum: number, nchars: number): number; + selectSubString(charnum: number, nchars: number): void; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextContentElement: { + prototype: SVGTextContentElement; + new(): SVGTextContentElement; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; +} + +interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextElement: { + prototype: SVGTextElement; + new(): SVGTextElement; +} + +interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextPathElement: { + prototype: SVGTextPathElement; + new(): SVGTextPathElement; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; +} + +interface SVGTextPositioningElement extends SVGTextContentElement { + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; +} + +declare var SVGTextPositioningElement: { + prototype: SVGTextPositioningElement; + new(): SVGTextPositioningElement; +} + +interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTitleElement: { + prototype: SVGTitleElement; + new(): SVGTitleElement; +} + +interface SVGTransform { + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; + setMatrix(matrix: SVGMatrix): void; + setRotate(angle: number, cx: number, cy: number): void; + setScale(sx: number, sy: number): void; + setSkewX(angle: number): void; + setSkewY(angle: number): void; + setTranslate(tx: number, ty: number): void; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +declare var SVGTransform: { + prototype: SVGTransform; + new(): SVGTransform; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +interface SVGTransformList { + readonly numberOfItems: number; + appendItem(newItem: SVGTransform): SVGTransform; + clear(): void; + consolidate(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + getItem(index: number): SVGTransform; + initialize(newItem: SVGTransform): SVGTransform; + insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; + removeItem(index: number): SVGTransform; + replaceItem(newItem: SVGTransform, index: number): SVGTransform; +} + +declare var SVGTransformList: { + prototype: SVGTransformList; + new(): SVGTransformList; +} + +interface SVGUnitTypes { + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; +} +declare var SVGUnitTypes: SVGUnitTypes; + +interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGUseElement: { + prototype: SVGUseElement; + new(): SVGUseElement; +} + +interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { + readonly viewTarget: SVGStringList; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGViewElement: { + prototype: SVGViewElement; + new(): SVGViewElement; +} + +interface SVGZoomAndPan { + readonly zoomAndPan: number; +} + +declare var SVGZoomAndPan: { + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; +} + +interface SVGZoomEvent extends UIEvent { + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; +} + +declare var SVGZoomEvent: { + prototype: SVGZoomEvent; + new(): SVGZoomEvent; +} + +interface Screen extends EventTarget { + readonly availHeight: number; + readonly availWidth: number; + bufferDepth: number; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; + onmsorientationchange: (this: this, ev: Event) => any; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; + msLockOrientation(orientations: string | string[]): boolean; + msUnlockOrientation(): void; + addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Screen: { + prototype: Screen; + new(): Screen; +} + +interface ScriptNotifyEvent extends Event { + readonly callingUri: string; + readonly value: string; +} + +declare var ScriptNotifyEvent: { + prototype: ScriptNotifyEvent; + new(): ScriptNotifyEvent; +} + +interface ScriptProcessorNode extends AudioNode { + readonly bufferSize: number; + onaudioprocess: (this: this, ev: AudioProcessingEvent) => any; + addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ScriptProcessorNode: { + prototype: ScriptProcessorNode; + new(): ScriptProcessorNode; +} + +interface Selection { + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; + addRange(range: Range): void; + collapse(parentNode: Node, offset: number): void; + collapseToEnd(): void; + collapseToStart(): void; + containsNode(node: Node, partlyContained: boolean): boolean; + deleteFromDocument(): void; + empty(): void; + extend(newNode: Node, offset: number): void; + getRangeAt(index: number): Range; + removeAllRanges(): void; + removeRange(range: Range): void; + selectAllChildren(parentNode: Node): void; + setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; + toString(): string; +} + +declare var Selection: { + prototype: Selection; + new(): Selection; +} + +interface SourceBuffer extends EventTarget { + appendWindowEnd: number; + appendWindowStart: number; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; + mode: string; + timestampOffset: number; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; + abort(): void; + appendBuffer(data: ArrayBuffer | ArrayBufferView): void; + appendStream(stream: MSStream, maxSize?: number): void; + remove(start: number, end: number): void; +} + +declare var SourceBuffer: { + prototype: SourceBuffer; + new(): SourceBuffer; +} + +interface SourceBufferList extends EventTarget { + readonly length: number; + item(index: number): SourceBuffer; + [index: number]: SourceBuffer; +} + +declare var SourceBufferList: { + prototype: SourceBufferList; + new(): SourceBufferList; +} + +interface StereoPannerNode extends AudioNode { + readonly pan: AudioParam; +} + +declare var StereoPannerNode: { + prototype: StereoPannerNode; + new(): StereoPannerNode; +} + +interface Storage { + readonly length: number; + clear(): void; + getItem(key: string): string | null; + key(index: number): string | null; + removeItem(key: string): void; + setItem(key: string, data: string): void; + [key: string]: any; + [index: number]: string; +} + +declare var Storage: { + prototype: Storage; + new(): Storage; +} + +interface StorageEvent extends Event { + readonly url: string; + key?: string; + oldValue?: string; + newValue?: string; + storageArea?: Storage; +} + +declare var StorageEvent: { + prototype: StorageEvent; + new (type: string, eventInitDict?: StorageEventInit): StorageEvent; +} + +interface StyleMedia { + readonly type: string; + matchMedium(mediaquery: string): boolean; +} + +declare var StyleMedia: { + prototype: StyleMedia; + new(): StyleMedia; +} + +interface StyleSheet { + disabled: boolean; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; +} + +declare var StyleSheet: { + prototype: StyleSheet; + new(): StyleSheet; +} + +interface StyleSheetList { + readonly length: number; + item(index?: number): StyleSheet; + [index: number]: StyleSheet; +} + +declare var StyleSheetList: { + prototype: StyleSheetList; + new(): StyleSheetList; +} + +interface StyleSheetPageList { + readonly length: number; + item(index: number): CSSPageRule; + [index: number]: CSSPageRule; +} + +declare var StyleSheetPageList: { + prototype: StyleSheetPageList; + new(): StyleSheetPageList; +} + +interface SubtleCrypto { + decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; + encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + exportKey(format: "jwk", key: CryptoKey): PromiseLike; + exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; + unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; +} + +declare var SubtleCrypto: { + prototype: SubtleCrypto; + new(): SubtleCrypto; +} + +interface Text extends CharacterData { + readonly wholeText: string; + splitText(offset: number): Text; +} + +declare var Text: { + prototype: Text; + new(): Text; +} + +interface TextEvent extends UIEvent { + readonly data: string; + readonly inputMethod: number; + readonly locale: string; + initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +declare var TextEvent: { + prototype: TextEvent; + new(): TextEvent; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +interface TextMetrics { + readonly width: number; +} + +declare var TextMetrics: { + prototype: TextMetrics; + new(): TextMetrics; +} + +interface TextTrack extends EventTarget { + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; + mode: any; + oncuechange: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + readonly readyState: number; + addCue(cue: TextTrackCue): void; + removeCue(cue: TextTrackCue): void; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; + addEventListener(type: "cuechange", 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrack: { + prototype: TextTrack; + new(): TextTrack; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; +} + +interface TextTrackCue extends EventTarget { + endTime: number; + id: string; + onenter: (this: this, ev: Event) => any; + onexit: (this: this, ev: Event) => any; + pauseOnExit: boolean; + startTime: number; + text: string; + readonly track: TextTrack; + getCueAsHTML(): DocumentFragment; + addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrackCue: { + prototype: TextTrackCue; + new(startTime: number, endTime: number, text: string): TextTrackCue; +} + +interface TextTrackCueList { + readonly length: number; + getCueById(id: string): TextTrackCue; + item(index: number): TextTrackCue; + [index: number]: TextTrackCue; +} + +declare var TextTrackCueList: { + prototype: TextTrackCueList; + new(): TextTrackCueList; +} + +interface TextTrackList extends EventTarget { + readonly length: number; + onaddtrack: ((this: this, ev: TrackEvent) => any) | null; + item(index: number): TextTrack; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: TextTrack; +} + +declare var TextTrackList: { + prototype: TextTrackList; + new(): TextTrackList; +} + +interface TimeRanges { + readonly length: number; + end(index: number): number; + start(index: number): number; +} + +declare var TimeRanges: { + prototype: TimeRanges; + new(): TimeRanges; +} + +interface Touch { + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; +} + +declare var Touch: { + prototype: Touch; + new(): Touch; +} + +interface TouchEvent extends UIEvent { + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly ctrlKey: boolean; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; +} + +declare var TouchEvent: { + prototype: TouchEvent; + new(): TouchEvent; +} + +interface TouchList { + readonly length: number; + item(index: number): Touch | null; + [index: number]: Touch; +} + +declare var TouchList: { + prototype: TouchList; + new(): TouchList; +} + +interface TrackEvent extends Event { + readonly track: any; +} + +declare var TrackEvent: { + prototype: TrackEvent; + new(): TrackEvent; +} + +interface TransitionEvent extends Event { + readonly elapsedTime: number; + readonly propertyName: string; + initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; +} + +declare var TransitionEvent: { + prototype: TransitionEvent; + new(): TransitionEvent; +} + +interface TreeWalker { + currentNode: Node; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + firstChild(): Node; + lastChild(): Node; + nextNode(): Node; + nextSibling(): Node; + parentNode(): Node; + previousNode(): Node; + previousSibling(): Node; +} + +declare var TreeWalker: { + prototype: TreeWalker; + new(): TreeWalker; +} + +interface UIEvent extends Event { + readonly detail: number; + readonly view: Window; + initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; +} + +declare var UIEvent: { + prototype: UIEvent; + new(type: string, eventInitDict?: UIEventInit): UIEvent; +} + +interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; + createObjectURL(object: any, options?: ObjectURLOptions): string; + revokeObjectURL(url: string): void; +} + +interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { + readonly mediaType: string; +} + +declare var UnviewableContentIdentifiedEvent: { + prototype: UnviewableContentIdentifiedEvent; + new(): UnviewableContentIdentifiedEvent; +} + +interface ValidityState { + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; +} + +declare var ValidityState: { + prototype: ValidityState; + new(): ValidityState; +} + +interface VideoPlaybackQuality { + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; +} + +declare var VideoPlaybackQuality: { + prototype: VideoPlaybackQuality; + new(): VideoPlaybackQuality; +} + +interface VideoTrack { + readonly id: string; + kind: string; + readonly label: string; + language: string; + selected: boolean; + readonly sourceBuffer: SourceBuffer; +} + +declare var VideoTrack: { + prototype: VideoTrack; + new(): VideoTrack; +} + +interface VideoTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: this, ev: TrackEvent) => any; + onchange: (this: this, ev: Event) => any; + onremovetrack: (this: this, ev: TrackEvent) => any; + readonly selectedIndex: number; + getTrackById(id: string): VideoTrack | null; + item(index: number): VideoTrack; + addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: VideoTrack; +} + +declare var VideoTrackList: { + prototype: VideoTrackList; + new(): VideoTrackList; +} + +interface WEBGL_compressed_texture_s3tc { + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +declare var WEBGL_compressed_texture_s3tc: { + prototype: WEBGL_compressed_texture_s3tc; + new(): WEBGL_compressed_texture_s3tc; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +interface WEBGL_debug_renderer_info { + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +declare var WEBGL_debug_renderer_info: { + prototype: WEBGL_debug_renderer_info; + new(): WEBGL_debug_renderer_info; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +interface WEBGL_depth_texture { + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +declare var WEBGL_depth_texture: { + prototype: WEBGL_depth_texture; + new(): WEBGL_depth_texture; + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +interface WaveShaperNode extends AudioNode { + curve: Float32Array | null; + oversample: string; +} + +declare var WaveShaperNode: { + prototype: WaveShaperNode; + new(): WaveShaperNode; +} + +interface WebGLActiveInfo { + readonly name: string; + readonly size: number; + readonly type: number; +} + +declare var WebGLActiveInfo: { + prototype: WebGLActiveInfo; + new(): WebGLActiveInfo; +} + +interface WebGLBuffer extends WebGLObject { +} + +declare var WebGLBuffer: { + prototype: WebGLBuffer; + new(): WebGLBuffer; +} + +interface WebGLContextEvent extends Event { + readonly statusMessage: string; +} + +declare var WebGLContextEvent: { + prototype: WebGLContextEvent; + new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; +} + +interface WebGLFramebuffer extends WebGLObject { +} + +declare var WebGLFramebuffer: { + prototype: WebGLFramebuffer; + new(): WebGLFramebuffer; +} + +interface WebGLObject { +} + +declare var WebGLObject: { + prototype: WebGLObject; + new(): WebGLObject; +} + +interface WebGLProgram extends WebGLObject { +} + +declare var WebGLProgram: { + prototype: WebGLProgram; + new(): WebGLProgram; +} + +interface WebGLRenderbuffer extends WebGLObject { +} + +declare var WebGLRenderbuffer: { + prototype: WebGLRenderbuffer; + new(): WebGLRenderbuffer; +} + +interface WebGLRenderingContext { + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; + activeTexture(texture: number): void; + attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; + bindBuffer(target: number, buffer: WebGLBuffer | null): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; + bindTexture(target: number, texture: WebGLTexture | null): void; + blendColor(red: number, green: number, blue: number, alpha: number): void; + blendEquation(mode: number): void; + blendEquationSeparate(modeRGB: number, modeAlpha: number): void; + blendFunc(sfactor: number, dfactor: number): void; + blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; + bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; + checkFramebufferStatus(target: number): number; + clear(mask: number): void; + clearColor(red: number, green: number, blue: number, alpha: number): void; + clearDepth(depth: number): void; + clearStencil(s: number): void; + colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; + compileShader(shader: WebGLShader | null): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; + copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; + copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; + createBuffer(): WebGLBuffer | null; + createFramebuffer(): WebGLFramebuffer | null; + createProgram(): WebGLProgram | null; + createRenderbuffer(): WebGLRenderbuffer | null; + createShader(type: number): WebGLShader | null; + createTexture(): WebGLTexture | null; + cullFace(mode: number): void; + deleteBuffer(buffer: WebGLBuffer | null): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; + deleteProgram(program: WebGLProgram | null): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; + deleteShader(shader: WebGLShader | null): void; + deleteTexture(texture: WebGLTexture | null): void; + depthFunc(func: number): void; + depthMask(flag: boolean): void; + depthRange(zNear: number, zFar: number): void; + detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + disable(cap: number): void; + disableVertexAttribArray(index: number): void; + drawArrays(mode: number, first: number, count: number): void; + drawElements(mode: number, count: number, type: number, offset: number): void; + enable(cap: number): void; + enableVertexAttribArray(index: number): void; + finish(): void; + flush(): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; + frontFace(mode: number): void; + generateMipmap(target: number): void; + getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; + getAttribLocation(program: WebGLProgram | null, name: string): number; + getBufferParameter(target: number, pname: number): any; + getContextAttributes(): WebGLContextAttributes; + getError(): number; + getExtension(name: string): any; + getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; + getParameter(pname: number): any; + getProgramInfoLog(program: WebGLProgram | null): string | null; + getProgramParameter(program: WebGLProgram | null, pname: number): any; + getRenderbufferParameter(target: number, pname: number): any; + getShaderInfoLog(shader: WebGLShader | null): string | null; + getShaderParameter(shader: WebGLShader | null, pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; + getShaderSource(shader: WebGLShader | null): string | null; + getSupportedExtensions(): string[] | null; + getTexParameter(target: number, pname: number): any; + getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; + getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; + getVertexAttrib(index: number, pname: number): any; + getVertexAttribOffset(index: number, pname: number): number; + hint(target: number, mode: number): void; + isBuffer(buffer: WebGLBuffer | null): boolean; + isContextLost(): boolean; + isEnabled(cap: number): boolean; + isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; + isProgram(program: WebGLProgram | null): boolean; + isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; + isShader(shader: WebGLShader | null): boolean; + isTexture(texture: WebGLTexture | null): boolean; + lineWidth(width: number): void; + linkProgram(program: WebGLProgram | null): void; + pixelStorei(pname: number, param: number): void; + polygonOffset(factor: number, units: number): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; + renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; + sampleCoverage(value: number, invert: boolean): void; + scissor(x: number, y: number, width: number, height: number): void; + shaderSource(shader: WebGLShader | null, source: string): void; + stencilFunc(func: number, ref: number, mask: number): void; + stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; + stencilMask(mask: number): void; + stencilMaskSeparate(face: number, mask: number): void; + stencilOp(fail: number, zfail: number, zpass: number): void; + stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; + texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + texParameterf(target: number, pname: number, param: number): void; + texParameteri(target: number, pname: number, param: number): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + uniform1f(location: WebGLUniformLocation | null, x: number): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform1i(location: WebGLUniformLocation | null, x: number): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + useProgram(program: WebGLProgram | null): void; + validateProgram(program: WebGLProgram | null): void; + vertexAttrib1f(indx: number, x: number): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib2f(indx: number, x: number, y: number): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib3f(indx: number, x: number, y: number, z: number): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; + vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; + viewport(x: number, y: number, width: number, height: number): void; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +declare var WebGLRenderingContext: { + prototype: WebGLRenderingContext; + new(): WebGLRenderingContext; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +interface WebGLShader extends WebGLObject { +} + +declare var WebGLShader: { + prototype: WebGLShader; + new(): WebGLShader; +} + +interface WebGLShaderPrecisionFormat { + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; +} + +declare var WebGLShaderPrecisionFormat: { + prototype: WebGLShaderPrecisionFormat; + new(): WebGLShaderPrecisionFormat; +} + +interface WebGLTexture extends WebGLObject { +} + +declare var WebGLTexture: { + prototype: WebGLTexture; + new(): WebGLTexture; +} + +interface WebGLUniformLocation { +} + +declare var WebGLUniformLocation: { + prototype: WebGLUniformLocation; + new(): WebGLUniformLocation; +} + +interface WebKitCSSMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + m11: number; + m12: number; + m13: number; + m14: number; + m21: number; + m22: number; + m23: number; + m24: number; + m31: number; + m32: number; + m33: number; + m34: number; + m41: number; + m42: number; + m43: number; + m44: number; + inverse(): WebKitCSSMatrix; + multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; + rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; + rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; + scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; + setMatrixValue(value: string): void; + skewX(angle: number): WebKitCSSMatrix; + skewY(angle: number): WebKitCSSMatrix; + toString(): string; + translate(x: number, y: number, z?: number): WebKitCSSMatrix; +} + +declare var WebKitCSSMatrix: { + prototype: WebKitCSSMatrix; + new(text?: string): WebKitCSSMatrix; +} + +interface WebKitPoint { + x: number; + y: number; +} + +declare var WebKitPoint: { + prototype: WebKitPoint; + new(x?: number, y?: number): WebKitPoint; +} + +interface WebSocket extends EventTarget { + binaryType: string; + readonly bufferedAmount: number; + readonly extensions: string; + onclose: (this: this, ev: CloseEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onopen: (this: this, ev: Event) => any; + readonly protocol: string; + readonly readyState: number; + readonly url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; + addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string | string[]): WebSocket; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; +} + +interface WheelEvent extends MouseEvent { + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; + getCurrentPoint(element: Element): void; + initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +declare var WheelEvent: { + prototype: WheelEvent; + new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { + readonly applicationCache: ApplicationCache; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; + defaultStatus: string; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; + event: Event | undefined; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msCredentials: MSCredentials; + name: string; + readonly navigator: Navigator; + offscreenBuffering: string | boolean; + onabort: (this: this, ev: UIEvent) => any; + onafterprint: (this: this, ev: Event) => any; + onbeforeprint: (this: this, ev: Event) => any; + onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + onblur: (this: this, ev: FocusEvent) => any; + oncanplay: (this: this, ev: Event) => any; + oncanplaythrough: (this: this, ev: Event) => any; + onchange: (this: this, ev: Event) => any; + onclick: (this: this, ev: MouseEvent) => any; + oncompassneedscalibration: (this: this, ev: Event) => any; + oncontextmenu: (this: this, ev: PointerEvent) => any; + ondblclick: (this: this, ev: MouseEvent) => any; + ondevicelight: (this: this, ev: DeviceLightEvent) => any; + ondevicemotion: (this: this, ev: DeviceMotionEvent) => any; + ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any; + ondrag: (this: this, ev: DragEvent) => any; + ondragend: (this: this, ev: DragEvent) => any; + ondragenter: (this: this, ev: DragEvent) => any; + ondragleave: (this: this, ev: DragEvent) => any; + ondragover: (this: this, ev: DragEvent) => any; + ondragstart: (this: this, ev: DragEvent) => any; + ondrop: (this: this, ev: DragEvent) => any; + ondurationchange: (this: this, ev: Event) => any; + onemptied: (this: this, ev: Event) => any; + onended: (this: this, ev: MediaStreamErrorEvent) => any; + onerror: ErrorEventHandler; + onfocus: (this: this, ev: FocusEvent) => any; + onhashchange: (this: this, ev: HashChangeEvent) => any; + oninput: (this: this, ev: Event) => any; + oninvalid: (this: this, ev: Event) => any; + onkeydown: (this: this, ev: KeyboardEvent) => any; + onkeypress: (this: this, ev: KeyboardEvent) => any; + onkeyup: (this: this, ev: KeyboardEvent) => any; + onload: (this: this, ev: Event) => any; + onloadeddata: (this: this, ev: Event) => any; + onloadedmetadata: (this: this, ev: Event) => any; + onloadstart: (this: this, ev: Event) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onmousedown: (this: this, ev: MouseEvent) => any; + onmouseenter: (this: this, ev: MouseEvent) => any; + onmouseleave: (this: this, ev: MouseEvent) => any; + onmousemove: (this: this, ev: MouseEvent) => any; + onmouseout: (this: this, ev: MouseEvent) => any; + onmouseover: (this: this, ev: MouseEvent) => any; + onmouseup: (this: this, ev: MouseEvent) => any; + onmousewheel: (this: this, ev: WheelEvent) => any; + onmsgesturechange: (this: this, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; + onmsgestureend: (this: this, ev: MSGestureEvent) => any; + onmsgesturehold: (this: this, ev: MSGestureEvent) => any; + onmsgesturestart: (this: this, ev: MSGestureEvent) => any; + onmsgesturetap: (this: this, ev: MSGestureEvent) => any; + onmsinertiastart: (this: this, ev: MSGestureEvent) => any; + onmspointercancel: (this: this, ev: MSPointerEvent) => any; + onmspointerdown: (this: this, ev: MSPointerEvent) => any; + onmspointerenter: (this: this, ev: MSPointerEvent) => any; + onmspointerleave: (this: this, ev: MSPointerEvent) => any; + onmspointermove: (this: this, ev: MSPointerEvent) => any; + onmspointerout: (this: this, ev: MSPointerEvent) => any; + onmspointerover: (this: this, ev: MSPointerEvent) => any; + onmspointerup: (this: this, ev: MSPointerEvent) => any; + onoffline: (this: this, ev: Event) => any; + ononline: (this: this, ev: Event) => any; + onorientationchange: (this: this, ev: Event) => any; + onpagehide: (this: this, ev: PageTransitionEvent) => any; + onpageshow: (this: this, ev: PageTransitionEvent) => any; + onpause: (this: this, ev: Event) => any; + onplay: (this: this, ev: Event) => any; + onplaying: (this: this, ev: Event) => any; + onpopstate: (this: this, ev: PopStateEvent) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + onratechange: (this: this, ev: Event) => any; + onreadystatechange: (this: this, ev: ProgressEvent) => any; + onreset: (this: this, ev: Event) => any; + onresize: (this: this, ev: UIEvent) => any; + onscroll: (this: this, ev: UIEvent) => any; + onseeked: (this: this, ev: Event) => any; + onseeking: (this: this, ev: Event) => any; + onselect: (this: this, ev: UIEvent) => any; + onstalled: (this: this, ev: Event) => any; + onstorage: (this: this, ev: StorageEvent) => any; + onsubmit: (this: this, ev: Event) => any; + onsuspend: (this: this, ev: Event) => any; + ontimeupdate: (this: this, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onunload: (this: this, ev: Event) => any; + onvolumechange: (this: this, ev: Event) => any; + onwaiting: (this: this, ev: Event) => any; + opener: any; + orientation: string | number; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; + status: string; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; + Blob: typeof Blob; + alert(message?: any): void; + blur(): void; + cancelAnimationFrame(handle: number): void; + captureEvents(): void; + close(): void; + confirm(message?: string): boolean; + focus(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; + getSelection(): Selection; + matchMedia(mediaQuery: string): MediaQueryList; + moveBy(x?: number, y?: number): void; + moveTo(x?: number, y?: number): void; + msWriteProfilerMark(profilerMarkName: string): void; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; + print(): void; + prompt(message?: string, _default?: string): string | null; + releaseEvents(): void; + requestAnimationFrame(callback: FrameRequestCallback): number; + resizeBy(x?: number, y?: number): void; + resizeTo(x?: number, y?: number): void; + scroll(x?: number, y?: number): void; + scrollBy(x?: number, y?: number): void; + scrollTo(x?: number, y?: number): void; + webkitCancelAnimationFrame(handle: number): void; + 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; + addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; + addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; + addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + 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; +} + +declare var Window: { + prototype: Window; + new(): Window; +} + +interface Worker extends EventTarget, AbstractWorker { + onmessage: (this: this, ev: MessageEvent) => any; + postMessage(message: any, ports?: any): void; + terminate(): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface XMLDocument extends Document { +} + +declare var XMLDocument: { + prototype: XMLDocument; + new(): XMLDocument; +} + +interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { + onreadystatechange: (this: this, ev: Event) => any; + readonly readyState: number; + readonly response: any; + readonly responseText: string; + responseType: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; + timeout: number; + readonly upload: XMLHttpRequestUpload; + withCredentials: boolean; + msCaching?: string; + readonly responseURL: string; + abort(): void; + getAllResponseHeaders(): string; + getResponseHeader(header: string): string | null; + msCachingEnabled(): boolean; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + overrideMimeType(mime: string): void; + send(data?: Document): void; + send(data?: string): void; + send(data?: any): void; + setRequestHeader(header: string, value: string): void; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + 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: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", 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; +} + +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + create(): XMLHttpRequest; +} + +interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequestUpload: { + prototype: XMLHttpRequestUpload; + new(): XMLHttpRequestUpload; +} + +interface XMLSerializer { + serializeToString(target: Node): string; +} + +declare var XMLSerializer: { + prototype: XMLSerializer; + new(): XMLSerializer; +} + +interface XPathEvaluator { + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver?: Node): XPathNSResolver; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; +} + +declare var XPathEvaluator: { + prototype: XPathEvaluator; + new(): XPathEvaluator; +} + +interface XPathExpression { + evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; +} + +declare var XPathExpression: { + prototype: XPathExpression; + new(): XPathExpression; +} + +interface XPathNSResolver { + lookupNamespaceURI(prefix: string): string; +} + +declare var XPathNSResolver: { + prototype: XPathNSResolver; + new(): XPathNSResolver; +} + +interface XPathResult { + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; + iterateNext(): Node; + snapshotItem(index: number): Node; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +declare var XPathResult: { + prototype: XPathResult; + new(): XPathResult; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +interface XSLTProcessor { + clearParameters(): void; + getParameter(namespaceURI: string, localName: string): any; + importStylesheet(style: Node): void; + removeParameter(namespaceURI: string, localName: string): void; + reset(): void; + setParameter(namespaceURI: string, localName: string, value: any): void; + transformToDocument(source: Node): Document; + transformToFragment(source: Node, document: Document): DocumentFragment; +} + +declare var XSLTProcessor: { + prototype: XSLTProcessor; + new(): XSLTProcessor; +} + +interface AbstractWorker { + onerror: (this: this, ev: ErrorEvent) => any; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + +interface ChildNode { + remove(): void; +} + +interface DOML2DeprecatedColorProperty { + color: string; +} + +interface DOML2DeprecatedSizeProperty { + size: number; +} + +interface DocumentEvent { + createEvent(eventInterface:"AnimationEvent"): AnimationEvent; + createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; + createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; + createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; + createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; + createEvent(eventInterface:"CloseEvent"): CloseEvent; + createEvent(eventInterface:"CommandEvent"): CommandEvent; + createEvent(eventInterface:"CompositionEvent"): CompositionEvent; + createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; + createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface:"DragEvent"): DragEvent; + createEvent(eventInterface:"ErrorEvent"): ErrorEvent; + createEvent(eventInterface:"Event"): Event; + createEvent(eventInterface:"Events"): Event; + createEvent(eventInterface:"FocusEvent"): FocusEvent; + createEvent(eventInterface:"GamepadEvent"): GamepadEvent; + createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; + createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; + createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; + createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; + createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; + createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; + createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; + createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; + createEvent(eventInterface:"MessageEvent"): MessageEvent; + createEvent(eventInterface:"MouseEvent"): MouseEvent; + createEvent(eventInterface:"MouseEvents"): MouseEvent; + createEvent(eventInterface:"MutationEvent"): MutationEvent; + createEvent(eventInterface:"MutationEvents"): MutationEvent; + createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; + createEvent(eventInterface:"NavigationEvent"): NavigationEvent; + createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; + createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; + createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; + createEvent(eventInterface:"PointerEvent"): PointerEvent; + createEvent(eventInterface:"PopStateEvent"): PopStateEvent; + createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; + createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; + createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; + createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; + createEvent(eventInterface:"StorageEvent"): StorageEvent; + createEvent(eventInterface:"TextEvent"): TextEvent; + createEvent(eventInterface:"TouchEvent"): TouchEvent; + createEvent(eventInterface:"TrackEvent"): TrackEvent; + createEvent(eventInterface:"TransitionEvent"): TransitionEvent; + createEvent(eventInterface:"UIEvent"): UIEvent; + createEvent(eventInterface:"UIEvents"): UIEvent; + createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; + createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface:"WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; +} + +interface ElementTraversal { + readonly childElementCount: number; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly nextElementSibling: Element; + readonly previousElementSibling: Element; +} + +interface GetSVGDocument { + getSVGDocument(): Document; +} + +interface GlobalEventHandlers { + onpointercancel: (this: this, ev: PointerEvent) => any; + onpointerdown: (this: this, ev: PointerEvent) => any; + onpointerenter: (this: this, ev: PointerEvent) => any; + onpointerleave: (this: this, ev: PointerEvent) => any; + onpointermove: (this: this, ev: PointerEvent) => any; + onpointerout: (this: this, ev: PointerEvent) => any; + onpointerover: (this: this, ev: PointerEvent) => any; + onpointerup: (this: this, ev: PointerEvent) => any; + onwheel: (this: this, ev: WheelEvent) => any; + addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; + addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface HTMLTableAlignment { + /** + * Sets or retrieves a value that you can use to implement your own ch functionality for the object. + */ + ch: string; + /** + * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. + */ + chOff: string; + /** + * Sets or retrieves how text and other content are vertically aligned within the object that contains them. + */ + vAlign: string; +} + +interface IDBEnvironment { + readonly indexedDB: IDBFactory; +} + +interface LinkStyle { + readonly sheet: StyleSheet; +} + +interface MSBaseReader { + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + onloadend: (this: this, ev: ProgressEvent) => any; + onloadstart: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + readonly readyState: number; + readonly result: any; + abort(): void; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface MSFileSaver { + msSaveBlob(blob: any, defaultName?: string): boolean; + msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; +} + +interface MSNavigatorDoNotTrack { + confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; + confirmWebWideTrackingException(args: ExceptionInformation): boolean; + removeSiteSpecificTrackingException(args: ExceptionInformation): void; + removeWebWideTrackingException(args: ExceptionInformation): void; + storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; + storeWebWideTrackingException(args: StoreExceptionsInformation): void; +} + +interface NavigatorContentUtils { +} + +interface NavigatorGeolocation { + readonly geolocation: Geolocation; +} + +interface NavigatorID { + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; +} + +interface NavigatorOnLine { + readonly onLine: boolean; +} + +interface NavigatorStorageUtils { +} + +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + +interface NodeSelector { + 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; + querySelectorAll(selectors: "abbr"): NodeListOf; + querySelectorAll(selectors: "acronym"): NodeListOf; + querySelectorAll(selectors: "address"): NodeListOf; + querySelectorAll(selectors: "applet"): NodeListOf; + querySelectorAll(selectors: "area"): NodeListOf; + querySelectorAll(selectors: "article"): NodeListOf; + querySelectorAll(selectors: "aside"): NodeListOf; + querySelectorAll(selectors: "audio"): NodeListOf; + querySelectorAll(selectors: "b"): NodeListOf; + querySelectorAll(selectors: "base"): NodeListOf; + querySelectorAll(selectors: "basefont"): NodeListOf; + querySelectorAll(selectors: "bdo"): NodeListOf; + querySelectorAll(selectors: "big"): NodeListOf; + querySelectorAll(selectors: "blockquote"): NodeListOf; + querySelectorAll(selectors: "body"): NodeListOf; + querySelectorAll(selectors: "br"): NodeListOf; + querySelectorAll(selectors: "button"): NodeListOf; + querySelectorAll(selectors: "canvas"): NodeListOf; + querySelectorAll(selectors: "caption"): NodeListOf; + querySelectorAll(selectors: "center"): NodeListOf; + querySelectorAll(selectors: "circle"): NodeListOf; + querySelectorAll(selectors: "cite"): NodeListOf; + querySelectorAll(selectors: "clippath"): NodeListOf; + querySelectorAll(selectors: "code"): NodeListOf; + querySelectorAll(selectors: "col"): NodeListOf; + querySelectorAll(selectors: "colgroup"): NodeListOf; + querySelectorAll(selectors: "datalist"): NodeListOf; + querySelectorAll(selectors: "dd"): NodeListOf; + querySelectorAll(selectors: "defs"): NodeListOf; + querySelectorAll(selectors: "del"): NodeListOf; + querySelectorAll(selectors: "desc"): NodeListOf; + querySelectorAll(selectors: "dfn"): NodeListOf; + querySelectorAll(selectors: "dir"): NodeListOf; + querySelectorAll(selectors: "div"): NodeListOf; + querySelectorAll(selectors: "dl"): NodeListOf; + querySelectorAll(selectors: "dt"): NodeListOf; + querySelectorAll(selectors: "ellipse"): NodeListOf; + querySelectorAll(selectors: "em"): NodeListOf; + querySelectorAll(selectors: "embed"): NodeListOf; + querySelectorAll(selectors: "feblend"): NodeListOf; + querySelectorAll(selectors: "fecolormatrix"): NodeListOf; + querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf; + querySelectorAll(selectors: "fecomposite"): NodeListOf; + querySelectorAll(selectors: "feconvolvematrix"): NodeListOf; + querySelectorAll(selectors: "fediffuselighting"): NodeListOf; + querySelectorAll(selectors: "fedisplacementmap"): NodeListOf; + querySelectorAll(selectors: "fedistantlight"): NodeListOf; + querySelectorAll(selectors: "feflood"): NodeListOf; + querySelectorAll(selectors: "fefunca"): NodeListOf; + querySelectorAll(selectors: "fefuncb"): NodeListOf; + querySelectorAll(selectors: "fefuncg"): NodeListOf; + querySelectorAll(selectors: "fefuncr"): NodeListOf; + querySelectorAll(selectors: "fegaussianblur"): NodeListOf; + querySelectorAll(selectors: "feimage"): NodeListOf; + querySelectorAll(selectors: "femerge"): NodeListOf; + querySelectorAll(selectors: "femergenode"): NodeListOf; + querySelectorAll(selectors: "femorphology"): NodeListOf; + querySelectorAll(selectors: "feoffset"): NodeListOf; + querySelectorAll(selectors: "fepointlight"): NodeListOf; + querySelectorAll(selectors: "fespecularlighting"): NodeListOf; + querySelectorAll(selectors: "fespotlight"): NodeListOf; + querySelectorAll(selectors: "fetile"): NodeListOf; + querySelectorAll(selectors: "feturbulence"): NodeListOf; + querySelectorAll(selectors: "fieldset"): NodeListOf; + querySelectorAll(selectors: "figcaption"): NodeListOf; + querySelectorAll(selectors: "figure"): NodeListOf; + querySelectorAll(selectors: "filter"): NodeListOf; + querySelectorAll(selectors: "font"): NodeListOf; + querySelectorAll(selectors: "footer"): NodeListOf; + querySelectorAll(selectors: "foreignobject"): NodeListOf; + querySelectorAll(selectors: "form"): NodeListOf; + querySelectorAll(selectors: "frame"): NodeListOf; + querySelectorAll(selectors: "frameset"): NodeListOf; + querySelectorAll(selectors: "g"): NodeListOf; + querySelectorAll(selectors: "h1"): NodeListOf; + querySelectorAll(selectors: "h2"): NodeListOf; + querySelectorAll(selectors: "h3"): NodeListOf; + querySelectorAll(selectors: "h4"): NodeListOf; + querySelectorAll(selectors: "h5"): NodeListOf; + querySelectorAll(selectors: "h6"): NodeListOf; + querySelectorAll(selectors: "head"): NodeListOf; + querySelectorAll(selectors: "header"): NodeListOf; + querySelectorAll(selectors: "hgroup"): NodeListOf; + querySelectorAll(selectors: "hr"): NodeListOf; + querySelectorAll(selectors: "html"): NodeListOf; + querySelectorAll(selectors: "i"): NodeListOf; + querySelectorAll(selectors: "iframe"): NodeListOf; + querySelectorAll(selectors: "image"): NodeListOf; + querySelectorAll(selectors: "img"): NodeListOf; + querySelectorAll(selectors: "input"): NodeListOf; + querySelectorAll(selectors: "ins"): NodeListOf; + querySelectorAll(selectors: "isindex"): NodeListOf; + querySelectorAll(selectors: "kbd"): NodeListOf; + querySelectorAll(selectors: "keygen"): NodeListOf; + querySelectorAll(selectors: "label"): NodeListOf; + querySelectorAll(selectors: "legend"): NodeListOf; + querySelectorAll(selectors: "li"): NodeListOf; + querySelectorAll(selectors: "line"): NodeListOf; + querySelectorAll(selectors: "lineargradient"): NodeListOf; + querySelectorAll(selectors: "link"): NodeListOf; + querySelectorAll(selectors: "listing"): NodeListOf; + querySelectorAll(selectors: "map"): NodeListOf; + querySelectorAll(selectors: "mark"): NodeListOf; + querySelectorAll(selectors: "marker"): NodeListOf; + querySelectorAll(selectors: "marquee"): NodeListOf; + querySelectorAll(selectors: "mask"): NodeListOf; + querySelectorAll(selectors: "menu"): NodeListOf; + querySelectorAll(selectors: "meta"): NodeListOf; + querySelectorAll(selectors: "metadata"): NodeListOf; + querySelectorAll(selectors: "meter"): NodeListOf; + querySelectorAll(selectors: "nav"): NodeListOf; + querySelectorAll(selectors: "nextid"): NodeListOf; + querySelectorAll(selectors: "nobr"): NodeListOf; + querySelectorAll(selectors: "noframes"): NodeListOf; + querySelectorAll(selectors: "noscript"): NodeListOf; + querySelectorAll(selectors: "object"): NodeListOf; + querySelectorAll(selectors: "ol"): NodeListOf; + querySelectorAll(selectors: "optgroup"): NodeListOf; + querySelectorAll(selectors: "option"): NodeListOf; + querySelectorAll(selectors: "p"): NodeListOf; + querySelectorAll(selectors: "param"): NodeListOf; + querySelectorAll(selectors: "path"): NodeListOf; + querySelectorAll(selectors: "pattern"): NodeListOf; + querySelectorAll(selectors: "picture"): NodeListOf; + querySelectorAll(selectors: "plaintext"): NodeListOf; + querySelectorAll(selectors: "polygon"): NodeListOf; + querySelectorAll(selectors: "polyline"): NodeListOf; + querySelectorAll(selectors: "pre"): NodeListOf; + querySelectorAll(selectors: "progress"): NodeListOf; + querySelectorAll(selectors: "q"): NodeListOf; + querySelectorAll(selectors: "radialgradient"): NodeListOf; + querySelectorAll(selectors: "rect"): NodeListOf; + querySelectorAll(selectors: "rt"): NodeListOf; + querySelectorAll(selectors: "ruby"): NodeListOf; + querySelectorAll(selectors: "s"): NodeListOf; + querySelectorAll(selectors: "samp"): NodeListOf; + querySelectorAll(selectors: "script"): NodeListOf; + querySelectorAll(selectors: "section"): NodeListOf; + querySelectorAll(selectors: "select"): NodeListOf; + querySelectorAll(selectors: "small"): NodeListOf; + querySelectorAll(selectors: "source"): NodeListOf; + querySelectorAll(selectors: "span"): NodeListOf; + querySelectorAll(selectors: "stop"): NodeListOf; + querySelectorAll(selectors: "strike"): NodeListOf; + querySelectorAll(selectors: "strong"): NodeListOf; + querySelectorAll(selectors: "style"): NodeListOf; + querySelectorAll(selectors: "sub"): NodeListOf; + querySelectorAll(selectors: "sup"): NodeListOf; + querySelectorAll(selectors: "svg"): NodeListOf; + querySelectorAll(selectors: "switch"): NodeListOf; + querySelectorAll(selectors: "symbol"): NodeListOf; + querySelectorAll(selectors: "table"): NodeListOf; + querySelectorAll(selectors: "tbody"): NodeListOf; + querySelectorAll(selectors: "td"): NodeListOf; + querySelectorAll(selectors: "template"): NodeListOf; + querySelectorAll(selectors: "text"): NodeListOf; + querySelectorAll(selectors: "textpath"): NodeListOf; + querySelectorAll(selectors: "textarea"): NodeListOf; + querySelectorAll(selectors: "tfoot"): NodeListOf; + querySelectorAll(selectors: "th"): NodeListOf; + querySelectorAll(selectors: "thead"): NodeListOf; + querySelectorAll(selectors: "title"): NodeListOf; + querySelectorAll(selectors: "tr"): NodeListOf; + querySelectorAll(selectors: "track"): NodeListOf; + querySelectorAll(selectors: "tspan"): NodeListOf; + querySelectorAll(selectors: "tt"): NodeListOf; + querySelectorAll(selectors: "u"): NodeListOf; + querySelectorAll(selectors: "ul"): NodeListOf; + querySelectorAll(selectors: "use"): NodeListOf; + querySelectorAll(selectors: "var"): NodeListOf; + querySelectorAll(selectors: "video"): NodeListOf; + querySelectorAll(selectors: "view"): NodeListOf; + querySelectorAll(selectors: "wbr"): NodeListOf; + querySelectorAll(selectors: "x-ms-webview"): NodeListOf; + querySelectorAll(selectors: "xmp"): NodeListOf; + querySelectorAll(selectors: string): NodeListOf; +} + +interface RandomSource { + getRandomValues(array: ArrayBufferView): ArrayBufferView; +} + +interface SVGAnimatedPathData { + readonly pathSegList: SVGPathSegList; +} + +interface SVGAnimatedPoints { + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; +} + +interface SVGExternalResourcesRequired { + readonly externalResourcesRequired: SVGAnimatedBoolean; +} + +interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; +} + +interface SVGFitToViewBox { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; +} + +interface SVGLangSpace { + xmllang: string; + xmlspace: string; +} + +interface SVGLocatable { + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; + getBBox(): SVGRect; + getCTM(): SVGMatrix; + getScreenCTM(): SVGMatrix; + getTransformToElement(element: SVGElement): SVGMatrix; +} + +interface SVGStylable { + className: any; + readonly style: CSSStyleDeclaration; +} + +interface SVGTests { + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; + hasExtension(extension: string): boolean; +} + +interface SVGTransformable extends SVGLocatable { + readonly transform: SVGAnimatedTransformList; +} + +interface SVGURIReference { + readonly href: SVGAnimatedString; +} + +interface WindowBase64 { + atob(encodedString: string): string; + btoa(rawString: string): string; +} + +interface WindowConsole { + readonly console: Console; +} + +interface WindowLocalStorage { + readonly localStorage: Storage; +} + +interface WindowSessionStorage { + readonly sessionStorage: Storage; +} + +interface WindowTimers extends Object, WindowTimersExtension { + clearInterval(handle: number): void; + clearTimeout(handle: number): void; + setInterval(handler: (...args: any[]) => void, timeout: number): number; + setInterval(handler: any, timeout?: any, ...args: any[]): number; + setTimeout(handler: (...args: any[]) => void, timeout: number): number; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; +} + +interface WindowTimersExtension { + clearImmediate(handle: number): void; + setImmediate(handler: (...args: any[]) => void): number; + setImmediate(handler: any, ...args: any[]): number; +} + +interface XMLHttpRequestEventTarget { + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + onloadend: (this: this, ev: ProgressEvent) => any; + onloadstart: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + ontimeout: (this: this, ev: ProgressEvent) => any; + 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface StorageEventInit extends EventInit { + key?: string; + oldValue?: string; + newValue?: string; + url: string; + storageArea?: Storage; +} + +interface Canvas2DContextAttributes { + alpha?: boolean; + willReadFrequently?: boolean; + storage?: boolean; + [attribute: string]: boolean | string | undefined; +} + +interface NodeListOf extends NodeList { + length: number; + item(index: number): TNode; + [index: number]: TNode; +} + +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + +interface EventListenerObject { + handleEvent(evt: Event): void; +} + +interface MessageEventInit extends EventInit { + data?: any; + origin?: string; + lastEventId?: string; + channel?: string; + source?: any; + ports?: MessagePort[]; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + 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; +} + +interface IDBArrayKey extends Array { +} + +interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: AlgorithmIdentifier; +} + +interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: AlgorithmIdentifier; +} + +interface RsaHashedImportParams { + hash: AlgorithmIdentifier; +} + +interface RsaPssParams { + saltLength: number; +} + +interface RsaOaepParams extends Algorithm { + label?: BufferSource; +} + +interface EcdsaParams extends Algorithm { + hash: AlgorithmIdentifier; +} + +interface EcKeyGenParams extends Algorithm { + namedCurve: string; +} + +interface EcKeyAlgorithm extends KeyAlgorithm { + typedCurve: string; +} + +interface EcKeyImportParams { + namedCurve: string; +} + +interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; +} + +interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +interface AesKeyGenParams extends Algorithm { + length: number; +} + +interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +interface AesCbcParams extends Algorithm { + iv: BufferSource; +} + +interface AesCmacParams extends Algorithm { + length: number; +} + +interface AesGcmParams extends Algorithm { + iv: BufferSource; + additionalData?: BufferSource; + tagLength?: number; +} + +interface AesCfbParams extends Algorithm { + iv: BufferSource; +} + +interface HmacImportParams extends Algorithm { + hash?: AlgorithmIdentifier; + length?: number; +} + +interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: AlgorithmIdentifier; + length: number; +} + +interface HmacKeyGenParams extends Algorithm { + hash: AlgorithmIdentifier; + length?: number; +} + +interface DhKeyGenParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyAlgorithm extends KeyAlgorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface DhImportKeyParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface ConcatParams extends Algorithm { + hash?: AlgorithmIdentifier; + algorithmId: Uint8Array; + partyUInfo: Uint8Array; + partyVInfo: Uint8Array; + publicInfo?: Uint8Array; + privateInfo?: Uint8Array; +} + +interface HkdfCtrParams extends Algorithm { + hash: AlgorithmIdentifier; + label: BufferSource; + context: BufferSource; +} + +interface Pbkdf2Params extends Algorithm { + salt: BufferSource; + iterations: number; + hash: AlgorithmIdentifier; +} + +interface RsaOtherPrimesInfo { + r: string; + d: string; + t: string; +} + +interface JsonWebKey { + kty: string; + use?: string; + key_ops?: string[]; + alg?: string; + kid?: string; + x5u?: string; + x5c?: string; + x5t?: string; + ext?: boolean; + crv?: string; + x?: string; + y?: string; + d?: string; + n?: string; + e?: string; + p?: string; + q?: string; + dp?: string; + dq?: string; + qi?: string; + oth?: RsaOtherPrimesInfo[]; + k?: string; +} + +interface ParentNode { + readonly children: HTMLCollection; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly childElementCount: number; +} + +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + +interface ErrorEventHandler { + (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; +} +interface PositionCallback { + (position: Position): void; +} +interface PositionErrorCallback { + (error: PositionError): void; +} +interface MediaQueryListListener { + (mql: MediaQueryList): void; +} +interface MSLaunchUriCallback { + (): void; +} +interface FrameRequestCallback { + (time: number): void; +} +interface MSUnsafeFunctionCallback { + (): any; +} +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} +interface MutationCallback { + (mutations: MutationRecord[], observer: MutationObserver): void; +} +interface DecodeSuccessCallback { + (decodedData: AudioBuffer): void; +} +interface DecodeErrorCallback { + (error: DOMException): void; +} +interface FunctionStringCallback { + (data: string): void; +} +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: string): void; +} +declare var Audio: {new(src?: string): HTMLAudioElement; }; +declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; +declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; +declare var applicationCache: ApplicationCache; +declare var clientInformation: Navigator; +declare var closed: boolean; +declare var crypto: Crypto; +declare var defaultStatus: string; +declare var devicePixelRatio: number; +declare var doNotTrack: string; +declare var document: Document; +declare var event: Event | undefined; +declare var external: External; +declare var frameElement: Element; +declare var frames: Window; +declare var history: History; +declare var innerHeight: number; +declare var innerWidth: number; +declare var length: number; +declare var location: Location; +declare var locationbar: BarProp; +declare var menubar: BarProp; +declare var msCredentials: MSCredentials; +declare const name: never; +declare var navigator: Navigator; +declare var offscreenBuffering: string | boolean; +declare var onabort: (this: Window, ev: UIEvent) => any; +declare var onafterprint: (this: Window, ev: Event) => any; +declare var onbeforeprint: (this: Window, ev: Event) => any; +declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; +declare var onblur: (this: Window, ev: FocusEvent) => any; +declare var oncanplay: (this: Window, ev: Event) => any; +declare var oncanplaythrough: (this: Window, ev: Event) => any; +declare var onchange: (this: Window, ev: Event) => any; +declare var onclick: (this: Window, ev: MouseEvent) => any; +declare var oncompassneedscalibration: (this: Window, ev: Event) => any; +declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; +declare var ondblclick: (this: Window, ev: MouseEvent) => any; +declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; +declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; +declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; +declare var ondrag: (this: Window, ev: DragEvent) => any; +declare var ondragend: (this: Window, ev: DragEvent) => any; +declare var ondragenter: (this: Window, ev: DragEvent) => any; +declare var ondragleave: (this: Window, ev: DragEvent) => any; +declare var ondragover: (this: Window, ev: DragEvent) => any; +declare var ondragstart: (this: Window, ev: DragEvent) => any; +declare var ondrop: (this: Window, ev: DragEvent) => any; +declare var ondurationchange: (this: Window, ev: Event) => any; +declare var onemptied: (this: Window, ev: Event) => any; +declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; +declare var onerror: ErrorEventHandler; +declare var onfocus: (this: Window, ev: FocusEvent) => any; +declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; +declare var oninput: (this: Window, ev: Event) => any; +declare var oninvalid: (this: Window, ev: Event) => any; +declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; +declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; +declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; +declare var onload: (this: Window, ev: Event) => any; +declare var onloadeddata: (this: Window, ev: Event) => any; +declare var onloadedmetadata: (this: Window, ev: Event) => any; +declare var onloadstart: (this: Window, ev: Event) => any; +declare var onmessage: (this: Window, ev: MessageEvent) => any; +declare var onmousedown: (this: Window, ev: MouseEvent) => any; +declare var onmouseenter: (this: Window, ev: MouseEvent) => any; +declare var onmouseleave: (this: Window, ev: MouseEvent) => any; +declare var onmousemove: (this: Window, ev: MouseEvent) => any; +declare var onmouseout: (this: Window, ev: MouseEvent) => any; +declare var onmouseover: (this: Window, ev: MouseEvent) => any; +declare var onmouseup: (this: Window, ev: MouseEvent) => any; +declare var onmousewheel: (this: Window, ev: WheelEvent) => any; +declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; +declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; +declare var onoffline: (this: Window, ev: Event) => any; +declare var ononline: (this: Window, ev: Event) => any; +declare var onorientationchange: (this: Window, ev: Event) => any; +declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; +declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; +declare var onpause: (this: Window, ev: Event) => any; +declare var onplay: (this: Window, ev: Event) => any; +declare var onplaying: (this: Window, ev: Event) => any; +declare var onpopstate: (this: Window, ev: PopStateEvent) => any; +declare var onprogress: (this: Window, ev: ProgressEvent) => any; +declare var onratechange: (this: Window, ev: Event) => any; +declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; +declare var onreset: (this: Window, ev: Event) => any; +declare var onresize: (this: Window, ev: UIEvent) => any; +declare var onscroll: (this: Window, ev: UIEvent) => any; +declare var onseeked: (this: Window, ev: Event) => any; +declare var onseeking: (this: Window, ev: Event) => any; +declare var onselect: (this: Window, ev: UIEvent) => any; +declare var onstalled: (this: Window, ev: Event) => any; +declare var onstorage: (this: Window, ev: StorageEvent) => any; +declare var onsubmit: (this: Window, ev: Event) => any; +declare var onsuspend: (this: Window, ev: Event) => any; +declare var ontimeupdate: (this: Window, ev: Event) => any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +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: any; +declare var orientation: string | number; +declare var outerHeight: number; +declare var outerWidth: number; +declare var pageXOffset: number; +declare var pageYOffset: number; +declare var parent: Window; +declare var performance: Performance; +declare var personalbar: BarProp; +declare var screen: Screen; +declare var screenLeft: number; +declare var screenTop: number; +declare var screenX: number; +declare var screenY: number; +declare var scrollX: number; +declare var scrollY: number; +declare var scrollbars: BarProp; +declare var self: Window; +declare var status: string; +declare var statusbar: BarProp; +declare var styleMedia: StyleMedia; +declare var toolbar: BarProp; +declare var top: Window; +declare var window: Window; +declare function alert(message?: any): void; +declare function blur(): void; +declare function cancelAnimationFrame(handle: number): void; +declare function captureEvents(): void; +declare function close(): void; +declare function confirm(message?: string): boolean; +declare function focus(): void; +declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; +declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; +declare function getSelection(): Selection; +declare function matchMedia(mediaQuery: string): MediaQueryList; +declare function moveBy(x?: number, y?: number): void; +declare function moveTo(x?: number, y?: number): void; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; +declare function print(): void; +declare function prompt(message?: string, _default?: string): string | null; +declare function releaseEvents(): void; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; +declare function resizeBy(x?: number, y?: number): void; +declare function resizeTo(x?: number, y?: number): void; +declare function scroll(x?: number, y?: number): void; +declare function scrollBy(x?: number, y?: number): void; +declare function scrollTo(x?: number, y?: number): void; +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; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function clearInterval(handle: number): void; +declare function clearTimeout(handle: number): void; +declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function clearImmediate(handle: number): void; +declare function setImmediate(handler: (...args: any[]) => void): number; +declare function setImmediate(handler: any, ...args: any[]): number; +declare var sessionStorage: Storage; +declare var localStorage: Storage; +declare var console: Console; +declare var onpointercancel: (this: Window, ev: PointerEvent) => any; +declare var onpointerdown: (this: Window, ev: PointerEvent) => any; +declare var onpointerenter: (this: Window, ev: PointerEvent) => any; +declare var onpointerleave: (this: Window, ev: PointerEvent) => any; +declare var onpointermove: (this: Window, ev: PointerEvent) => any; +declare var onpointerout: (this: Window, ev: PointerEvent) => any; +declare var onpointerover: (this: Window, ev: PointerEvent) => any; +declare var onpointerup: (this: Window, ev: PointerEvent) => any; +declare var onwheel: (this: Window, ev: WheelEvent) => any; +declare var indexedDB: IDBFactory; +declare function atob(encodedString: string): string; +declare function btoa(rawString: string): string; +declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +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; type ScrollRestoration = "auto" | "manual"; - -///////////////////////////// -/// WorkerGlobalScope APIs -///////////////////////////// -// These are only available in a Web Worker -declare function importScripts(...urls: string[]): void; + +///////////////////////////// +/// WorkerGlobalScope APIs +///////////////////////////// +// These are only available in a Web Worker +declare function importScripts(...urls: string[]): void; - - -///////////////////////////// -/// Windows Script Host APIS -///////////////////////////// - - -interface ActiveXObject { - new (s: string): any; -} -declare var ActiveXObject: ActiveXObject; - -interface ITextWriter { - Write(s: string): void; - WriteLine(s: string): void; - Close(): void; -} - -interface TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; - - /** - * The current line number in an input stream. - */ - Line: number; - - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; -} - -interface TextStreamWriter extends TextStreamBase { - /** - * Sends a string to an output stream. - */ - Write(s: string): void; - - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; - - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; -} - -interface TextStreamReader extends TextStreamBase { - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; - - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; - - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; - - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; - - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; - - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; - - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; -} - -declare var WScript: { - /** - * Outputs text to either a message box (under WScript.exe) or the command console window followed by - * a newline (under CScript.exe). - */ - Echo(s: any): void; - - /** - * Exposes the write-only error output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdErr: TextStreamWriter; - - /** - * Exposes the write-only output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdOut: TextStreamWriter; - Arguments: { length: number; Item(n: number): string; }; - - /** - * The full path of the currently running script. - */ - ScriptFullName: string; - - /** - * Forces the script to stop immediately, with an optional exit code. - */ - Quit(exitCode?: number): number; - - /** - * The Windows Script Host build version number. - */ - BuildVersion: number; - - /** - * Fully qualified path of the host executable. - */ - FullName: string; - - /** - * Gets/sets the script mode - interactive(true) or batch(false). - */ - Interactive: boolean; - - /** - * The name of the host executable (WScript.exe or CScript.exe). - */ - Name: string; - - /** - * Path of the directory containing the host executable. - */ - Path: string; - - /** - * The filename of the currently running script. - */ - ScriptName: string; - - /** - * Exposes the read-only input stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdIn: TextStreamReader; - - /** - * Windows Script Host version - */ - Version: string; - - /** - * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. - */ - ConnectObject(objEventSource: any, strPrefix: string): void; - - /** - * Creates a COM object. - * @param strProgiID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - CreateObject(strProgID: string, strPrefix?: string): any; - - /** - * Disconnects a COM object from its event sources. - */ - DisconnectObject(obj: any): void; - - /** - * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. - * @param strPathname Fully qualified path to the file containing the object persisted to disk. - * For objects in memory, pass a zero-length string. - * @param strProgID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; - - /** - * Suspends script execution for a specified length of time, then continues execution. - * @param intTime Interval (in milliseconds) to suspend script execution. - */ - Sleep(intTime: number): void; -}; - -/** - * Allows enumerating over a COM collection, which may not have indexed item access. - */ -interface Enumerator { - /** - * Returns true if the current item is the last one in the collection, or the collection is empty, - * or the current item is undefined. - */ - atEnd(): boolean; - - /** - * Returns the current item in the collection - */ - item(): T; - - /** - * Resets the current item in the collection to the first item. If there are no items in the collection, - * the current item is set to undefined. - */ - moveFirst(): void; - - /** - * Moves the current item to the next item in the collection. If the enumerator is at the end of - * the collection or the collection is empty, the current item is set to undefined. - */ - moveNext(): void; -} - -interface EnumeratorConstructor { - new (collection: any): Enumerator; - new (collection: any): Enumerator; -} - -declare var Enumerator: EnumeratorConstructor; - -/** - * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. - */ -interface VBArray { - /** - * Returns the number of dimensions (1-based). - */ - dimensions(): number; - - /** - * Takes an index for each dimension in the array, and returns the item at the corresponding location. - */ - getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; - - /** - * Returns the smallest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - lbound(dimension?: number): number; - - /** - * Returns the largest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - ubound(dimension?: number): number; - - /** - * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, - * each successive dimension is appended to the end of the array. - * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] - */ - toArray(): T[]; -} - -interface VBArrayConstructor { - new (safeArray: any): VBArray; - new (safeArray: any): VBArray; -} - -declare var VBArray: VBArrayConstructor; - -/** - * Automation date (VT_DATE) - */ -interface VarDate { } - -interface DateConstructor { - new (vd: VarDate): Date; -} - -interface Date { - getVarDate: () => VarDate; -} -/// - -interface DOMTokenList { - [Symbol.iterator](): IterableIterator; -} - -interface NodeList { - [Symbol.iterator](): IterableIterator -} - -interface NodeListOf { - [Symbol.iterator](): IterableIterator -} +///////////////////////////// +/// Windows Script Host APIS +///////////////////////////// + + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; + +interface ITextWriter { + Write(s: string): void; + WriteLine(s: string): void; + Close(): void; +} + +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + + /** + * The current line number in an input stream. + */ + Line: number; + + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; +} + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by + * a newline (under CScript.exe). + */ + Echo(s: any): void; + + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + + /** + * Fully qualified path of the host executable. + */ + FullName: string; + + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + + /** + * Path of the directory containing the host executable. + */ + Path: string; + + /** + * The filename of the currently running script. + */ + ScriptName: string; + + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + + /** + * Windows Script Host version + */ + Version: string; + + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. + * For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; + +/** + * Allows enumerating over a COM collection, which may not have indexed item access. + */ +interface Enumerator { + /** + * Returns true if the current item is the last one in the collection, or the collection is empty, + * or the current item is undefined. + */ + atEnd(): boolean; + + /** + * Returns the current item in the collection + */ + item(): T; + + /** + * Resets the current item in the collection to the first item. If there are no items in the collection, + * the current item is set to undefined. + */ + moveFirst(): void; + + /** + * Moves the current item to the next item in the collection. If the enumerator is at the end of + * the collection or the collection is empty, the current item is set to undefined. + */ + moveNext(): void; +} + +interface EnumeratorConstructor { + new (collection: any): Enumerator; + new (collection: any): Enumerator; +} + +declare var Enumerator: EnumeratorConstructor; + +/** + * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. + */ +interface VBArray { + /** + * Returns the number of dimensions (1-based). + */ + dimensions(): number; + + /** + * Takes an index for each dimension in the array, and returns the item at the corresponding location. + */ + getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; + + /** + * Returns the smallest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + lbound(dimension?: number): number; + + /** + * Returns the largest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + ubound(dimension?: number): number; + + /** + * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, + * each successive dimension is appended to the end of the array. + * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] + */ + toArray(): T[]; +} + +interface VBArrayConstructor { + new (safeArray: any): VBArray; + new (safeArray: any): VBArray; +} + +declare var VBArray: VBArrayConstructor; + +/** + * Automation date (VT_DATE) + */ +interface VarDate { } + +interface DateConstructor { + new (vd: VarDate): Date; +} + +interface Date { + getVarDate: () => VarDate; +} + + +/// + +interface DOMTokenList { + [Symbol.iterator](): IterableIterator; +} + +interface NodeList { + [Symbol.iterator](): IterableIterator +} + +interface NodeListOf { + [Symbol.iterator](): IterableIterator +} diff --git a/lib/lib.scripthost.d.ts b/lib/lib.scripthost.d.ts index 2d2f4df3b70..2be78dec994 100644 --- a/lib/lib.scripthost.d.ts +++ b/lib/lib.scripthost.d.ts @@ -1,311 +1,311 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// - - -///////////////////////////// -/// Windows Script Host APIS -///////////////////////////// - - -interface ActiveXObject { - new (s: string): any; -} -declare var ActiveXObject: ActiveXObject; - -interface ITextWriter { - Write(s: string): void; - WriteLine(s: string): void; - Close(): void; -} - -interface TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; - - /** - * The current line number in an input stream. - */ - Line: number; - - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; -} - -interface TextStreamWriter extends TextStreamBase { - /** - * Sends a string to an output stream. - */ - Write(s: string): void; - - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; - - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; -} - -interface TextStreamReader extends TextStreamBase { - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; - - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; - - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; - - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; - - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; - - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; - - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; -} - -declare var WScript: { - /** - * Outputs text to either a message box (under WScript.exe) or the command console window followed by - * a newline (under CScript.exe). - */ - Echo(s: any): void; - - /** - * Exposes the write-only error output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdErr: TextStreamWriter; - - /** - * Exposes the write-only output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdOut: TextStreamWriter; - Arguments: { length: number; Item(n: number): string; }; - - /** - * The full path of the currently running script. - */ - ScriptFullName: string; - - /** - * Forces the script to stop immediately, with an optional exit code. - */ - Quit(exitCode?: number): number; - - /** - * The Windows Script Host build version number. - */ - BuildVersion: number; - - /** - * Fully qualified path of the host executable. - */ - FullName: string; - - /** - * Gets/sets the script mode - interactive(true) or batch(false). - */ - Interactive: boolean; - - /** - * The name of the host executable (WScript.exe or CScript.exe). - */ - Name: string; - - /** - * Path of the directory containing the host executable. - */ - Path: string; - - /** - * The filename of the currently running script. - */ - ScriptName: string; - - /** - * Exposes the read-only input stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdIn: TextStreamReader; - - /** - * Windows Script Host version - */ - Version: string; - - /** - * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. - */ - ConnectObject(objEventSource: any, strPrefix: string): void; - - /** - * Creates a COM object. - * @param strProgiID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - CreateObject(strProgID: string, strPrefix?: string): any; - - /** - * Disconnects a COM object from its event sources. - */ - DisconnectObject(obj: any): void; - - /** - * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. - * @param strPathname Fully qualified path to the file containing the object persisted to disk. - * For objects in memory, pass a zero-length string. - * @param strProgID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; - - /** - * Suspends script execution for a specified length of time, then continues execution. - * @param intTime Interval (in milliseconds) to suspend script execution. - */ - Sleep(intTime: number): void; -}; - -/** - * Allows enumerating over a COM collection, which may not have indexed item access. - */ -interface Enumerator { - /** - * Returns true if the current item is the last one in the collection, or the collection is empty, - * or the current item is undefined. - */ - atEnd(): boolean; - - /** - * Returns the current item in the collection - */ - item(): T; - - /** - * Resets the current item in the collection to the first item. If there are no items in the collection, - * the current item is set to undefined. - */ - moveFirst(): void; - - /** - * Moves the current item to the next item in the collection. If the enumerator is at the end of - * the collection or the collection is empty, the current item is set to undefined. - */ - moveNext(): void; -} - -interface EnumeratorConstructor { - new (collection: any): Enumerator; - new (collection: any): Enumerator; -} - -declare var Enumerator: EnumeratorConstructor; - -/** - * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. - */ -interface VBArray { - /** - * Returns the number of dimensions (1-based). - */ - dimensions(): number; - - /** - * Takes an index for each dimension in the array, and returns the item at the corresponding location. - */ - getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; - - /** - * Returns the smallest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - lbound(dimension?: number): number; - - /** - * Returns the largest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - ubound(dimension?: number): number; - - /** - * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, - * each successive dimension is appended to the end of the array. - * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] - */ - toArray(): T[]; -} - -interface VBArrayConstructor { - new (safeArray: any): VBArray; - new (safeArray: any): VBArray; -} - -declare var VBArray: VBArrayConstructor; - -/** - * Automation date (VT_DATE) - */ -interface VarDate { } - -interface DateConstructor { - new (vd: VarDate): Date; -} - -interface Date { - getVarDate: () => VarDate; -} + + +///////////////////////////// +/// Windows Script Host APIS +///////////////////////////// + + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; + +interface ITextWriter { + Write(s: string): void; + WriteLine(s: string): void; + Close(): void; +} + +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + + /** + * The current line number in an input stream. + */ + Line: number; + + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; +} + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by + * a newline (under CScript.exe). + */ + Echo(s: any): void; + + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + + /** + * Fully qualified path of the host executable. + */ + FullName: string; + + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + + /** + * Path of the directory containing the host executable. + */ + Path: string; + + /** + * The filename of the currently running script. + */ + ScriptName: string; + + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + + /** + * Windows Script Host version + */ + Version: string; + + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. + * For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; + +/** + * Allows enumerating over a COM collection, which may not have indexed item access. + */ +interface Enumerator { + /** + * Returns true if the current item is the last one in the collection, or the collection is empty, + * or the current item is undefined. + */ + atEnd(): boolean; + + /** + * Returns the current item in the collection + */ + item(): T; + + /** + * Resets the current item in the collection to the first item. If there are no items in the collection, + * the current item is set to undefined. + */ + moveFirst(): void; + + /** + * Moves the current item to the next item in the collection. If the enumerator is at the end of + * the collection or the collection is empty, the current item is set to undefined. + */ + moveNext(): void; +} + +interface EnumeratorConstructor { + new (collection: any): Enumerator; + new (collection: any): Enumerator; +} + +declare var Enumerator: EnumeratorConstructor; + +/** + * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. + */ +interface VBArray { + /** + * Returns the number of dimensions (1-based). + */ + dimensions(): number; + + /** + * Takes an index for each dimension in the array, and returns the item at the corresponding location. + */ + getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; + + /** + * Returns the smallest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + lbound(dimension?: number): number; + + /** + * Returns the largest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + ubound(dimension?: number): number; + + /** + * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, + * each successive dimension is appended to the end of the array. + * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] + */ + toArray(): T[]; +} + +interface VBArrayConstructor { + new (safeArray: any): VBArray; + new (safeArray: any): VBArray; +} + +declare var VBArray: VBArrayConstructor; + +/** + * Automation date (VT_DATE) + */ +interface VarDate { } + +interface DateConstructor { + new (vd: VarDate): Date; +} + +interface Date { + getVarDate: () => VarDate; +} diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index cef348959e2..b505b17a0d1 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -1,1226 +1,1226 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ -/// + +/// - -///////////////////////////// -/// IE Worker APIs -///////////////////////////// - -interface Algorithm { - name: string; -} - -interface EventInit { - bubbles?: boolean; - cancelable?: boolean; -} - -interface IDBIndexParameters { - multiEntry?: boolean; - unique?: boolean; -} - -interface IDBObjectStoreParameters { - autoIncrement?: boolean; - keyPath?: IDBKeyPath; -} - -interface KeyAlgorithm { - name?: string; -} - -interface EventListener { - (evt: Event): void; -} - -interface AudioBuffer { - readonly duration: number; - readonly length: number; - readonly numberOfChannels: number; - readonly sampleRate: number; - copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; - copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(): AudioBuffer; -} - -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface CloseEvent extends Event { - readonly code: number; - readonly reason: string; - readonly wasClean: boolean; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(): CloseEvent; -} - -interface Console { - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - clear(): void; - count(countTitle?: string): void; - debug(message?: string, ...optionalParams: any[]): void; - dir(value?: any, ...optionalParams: any[]): void; - dirxml(value: any): void; - error(message?: any, ...optionalParams: any[]): void; - exception(message?: string, ...optionalParams: any[]): void; - group(groupTitle?: string): void; - groupCollapsed(groupTitle?: string): void; - groupEnd(): void; - info(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: any): boolean; - profile(reportName?: string): void; - profileEnd(): void; - select(element: any): void; - table(...data: any[]): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(message?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; -} - -declare var Console: { - prototype: Console; - new(): Console; -} - -interface Coordinates { - readonly accuracy: number; - readonly altitude: number | null; - readonly altitudeAccuracy: number | null; - readonly heading: number | null; - readonly latitude: number; - readonly longitude: number; - readonly speed: number | null; -} - -declare var Coordinates: { - prototype: Coordinates; - new(): Coordinates; -} - -interface CryptoKey { - readonly algorithm: KeyAlgorithm; - readonly extractable: boolean; - readonly type: string; - readonly usages: string[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -} - -interface DOMError { - readonly name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -} - -interface DOMException { - readonly code: number; - readonly message: string; - readonly name: string; - toString(): string; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(): DOMException; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -interface DOMStringList { - readonly length: number; - contains(str: string): boolean; - item(index: number): string | null; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -} - -interface ErrorEvent extends Event { - readonly colno: number; - readonly error: any; - readonly filename: string; - readonly lineno: number; - readonly message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(): ErrorEvent; -} - -interface Event { - readonly bubbles: boolean; - cancelBubble: boolean; - readonly cancelable: boolean; - readonly currentTarget: EventTarget; - readonly defaultPrevented: boolean; - readonly eventPhase: number; - readonly isTrusted: boolean; - returnValue: boolean; - readonly srcElement: any; - readonly target: EventTarget; - readonly timeStamp: number; - readonly type: string; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - preventDefault(): void; - stopImmediatePropagation(): void; - stopPropagation(): void; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -interface EventTarget { - addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -} - -interface File extends Blob { - readonly lastModifiedDate: any; - readonly name: string; - readonly webkitRelativePath: string; -} - -declare var File: { - prototype: File; - new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; -} - -interface FileList { - readonly length: number; - item(index: number): File; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -} - -interface FileReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; -} - -interface IDBCursor { - readonly direction: string; - key: IDBKeyRange | IDBValidKey; - readonly primaryKey: any; - source: IDBObjectStore | IDBIndex; - advance(count: number): void; - continue(key?: IDBKeyRange | IDBValidKey): void; - delete(): IDBRequest; - update(value: any): IDBRequest; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -declare var IDBCursor: { - prototype: IDBCursor; - new(): IDBCursor; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -interface IDBCursorWithValue extends IDBCursor { - readonly value: any; -} - -declare var IDBCursorWithValue: { - prototype: IDBCursorWithValue; - new(): IDBCursorWithValue; -} - -interface IDBDatabase extends EventTarget { - readonly name: string; - readonly objectStoreNames: DOMStringList; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - version: number; - onversionchange: (ev: IDBVersionChangeEvent) => any; - close(): void; - createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; - deleteObjectStore(name: string): void; - transaction(storeNames: string | string[], mode?: string): IDBTransaction; - addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBDatabase: { - prototype: IDBDatabase; - new(): IDBDatabase; -} - -interface IDBFactory { - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; - open(name: string, version?: number): IDBOpenDBRequest; -} - -declare var IDBFactory: { - prototype: IDBFactory; - new(): IDBFactory; -} - -interface IDBIndex { - keyPath: string | string[]; - readonly name: string; - readonly objectStore: IDBObjectStore; - readonly unique: boolean; - multiEntry: boolean; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - get(key: IDBKeyRange | IDBValidKey): IDBRequest; - getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; -} - -declare var IDBIndex: { - prototype: IDBIndex; - new(): IDBIndex; -} - -interface IDBKeyRange { - readonly lower: any; - readonly lowerOpen: boolean; - readonly upper: any; - readonly upperOpen: boolean; -} - -declare var IDBKeyRange: { - prototype: IDBKeyRange; - new(): IDBKeyRange; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(lower: any, open?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - upperBound(upper: any, open?: boolean): IDBKeyRange; -} - -interface IDBObjectStore { - readonly indexNames: DOMStringList; - keyPath: string | string[]; - readonly name: string; - readonly transaction: IDBTransaction; - autoIncrement: boolean; - add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; - clear(): IDBRequest; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: IDBKeyRange | IDBValidKey): IDBRequest; - deleteIndex(indexName: string): void; - get(key: any): IDBRequest; - index(name: string): IDBIndex; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; -} - -declare var IDBObjectStore: { - prototype: IDBObjectStore; - new(): IDBObjectStore; -} - -interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: this, ev: Event) => any; - onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; - addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBOpenDBRequest: { - prototype: IDBOpenDBRequest; - new(): IDBOpenDBRequest; -} - -interface IDBRequest extends EventTarget { - readonly error: DOMError; - onerror: (this: this, ev: ErrorEvent) => any; - onsuccess: (this: this, ev: Event) => any; - readonly readyState: string; - readonly result: any; - source: IDBObjectStore | IDBIndex | IDBCursor; - readonly transaction: IDBTransaction; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBRequest: { - prototype: IDBRequest; - new(): IDBRequest; -} - -interface IDBTransaction extends EventTarget { - readonly db: IDBDatabase; - readonly error: DOMError; - readonly mode: string; - onabort: (this: this, ev: Event) => any; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBTransaction: { - prototype: IDBTransaction; - new(): IDBTransaction; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; -} - -interface IDBVersionChangeEvent extends Event { - readonly newVersion: number | null; - readonly oldVersion: number; -} - -declare var IDBVersionChangeEvent: { - prototype: IDBVersionChangeEvent; - new(): IDBVersionChangeEvent; -} - -interface ImageData { - data: Uint8ClampedArray; - readonly height: number; - readonly width: number; -} - -declare var ImageData: { - prototype: ImageData; - new(width: number, height: number): ImageData; - new(array: Uint8ClampedArray, width: number, height: number): ImageData; -} - -interface MSApp { - clearTemporaryWebDataAsync(): MSAppAsyncOperation; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createDataPackage(object: any): any; - createDataPackageFromSelection(): any; - createFileFromStorageFile(storageFile: any): File; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; - getViewId(view: any): any; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - pageHandlesAllApplicationActivations(enabled: boolean): void; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - terminateApp(exceptionObject: any): void; - readonly CURRENT: string; - readonly HIGH: string; - readonly IDLE: string; - readonly NORMAL: string; -} -declare var MSApp: MSApp; - -interface MSAppAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSAppAsyncOperation: { - prototype: MSAppAsyncOperation; - new(): MSAppAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} - -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new(): MSBlobBuilder; -} - -interface MSStream { - readonly type: string; - msClose(): void; - msDetachStream(): any; -} - -declare var MSStream: { - prototype: MSStream; - new(): MSStream; -} - -interface MSStreamReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBinaryString(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSStreamReader: { - prototype: MSStreamReader; - new(): MSStreamReader; -} - -interface MediaQueryList { - readonly matches: boolean; - readonly media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -declare var MediaQueryList: { - prototype: MediaQueryList; - new(): MediaQueryList; -} - -interface MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; -} - -declare var MessageChannel: { - prototype: MessageChannel; - new(): MessageChannel; -} - -interface MessageEvent extends Event { - readonly data: any; - readonly origin: string; - readonly ports: any; - readonly source: any; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: any): void; -} - -declare var MessageEvent: { - prototype: MessageEvent; - new(type: string, eventInitDict?: MessageEventInit): MessageEvent; -} - -interface MessagePort extends EventTarget { - onmessage: (this: this, ev: MessageEvent) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MessagePort: { - prototype: MessagePort; - new(): MessagePort; -} - -interface Position { - readonly coords: Coordinates; - readonly timestamp: number; -} - -declare var Position: { - prototype: Position; - new(): Position; -} - -interface PositionError { - readonly code: number; - readonly message: string; - toString(): string; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -declare var PositionError: { - prototype: PositionError; - new(): PositionError; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -interface ProgressEvent extends Event { - readonly lengthComputable: boolean; - readonly loaded: number; - readonly total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -declare var ProgressEvent: { - prototype: ProgressEvent; - new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; -} - -interface WebSocket extends EventTarget { - binaryType: string; - readonly bufferedAmount: number; - readonly extensions: string; - onclose: (this: this, ev: CloseEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onopen: (this: this, ev: Event) => any; - readonly protocol: string; - readonly readyState: number; - readonly url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WebSocket: { - prototype: WebSocket; - new(url: string, protocols?: string | string[]): WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; -} - -interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: this, ev: MessageEvent) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Worker: { - prototype: Worker; - new(stringUrl: string): Worker; -} - -interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: this, ev: Event) => any; - readonly readyState: number; - readonly response: any; - readonly responseText: string; - responseType: string; - readonly responseXML: any; - readonly status: number; - readonly statusText: string; - timeout: number; - readonly upload: XMLHttpRequestUpload; - withCredentials: boolean; - msCaching?: string; - readonly responseURL: string; - abort(): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string | null; - msCachingEnabled(): boolean; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - overrideMimeType(mime: string): void; - send(data?: string): void; - send(data?: any): void; - setRequestHeader(header: string, value: string): void; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - 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: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", 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; -} - -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new(): XMLHttpRequest; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - create(): XMLHttpRequest; -} - -interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequestUpload: { - prototype: XMLHttpRequestUpload; - new(): XMLHttpRequestUpload; -} - -interface AbstractWorker { - onerror: (this: this, ev: ErrorEvent) => any; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface MSBaseReader { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - readonly readyState: number; - readonly result: any; - abort(): void; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface NavigatorID { - readonly appName: string; - readonly appVersion: string; - readonly platform: string; - readonly product: string; - readonly productSub: string; - readonly userAgent: string; - readonly vendor: string; - readonly vendorSub: string; -} - -interface NavigatorOnLine { - readonly onLine: boolean; -} - -interface WindowBase64 { - atob(encodedString: string): string; - btoa(rawString: string): string; -} - -interface WindowConsole { - readonly console: Console; -} - -interface XMLHttpRequestEventTarget { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - ontimeout: (this: this, ev: ProgressEvent) => any; - 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface FileReaderSync { - readAsArrayBuffer(blob: Blob): any; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): string; - readAsText(blob: Blob, encoding?: string): string; -} - -declare var FileReaderSync: { - prototype: FileReaderSync; - new(): FileReaderSync; -} - -interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole { - readonly location: WorkerLocation; - onerror: (this: this, ev: ErrorEvent) => any; - readonly self: WorkerGlobalScope; - close(): void; - msWriteProfilerMark(profilerMarkName: string): void; - toString(): string; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WorkerGlobalScope: { - prototype: WorkerGlobalScope; - new(): WorkerGlobalScope; -} - -interface WorkerLocation { - readonly hash: string; - readonly host: string; - readonly hostname: string; - readonly href: string; - readonly pathname: string; - readonly port: string; - readonly protocol: string; - readonly search: string; - toString(): string; -} - -declare var WorkerLocation: { - prototype: WorkerLocation; - new(): WorkerLocation; -} - -interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine { - readonly hardwareConcurrency: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WorkerNavigator: { - prototype: WorkerNavigator; - new(): WorkerNavigator; -} - -interface DedicatedWorkerGlobalScope { - onmessage: (this: this, ev: MessageEvent) => any; - postMessage(data: any): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface WorkerUtils extends Object, WindowBase64 { - readonly indexedDB: IDBFactory; - readonly msIndexedDB: IDBFactory; - readonly navigator: WorkerNavigator; - clearImmediate(handle: number): void; - clearInterval(handle: number): void; - clearTimeout(handle: number): void; - importScripts(...urls: string[]): void; - setImmediate(handler: (...args: any[]) => void): number; - setImmediate(handler: any, ...args: any[]): number; - setInterval(handler: (...args: any[]) => void, timeout: number): number; - setInterval(handler: any, timeout?: any, ...args: any[]): number; - setTimeout(handler: (...args: any[]) => void, timeout: number): number; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface FilePropertyBag { - type?: string; - lastModified?: number; -} - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface MessageEventInit extends EventInit { - data?: any; - origin?: string; - lastEventId?: string; - channel?: string; - source?: any; - ports?: MessagePort[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - total?: number; -} - -interface IDBArrayKey extends Array { -} - -interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: AlgorithmIdentifier; -} - -interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: AlgorithmIdentifier; -} - -interface RsaHashedImportParams { - hash: AlgorithmIdentifier; -} - -interface RsaPssParams { - saltLength: number; -} - -interface RsaOaepParams extends Algorithm { - label?: BufferSource; -} - -interface EcdsaParams extends Algorithm { - hash: AlgorithmIdentifier; -} - -interface EcKeyGenParams extends Algorithm { - namedCurve: string; -} - -interface EcKeyAlgorithm extends KeyAlgorithm { - typedCurve: string; -} - -interface EcKeyImportParams { - namedCurve: string; -} - -interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; -} - -interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; -} - -interface AesKeyGenParams extends Algorithm { - length: number; -} - -interface AesDerivedKeyParams extends Algorithm { - length: number; -} - -interface AesCbcParams extends Algorithm { - iv: BufferSource; -} - -interface AesCmacParams extends Algorithm { - length: number; -} - -interface AesGcmParams extends Algorithm { - iv: BufferSource; - additionalData?: BufferSource; - tagLength?: number; -} - -interface AesCfbParams extends Algorithm { - iv: BufferSource; -} - -interface HmacImportParams extends Algorithm { - hash?: AlgorithmIdentifier; - length?: number; -} - -interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: AlgorithmIdentifier; - length: number; -} - -interface HmacKeyGenParams extends Algorithm { - hash: AlgorithmIdentifier; - length?: number; -} - -interface DhKeyGenParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyAlgorithm extends KeyAlgorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface DhImportKeyParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface ConcatParams extends Algorithm { - hash?: AlgorithmIdentifier; - algorithmId: Uint8Array; - partyUInfo: Uint8Array; - partyVInfo: Uint8Array; - publicInfo?: Uint8Array; - privateInfo?: Uint8Array; -} - -interface HkdfCtrParams extends Algorithm { - hash: AlgorithmIdentifier; - label: BufferSource; - context: BufferSource; -} - -interface Pbkdf2Params extends Algorithm { - salt: BufferSource; - iterations: number; - hash: AlgorithmIdentifier; -} - -interface RsaOtherPrimesInfo { - r: string; - d: string; - t: string; -} - -interface JsonWebKey { - kty: string; - use?: string; - key_ops?: string[]; - alg?: string; - kid?: string; - x5u?: string; - x5c?: string; - x5t?: string; - ext?: boolean; - crv?: string; - x?: string; - y?: string; - d?: string; - n?: string; - e?: string; - p?: string; - q?: string; - dp?: string; - dq?: string; - qi?: string; - oth?: RsaOtherPrimesInfo[]; - k?: string; -} - -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - -interface ErrorEventHandler { - (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; -} -interface PositionCallback { - (position: Position): void; -} -interface PositionErrorCallback { - (error: PositionError): void; -} -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} -interface MSLaunchUriCallback { - (): void; -} -interface MSUnsafeFunctionCallback { - (): any; -} -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} -interface DecodeSuccessCallback { - (decodedData: AudioBuffer): void; -} -interface DecodeErrorCallback { - (error: DOMException): void; -} -interface FunctionStringCallback { - (data: string): void; -} -declare var location: WorkerLocation; -declare var onerror: (this: WorkerGlobalScope, ev: ErrorEvent) => any; -declare var self: WorkerGlobalScope; -declare function close(): void; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function toString(): string; -declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare var indexedDB: IDBFactory; -declare var msIndexedDB: IDBFactory; -declare var navigator: WorkerNavigator; -declare function clearImmediate(handle: number): void; -declare function clearInterval(handle: number): void; -declare function clearTimeout(handle: number): void; -declare function importScripts(...urls: string[]): void; -declare function setImmediate(handler: (...args: any[]) => void): number; -declare function setImmediate(handler: any, ...args: any[]): number; -declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; -declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function atob(encodedString: string): string; -declare function btoa(rawString: string): string; -declare var onmessage: (this: WorkerGlobalScope, ev: MessageEvent) => any; -declare function postMessage(data: any): void; -declare var console: Console; -declare function addEventListener(type: "error", listener: (this: WorkerGlobalScope, ev: ErrorEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "message", listener: (this: WorkerGlobalScope, ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -type AlgorithmIdentifier = string | Algorithm; -type IDBKeyPath = string; -type IDBValidKey = number | string | Date | IDBArrayKey; + +///////////////////////////// +/// IE Worker APIs +///////////////////////////// + +interface Algorithm { + name: string; +} + +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; +} + +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + +interface KeyAlgorithm { + name?: string; +} + +interface EventListener { + (evt: Event): void; +} + +interface AudioBuffer { + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; + getChannelData(channel: number): Float32Array; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(): AudioBuffer; +} + +interface Blob { + readonly size: number; + readonly type: string; + msClose(): void; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; +} + +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface CloseEvent extends Event { + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} + +declare var CloseEvent: { + prototype: CloseEvent; + new(): CloseEvent; +} + +interface Console { + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + clear(): void; + count(countTitle?: string): void; + debug(message?: string, ...optionalParams: any[]): void; + dir(value?: any, ...optionalParams: any[]): void; + dirxml(value: any): void; + error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; + group(groupTitle?: string): void; + groupCollapsed(groupTitle?: string): void; + groupEnd(): void; + info(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: any): boolean; + profile(reportName?: string): void; + profileEnd(): void; + select(element: any): void; + table(...data: any[]): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; +} + +declare var Console: { + prototype: Console; + new(): Console; +} + +interface Coordinates { + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; +} + +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface CryptoKey { + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; +} + +declare var CryptoKey: { + prototype: CryptoKey; + new(): CryptoKey; +} + +interface DOMError { + readonly name: string; + toString(): string; +} + +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface DOMException { + readonly code: number; + readonly message: string; + readonly name: string; + toString(): string; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +interface DOMStringList { + readonly length: number; + contains(str: string): boolean; + item(index: number): string | null; + [index: number]: string; +} + +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface ErrorEvent extends Event { + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} + +declare var ErrorEvent: { + prototype: ErrorEvent; + new(): ErrorEvent; +} + +interface Event { + readonly bubbles: boolean; + cancelBubble: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; + returnValue: boolean; + readonly srcElement: any; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + preventDefault(): void; + stopImmediatePropagation(): void; + stopPropagation(): void; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +declare var Event: { + prototype: Event; + new(type: string, eventInitDict?: EventInit): Event; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +interface EventTarget { + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; + dispatchEvent(evt: Event): boolean; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var EventTarget: { + prototype: EventTarget; + new(): EventTarget; +} + +interface File extends Blob { + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; +} + +declare var File: { + prototype: File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; +} + +interface FileList { + readonly length: number; + item(index: number): File; + [index: number]: File; +} + +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface FileReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface IDBCursor { + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; + advance(count: number): void; + continue(key?: IDBKeyRange | IDBValidKey): void; + delete(): IDBRequest; + update(value: any): IDBRequest; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +interface IDBCursorWithValue extends IDBCursor { + readonly value: any; +} + +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface IDBDatabase extends EventTarget { + readonly name: string; + readonly objectStoreNames: DOMStringList; + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; + close(): void; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; + deleteObjectStore(name: string): void; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + 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: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface IDBFactory { + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; + open(name: string, version?: number): IDBOpenDBRequest; +} + +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface IDBIndex { + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; +} + +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface IDBKeyRange { + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; +} + +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; +} + +interface IDBObjectStore { + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; + clear(): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; + deleteIndex(indexName: string): void; + get(key: any): IDBRequest; + index(name: string): IDBIndex; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; +} + +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface IDBOpenDBRequest extends IDBRequest { + onblocked: (this: this, ev: Event) => any; + onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; + addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface IDBRequest extends EventTarget { + readonly error: DOMError; + onerror: (this: this, ev: ErrorEvent) => any; + onsuccess: (this: this, ev: Event) => any; + readonly readyState: string; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface IDBTransaction extends EventTarget { + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; + onabort: (this: this, ev: Event) => any; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; + addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; +} + +interface IDBVersionChangeEvent extends Event { + readonly newVersion: number | null; + readonly oldVersion: number; +} + +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface ImageData { + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; +} + +declare var ImageData: { + prototype: ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; +} + +interface MSApp { + clearTemporaryWebDataAsync(): MSAppAsyncOperation; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createDataPackage(object: any): any; + createDataPackageFromSelection(): any; + createFileFromStorageFile(storageFile: any): File; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + getCurrentPriority(): string; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; + getViewId(view: any): any; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + pageHandlesAllApplicationActivations(enabled: boolean): void; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + terminateApp(exceptionObject: any): void; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; +} +declare var MSApp: MSApp; + +interface MSAppAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + readonly readyState: number; + readonly result: any; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSAppAsyncOperation: { + prototype: MSAppAsyncOperation; + new(): MSAppAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} + +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface MSStream { + readonly type: string; + msClose(): void; + msDetachStream(): any; +} + +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSStreamReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBinaryString(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface MediaQueryList { + readonly matches: boolean; + readonly media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} + +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + +interface MessageChannel { + readonly port1: MessagePort; + readonly port2: MessagePort; +} + +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface MessageEvent extends Event { + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: any; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: any): void; +} + +declare var MessageEvent: { + prototype: MessageEvent; + new(type: string, eventInitDict?: MessageEventInit): MessageEvent; +} + +interface MessagePort extends EventTarget { + onmessage: (this: this, ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, ports?: any): void; + start(): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface Position { + readonly coords: Coordinates; + readonly timestamp: number; +} + +declare var Position: { + prototype: Position; + new(): Position; +} + +interface PositionError { + readonly code: number; + readonly message: string; + toString(): string; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +interface ProgressEvent extends Event { + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} + +declare var ProgressEvent: { + prototype: ProgressEvent; + new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; +} + +interface WebSocket extends EventTarget { + binaryType: string; + readonly bufferedAmount: number; + readonly extensions: string; + onclose: (this: this, ev: CloseEvent) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onmessage: (this: this, ev: MessageEvent) => any; + onopen: (this: this, ev: Event) => any; + readonly protocol: string; + readonly readyState: number; + readonly url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; + addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string | string[]): WebSocket; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; +} + +interface Worker extends EventTarget, AbstractWorker { + onmessage: (this: this, ev: MessageEvent) => any; + postMessage(message: any, ports?: any): void; + terminate(): void; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { + onreadystatechange: (this: this, ev: Event) => any; + readonly readyState: number; + readonly response: any; + readonly responseText: string; + responseType: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; + timeout: number; + readonly upload: XMLHttpRequestUpload; + withCredentials: boolean; + msCaching?: string; + readonly responseURL: string; + abort(): void; + getAllResponseHeaders(): string; + getResponseHeader(header: string): string | null; + msCachingEnabled(): boolean; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + overrideMimeType(mime: string): void; + send(data?: string): void; + send(data?: any): void; + setRequestHeader(header: string, value: string): void; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + 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: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "progress", 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; +} + +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + create(): XMLHttpRequest; +} + +interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequestUpload: { + prototype: XMLHttpRequestUpload; + new(): XMLHttpRequestUpload; +} + +interface AbstractWorker { + onerror: (this: this, ev: ErrorEvent) => any; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface MSBaseReader { + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + onloadend: (this: this, ev: ProgressEvent) => any; + onloadstart: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + readonly readyState: number; + readonly result: any; + abort(): void; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface NavigatorID { + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; +} + +interface NavigatorOnLine { + readonly onLine: boolean; +} + +interface WindowBase64 { + atob(encodedString: string): string; + btoa(rawString: string): string; +} + +interface WindowConsole { + readonly console: Console; +} + +interface XMLHttpRequestEventTarget { + onabort: (this: this, ev: Event) => any; + onerror: (this: this, ev: ErrorEvent) => any; + onload: (this: this, ev: Event) => any; + onloadend: (this: this, ev: ProgressEvent) => any; + onloadstart: (this: this, ev: Event) => any; + onprogress: (this: this, ev: ProgressEvent) => any; + ontimeout: (this: this, ev: ProgressEvent) => any; + 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface FileReaderSync { + readAsArrayBuffer(blob: Blob): any; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): string; + readAsText(blob: Blob, encoding?: string): string; +} + +declare var FileReaderSync: { + prototype: FileReaderSync; + new(): FileReaderSync; +} + +interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole { + readonly location: WorkerLocation; + onerror: (this: this, ev: ErrorEvent) => any; + readonly self: WorkerGlobalScope; + close(): void; + msWriteProfilerMark(profilerMarkName: string): void; + toString(): string; + addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WorkerGlobalScope: { + prototype: WorkerGlobalScope; + new(): WorkerGlobalScope; +} + +interface WorkerLocation { + readonly hash: string; + readonly host: string; + readonly hostname: string; + readonly href: string; + readonly pathname: string; + readonly port: string; + readonly protocol: string; + readonly search: string; + toString(): string; +} + +declare var WorkerLocation: { + prototype: WorkerLocation; + new(): WorkerLocation; +} + +interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine { + readonly hardwareConcurrency: number; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WorkerNavigator: { + prototype: WorkerNavigator; + new(): WorkerNavigator; +} + +interface DedicatedWorkerGlobalScope { + onmessage: (this: this, ev: MessageEvent) => any; + postMessage(data: any): void; + addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface WorkerUtils extends Object, WindowBase64 { + readonly indexedDB: IDBFactory; + readonly msIndexedDB: IDBFactory; + readonly navigator: WorkerNavigator; + clearImmediate(handle: number): void; + clearInterval(handle: number): void; + clearTimeout(handle: number): void; + importScripts(...urls: string[]): void; + setImmediate(handler: (...args: any[]) => void): number; + setImmediate(handler: any, ...args: any[]): number; + setInterval(handler: (...args: any[]) => void, timeout: number): number; + setInterval(handler: any, timeout?: any, ...args: any[]): number; + setTimeout(handler: (...args: any[]) => void, timeout: number): number; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + +interface EventListenerObject { + handleEvent(evt: Event): void; +} + +interface MessageEventInit extends EventInit { + data?: any; + origin?: string; + lastEventId?: string; + channel?: string; + source?: any; + ports?: MessagePort[]; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +interface IDBArrayKey extends Array { +} + +interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: AlgorithmIdentifier; +} + +interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: AlgorithmIdentifier; +} + +interface RsaHashedImportParams { + hash: AlgorithmIdentifier; +} + +interface RsaPssParams { + saltLength: number; +} + +interface RsaOaepParams extends Algorithm { + label?: BufferSource; +} + +interface EcdsaParams extends Algorithm { + hash: AlgorithmIdentifier; +} + +interface EcKeyGenParams extends Algorithm { + namedCurve: string; +} + +interface EcKeyAlgorithm extends KeyAlgorithm { + typedCurve: string; +} + +interface EcKeyImportParams { + namedCurve: string; +} + +interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; +} + +interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +interface AesKeyGenParams extends Algorithm { + length: number; +} + +interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +interface AesCbcParams extends Algorithm { + iv: BufferSource; +} + +interface AesCmacParams extends Algorithm { + length: number; +} + +interface AesGcmParams extends Algorithm { + iv: BufferSource; + additionalData?: BufferSource; + tagLength?: number; +} + +interface AesCfbParams extends Algorithm { + iv: BufferSource; +} + +interface HmacImportParams extends Algorithm { + hash?: AlgorithmIdentifier; + length?: number; +} + +interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: AlgorithmIdentifier; + length: number; +} + +interface HmacKeyGenParams extends Algorithm { + hash: AlgorithmIdentifier; + length?: number; +} + +interface DhKeyGenParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyAlgorithm extends KeyAlgorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface DhImportKeyParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface ConcatParams extends Algorithm { + hash?: AlgorithmIdentifier; + algorithmId: Uint8Array; + partyUInfo: Uint8Array; + partyVInfo: Uint8Array; + publicInfo?: Uint8Array; + privateInfo?: Uint8Array; +} + +interface HkdfCtrParams extends Algorithm { + hash: AlgorithmIdentifier; + label: BufferSource; + context: BufferSource; +} + +interface Pbkdf2Params extends Algorithm { + salt: BufferSource; + iterations: number; + hash: AlgorithmIdentifier; +} + +interface RsaOtherPrimesInfo { + r: string; + d: string; + t: string; +} + +interface JsonWebKey { + kty: string; + use?: string; + key_ops?: string[]; + alg?: string; + kid?: string; + x5u?: string; + x5c?: string; + x5t?: string; + ext?: boolean; + crv?: string; + x?: string; + y?: string; + d?: string; + n?: string; + e?: string; + p?: string; + q?: string; + dp?: string; + dq?: string; + qi?: string; + oth?: RsaOtherPrimesInfo[]; + k?: string; +} + +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + +interface ErrorEventHandler { + (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; +} +interface PositionCallback { + (position: Position): void; +} +interface PositionErrorCallback { + (error: PositionError): void; +} +interface MediaQueryListListener { + (mql: MediaQueryList): void; +} +interface MSLaunchUriCallback { + (): void; +} +interface MSUnsafeFunctionCallback { + (): any; +} +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} +interface DecodeSuccessCallback { + (decodedData: AudioBuffer): void; +} +interface DecodeErrorCallback { + (error: DOMException): void; +} +interface FunctionStringCallback { + (data: string): void; +} +declare var location: WorkerLocation; +declare var onerror: (this: WorkerGlobalScope, ev: ErrorEvent) => any; +declare var self: WorkerGlobalScope; +declare function close(): void; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function toString(): string; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function dispatchEvent(evt: Event): boolean; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare var indexedDB: IDBFactory; +declare var msIndexedDB: IDBFactory; +declare var navigator: WorkerNavigator; +declare function clearImmediate(handle: number): void; +declare function clearInterval(handle: number): void; +declare function clearTimeout(handle: number): void; +declare function importScripts(...urls: string[]): void; +declare function setImmediate(handler: (...args: any[]) => void): number; +declare function setImmediate(handler: any, ...args: any[]): number; +declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function atob(encodedString: string): string; +declare function btoa(rawString: string): string; +declare var onmessage: (this: WorkerGlobalScope, ev: MessageEvent) => any; +declare function postMessage(data: any): void; +declare var console: Console; +declare function addEventListener(type: "error", listener: (this: WorkerGlobalScope, ev: ErrorEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "message", listener: (this: WorkerGlobalScope, ev: MessageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AlgorithmIdentifier = string | Algorithm; +type IDBKeyPath = string; +type IDBValidKey = number | string | Date | IDBArrayKey; type BufferSource = ArrayBuffer | ArrayBufferView; \ No newline at end of file diff --git a/lib/protocol.d.ts b/lib/protocol.d.ts index 0d5c5fbfc0e..855a4f5fe00 100644 --- a/lib/protocol.d.ts +++ b/lib/protocol.d.ts @@ -1,1769 +1,1769 @@ -/** - * Declaration module describing the TypeScript Server protocol - */ -declare namespace ts.server.protocol { - namespace CommandTypes { - type Brace = "brace"; - type BraceCompletion = "braceCompletion"; - type Change = "change"; - type Close = "close"; - type Completions = "completions"; - type CompletionDetails = "completionEntryDetails"; - type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList"; - type CompileOnSaveEmitFile = "compileOnSaveEmitFile"; - type Configure = "configure"; - type Definition = "definition"; - type Implementation = "implementation"; - type Exit = "exit"; - type Format = "format"; - type Formatonkey = "formatonkey"; - type Geterr = "geterr"; - type GeterrForProject = "geterrForProject"; - type SemanticDiagnosticsSync = "semanticDiagnosticsSync"; - type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync"; - type NavBar = "navbar"; - type Navto = "navto"; - type NavTree = "navtree"; - type NavTreeFull = "navtree-full"; - type Occurrences = "occurrences"; - type DocumentHighlights = "documentHighlights"; - type Open = "open"; - type Quickinfo = "quickinfo"; - type References = "references"; - type Reload = "reload"; - type Rename = "rename"; - type Saveto = "saveto"; - type SignatureHelp = "signatureHelp"; - type TypeDefinition = "typeDefinition"; - type ProjectInfo = "projectInfo"; - type ReloadProjects = "reloadProjects"; - type Unknown = "unknown"; - type OpenExternalProject = "openExternalProject"; - type OpenExternalProjects = "openExternalProjects"; - type CloseExternalProject = "closeExternalProject"; - type TodoComments = "todoComments"; - type Indentation = "indentation"; - type DocCommentTemplate = "docCommentTemplate"; - type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; - type GetCodeFixes = "getCodeFixes"; - type GetSupportedCodeFixes = "getSupportedCodeFixes"; - } - /** - * A TypeScript Server message - */ - interface Message { - /** - * Sequence number of the message - */ - seq: number; - /** - * One of "request", "response", or "event" - */ - type: "request" | "response" | "event"; - } - /** - * Client-initiated request message - */ - interface Request extends Message { - /** - * The command to execute - */ - command: string; - /** - * Object containing arguments for the command - */ - arguments?: any; - } - /** - * Request to reload the project structure for all the opened files - */ - interface ReloadProjectsRequest extends Message { - command: CommandTypes.ReloadProjects; - } - /** - * Server-initiated event message - */ - interface Event extends Message { - /** - * Name of event - */ - event: string; - /** - * Event-specific information - */ - body?: any; - } - /** - * Response by server to client request message. - */ - interface Response extends Message { - /** - * Sequence number of the request message. - */ - request_seq: number; - /** - * Outcome of the request. - */ - success: boolean; - /** - * The command requested. - */ - command: string; - /** - * Contains error message if success === false. - */ - message?: string; - /** - * Contains message body if success === true. - */ - body?: any; - } - /** - * Arguments for FileRequest messages. - */ - interface FileRequestArgs { - /** - * The file for the request (absolute pathname required). - */ - file: string; - projectFileName?: string; - } - /** - * Requests a JS Doc comment template for a given position - */ - interface DocCommentTemplateRequest extends FileLocationRequest { - command: CommandTypes.DocCommentTemplate; - } - /** - * Response to DocCommentTemplateRequest - */ - interface DocCommandTemplateResponse extends Response { - body?: TextInsertion; - } - /** - * A request to get TODO comments from the file - */ - interface TodoCommentRequest extends FileRequest { - command: CommandTypes.TodoComments; - arguments: TodoCommentRequestArgs; - } - /** - * Arguments for TodoCommentRequest request. - */ - interface TodoCommentRequestArgs extends FileRequestArgs { - /** - * Array of target TodoCommentDescriptors that describes TODO comments to be found - */ - descriptors: TodoCommentDescriptor[]; - } - /** - * Response for TodoCommentRequest request. - */ - interface TodoCommentsResponse extends Response { - body?: TodoComment[]; - } - /** - * A request to get indentation for a location in file - */ - interface IndentationRequest extends FileLocationRequest { - command: CommandTypes.Indentation; - arguments: IndentationRequestArgs; - } - /** - * Response for IndentationRequest request. - */ - interface IndentationResponse extends Response { - body?: IndentationResult; - } - /** - * Indentation result representing where indentation should be placed - */ - interface IndentationResult { - /** - * The base position in the document that the indent should be relative to - */ - position: number; - /** - * The number of columns the indent should be at relative to the position's column. - */ - indentation: number; - } - /** - * Arguments for IndentationRequest request. - */ - interface IndentationRequestArgs extends FileLocationRequestArgs { - /** - * An optional set of settings to be used when computing indentation. - * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings. - */ - options?: EditorSettings; - } - /** - * Arguments for ProjectInfoRequest request. - */ - interface ProjectInfoRequestArgs extends FileRequestArgs { - /** - * Indicate if the file name list of the project is needed - */ - needFileNameList: boolean; - } - /** - * A request to get the project information of the current file. - */ - interface ProjectInfoRequest extends Request { - command: CommandTypes.ProjectInfo; - arguments: ProjectInfoRequestArgs; - } - /** - * A request to retrieve compiler options diagnostics for a project - */ - interface CompilerOptionsDiagnosticsRequest extends Request { - arguments: CompilerOptionsDiagnosticsRequestArgs; - } - /** - * Arguments for CompilerOptionsDiagnosticsRequest request. - */ - interface CompilerOptionsDiagnosticsRequestArgs { - /** - * Name of the project to retrieve compiler options diagnostics. - */ - projectFileName: string; - } - /** - * Response message body for "projectInfo" request - */ - interface ProjectInfo { - /** - * For configured project, this is the normalized path of the 'tsconfig.json' file - * For inferred project, this is undefined - */ - configFileName: string; - /** - * The list of normalized file name in the project, including 'lib.d.ts' - */ - fileNames?: string[]; - /** - * Indicates if the project has a active language service instance - */ - languageServiceDisabled?: boolean; - } - /** - * Represents diagnostic info that includes location of diagnostic in two forms - * - start position and length of the error span - * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span. - */ - interface DiagnosticWithLinePosition { - message: string; - start: number; - length: number; - startLocation: Location; - endLocation: Location; - category: string; - code: number; - } - /** - * Response message for "projectInfo" request - */ - interface ProjectInfoResponse extends Response { - body?: ProjectInfo; - } - /** - * Request whose sole parameter is a file name. - */ - interface FileRequest extends Request { - arguments: FileRequestArgs; - } - /** - * Instances of this interface specify a location in a source file: - * (file, line, character offset), where line and character offset are 1-based. - */ - interface FileLocationRequestArgs extends FileRequestArgs { - /** - * The line number for the request (1-based). - */ - line: number; - /** - * The character offset (on the line) for the request (1-based). - */ - offset: number; - } - /** - * Request for the available codefixes at a specific position. - */ - interface CodeFixRequest extends Request { - command: CommandTypes.GetCodeFixes; - arguments: CodeFixRequestArgs; - } - /** - * Instances of this interface specify errorcodes on a specific location in a sourcefile. - */ - interface CodeFixRequestArgs extends FileRequestArgs { - /** - * The line number for the request (1-based). - */ - startLine: number; - /** - * The character offset (on the line) for the request (1-based). - */ - startOffset: number; - /** - * The line number for the request (1-based). - */ - endLine: number; - /** - * The character offset (on the line) for the request (1-based). - */ - endOffset: number; - /** - * Errorcodes we want to get the fixes for. - */ - errorCodes?: number[]; - } - /** - * Response for GetCodeFixes request. - */ - interface GetCodeFixesResponse extends Response { - body?: CodeAction[]; - } - /** - * A request whose arguments specify a file location (file, line, col). - */ - interface FileLocationRequest extends FileRequest { - arguments: FileLocationRequestArgs; - } - /** - * A request to get codes of supported code fixes. - */ - interface GetSupportedCodeFixesRequest extends Request { - command: CommandTypes.GetSupportedCodeFixes; - } - /** - * A response for GetSupportedCodeFixesRequest request. - */ - interface GetSupportedCodeFixesResponse extends Response { - /** - * List of error codes supported by the server. - */ - body?: string[]; - } - /** - * Arguments for EncodedSemanticClassificationsRequest request. - */ - interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { - /** - * Start position of the span. - */ - start: number; - /** - * Length of the span. - */ - length: number; - } - /** - * Arguments in document highlight request; include: filesToSearch, file, - * line, offset. - */ - interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { - /** - * List of files to search for document highlights. - */ - filesToSearch: string[]; - } - /** - * Go to definition request; value of command field is - * "definition". Return response giving the file locations that - * define the symbol found in file at location line, col. - */ - interface DefinitionRequest extends FileLocationRequest { - command: CommandTypes.Definition; - } - /** - * Go to type request; value of command field is - * "typeDefinition". Return response giving the file locations that - * define the type for the symbol found in file at location line, col. - */ - interface TypeDefinitionRequest extends FileLocationRequest { - command: CommandTypes.TypeDefinition; - } - /** - * Go to implementation request; value of command field is - * "implementation". Return response giving the file locations that - * implement the symbol found in file at location line, col. - */ - interface ImplementationRequest extends FileLocationRequest { - command: CommandTypes.Implementation; - } - /** - * Location in source code expressed as (one-based) line and character offset. - */ - interface Location { - line: number; - offset: number; - } - /** - * Object found in response messages defining a span of text in source code. - */ - interface TextSpan { - /** - * First character of the definition. - */ - start: Location; - /** - * One character past last character of the definition. - */ - end: Location; - } - /** - * Object found in response messages defining a span of text in a specific source file. - */ - interface FileSpan extends TextSpan { - /** - * File containing text span. - */ - file: string; - } - /** - * Definition response message. Gives text range for definition. - */ - interface DefinitionResponse extends Response { - body?: FileSpan[]; - } - /** - * Definition response message. Gives text range for definition. - */ - interface TypeDefinitionResponse extends Response { - body?: FileSpan[]; - } - /** - * Implementation response message. Gives text range for implementations. - */ - interface ImplementationResponse extends Response { - body?: FileSpan[]; - } - /** - * Request to get brace completion for a location in the file. - */ - interface BraceCompletionRequest extends FileLocationRequest { - command: CommandTypes.BraceCompletion; - arguments: BraceCompletionRequestArgs; - } - /** - * Argument for BraceCompletionRequest request. - */ - interface BraceCompletionRequestArgs extends FileLocationRequestArgs { - /** - * Kind of opening brace - */ - openingBrace: string; - } - /** - * Get occurrences request; value of command field is - * "occurrences". Return response giving spans that are relevant - * in the file at a given line and column. - */ - interface OccurrencesRequest extends FileLocationRequest { - command: CommandTypes.Occurrences; - } - interface OccurrencesResponseItem extends FileSpan { - /** - * True if the occurrence is a write location, false otherwise. - */ - isWriteAccess: boolean; - } - interface OccurrencesResponse extends Response { - body?: OccurrencesResponseItem[]; - } - /** - * Get document highlights request; value of command field is - * "documentHighlights". Return response giving spans that are relevant - * in the file at a given line and column. - */ - interface DocumentHighlightsRequest extends FileLocationRequest { - command: CommandTypes.DocumentHighlights; - arguments: DocumentHighlightsRequestArgs; - } - /** - * Span augmented with extra information that denotes the kind of the highlighting to be used for span. - * Kind is taken from HighlightSpanKind type. - */ - interface HighlightSpan extends TextSpan { - kind: string; - } - /** - * Represents a set of highligh spans for a give name - */ - interface DocumentHighlightsItem { - /** - * File containing highlight spans. - */ - file: string; - /** - * Spans to highlight in file. - */ - highlightSpans: HighlightSpan[]; - } - /** - * Response for a DocumentHighlightsRequest request. - */ - interface DocumentHighlightsResponse extends Response { - body?: DocumentHighlightsItem[]; - } - /** - * Find references request; value of command field is - * "references". Return response giving the file locations that - * reference the symbol found in file at location line, col. - */ - interface ReferencesRequest extends FileLocationRequest { - command: CommandTypes.References; - } - interface ReferencesResponseItem extends FileSpan { - /** Text of line containing the reference. Including this - * with the response avoids latency of editor loading files - * to show text of reference line (the server already has - * loaded the referencing files). - */ - lineText: string; - /** - * True if reference is a write location, false otherwise. - */ - isWriteAccess: boolean; - /** - * True if reference is a definition, false otherwise. - */ - isDefinition: boolean; - } - /** - * The body of a "references" response message. - */ - interface ReferencesResponseBody { - /** - * The file locations referencing the symbol. - */ - refs: ReferencesResponseItem[]; - /** - * The name of the symbol. - */ - symbolName: string; - /** - * The start character offset of the symbol (on the line provided by the references request). - */ - symbolStartOffset: number; - /** - * The full display name of the symbol. - */ - symbolDisplayString: string; - } - /** - * Response to "references" request. - */ - interface ReferencesResponse extends Response { - body?: ReferencesResponseBody; - } - /** - * Argument for RenameRequest request. - */ - interface RenameRequestArgs extends FileLocationRequestArgs { - /** - * Should text at specified location be found/changed in comments? - */ - findInComments?: boolean; - /** - * Should text at specified location be found/changed in strings? - */ - findInStrings?: boolean; - } - /** - * Rename request; value of command field is "rename". Return - * response giving the file locations that reference the symbol - * found in file at location line, col. Also return full display - * name of the symbol so that client can print it unambiguously. - */ - interface RenameRequest extends FileLocationRequest { - command: CommandTypes.Rename; - arguments: RenameRequestArgs; - } - /** - * Information about the item to be renamed. - */ - interface RenameInfo { - /** - * True if item can be renamed. - */ - canRename: boolean; - /** - * Error message if item can not be renamed. - */ - localizedErrorMessage?: string; - /** - * Display name of the item to be renamed. - */ - displayName: string; - /** - * Full display name of item to be renamed. - */ - fullDisplayName: string; - /** - * The items's kind (such as 'className' or 'parameterName' or plain 'text'). - */ - kind: string; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers: string; - } - /** - * A group of text spans, all in 'file'. - */ - interface SpanGroup { - /** The file to which the spans apply */ - file: string; - /** The text spans in this group */ - locs: TextSpan[]; - } - interface RenameResponseBody { - /** - * Information about the item to be renamed. - */ - info: RenameInfo; - /** - * An array of span groups (one per file) that refer to the item to be renamed. - */ - locs: SpanGroup[]; - } - /** - * Rename response message. - */ - interface RenameResponse extends Response { - body?: RenameResponseBody; - } - /** - * Represents a file in external project. - * External project is project whose set of files, compilation options and open\close state - * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio). - * External project will exist even if all files in it are closed and should be closed explicity. - * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will - * create configured project for every config file but will maintain a link that these projects were created - * as a result of opening external project so they should be removed once external project is closed. - */ - interface ExternalFile { - /** - * Name of file file - */ - fileName: string; - /** - * Script kind of the file - */ - scriptKind?: ScriptKindName | ts.ScriptKind; - /** - * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript) - */ - hasMixedContent?: boolean; - /** - * Content of the file - */ - content?: string; - } - /** - * Represent an external project - */ - interface ExternalProject { - /** - * Project name - */ - projectFileName: string; - /** - * List of root files in project - */ - rootFiles: ExternalFile[]; - /** - * Compiler options for the project - */ - options: ExternalProjectCompilerOptions; - /** - * Explicitly specified typing options for the project - */ - typingOptions?: TypingOptions; - } - interface CompileOnSaveMixin { - /** - * If compile on save is enabled for the project - */ - compileOnSave?: boolean; - } - /** - * For external projects, some of the project settings are sent together with - * compiler settings. - */ - type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin; - /** - * Represents a set of changes that happen in project - */ - interface ProjectChanges { - /** - * List of added files - */ - added: string[]; - /** - * List of removed files - */ - removed: string[]; - } - /** - * Information found in a configure request. - */ - interface ConfigureRequestArguments { - /** - * Information about the host, for example 'Emacs 24.4' or - * 'Sublime Text version 3075' - */ - hostInfo?: string; - /** - * If present, tab settings apply only to this file. - */ - file?: string; - /** - * The format options to use during formatting and other code editing features. - */ - formatOptions?: FormatCodeSettings; - } - /** - * Configure request; value of command field is "configure". Specifies - * host information, such as host type, tab size, and indent size. - */ - interface ConfigureRequest extends Request { - command: CommandTypes.Configure; - arguments: ConfigureRequestArguments; - } - /** - * Response to "configure" request. This is just an acknowledgement, so - * no body field is required. - */ - interface ConfigureResponse extends Response { - } - /** - * Information found in an "open" request. - */ - interface OpenRequestArgs extends FileRequestArgs { - /** - * Used when a version of the file content is known to be more up to date than the one on disk. - * Then the known content will be used upon opening instead of the disk copy - */ - fileContent?: string; - /** - * Used to specify the script kind of the file explicitly. It could be one of the following: - * "TS", "JS", "TSX", "JSX" - */ - scriptKindName?: ScriptKindName; - } - type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; - /** - * Open request; value of command field is "open". Notify the - * server that the client has file open. The server will not - * monitor the filesystem for changes in this file and will assume - * that the client is updating the server (using the change and/or - * reload messages) when the file changes. Server does not currently - * send a response to an open request. - */ - interface OpenRequest extends Request { - command: CommandTypes.Open; - arguments: OpenRequestArgs; - } - /** - * Request to open or update external project - */ - interface OpenExternalProjectRequest extends Request { - command: CommandTypes.OpenExternalProject; - arguments: OpenExternalProjectArgs; - } - /** - * Arguments to OpenExternalProjectRequest request - */ - type OpenExternalProjectArgs = ExternalProject; - /** - * Request to open multiple external projects - */ - interface OpenExternalProjectsRequest extends Request { - command: CommandTypes.OpenExternalProjects; - arguments: OpenExternalProjectsArgs; - } - /** - * Arguments to OpenExternalProjectsRequest - */ - interface OpenExternalProjectsArgs { - /** - * List of external projects to open or update - */ - projects: ExternalProject[]; - } - /** - * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so - * no body field is required. - */ - interface OpenExternalProjectResponse extends Response { - } - /** - * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so - * no body field is required. - */ - interface OpenExternalProjectsResponse extends Response { - } - /** - * Request to close external project. - */ - interface CloseExternalProjectRequest extends Request { - command: CommandTypes.CloseExternalProject; - arguments: CloseExternalProjectRequestArgs; - } - /** - * Arguments to CloseExternalProjectRequest request - */ - interface CloseExternalProjectRequestArgs { - /** - * Name of the project to close - */ - projectFileName: string; - } - /** - * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so - * no body field is required. - */ - interface CloseExternalProjectResponse extends Response { - } - /** - * Request to set compiler options for inferred projects. - * External projects are opened / closed explicitly. - * Configured projects are opened when user opens loose file that has 'tsconfig.json' or 'jsconfig.json' anywhere in one of containing folders. - * This configuration file will be used to obtain a list of files and configuration settings for the project. - * Inferred projects are created when user opens a loose file that is not the part of external project - * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false, - * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true. - */ - interface SetCompilerOptionsForInferredProjectsRequest extends Request { - command: CommandTypes.CompilerOptionsForInferredProjects; - arguments: SetCompilerOptionsForInferredProjectsArgs; - } - /** - * Argument for SetCompilerOptionsForInferredProjectsRequest request. - */ - interface SetCompilerOptionsForInferredProjectsArgs { - /** - * Compiler options to be used with inferred projects. - */ - options: ExternalProjectCompilerOptions; - } - /** - * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so - * no body field is required. - */ - interface SetCompilerOptionsForInferredProjectsResponse extends Response { - } - /** - * Exit request; value of command field is "exit". Ask the server process - * to exit. - */ - interface ExitRequest extends Request { - command: CommandTypes.Exit; - } - /** - * Close request; value of command field is "close". Notify the - * server that the client has closed a previously open file. If - * file is still referenced by open files, the server will resume - * monitoring the filesystem for changes to file. Server does not - * currently send a response to a close request. - */ - interface CloseRequest extends FileRequest { - command: CommandTypes.Close; - } - /** - * Request to obtain the list of files that should be regenerated if target file is recompiled. - * NOTE: this us query-only operation and does not generate any output on disk. - */ - interface CompileOnSaveAffectedFileListRequest extends FileRequest { - command: CommandTypes.CompileOnSaveAffectedFileList; - } - /** - * Contains a list of files that should be regenerated in a project - */ - interface CompileOnSaveAffectedFileListSingleProject { - /** - * Project name - */ - projectFileName: string; - /** - * List of files names that should be recompiled - */ - fileNames: string[]; - } - /** - * Response for CompileOnSaveAffectedFileListRequest request; - */ - interface CompileOnSaveAffectedFileListResponse extends Response { - body: CompileOnSaveAffectedFileListSingleProject[]; - } - /** - * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk. - */ - interface CompileOnSaveEmitFileRequest extends FileRequest { - command: CommandTypes.CompileOnSaveEmitFile; - arguments: CompileOnSaveEmitFileRequestArgs; - } - /** - * Arguments for CompileOnSaveEmitFileRequest - */ - interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs { - /** - * if true - then file should be recompiled even if it does not have any changes. - */ - forced?: boolean; - } - /** - * Quickinfo request; value of command field is - * "quickinfo". Return response giving a quick type and - * documentation string for the symbol found in file at location - * line, col. - */ - interface QuickInfoRequest extends FileLocationRequest { - command: CommandTypes.Quickinfo; - } - /** - * Body of QuickInfoResponse. - */ - interface QuickInfoResponseBody { - /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ - kind: string; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers: string; - /** - * Starting file location of symbol. - */ - start: Location; - /** - * One past last character of symbol. - */ - end: Location; - /** - * Type and kind of symbol. - */ - displayString: string; - /** - * Documentation associated with symbol. - */ - documentation: string; - } - /** - * Quickinfo response message. - */ - interface QuickInfoResponse extends Response { - body?: QuickInfoResponseBody; - } - /** - * Arguments for format messages. - */ - interface FormatRequestArgs extends FileLocationRequestArgs { - /** - * Last line of range for which to format text in file. - */ - endLine: number; - /** - * Character offset on last line of range for which to format text in file. - */ - endOffset: number; - /** - * Format options to be used. - */ - options?: FormatCodeSettings; - } - /** - * Format request; value of command field is "format". Return - * response giving zero or more edit instructions. The edit - * instructions will be sorted in file order. Applying the edit - * instructions in reverse to file will result in correctly - * reformatted text. - */ - interface FormatRequest extends FileLocationRequest { - command: CommandTypes.Format; - arguments: FormatRequestArgs; - } - /** - * Object found in response messages defining an editing - * instruction for a span of text in source code. The effect of - * this instruction is to replace the text starting at start and - * ending one character before end with newText. For an insertion, - * the text span is empty. For a deletion, newText is empty. - */ - interface CodeEdit { - /** - * First character of the text span to edit. - */ - start: Location; - /** - * One character past last character of the text span to edit. - */ - end: Location; - /** - * Replace the span defined above with this string (may be - * the empty string). - */ - newText: string; - } - interface FileCodeEdits { - fileName: string; - textChanges: CodeEdit[]; - } - interface CodeFixResponse extends Response { - /** The code actions that are available */ - body?: CodeAction[]; - } - interface CodeAction { - /** Description of the code action to display in the UI of the editor */ - description: string; - /** Text changes to apply to each file as part of the code action */ - changes: FileCodeEdits[]; - } - /** - * Format and format on key response message. - */ - interface FormatResponse extends Response { - body?: CodeEdit[]; - } - /** - * Arguments for format on key messages. - */ - interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { - /** - * Key pressed (';', '\n', or '}'). - */ - key: string; - options?: FormatCodeSettings; - } - /** - * Format on key request; value of command field is - * "formatonkey". Given file location and key typed (as string), - * return response giving zero or more edit instructions. The - * edit instructions will be sorted in file order. Applying the - * edit instructions in reverse to file will result in correctly - * reformatted text. - */ - interface FormatOnKeyRequest extends FileLocationRequest { - command: CommandTypes.Formatonkey; - arguments: FormatOnKeyRequestArgs; - } - /** - * Arguments for completions messages. - */ - interface CompletionsRequestArgs extends FileLocationRequestArgs { - /** - * Optional prefix to apply to possible completions. - */ - prefix?: string; - } - /** - * Completions request; value of command field is "completions". - * Given a file location (file, line, col) and a prefix (which may - * be the empty string), return the possible completions that - * begin with prefix. - */ - interface CompletionsRequest extends FileLocationRequest { - command: CommandTypes.Completions; - arguments: CompletionsRequestArgs; - } - /** - * Arguments for completion details request. - */ - interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { - /** - * Names of one or more entries for which to obtain details. - */ - entryNames: string[]; - } - /** - * Completion entry details request; value of command field is - * "completionEntryDetails". Given a file location (file, line, - * col) and an array of completion entry names return more - * detailed information for each completion entry. - */ - interface CompletionDetailsRequest extends FileLocationRequest { - command: CommandTypes.CompletionDetails; - arguments: CompletionDetailsRequestArgs; - } - /** - * Part of a symbol description. - */ - interface SymbolDisplayPart { - /** - * Text of an item describing the symbol. - */ - text: string; - /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ - kind: string; - } - /** - * An item found in a completion response. - */ - interface CompletionEntry { - /** - * The symbol's name. - */ - name: string; - /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ - kind: string; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers: string; - /** - * A string that is used for comparing completion items so that they can be ordered. This - * is often the same as the name but may be different in certain circumstances. - */ - sortText: string; - /** - * An optional span that indicates the text to be replaced by this completion item. If present, - * this span should be used instead of the default one. - */ - replacementSpan?: TextSpan; - } - /** - * Additional completion entry details, available on demand - */ - interface CompletionEntryDetails { - /** - * The symbol's name. - */ - name: string; - /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ - kind: string; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers: string; - /** - * Display parts of the symbol (similar to quick info). - */ - displayParts: SymbolDisplayPart[]; - /** - * Documentation strings for the symbol. - */ - documentation: SymbolDisplayPart[]; - } - interface CompletionsResponse extends Response { - body?: CompletionEntry[]; - } - interface CompletionDetailsResponse extends Response { - body?: CompletionEntryDetails[]; - } - /** - * Signature help information for a single parameter - */ - interface SignatureHelpParameter { - /** - * The parameter's name - */ - name: string; - /** - * Documentation of the parameter. - */ - documentation: SymbolDisplayPart[]; - /** - * Display parts of the parameter. - */ - displayParts: SymbolDisplayPart[]; - /** - * Whether the parameter is optional or not. - */ - isOptional: boolean; - } - /** - * Represents a single signature to show in signature help. - */ - interface SignatureHelpItem { - /** - * Whether the signature accepts a variable number of arguments. - */ - isVariadic: boolean; - /** - * The prefix display parts. - */ - prefixDisplayParts: SymbolDisplayPart[]; - /** - * The suffix display parts. - */ - suffixDisplayParts: SymbolDisplayPart[]; - /** - * The separator display parts. - */ - separatorDisplayParts: SymbolDisplayPart[]; - /** - * The signature helps items for the parameters. - */ - parameters: SignatureHelpParameter[]; - /** - * The signature's documentation - */ - documentation: SymbolDisplayPart[]; - } - /** - * Signature help items found in the response of a signature help request. - */ - interface SignatureHelpItems { - /** - * The signature help items. - */ - items: SignatureHelpItem[]; - /** - * The span for which signature help should appear on a signature - */ - applicableSpan: TextSpan; - /** - * The item selected in the set of available help items. - */ - selectedItemIndex: number; - /** - * The argument selected in the set of parameters. - */ - argumentIndex: number; - /** - * The argument count - */ - argumentCount: number; - } - /** - * Arguments of a signature help request. - */ - interface SignatureHelpRequestArgs extends FileLocationRequestArgs { - } - /** - * Signature help request; value of command field is "signatureHelp". - * Given a file location (file, line, col), return the signature - * help. - */ - interface SignatureHelpRequest extends FileLocationRequest { - command: CommandTypes.SignatureHelp; - arguments: SignatureHelpRequestArgs; - } - /** - * Response object for a SignatureHelpRequest. - */ - interface SignatureHelpResponse extends Response { - body?: SignatureHelpItems; - } - /** - * Synchronous request for semantic diagnostics of one file. - */ - interface SemanticDiagnosticsSyncRequest extends FileRequest { - command: CommandTypes.SemanticDiagnosticsSync; - arguments: SemanticDiagnosticsSyncRequestArgs; - } - interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs { - includeLinePosition?: boolean; - } - /** - * Response object for synchronous sematic diagnostics request. - */ - interface SemanticDiagnosticsSyncResponse extends Response { - body?: Diagnostic[] | DiagnosticWithLinePosition[]; - } - /** - * Synchronous request for syntactic diagnostics of one file. - */ - interface SyntacticDiagnosticsSyncRequest extends FileRequest { - command: CommandTypes.SyntacticDiagnosticsSync; - arguments: SyntacticDiagnosticsSyncRequestArgs; - } - interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs { - includeLinePosition?: boolean; - } - /** - * Response object for synchronous syntactic diagnostics request. - */ - interface SyntacticDiagnosticsSyncResponse extends Response { - body?: Diagnostic[] | DiagnosticWithLinePosition[]; - } - /** - * Arguments for GeterrForProject request. - */ - interface GeterrForProjectRequestArgs { - /** - * the file requesting project error list - */ - file: string; - /** - * Delay in milliseconds to wait before starting to compute - * errors for the files in the file list - */ - delay: number; - } - /** - * GeterrForProjectRequest request; value of command field is - * "geterrForProject". It works similarly with 'Geterr', only - * it request for every file in this project. - */ - interface GeterrForProjectRequest extends Request { - command: CommandTypes.GeterrForProject; - arguments: GeterrForProjectRequestArgs; - } - /** - * Arguments for geterr messages. - */ - interface GeterrRequestArgs { - /** - * List of file names for which to compute compiler errors. - * The files will be checked in list order. - */ - files: string[]; - /** - * Delay in milliseconds to wait before starting to compute - * errors for the files in the file list - */ - delay: number; - } - /** - * Geterr request; value of command field is "geterr". Wait for - * delay milliseconds and then, if during the wait no change or - * reload messages have arrived for the first file in the files - * list, get the syntactic errors for the file, field requests, - * and then get the semantic errors for the file. Repeat with a - * smaller delay for each subsequent file on the files list. Best - * practice for an editor is to send a file list containing each - * file that is currently visible, in most-recently-used order. - */ - interface GeterrRequest extends Request { - command: CommandTypes.Geterr; - arguments: GeterrRequestArgs; - } - /** - * Item of diagnostic information found in a DiagnosticEvent message. - */ - interface Diagnostic { - /** - * Starting file location at which text applies. - */ - start: Location; - /** - * The last file location at which the text applies. - */ - end: Location; - /** - * Text of diagnostic message. - */ - text: string; - /** - * The error code of the diagnostic message. - */ - code?: number; - } - interface DiagnosticEventBody { - /** - * The file for which diagnostic information is reported. - */ - file: string; - /** - * An array of diagnostic information items. - */ - diagnostics: Diagnostic[]; - } - /** - * Event message for "syntaxDiag" and "semanticDiag" event types. - * These events provide syntactic and semantic errors for a file. - */ - interface DiagnosticEvent extends Event { - body?: DiagnosticEventBody; - } - interface ConfigFileDiagnosticEventBody { - /** - * The file which trigged the searching and error-checking of the config file - */ - triggerFile: string; - /** - * The name of the found config file. - */ - configFile: string; - /** - * An arry of diagnostic information items for the found config file. - */ - diagnostics: Diagnostic[]; - } - /** - * Event message for "configFileDiag" event type. - * This event provides errors for a found config file. - */ - interface ConfigFileDiagnosticEvent extends Event { - body?: ConfigFileDiagnosticEventBody; - event: "configFileDiag"; - } - /** - * Arguments for reload request. - */ - interface ReloadRequestArgs extends FileRequestArgs { - /** - * Name of temporary file from which to reload file - * contents. May be same as file. - */ - tmpfile: string; - } - /** - * Reload request message; value of command field is "reload". - * Reload contents of file with name given by the 'file' argument - * from temporary file with name given by the 'tmpfile' argument. - * The two names can be identical. - */ - interface ReloadRequest extends FileRequest { - command: CommandTypes.Reload; - arguments: ReloadRequestArgs; - } - /** - * Response to "reload" request. This is just an acknowledgement, so - * no body field is required. - */ - interface ReloadResponse extends Response { - } - /** - * Arguments for saveto request. - */ - interface SavetoRequestArgs extends FileRequestArgs { - /** - * Name of temporary file into which to save server's view of - * file contents. - */ - tmpfile: string; - } - /** - * Saveto request message; value of command field is "saveto". - * For debugging purposes, save to a temporaryfile (named by - * argument 'tmpfile') the contents of file named by argument - * 'file'. The server does not currently send a response to a - * "saveto" request. - */ - interface SavetoRequest extends FileRequest { - command: CommandTypes.Saveto; - arguments: SavetoRequestArgs; - } - /** - * Arguments for navto request message. - */ - interface NavtoRequestArgs extends FileRequestArgs { - /** - * Search term to navigate to from current location; term can - * be '.*' or an identifier prefix. - */ - searchValue: string; - /** - * Optional limit on the number of items to return. - */ - maxResultCount?: number; - /** - * Optional flag to indicate we want results for just the current file - * or the entire project. - */ - currentFileOnly?: boolean; - projectFileName?: string; - } - /** - * Navto request message; value of command field is "navto". - * Return list of objects giving file locations and symbols that - * match the search term given in argument 'searchTerm'. The - * context for the search is given by the named file. - */ - interface NavtoRequest extends FileRequest { - command: CommandTypes.Navto; - arguments: NavtoRequestArgs; - } - /** - * An item found in a navto response. - */ - interface NavtoItem { - /** - * The symbol's name. - */ - name: string; - /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ - kind: string; - /** - * exact, substring, or prefix. - */ - matchKind?: string; - /** - * If this was a case sensitive or insensitive match. - */ - isCaseSensitive?: boolean; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers?: string; - /** - * The file in which the symbol is found. - */ - file: string; - /** - * The location within file at which the symbol is found. - */ - start: Location; - /** - * One past the last character of the symbol. - */ - end: Location; - /** - * Name of symbol's container symbol (if any); for example, - * the class name if symbol is a class member. - */ - containerName?: string; - /** - * Kind of symbol's container symbol (if any). - */ - containerKind?: string; - } - /** - * Navto response message. Body is an array of navto items. Each - * item gives a symbol that matched the search term. - */ - interface NavtoResponse extends Response { - body?: NavtoItem[]; - } - /** - * Arguments for change request message. - */ - interface ChangeRequestArgs extends FormatRequestArgs { - /** - * Optional string to insert at location (file, line, offset). - */ - insertString?: string; - } - /** - * Change request message; value of command field is "change". - * Update the server's view of the file named by argument 'file'. - * Server does not currently send a response to a change request. - */ - interface ChangeRequest extends FileLocationRequest { - command: CommandTypes.Change; - arguments: ChangeRequestArgs; - } - /** - * Response to "brace" request. - */ - interface BraceResponse extends Response { - body?: TextSpan[]; - } - /** - * Brace matching request; value of command field is "brace". - * Return response giving the file locations of matching braces - * found in file at location line, offset. - */ - interface BraceRequest extends FileLocationRequest { - command: CommandTypes.Brace; - } - /** - * NavBar items request; value of command field is "navbar". - * Return response giving the list of navigation bar entries - * extracted from the requested file. - */ - interface NavBarRequest extends FileRequest { - command: CommandTypes.NavBar; - } - /** - * NavTree request; value of command field is "navtree". - * Return response giving the navigation tree of the requested file. - */ - interface NavTreeRequest extends FileRequest { - command: CommandTypes.NavTree; - } - interface NavigationBarItem { - /** - * The item's display text. - */ - text: string; - /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ - kind: string; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers?: string; - /** - * The definition locations of the item. - */ - spans: TextSpan[]; - /** - * Optional children. - */ - childItems?: NavigationBarItem[]; - /** - * Number of levels deep this item should appear. - */ - indent: number; - } - /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */ - interface NavigationTree { - text: string; - kind: string; - kindModifiers: string; - spans: TextSpan[]; - childItems?: NavigationTree[]; - } - type TelemetryEventName = "telemetry"; - interface TelemetryEvent extends Event { - event: TelemetryEventName; - body: TelemetryEventBody; - } - interface TelemetryEventBody { - telemetryEventName: string; - payload: any; - } - type TypingsInstalledTelemetryEventName = "typingsInstalled"; - interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody { - telemetryEventName: TypingsInstalledTelemetryEventName; - payload: TypingsInstalledTelemetryEventPayload; - } - interface TypingsInstalledTelemetryEventPayload { - /** - * Comma separated list of installed typing packages - */ - installedPackages: string; - /** - * true if install request succeeded, otherwise - false - */ - installSuccess: boolean; - } - interface NavBarResponse extends Response { - body?: NavigationBarItem[]; - } - interface NavTreeResponse extends Response { - body?: NavigationTree; - } - namespace IndentStyle { - type None = "None"; - type Block = "Block"; - type Smart = "Smart"; - } - type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart; - interface EditorSettings { - baseIndentSize?: number; - indentSize?: number; - tabSize?: number; - newLineCharacter?: string; - convertTabsToSpaces?: boolean; - indentStyle?: IndentStyle | ts.IndentStyle; - } - interface FormatCodeSettings extends EditorSettings { - insertSpaceAfterCommaDelimiter?: boolean; - insertSpaceAfterSemicolonInForStatements?: boolean; - insertSpaceBeforeAndAfterBinaryOperators?: boolean; - insertSpaceAfterKeywordsInControlFlowStatements?: boolean; - insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; - insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; - insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; - placeOpenBraceOnNewLineForFunctions?: boolean; - placeOpenBraceOnNewLineForControlBlocks?: boolean; - } - interface CompilerOptions { - allowJs?: boolean; - allowSyntheticDefaultImports?: boolean; - allowUnreachableCode?: boolean; - allowUnusedLabels?: boolean; - baseUrl?: string; - charset?: string; - declaration?: boolean; - declarationDir?: string; - disableSizeLimit?: boolean; - emitBOM?: boolean; - emitDecoratorMetadata?: boolean; - experimentalDecorators?: boolean; - forceConsistentCasingInFileNames?: boolean; - inlineSourceMap?: boolean; - inlineSources?: boolean; - isolatedModules?: boolean; - jsx?: JsxEmit | ts.JsxEmit; - lib?: string[]; - locale?: string; - mapRoot?: string; - maxNodeModuleJsDepth?: number; - module?: ModuleKind | ts.ModuleKind; - moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind; - newLine?: NewLineKind | ts.NewLineKind; - noEmit?: boolean; - noEmitHelpers?: boolean; - noEmitOnError?: boolean; - noErrorTruncation?: boolean; - noFallthroughCasesInSwitch?: boolean; - noImplicitAny?: boolean; - noImplicitReturns?: boolean; - noImplicitThis?: boolean; - noUnusedLocals?: boolean; - noUnusedParameters?: boolean; - noImplicitUseStrict?: boolean; - noLib?: boolean; - noResolve?: boolean; - out?: string; - outDir?: string; - outFile?: string; - paths?: MapLike; - preserveConstEnums?: boolean; - project?: string; - reactNamespace?: string; - removeComments?: boolean; - rootDir?: string; - rootDirs?: string[]; - skipLibCheck?: boolean; - skipDefaultLibCheck?: boolean; - sourceMap?: boolean; - sourceRoot?: string; - strictNullChecks?: boolean; - suppressExcessPropertyErrors?: boolean; - suppressImplicitAnyIndexErrors?: boolean; - target?: ScriptTarget | ts.ScriptTarget; - traceResolution?: boolean; - types?: string[]; - /** Paths used to used to compute primary types search locations */ - typeRoots?: string[]; - [option: string]: CompilerOptionsValue | undefined; - } - namespace JsxEmit { - type None = "None"; - type Preserve = "Preserve"; - type React = "React"; - } - type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React; - namespace ModuleKind { - type None = "None"; - type CommonJS = "CommonJS"; - type AMD = "AMD"; - type UMD = "UMD"; - type System = "System"; - type ES6 = "ES6"; - type ES2015 = "ES2015"; - } - type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015; - namespace ModuleResolutionKind { - type Classic = "Classic"; - type Node = "Node"; - } - type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node; - namespace NewLineKind { - type Crlf = "Crlf"; - type Lf = "Lf"; - } - type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf; - namespace ScriptTarget { - type ES3 = "ES3"; - type ES5 = "ES5"; - type ES6 = "ES6"; - type ES2015 = "ES2015"; - } - type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015; -} +/** + * Declaration module describing the TypeScript Server protocol + */ +declare namespace ts.server.protocol { + namespace CommandTypes { + type Brace = "brace"; + type BraceCompletion = "braceCompletion"; + type Change = "change"; + type Close = "close"; + type Completions = "completions"; + type CompletionDetails = "completionEntryDetails"; + type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList"; + type CompileOnSaveEmitFile = "compileOnSaveEmitFile"; + type Configure = "configure"; + type Definition = "definition"; + type Implementation = "implementation"; + type Exit = "exit"; + type Format = "format"; + type Formatonkey = "formatonkey"; + type Geterr = "geterr"; + type GeterrForProject = "geterrForProject"; + type SemanticDiagnosticsSync = "semanticDiagnosticsSync"; + type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync"; + type NavBar = "navbar"; + type Navto = "navto"; + type NavTree = "navtree"; + type NavTreeFull = "navtree-full"; + type Occurrences = "occurrences"; + type DocumentHighlights = "documentHighlights"; + type Open = "open"; + type Quickinfo = "quickinfo"; + type References = "references"; + type Reload = "reload"; + type Rename = "rename"; + type Saveto = "saveto"; + type SignatureHelp = "signatureHelp"; + type TypeDefinition = "typeDefinition"; + type ProjectInfo = "projectInfo"; + type ReloadProjects = "reloadProjects"; + type Unknown = "unknown"; + type OpenExternalProject = "openExternalProject"; + type OpenExternalProjects = "openExternalProjects"; + type CloseExternalProject = "closeExternalProject"; + type TodoComments = "todoComments"; + type Indentation = "indentation"; + type DocCommentTemplate = "docCommentTemplate"; + type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; + type GetCodeFixes = "getCodeFixes"; + type GetSupportedCodeFixes = "getSupportedCodeFixes"; + } + /** + * A TypeScript Server message + */ + interface Message { + /** + * Sequence number of the message + */ + seq: number; + /** + * One of "request", "response", or "event" + */ + type: "request" | "response" | "event"; + } + /** + * Client-initiated request message + */ + interface Request extends Message { + /** + * The command to execute + */ + command: string; + /** + * Object containing arguments for the command + */ + arguments?: any; + } + /** + * Request to reload the project structure for all the opened files + */ + interface ReloadProjectsRequest extends Message { + command: CommandTypes.ReloadProjects; + } + /** + * Server-initiated event message + */ + interface Event extends Message { + /** + * Name of event + */ + event: string; + /** + * Event-specific information + */ + body?: any; + } + /** + * Response by server to client request message. + */ + interface Response extends Message { + /** + * Sequence number of the request message. + */ + request_seq: number; + /** + * Outcome of the request. + */ + success: boolean; + /** + * The command requested. + */ + command: string; + /** + * Contains error message if success === false. + */ + message?: string; + /** + * Contains message body if success === true. + */ + body?: any; + } + /** + * Arguments for FileRequest messages. + */ + interface FileRequestArgs { + /** + * The file for the request (absolute pathname required). + */ + file: string; + projectFileName?: string; + } + /** + * Requests a JS Doc comment template for a given position + */ + interface DocCommentTemplateRequest extends FileLocationRequest { + command: CommandTypes.DocCommentTemplate; + } + /** + * Response to DocCommentTemplateRequest + */ + interface DocCommandTemplateResponse extends Response { + body?: TextInsertion; + } + /** + * A request to get TODO comments from the file + */ + interface TodoCommentRequest extends FileRequest { + command: CommandTypes.TodoComments; + arguments: TodoCommentRequestArgs; + } + /** + * Arguments for TodoCommentRequest request. + */ + interface TodoCommentRequestArgs extends FileRequestArgs { + /** + * Array of target TodoCommentDescriptors that describes TODO comments to be found + */ + descriptors: TodoCommentDescriptor[]; + } + /** + * Response for TodoCommentRequest request. + */ + interface TodoCommentsResponse extends Response { + body?: TodoComment[]; + } + /** + * A request to get indentation for a location in file + */ + interface IndentationRequest extends FileLocationRequest { + command: CommandTypes.Indentation; + arguments: IndentationRequestArgs; + } + /** + * Response for IndentationRequest request. + */ + interface IndentationResponse extends Response { + body?: IndentationResult; + } + /** + * Indentation result representing where indentation should be placed + */ + interface IndentationResult { + /** + * The base position in the document that the indent should be relative to + */ + position: number; + /** + * The number of columns the indent should be at relative to the position's column. + */ + indentation: number; + } + /** + * Arguments for IndentationRequest request. + */ + interface IndentationRequestArgs extends FileLocationRequestArgs { + /** + * An optional set of settings to be used when computing indentation. + * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings. + */ + options?: EditorSettings; + } + /** + * Arguments for ProjectInfoRequest request. + */ + interface ProjectInfoRequestArgs extends FileRequestArgs { + /** + * Indicate if the file name list of the project is needed + */ + needFileNameList: boolean; + } + /** + * A request to get the project information of the current file. + */ + interface ProjectInfoRequest extends Request { + command: CommandTypes.ProjectInfo; + arguments: ProjectInfoRequestArgs; + } + /** + * A request to retrieve compiler options diagnostics for a project + */ + interface CompilerOptionsDiagnosticsRequest extends Request { + arguments: CompilerOptionsDiagnosticsRequestArgs; + } + /** + * Arguments for CompilerOptionsDiagnosticsRequest request. + */ + interface CompilerOptionsDiagnosticsRequestArgs { + /** + * Name of the project to retrieve compiler options diagnostics. + */ + projectFileName: string; + } + /** + * Response message body for "projectInfo" request + */ + interface ProjectInfo { + /** + * For configured project, this is the normalized path of the 'tsconfig.json' file + * For inferred project, this is undefined + */ + configFileName: string; + /** + * The list of normalized file name in the project, including 'lib.d.ts' + */ + fileNames?: string[]; + /** + * Indicates if the project has a active language service instance + */ + languageServiceDisabled?: boolean; + } + /** + * Represents diagnostic info that includes location of diagnostic in two forms + * - start position and length of the error span + * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span. + */ + interface DiagnosticWithLinePosition { + message: string; + start: number; + length: number; + startLocation: Location; + endLocation: Location; + category: string; + code: number; + } + /** + * Response message for "projectInfo" request + */ + interface ProjectInfoResponse extends Response { + body?: ProjectInfo; + } + /** + * Request whose sole parameter is a file name. + */ + interface FileRequest extends Request { + arguments: FileRequestArgs; + } + /** + * Instances of this interface specify a location in a source file: + * (file, line, character offset), where line and character offset are 1-based. + */ + interface FileLocationRequestArgs extends FileRequestArgs { + /** + * The line number for the request (1-based). + */ + line: number; + /** + * The character offset (on the line) for the request (1-based). + */ + offset: number; + } + /** + * Request for the available codefixes at a specific position. + */ + interface CodeFixRequest extends Request { + command: CommandTypes.GetCodeFixes; + arguments: CodeFixRequestArgs; + } + /** + * Instances of this interface specify errorcodes on a specific location in a sourcefile. + */ + interface CodeFixRequestArgs extends FileRequestArgs { + /** + * The line number for the request (1-based). + */ + startLine: number; + /** + * The character offset (on the line) for the request (1-based). + */ + startOffset: number; + /** + * The line number for the request (1-based). + */ + endLine: number; + /** + * The character offset (on the line) for the request (1-based). + */ + endOffset: number; + /** + * Errorcodes we want to get the fixes for. + */ + errorCodes?: number[]; + } + /** + * Response for GetCodeFixes request. + */ + interface GetCodeFixesResponse extends Response { + body?: CodeAction[]; + } + /** + * A request whose arguments specify a file location (file, line, col). + */ + interface FileLocationRequest extends FileRequest { + arguments: FileLocationRequestArgs; + } + /** + * A request to get codes of supported code fixes. + */ + interface GetSupportedCodeFixesRequest extends Request { + command: CommandTypes.GetSupportedCodeFixes; + } + /** + * A response for GetSupportedCodeFixesRequest request. + */ + interface GetSupportedCodeFixesResponse extends Response { + /** + * List of error codes supported by the server. + */ + body?: string[]; + } + /** + * Arguments for EncodedSemanticClassificationsRequest request. + */ + interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { + /** + * Start position of the span. + */ + start: number; + /** + * Length of the span. + */ + length: number; + } + /** + * Arguments in document highlight request; include: filesToSearch, file, + * line, offset. + */ + interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { + /** + * List of files to search for document highlights. + */ + filesToSearch: string[]; + } + /** + * Go to definition request; value of command field is + * "definition". Return response giving the file locations that + * define the symbol found in file at location line, col. + */ + interface DefinitionRequest extends FileLocationRequest { + command: CommandTypes.Definition; + } + /** + * Go to type request; value of command field is + * "typeDefinition". Return response giving the file locations that + * define the type for the symbol found in file at location line, col. + */ + interface TypeDefinitionRequest extends FileLocationRequest { + command: CommandTypes.TypeDefinition; + } + /** + * Go to implementation request; value of command field is + * "implementation". Return response giving the file locations that + * implement the symbol found in file at location line, col. + */ + interface ImplementationRequest extends FileLocationRequest { + command: CommandTypes.Implementation; + } + /** + * Location in source code expressed as (one-based) line and character offset. + */ + interface Location { + line: number; + offset: number; + } + /** + * Object found in response messages defining a span of text in source code. + */ + interface TextSpan { + /** + * First character of the definition. + */ + start: Location; + /** + * One character past last character of the definition. + */ + end: Location; + } + /** + * Object found in response messages defining a span of text in a specific source file. + */ + interface FileSpan extends TextSpan { + /** + * File containing text span. + */ + file: string; + } + /** + * Definition response message. Gives text range for definition. + */ + interface DefinitionResponse extends Response { + body?: FileSpan[]; + } + /** + * Definition response message. Gives text range for definition. + */ + interface TypeDefinitionResponse extends Response { + body?: FileSpan[]; + } + /** + * Implementation response message. Gives text range for implementations. + */ + interface ImplementationResponse extends Response { + body?: FileSpan[]; + } + /** + * Request to get brace completion for a location in the file. + */ + interface BraceCompletionRequest extends FileLocationRequest { + command: CommandTypes.BraceCompletion; + arguments: BraceCompletionRequestArgs; + } + /** + * Argument for BraceCompletionRequest request. + */ + interface BraceCompletionRequestArgs extends FileLocationRequestArgs { + /** + * Kind of opening brace + */ + openingBrace: string; + } + /** + * Get occurrences request; value of command field is + * "occurrences". Return response giving spans that are relevant + * in the file at a given line and column. + */ + interface OccurrencesRequest extends FileLocationRequest { + command: CommandTypes.Occurrences; + } + interface OccurrencesResponseItem extends FileSpan { + /** + * True if the occurrence is a write location, false otherwise. + */ + isWriteAccess: boolean; + } + interface OccurrencesResponse extends Response { + body?: OccurrencesResponseItem[]; + } + /** + * Get document highlights request; value of command field is + * "documentHighlights". Return response giving spans that are relevant + * in the file at a given line and column. + */ + interface DocumentHighlightsRequest extends FileLocationRequest { + command: CommandTypes.DocumentHighlights; + arguments: DocumentHighlightsRequestArgs; + } + /** + * Span augmented with extra information that denotes the kind of the highlighting to be used for span. + * Kind is taken from HighlightSpanKind type. + */ + interface HighlightSpan extends TextSpan { + kind: string; + } + /** + * Represents a set of highligh spans for a give name + */ + interface DocumentHighlightsItem { + /** + * File containing highlight spans. + */ + file: string; + /** + * Spans to highlight in file. + */ + highlightSpans: HighlightSpan[]; + } + /** + * Response for a DocumentHighlightsRequest request. + */ + interface DocumentHighlightsResponse extends Response { + body?: DocumentHighlightsItem[]; + } + /** + * Find references request; value of command field is + * "references". Return response giving the file locations that + * reference the symbol found in file at location line, col. + */ + interface ReferencesRequest extends FileLocationRequest { + command: CommandTypes.References; + } + interface ReferencesResponseItem extends FileSpan { + /** Text of line containing the reference. Including this + * with the response avoids latency of editor loading files + * to show text of reference line (the server already has + * loaded the referencing files). + */ + lineText: string; + /** + * True if reference is a write location, false otherwise. + */ + isWriteAccess: boolean; + /** + * True if reference is a definition, false otherwise. + */ + isDefinition: boolean; + } + /** + * The body of a "references" response message. + */ + interface ReferencesResponseBody { + /** + * The file locations referencing the symbol. + */ + refs: ReferencesResponseItem[]; + /** + * The name of the symbol. + */ + symbolName: string; + /** + * The start character offset of the symbol (on the line provided by the references request). + */ + symbolStartOffset: number; + /** + * The full display name of the symbol. + */ + symbolDisplayString: string; + } + /** + * Response to "references" request. + */ + interface ReferencesResponse extends Response { + body?: ReferencesResponseBody; + } + /** + * Argument for RenameRequest request. + */ + interface RenameRequestArgs extends FileLocationRequestArgs { + /** + * Should text at specified location be found/changed in comments? + */ + findInComments?: boolean; + /** + * Should text at specified location be found/changed in strings? + */ + findInStrings?: boolean; + } + /** + * Rename request; value of command field is "rename". Return + * response giving the file locations that reference the symbol + * found in file at location line, col. Also return full display + * name of the symbol so that client can print it unambiguously. + */ + interface RenameRequest extends FileLocationRequest { + command: CommandTypes.Rename; + arguments: RenameRequestArgs; + } + /** + * Information about the item to be renamed. + */ + interface RenameInfo { + /** + * True if item can be renamed. + */ + canRename: boolean; + /** + * Error message if item can not be renamed. + */ + localizedErrorMessage?: string; + /** + * Display name of the item to be renamed. + */ + displayName: string; + /** + * Full display name of item to be renamed. + */ + fullDisplayName: string; + /** + * The items's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + } + /** + * A group of text spans, all in 'file'. + */ + interface SpanGroup { + /** The file to which the spans apply */ + file: string; + /** The text spans in this group */ + locs: TextSpan[]; + } + interface RenameResponseBody { + /** + * Information about the item to be renamed. + */ + info: RenameInfo; + /** + * An array of span groups (one per file) that refer to the item to be renamed. + */ + locs: SpanGroup[]; + } + /** + * Rename response message. + */ + interface RenameResponse extends Response { + body?: RenameResponseBody; + } + /** + * Represents a file in external project. + * External project is project whose set of files, compilation options and open\close state + * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio). + * External project will exist even if all files in it are closed and should be closed explicity. + * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will + * create configured project for every config file but will maintain a link that these projects were created + * as a result of opening external project so they should be removed once external project is closed. + */ + interface ExternalFile { + /** + * Name of file file + */ + fileName: string; + /** + * Script kind of the file + */ + scriptKind?: ScriptKindName | ts.ScriptKind; + /** + * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript) + */ + hasMixedContent?: boolean; + /** + * Content of the file + */ + content?: string; + } + /** + * Represent an external project + */ + interface ExternalProject { + /** + * Project name + */ + projectFileName: string; + /** + * List of root files in project + */ + rootFiles: ExternalFile[]; + /** + * Compiler options for the project + */ + options: ExternalProjectCompilerOptions; + /** + * Explicitly specified typing options for the project + */ + typingOptions?: TypingOptions; + } + interface CompileOnSaveMixin { + /** + * If compile on save is enabled for the project + */ + compileOnSave?: boolean; + } + /** + * For external projects, some of the project settings are sent together with + * compiler settings. + */ + type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin; + /** + * Represents a set of changes that happen in project + */ + interface ProjectChanges { + /** + * List of added files + */ + added: string[]; + /** + * List of removed files + */ + removed: string[]; + } + /** + * Information found in a configure request. + */ + interface ConfigureRequestArguments { + /** + * Information about the host, for example 'Emacs 24.4' or + * 'Sublime Text version 3075' + */ + hostInfo?: string; + /** + * If present, tab settings apply only to this file. + */ + file?: string; + /** + * The format options to use during formatting and other code editing features. + */ + formatOptions?: FormatCodeSettings; + } + /** + * Configure request; value of command field is "configure". Specifies + * host information, such as host type, tab size, and indent size. + */ + interface ConfigureRequest extends Request { + command: CommandTypes.Configure; + arguments: ConfigureRequestArguments; + } + /** + * Response to "configure" request. This is just an acknowledgement, so + * no body field is required. + */ + interface ConfigureResponse extends Response { + } + /** + * Information found in an "open" request. + */ + interface OpenRequestArgs extends FileRequestArgs { + /** + * Used when a version of the file content is known to be more up to date than the one on disk. + * Then the known content will be used upon opening instead of the disk copy + */ + fileContent?: string; + /** + * Used to specify the script kind of the file explicitly. It could be one of the following: + * "TS", "JS", "TSX", "JSX" + */ + scriptKindName?: ScriptKindName; + } + type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; + /** + * Open request; value of command field is "open". Notify the + * server that the client has file open. The server will not + * monitor the filesystem for changes in this file and will assume + * that the client is updating the server (using the change and/or + * reload messages) when the file changes. Server does not currently + * send a response to an open request. + */ + interface OpenRequest extends Request { + command: CommandTypes.Open; + arguments: OpenRequestArgs; + } + /** + * Request to open or update external project + */ + interface OpenExternalProjectRequest extends Request { + command: CommandTypes.OpenExternalProject; + arguments: OpenExternalProjectArgs; + } + /** + * Arguments to OpenExternalProjectRequest request + */ + type OpenExternalProjectArgs = ExternalProject; + /** + * Request to open multiple external projects + */ + interface OpenExternalProjectsRequest extends Request { + command: CommandTypes.OpenExternalProjects; + arguments: OpenExternalProjectsArgs; + } + /** + * Arguments to OpenExternalProjectsRequest + */ + interface OpenExternalProjectsArgs { + /** + * List of external projects to open or update + */ + projects: ExternalProject[]; + } + /** + * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so + * no body field is required. + */ + interface OpenExternalProjectResponse extends Response { + } + /** + * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so + * no body field is required. + */ + interface OpenExternalProjectsResponse extends Response { + } + /** + * Request to close external project. + */ + interface CloseExternalProjectRequest extends Request { + command: CommandTypes.CloseExternalProject; + arguments: CloseExternalProjectRequestArgs; + } + /** + * Arguments to CloseExternalProjectRequest request + */ + interface CloseExternalProjectRequestArgs { + /** + * Name of the project to close + */ + projectFileName: string; + } + /** + * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so + * no body field is required. + */ + interface CloseExternalProjectResponse extends Response { + } + /** + * Request to set compiler options for inferred projects. + * External projects are opened / closed explicitly. + * Configured projects are opened when user opens loose file that has 'tsconfig.json' or 'jsconfig.json' anywhere in one of containing folders. + * This configuration file will be used to obtain a list of files and configuration settings for the project. + * Inferred projects are created when user opens a loose file that is not the part of external project + * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false, + * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true. + */ + interface SetCompilerOptionsForInferredProjectsRequest extends Request { + command: CommandTypes.CompilerOptionsForInferredProjects; + arguments: SetCompilerOptionsForInferredProjectsArgs; + } + /** + * Argument for SetCompilerOptionsForInferredProjectsRequest request. + */ + interface SetCompilerOptionsForInferredProjectsArgs { + /** + * Compiler options to be used with inferred projects. + */ + options: ExternalProjectCompilerOptions; + } + /** + * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so + * no body field is required. + */ + interface SetCompilerOptionsForInferredProjectsResponse extends Response { + } + /** + * Exit request; value of command field is "exit". Ask the server process + * to exit. + */ + interface ExitRequest extends Request { + command: CommandTypes.Exit; + } + /** + * Close request; value of command field is "close". Notify the + * server that the client has closed a previously open file. If + * file is still referenced by open files, the server will resume + * monitoring the filesystem for changes to file. Server does not + * currently send a response to a close request. + */ + interface CloseRequest extends FileRequest { + command: CommandTypes.Close; + } + /** + * Request to obtain the list of files that should be regenerated if target file is recompiled. + * NOTE: this us query-only operation and does not generate any output on disk. + */ + interface CompileOnSaveAffectedFileListRequest extends FileRequest { + command: CommandTypes.CompileOnSaveAffectedFileList; + } + /** + * Contains a list of files that should be regenerated in a project + */ + interface CompileOnSaveAffectedFileListSingleProject { + /** + * Project name + */ + projectFileName: string; + /** + * List of files names that should be recompiled + */ + fileNames: string[]; + } + /** + * Response for CompileOnSaveAffectedFileListRequest request; + */ + interface CompileOnSaveAffectedFileListResponse extends Response { + body: CompileOnSaveAffectedFileListSingleProject[]; + } + /** + * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk. + */ + interface CompileOnSaveEmitFileRequest extends FileRequest { + command: CommandTypes.CompileOnSaveEmitFile; + arguments: CompileOnSaveEmitFileRequestArgs; + } + /** + * Arguments for CompileOnSaveEmitFileRequest + */ + interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs { + /** + * if true - then file should be recompiled even if it does not have any changes. + */ + forced?: boolean; + } + /** + * Quickinfo request; value of command field is + * "quickinfo". Return response giving a quick type and + * documentation string for the symbol found in file at location + * line, col. + */ + interface QuickInfoRequest extends FileLocationRequest { + command: CommandTypes.Quickinfo; + } + /** + * Body of QuickInfoResponse. + */ + interface QuickInfoResponseBody { + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + /** + * Starting file location of symbol. + */ + start: Location; + /** + * One past last character of symbol. + */ + end: Location; + /** + * Type and kind of symbol. + */ + displayString: string; + /** + * Documentation associated with symbol. + */ + documentation: string; + } + /** + * Quickinfo response message. + */ + interface QuickInfoResponse extends Response { + body?: QuickInfoResponseBody; + } + /** + * Arguments for format messages. + */ + interface FormatRequestArgs extends FileLocationRequestArgs { + /** + * Last line of range for which to format text in file. + */ + endLine: number; + /** + * Character offset on last line of range for which to format text in file. + */ + endOffset: number; + /** + * Format options to be used. + */ + options?: FormatCodeSettings; + } + /** + * Format request; value of command field is "format". Return + * response giving zero or more edit instructions. The edit + * instructions will be sorted in file order. Applying the edit + * instructions in reverse to file will result in correctly + * reformatted text. + */ + interface FormatRequest extends FileLocationRequest { + command: CommandTypes.Format; + arguments: FormatRequestArgs; + } + /** + * Object found in response messages defining an editing + * instruction for a span of text in source code. The effect of + * this instruction is to replace the text starting at start and + * ending one character before end with newText. For an insertion, + * the text span is empty. For a deletion, newText is empty. + */ + interface CodeEdit { + /** + * First character of the text span to edit. + */ + start: Location; + /** + * One character past last character of the text span to edit. + */ + end: Location; + /** + * Replace the span defined above with this string (may be + * the empty string). + */ + newText: string; + } + interface FileCodeEdits { + fileName: string; + textChanges: CodeEdit[]; + } + interface CodeFixResponse extends Response { + /** The code actions that are available */ + body?: CodeAction[]; + } + interface CodeAction { + /** Description of the code action to display in the UI of the editor */ + description: string; + /** Text changes to apply to each file as part of the code action */ + changes: FileCodeEdits[]; + } + /** + * Format and format on key response message. + */ + interface FormatResponse extends Response { + body?: CodeEdit[]; + } + /** + * Arguments for format on key messages. + */ + interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { + /** + * Key pressed (';', '\n', or '}'). + */ + key: string; + options?: FormatCodeSettings; + } + /** + * Format on key request; value of command field is + * "formatonkey". Given file location and key typed (as string), + * return response giving zero or more edit instructions. The + * edit instructions will be sorted in file order. Applying the + * edit instructions in reverse to file will result in correctly + * reformatted text. + */ + interface FormatOnKeyRequest extends FileLocationRequest { + command: CommandTypes.Formatonkey; + arguments: FormatOnKeyRequestArgs; + } + /** + * Arguments for completions messages. + */ + interface CompletionsRequestArgs extends FileLocationRequestArgs { + /** + * Optional prefix to apply to possible completions. + */ + prefix?: string; + } + /** + * Completions request; value of command field is "completions". + * Given a file location (file, line, col) and a prefix (which may + * be the empty string), return the possible completions that + * begin with prefix. + */ + interface CompletionsRequest extends FileLocationRequest { + command: CommandTypes.Completions; + arguments: CompletionsRequestArgs; + } + /** + * Arguments for completion details request. + */ + interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { + /** + * Names of one or more entries for which to obtain details. + */ + entryNames: string[]; + } + /** + * Completion entry details request; value of command field is + * "completionEntryDetails". Given a file location (file, line, + * col) and an array of completion entry names return more + * detailed information for each completion entry. + */ + interface CompletionDetailsRequest extends FileLocationRequest { + command: CommandTypes.CompletionDetails; + arguments: CompletionDetailsRequestArgs; + } + /** + * Part of a symbol description. + */ + interface SymbolDisplayPart { + /** + * Text of an item describing the symbol. + */ + text: string; + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; + } + /** + * An item found in a completion response. + */ + interface CompletionEntry { + /** + * The symbol's name. + */ + name: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + /** + * A string that is used for comparing completion items so that they can be ordered. This + * is often the same as the name but may be different in certain circumstances. + */ + sortText: string; + /** + * An optional span that indicates the text to be replaced by this completion item. If present, + * this span should be used instead of the default one. + */ + replacementSpan?: TextSpan; + } + /** + * Additional completion entry details, available on demand + */ + interface CompletionEntryDetails { + /** + * The symbol's name. + */ + name: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + /** + * Display parts of the symbol (similar to quick info). + */ + displayParts: SymbolDisplayPart[]; + /** + * Documentation strings for the symbol. + */ + documentation: SymbolDisplayPart[]; + } + interface CompletionsResponse extends Response { + body?: CompletionEntry[]; + } + interface CompletionDetailsResponse extends Response { + body?: CompletionEntryDetails[]; + } + /** + * Signature help information for a single parameter + */ + interface SignatureHelpParameter { + /** + * The parameter's name + */ + name: string; + /** + * Documentation of the parameter. + */ + documentation: SymbolDisplayPart[]; + /** + * Display parts of the parameter. + */ + displayParts: SymbolDisplayPart[]; + /** + * Whether the parameter is optional or not. + */ + isOptional: boolean; + } + /** + * Represents a single signature to show in signature help. + */ + interface SignatureHelpItem { + /** + * Whether the signature accepts a variable number of arguments. + */ + isVariadic: boolean; + /** + * The prefix display parts. + */ + prefixDisplayParts: SymbolDisplayPart[]; + /** + * The suffix display parts. + */ + suffixDisplayParts: SymbolDisplayPart[]; + /** + * The separator display parts. + */ + separatorDisplayParts: SymbolDisplayPart[]; + /** + * The signature helps items for the parameters. + */ + parameters: SignatureHelpParameter[]; + /** + * The signature's documentation + */ + documentation: SymbolDisplayPart[]; + } + /** + * Signature help items found in the response of a signature help request. + */ + interface SignatureHelpItems { + /** + * The signature help items. + */ + items: SignatureHelpItem[]; + /** + * The span for which signature help should appear on a signature + */ + applicableSpan: TextSpan; + /** + * The item selected in the set of available help items. + */ + selectedItemIndex: number; + /** + * The argument selected in the set of parameters. + */ + argumentIndex: number; + /** + * The argument count + */ + argumentCount: number; + } + /** + * Arguments of a signature help request. + */ + interface SignatureHelpRequestArgs extends FileLocationRequestArgs { + } + /** + * Signature help request; value of command field is "signatureHelp". + * Given a file location (file, line, col), return the signature + * help. + */ + interface SignatureHelpRequest extends FileLocationRequest { + command: CommandTypes.SignatureHelp; + arguments: SignatureHelpRequestArgs; + } + /** + * Response object for a SignatureHelpRequest. + */ + interface SignatureHelpResponse extends Response { + body?: SignatureHelpItems; + } + /** + * Synchronous request for semantic diagnostics of one file. + */ + interface SemanticDiagnosticsSyncRequest extends FileRequest { + command: CommandTypes.SemanticDiagnosticsSync; + arguments: SemanticDiagnosticsSyncRequestArgs; + } + interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs { + includeLinePosition?: boolean; + } + /** + * Response object for synchronous sematic diagnostics request. + */ + interface SemanticDiagnosticsSyncResponse extends Response { + body?: Diagnostic[] | DiagnosticWithLinePosition[]; + } + /** + * Synchronous request for syntactic diagnostics of one file. + */ + interface SyntacticDiagnosticsSyncRequest extends FileRequest { + command: CommandTypes.SyntacticDiagnosticsSync; + arguments: SyntacticDiagnosticsSyncRequestArgs; + } + interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs { + includeLinePosition?: boolean; + } + /** + * Response object for synchronous syntactic diagnostics request. + */ + interface SyntacticDiagnosticsSyncResponse extends Response { + body?: Diagnostic[] | DiagnosticWithLinePosition[]; + } + /** + * Arguments for GeterrForProject request. + */ + interface GeterrForProjectRequestArgs { + /** + * the file requesting project error list + */ + file: string; + /** + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ + delay: number; + } + /** + * GeterrForProjectRequest request; value of command field is + * "geterrForProject". It works similarly with 'Geterr', only + * it request for every file in this project. + */ + interface GeterrForProjectRequest extends Request { + command: CommandTypes.GeterrForProject; + arguments: GeterrForProjectRequestArgs; + } + /** + * Arguments for geterr messages. + */ + interface GeterrRequestArgs { + /** + * List of file names for which to compute compiler errors. + * The files will be checked in list order. + */ + files: string[]; + /** + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ + delay: number; + } + /** + * Geterr request; value of command field is "geterr". Wait for + * delay milliseconds and then, if during the wait no change or + * reload messages have arrived for the first file in the files + * list, get the syntactic errors for the file, field requests, + * and then get the semantic errors for the file. Repeat with a + * smaller delay for each subsequent file on the files list. Best + * practice for an editor is to send a file list containing each + * file that is currently visible, in most-recently-used order. + */ + interface GeterrRequest extends Request { + command: CommandTypes.Geterr; + arguments: GeterrRequestArgs; + } + /** + * Item of diagnostic information found in a DiagnosticEvent message. + */ + interface Diagnostic { + /** + * Starting file location at which text applies. + */ + start: Location; + /** + * The last file location at which the text applies. + */ + end: Location; + /** + * Text of diagnostic message. + */ + text: string; + /** + * The error code of the diagnostic message. + */ + code?: number; + } + interface DiagnosticEventBody { + /** + * The file for which diagnostic information is reported. + */ + file: string; + /** + * An array of diagnostic information items. + */ + diagnostics: Diagnostic[]; + } + /** + * Event message for "syntaxDiag" and "semanticDiag" event types. + * These events provide syntactic and semantic errors for a file. + */ + interface DiagnosticEvent extends Event { + body?: DiagnosticEventBody; + } + interface ConfigFileDiagnosticEventBody { + /** + * The file which trigged the searching and error-checking of the config file + */ + triggerFile: string; + /** + * The name of the found config file. + */ + configFile: string; + /** + * An arry of diagnostic information items for the found config file. + */ + diagnostics: Diagnostic[]; + } + /** + * Event message for "configFileDiag" event type. + * This event provides errors for a found config file. + */ + interface ConfigFileDiagnosticEvent extends Event { + body?: ConfigFileDiagnosticEventBody; + event: "configFileDiag"; + } + /** + * Arguments for reload request. + */ + interface ReloadRequestArgs extends FileRequestArgs { + /** + * Name of temporary file from which to reload file + * contents. May be same as file. + */ + tmpfile: string; + } + /** + * Reload request message; value of command field is "reload". + * Reload contents of file with name given by the 'file' argument + * from temporary file with name given by the 'tmpfile' argument. + * The two names can be identical. + */ + interface ReloadRequest extends FileRequest { + command: CommandTypes.Reload; + arguments: ReloadRequestArgs; + } + /** + * Response to "reload" request. This is just an acknowledgement, so + * no body field is required. + */ + interface ReloadResponse extends Response { + } + /** + * Arguments for saveto request. + */ + interface SavetoRequestArgs extends FileRequestArgs { + /** + * Name of temporary file into which to save server's view of + * file contents. + */ + tmpfile: string; + } + /** + * Saveto request message; value of command field is "saveto". + * For debugging purposes, save to a temporaryfile (named by + * argument 'tmpfile') the contents of file named by argument + * 'file'. The server does not currently send a response to a + * "saveto" request. + */ + interface SavetoRequest extends FileRequest { + command: CommandTypes.Saveto; + arguments: SavetoRequestArgs; + } + /** + * Arguments for navto request message. + */ + interface NavtoRequestArgs extends FileRequestArgs { + /** + * Search term to navigate to from current location; term can + * be '.*' or an identifier prefix. + */ + searchValue: string; + /** + * Optional limit on the number of items to return. + */ + maxResultCount?: number; + /** + * Optional flag to indicate we want results for just the current file + * or the entire project. + */ + currentFileOnly?: boolean; + projectFileName?: string; + } + /** + * Navto request message; value of command field is "navto". + * Return list of objects giving file locations and symbols that + * match the search term given in argument 'searchTerm'. The + * context for the search is given by the named file. + */ + interface NavtoRequest extends FileRequest { + command: CommandTypes.Navto; + arguments: NavtoRequestArgs; + } + /** + * An item found in a navto response. + */ + interface NavtoItem { + /** + * The symbol's name. + */ + name: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + /** + * exact, substring, or prefix. + */ + matchKind?: string; + /** + * If this was a case sensitive or insensitive match. + */ + isCaseSensitive?: boolean; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers?: string; + /** + * The file in which the symbol is found. + */ + file: string; + /** + * The location within file at which the symbol is found. + */ + start: Location; + /** + * One past the last character of the symbol. + */ + end: Location; + /** + * Name of symbol's container symbol (if any); for example, + * the class name if symbol is a class member. + */ + containerName?: string; + /** + * Kind of symbol's container symbol (if any). + */ + containerKind?: string; + } + /** + * Navto response message. Body is an array of navto items. Each + * item gives a symbol that matched the search term. + */ + interface NavtoResponse extends Response { + body?: NavtoItem[]; + } + /** + * Arguments for change request message. + */ + interface ChangeRequestArgs extends FormatRequestArgs { + /** + * Optional string to insert at location (file, line, offset). + */ + insertString?: string; + } + /** + * Change request message; value of command field is "change". + * Update the server's view of the file named by argument 'file'. + * Server does not currently send a response to a change request. + */ + interface ChangeRequest extends FileLocationRequest { + command: CommandTypes.Change; + arguments: ChangeRequestArgs; + } + /** + * Response to "brace" request. + */ + interface BraceResponse extends Response { + body?: TextSpan[]; + } + /** + * Brace matching request; value of command field is "brace". + * Return response giving the file locations of matching braces + * found in file at location line, offset. + */ + interface BraceRequest extends FileLocationRequest { + command: CommandTypes.Brace; + } + /** + * NavBar items request; value of command field is "navbar". + * Return response giving the list of navigation bar entries + * extracted from the requested file. + */ + interface NavBarRequest extends FileRequest { + command: CommandTypes.NavBar; + } + /** + * NavTree request; value of command field is "navtree". + * Return response giving the navigation tree of the requested file. + */ + interface NavTreeRequest extends FileRequest { + command: CommandTypes.NavTree; + } + interface NavigationBarItem { + /** + * The item's display text. + */ + text: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers?: string; + /** + * The definition locations of the item. + */ + spans: TextSpan[]; + /** + * Optional children. + */ + childItems?: NavigationBarItem[]; + /** + * Number of levels deep this item should appear. + */ + indent: number; + } + /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */ + interface NavigationTree { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems?: NavigationTree[]; + } + type TelemetryEventName = "telemetry"; + interface TelemetryEvent extends Event { + event: TelemetryEventName; + body: TelemetryEventBody; + } + interface TelemetryEventBody { + telemetryEventName: string; + payload: any; + } + type TypingsInstalledTelemetryEventName = "typingsInstalled"; + interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody { + telemetryEventName: TypingsInstalledTelemetryEventName; + payload: TypingsInstalledTelemetryEventPayload; + } + interface TypingsInstalledTelemetryEventPayload { + /** + * Comma separated list of installed typing packages + */ + installedPackages: string; + /** + * true if install request succeeded, otherwise - false + */ + installSuccess: boolean; + } + interface NavBarResponse extends Response { + body?: NavigationBarItem[]; + } + interface NavTreeResponse extends Response { + body?: NavigationTree; + } + namespace IndentStyle { + type None = "None"; + type Block = "Block"; + type Smart = "Smart"; + } + type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart; + interface EditorSettings { + baseIndentSize?: number; + indentSize?: number; + tabSize?: number; + newLineCharacter?: string; + convertTabsToSpaces?: boolean; + indentStyle?: IndentStyle | ts.IndentStyle; + } + interface FormatCodeSettings extends EditorSettings { + insertSpaceAfterCommaDelimiter?: boolean; + insertSpaceAfterSemicolonInForStatements?: boolean; + insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterKeywordsInControlFlowStatements?: boolean; + insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; + insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; + insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + placeOpenBraceOnNewLineForFunctions?: boolean; + placeOpenBraceOnNewLineForControlBlocks?: boolean; + } + interface CompilerOptions { + allowJs?: boolean; + allowSyntheticDefaultImports?: boolean; + allowUnreachableCode?: boolean; + allowUnusedLabels?: boolean; + baseUrl?: string; + charset?: string; + declaration?: boolean; + declarationDir?: string; + disableSizeLimit?: boolean; + emitBOM?: boolean; + emitDecoratorMetadata?: boolean; + experimentalDecorators?: boolean; + forceConsistentCasingInFileNames?: boolean; + inlineSourceMap?: boolean; + inlineSources?: boolean; + isolatedModules?: boolean; + jsx?: JsxEmit | ts.JsxEmit; + lib?: string[]; + locale?: string; + mapRoot?: string; + maxNodeModuleJsDepth?: number; + module?: ModuleKind | ts.ModuleKind; + moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind; + newLine?: NewLineKind | ts.NewLineKind; + noEmit?: boolean; + noEmitHelpers?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noFallthroughCasesInSwitch?: boolean; + noImplicitAny?: boolean; + noImplicitReturns?: boolean; + noImplicitThis?: boolean; + noUnusedLocals?: boolean; + noUnusedParameters?: boolean; + noImplicitUseStrict?: boolean; + noLib?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + outFile?: string; + paths?: MapLike; + preserveConstEnums?: boolean; + project?: string; + reactNamespace?: string; + removeComments?: boolean; + rootDir?: string; + rootDirs?: string[]; + skipLibCheck?: boolean; + skipDefaultLibCheck?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + strictNullChecks?: boolean; + suppressExcessPropertyErrors?: boolean; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget | ts.ScriptTarget; + traceResolution?: boolean; + types?: string[]; + /** Paths used to used to compute primary types search locations */ + typeRoots?: string[]; + [option: string]: CompilerOptionsValue | undefined; + } + namespace JsxEmit { + type None = "None"; + type Preserve = "Preserve"; + type React = "React"; + } + type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React; + namespace ModuleKind { + type None = "None"; + type CommonJS = "CommonJS"; + type AMD = "AMD"; + type UMD = "UMD"; + type System = "System"; + type ES6 = "ES6"; + type ES2015 = "ES2015"; + } + type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015; + namespace ModuleResolutionKind { + type Classic = "Classic"; + type Node = "Node"; + } + type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node; + namespace NewLineKind { + type Crlf = "Crlf"; + type Lf = "Lf"; + } + type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf; + namespace ScriptTarget { + type ES3 = "ES3"; + type ES5 = "ES5"; + type ES6 = "ES6"; + type ES2015 = "ES2015"; + } + type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015; +} declare namespace ts.server.protocol { interface TextInsertion { diff --git a/lib/tsc.js b/lib/tsc.js index 98b51ba9216..1e69c7a4d16 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -1,18 +1,18 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + var ts; (function (ts) { var OperationCanceledException = (function () { diff --git a/lib/tsserver.js b/lib/tsserver.js index a426c38658c..c308492a668 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -1,18 +1,18 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 5506c0e0566..6991547347c 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -1,18 +1,18 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 9f1423683eb..2ad7b8ae388 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -1,18 +1,18 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + declare namespace ts { interface MapLike { [index: string]: T; @@ -3098,5 +3098,5 @@ declare namespace ts { */ function getDefaultLibFilePath(options: CompilerOptions): string; } - + export = ts; \ No newline at end of file diff --git a/lib/typescript.js b/lib/typescript.js index a36522ece49..59bd352a9d9 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -1,18 +1,18 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index bbf7b441de3..5c337f07cc6 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -1,18 +1,18 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + declare namespace ts { interface MapLike { [index: string]: T; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index a36522ece49..59bd352a9d9 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -1,18 +1,18 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 12fae035226..70b4424c200 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -1,18 +1,18 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } From e2138da77e2cfecf7f8584384cb5bf78f92e88f8 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 15 Dec 2016 08:40:12 -0800 Subject: [PATCH 066/125] Add more files to .npmignore --- .npmignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.npmignore b/.npmignore index 02d8fe428f9..d3c27afeff4 100644 --- a/.npmignore +++ b/.npmignore @@ -1,8 +1,11 @@ built doc +Gulpfile.ts internal issue_template.md +jenkins.sh lib/README.md +netci.groovy pull_request_template.md scripts src From b624d4781705badb8eab3375865ebb83a6ae5b8a Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Thu, 15 Dec 2016 13:46:39 -0800 Subject: [PATCH 067/125] Update LKG --- lib/lib.d.ts | 4328 +++++-------- lib/lib.dom.d.ts | 4286 +++++-------- lib/lib.es2015.core.d.ts | 8 +- lib/lib.es2016.array.include.d.ts | 9 + lib/lib.es2017.object.d.ts | 13 +- lib/lib.es5.d.ts | 42 +- lib/lib.es6.d.ts | 4336 +++++-------- lib/lib.webworker.d.ts | 214 +- lib/protocol.d.ts | 76 +- lib/tsc.js | 7138 +++++++++++---------- lib/tsserver.js | 8728 +++++++++++++++----------- lib/tsserverlibrary.d.ts | 842 ++- lib/tsserverlibrary.js | 8639 ++++++++++++++----------- lib/typescript.d.ts | 171 +- lib/typescript.js | 9738 +++++++++++++++++------------ lib/typescriptServices.d.ts | 171 +- lib/typescriptServices.js | 9738 +++++++++++++++++------------ lib/typingsInstaller.js | 307 +- 18 files changed, 31919 insertions(+), 26865 deletions(-) diff --git a/lib/lib.d.ts b/lib/lib.d.ts index ce9c63c3242..5b1f3d7c393 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -200,7 +200,19 @@ interface ObjectConstructor { * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - freeze(o: T): T; + freeze(a: T[]): ReadonlyArray; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(f: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): Readonly; /** * Prevents the addition of new properties to an object. @@ -1363,6 +1375,34 @@ interface ArrayLike { readonly [n: number]: T; } +/** + * Make all properties in T optional + */ +type Partial = { + [P in keyof T]?: T[P]; +}; + +/** + * Make all properties in T readonly + */ +type Readonly = { + readonly [P in keyof T]: T[P]; +}; + +/** + * From T pick a set of properties K + */ +type Pick = { + [P in K]: T[P]; +} + +/** + * Construct a type with a set of properties K of type T + */ +type Record = { + [P in K]: T; +} + /** * Represents a raw buffer of binary data, which is used to store data for the * different typed arrays. ArrayBuffers cannot be read from or written to directly, @@ -4233,6 +4273,7 @@ interface DoubleRange { } interface EventInit { + scoped?: boolean; bubbles?: boolean; cancelable?: boolean; } @@ -5074,15 +5115,26 @@ declare var AnimationEvent: { new(): AnimationEvent; } +interface ApplicationCacheEventMap { + "cached": Event; + "checking": Event; + "downloading": Event; + "error": ErrorEvent; + "noupdate": Event; + "obsolete": Event; + "progress": ProgressEvent; + "updateready": Event; +} + interface ApplicationCache extends EventTarget { - oncached: (this: this, ev: Event) => any; - onchecking: (this: this, ev: Event) => any; - ondownloading: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onnoupdate: (this: this, ev: Event) => any; - onobsolete: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onupdateready: (this: this, ev: Event) => any; + oncached: (this: ApplicationCache, ev: Event) => any; + onchecking: (this: ApplicationCache, ev: Event) => any; + ondownloading: (this: ApplicationCache, ev: Event) => any; + onerror: (this: ApplicationCache, ev: ErrorEvent) => any; + onnoupdate: (this: ApplicationCache, ev: Event) => any; + onobsolete: (this: ApplicationCache, ev: Event) => any; + onprogress: (this: ApplicationCache, ev: ProgressEvent) => any; + onupdateready: (this: ApplicationCache, ev: Event) => any; readonly status: number; abort(): void; swapCache(): void; @@ -5093,14 +5145,7 @@ interface ApplicationCache extends EventTarget { readonly OBSOLETE: number; readonly UNCACHED: number; readonly UPDATEREADY: number; - addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5153,17 +5198,21 @@ declare var AudioBuffer: { new(): AudioBuffer; } +interface AudioBufferSourceNodeEventMap { + "ended": MediaStreamErrorEvent; +} + interface AudioBufferSourceNode extends AudioNode { buffer: AudioBuffer | null; readonly detune: AudioParam; loop: boolean; loopEnd: number; loopStart: number; - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any; readonly playbackRate: AudioParam; start(when?: number, offset?: number, duration?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5285,16 +5334,20 @@ declare var AudioTrack: { new(): AudioTrack; } +interface AudioTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + interface AudioTrackList extends EventTarget { readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; + onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any; + onchange: (this: AudioTrackList, ev: Event) => any; + onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any; getTrackById(id: string): AudioTrack | null; item(index: number): AudioTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [index: number]: AudioTrack; } @@ -5995,7 +6048,6 @@ interface CharacterData extends Node, ChildNode { insertData(offset: number, arg: string): void; replaceData(offset: number, count: number, arg: string): void; substringData(offset: number, count: number): string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var CharacterData: { @@ -6320,6 +6372,8 @@ declare var DOMTokenList: { interface DataCue extends TextTrackCue { data: ArrayBuffer; + addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var DataCue: { @@ -6448,7 +6502,98 @@ declare var DeviceRotationRate: { new(): DeviceRotationRate; } -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode { +interface DocumentEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforedeactivate": UIEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "fullscreenchange": Event; + "fullscreenerror": Event; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "mssitemodejumplistitemremoved": MSSiteModeEvent; + "msthumbnailclick": MSSiteModeEvent; + "pause": Event; + "play": Event; + "playing": Event; + "pointerlockchange": Event; + "pointerlockerror": Event; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": ProgressEvent; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectionchange": Event; + "selectstart": Event; + "stalled": Event; + "stop": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "volumechange": Event; + "waiting": Event; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + +interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot { /** * Sets or gets the URL for the current document. */ @@ -6571,294 +6716,294 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Fires when the user aborts the download. * @param ev The event. */ - onabort: (this: this, ev: UIEvent) => any; + onabort: (this: Document, ev: UIEvent) => any; /** * Fires when the object is set as the active element. * @param ev The event. */ - onactivate: (this: this, ev: UIEvent) => any; + onactivate: (this: Document, ev: UIEvent) => any; /** * Fires immediately before the object is set as the active element. * @param ev The event. */ - onbeforeactivate: (this: this, ev: UIEvent) => any; + onbeforeactivate: (this: Document, ev: UIEvent) => any; /** * Fires immediately before the activeElement is changed from the current object to another object in the parent document. * @param ev The event. */ - onbeforedeactivate: (this: this, ev: UIEvent) => any; + onbeforedeactivate: (this: Document, ev: UIEvent) => any; /** * Fires when the object loses the input focus. * @param ev The focus event. */ - onblur: (this: this, ev: FocusEvent) => any; + onblur: (this: Document, ev: FocusEvent) => any; /** * Occurs when playback is possible, but would require further buffering. * @param ev The event. */ - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; + oncanplay: (this: Document, ev: Event) => any; + oncanplaythrough: (this: Document, ev: Event) => any; /** * Fires when the contents of the object or selection have changed. * @param ev The event. */ - onchange: (this: this, ev: Event) => any; + onchange: (this: Document, ev: Event) => any; /** * Fires when the user clicks the left mouse button on the object * @param ev The mouse event. */ - onclick: (this: this, ev: MouseEvent) => any; + onclick: (this: Document, ev: MouseEvent) => any; /** * Fires when the user clicks the right mouse button in the client area, opening the context menu. * @param ev The mouse event. */ - oncontextmenu: (this: this, ev: PointerEvent) => any; + oncontextmenu: (this: Document, ev: PointerEvent) => any; /** * Fires when the user double-clicks the object. * @param ev The mouse event. */ - ondblclick: (this: this, ev: MouseEvent) => any; + ondblclick: (this: Document, ev: MouseEvent) => any; /** * Fires when the activeElement is changed from the current object to another object in the parent document. * @param ev The UI Event */ - ondeactivate: (this: this, ev: UIEvent) => any; + ondeactivate: (this: Document, ev: UIEvent) => any; /** * Fires on the source object continuously during a drag operation. * @param ev The event. */ - ondrag: (this: this, ev: DragEvent) => any; + ondrag: (this: Document, ev: DragEvent) => any; /** * Fires on the source object when the user releases the mouse at the close of a drag operation. * @param ev The event. */ - ondragend: (this: this, ev: DragEvent) => any; + ondragend: (this: Document, ev: DragEvent) => any; /** * Fires on the target element when the user drags the object to a valid drop target. * @param ev The drag event. */ - ondragenter: (this: this, ev: DragEvent) => any; + ondragenter: (this: Document, ev: DragEvent) => any; /** * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. * @param ev The drag event. */ - ondragleave: (this: this, ev: DragEvent) => any; + ondragleave: (this: Document, ev: DragEvent) => any; /** * Fires on the target element continuously while the user drags the object over a valid drop target. * @param ev The event. */ - ondragover: (this: this, ev: DragEvent) => any; + ondragover: (this: Document, ev: DragEvent) => any; /** * Fires on the source object when the user starts to drag a text selection or selected object. * @param ev The event. */ - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; + ondragstart: (this: Document, ev: DragEvent) => any; + ondrop: (this: Document, ev: DragEvent) => any; /** * Occurs when the duration attribute is updated. * @param ev The event. */ - ondurationchange: (this: this, ev: Event) => any; + ondurationchange: (this: Document, ev: Event) => any; /** * Occurs when the media element is reset to its initial state. * @param ev The event. */ - onemptied: (this: this, ev: Event) => any; + onemptied: (this: Document, ev: Event) => any; /** * Occurs when the end of playback is reached. * @param ev The event */ - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onended: (this: Document, ev: MediaStreamErrorEvent) => any; /** * Fires when an error occurs during object loading. * @param ev The event. */ - onerror: (this: this, ev: ErrorEvent) => any; + onerror: (this: Document, ev: ErrorEvent) => any; /** * Fires when the object receives focus. * @param ev The event. */ - onfocus: (this: this, ev: FocusEvent) => any; - onfullscreenchange: (this: this, ev: Event) => any; - onfullscreenerror: (this: this, ev: Event) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; + onfocus: (this: Document, ev: FocusEvent) => any; + onfullscreenchange: (this: Document, ev: Event) => any; + onfullscreenerror: (this: Document, ev: Event) => any; + oninput: (this: Document, ev: Event) => any; + oninvalid: (this: Document, ev: Event) => any; /** * Fires when the user presses a key. * @param ev The keyboard event */ - onkeydown: (this: this, ev: KeyboardEvent) => any; + onkeydown: (this: Document, ev: KeyboardEvent) => any; /** * Fires when the user presses an alphanumeric key. * @param ev The event. */ - onkeypress: (this: this, ev: KeyboardEvent) => any; + onkeypress: (this: Document, ev: KeyboardEvent) => any; /** * Fires when the user releases a key. * @param ev The keyboard event */ - onkeyup: (this: this, ev: KeyboardEvent) => any; + onkeyup: (this: Document, ev: KeyboardEvent) => any; /** * Fires immediately after the browser loads the object. * @param ev The event. */ - onload: (this: this, ev: Event) => any; + onload: (this: Document, ev: Event) => any; /** * Occurs when media data is loaded at the current playback position. * @param ev The event. */ - onloadeddata: (this: this, ev: Event) => any; + onloadeddata: (this: Document, ev: Event) => any; /** * Occurs when the duration and dimensions of the media have been determined. * @param ev The event. */ - onloadedmetadata: (this: this, ev: Event) => any; + onloadedmetadata: (this: Document, ev: Event) => any; /** * Occurs when Internet Explorer begins looking for media data. * @param ev The event. */ - onloadstart: (this: this, ev: Event) => any; + onloadstart: (this: Document, ev: Event) => any; /** * Fires when the user clicks the object with either mouse button. * @param ev The mouse event. */ - onmousedown: (this: this, ev: MouseEvent) => any; + onmousedown: (this: Document, ev: MouseEvent) => any; /** * Fires when the user moves the mouse over the object. * @param ev The mouse event. */ - onmousemove: (this: this, ev: MouseEvent) => any; + onmousemove: (this: Document, ev: MouseEvent) => any; /** * Fires when the user moves the mouse pointer outside the boundaries of the object. * @param ev The mouse event. */ - onmouseout: (this: this, ev: MouseEvent) => any; + onmouseout: (this: Document, ev: MouseEvent) => any; /** * Fires when the user moves the mouse pointer into the object. * @param ev The mouse event. */ - onmouseover: (this: this, ev: MouseEvent) => any; + onmouseover: (this: Document, ev: MouseEvent) => any; /** * Fires when the user releases a mouse button while the mouse is over the object. * @param ev The mouse event. */ - onmouseup: (this: this, ev: MouseEvent) => any; + onmouseup: (this: Document, ev: MouseEvent) => any; /** * Fires when the wheel button is rotated. * @param ev The mouse event */ - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; + onmousewheel: (this: Document, ev: WheelEvent) => any; + onmscontentzoom: (this: Document, ev: UIEvent) => any; + onmsgesturechange: (this: Document, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any; + onmsgestureend: (this: Document, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Document, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Document, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Document, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Document, ev: MSGestureEvent) => any; + onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any; + onmspointercancel: (this: Document, ev: MSPointerEvent) => any; + onmspointerdown: (this: Document, ev: MSPointerEvent) => any; + onmspointerenter: (this: Document, ev: MSPointerEvent) => any; + onmspointerleave: (this: Document, ev: MSPointerEvent) => any; + onmspointermove: (this: Document, ev: MSPointerEvent) => any; + onmspointerout: (this: Document, ev: MSPointerEvent) => any; + onmspointerover: (this: Document, ev: MSPointerEvent) => any; + onmspointerup: (this: Document, ev: MSPointerEvent) => any; /** * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. * @param ev The event. */ - onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any; + onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any; /** * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. * @param ev The event. */ - onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any; + onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any; /** * Occurs when playback is paused. * @param ev The event. */ - onpause: (this: this, ev: Event) => any; + onpause: (this: Document, ev: Event) => any; /** * Occurs when the play method is requested. * @param ev The event. */ - onplay: (this: this, ev: Event) => any; + onplay: (this: Document, ev: Event) => any; /** * Occurs when the audio or video has started playing. * @param ev The event. */ - onplaying: (this: this, ev: Event) => any; - onpointerlockchange: (this: this, ev: Event) => any; - onpointerlockerror: (this: this, ev: Event) => any; + onplaying: (this: Document, ev: Event) => any; + onpointerlockchange: (this: Document, ev: Event) => any; + onpointerlockerror: (this: Document, ev: Event) => any; /** * Occurs to indicate progress while downloading media data. * @param ev The event. */ - onprogress: (this: this, ev: ProgressEvent) => any; + onprogress: (this: Document, ev: ProgressEvent) => any; /** * Occurs when the playback rate is increased or decreased. * @param ev The event. */ - onratechange: (this: this, ev: Event) => any; + onratechange: (this: Document, ev: Event) => any; /** * Fires when the state of the object has changed. * @param ev The event */ - onreadystatechange: (this: this, ev: ProgressEvent) => any; + onreadystatechange: (this: Document, ev: ProgressEvent) => any; /** * Fires when the user resets a form. * @param ev The event. */ - onreset: (this: this, ev: Event) => any; + onreset: (this: Document, ev: Event) => any; /** * Fires when the user repositions the scroll box in the scroll bar on the object. * @param ev The event. */ - onscroll: (this: this, ev: UIEvent) => any; + onscroll: (this: Document, ev: UIEvent) => any; /** * Occurs when the seek operation ends. * @param ev The event. */ - onseeked: (this: this, ev: Event) => any; + onseeked: (this: Document, ev: Event) => any; /** * Occurs when the current playback position is moved. * @param ev The event. */ - onseeking: (this: this, ev: Event) => any; + onseeking: (this: Document, ev: Event) => any; /** * Fires when the current selection changes. * @param ev The event. */ - onselect: (this: this, ev: UIEvent) => any; + onselect: (this: Document, ev: UIEvent) => any; /** * Fires when the selection state of a document changes. * @param ev The event. */ - onselectionchange: (this: this, ev: Event) => any; - onselectstart: (this: this, ev: Event) => any; + onselectionchange: (this: Document, ev: Event) => any; + onselectstart: (this: Document, ev: Event) => any; /** * Occurs when the download has stopped. * @param ev The event. */ - onstalled: (this: this, ev: Event) => any; + onstalled: (this: Document, ev: Event) => any; /** * Fires when the user clicks the Stop button or leaves the Web page. * @param ev The event. */ - onstop: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; + onstop: (this: Document, ev: Event) => any; + onsubmit: (this: Document, ev: Event) => any; /** * Occurs if the load operation has been intentionally halted. * @param ev The event. */ - onsuspend: (this: this, ev: Event) => any; + onsuspend: (this: Document, ev: Event) => any; /** * Occurs to indicate the current playback position. * @param ev The event. */ - ontimeupdate: (this: this, ev: Event) => any; + ontimeupdate: (this: Document, ev: Event) => any; ontouchcancel: (ev: TouchEvent) => any; ontouchend: (ev: TouchEvent) => any; ontouchmove: (ev: TouchEvent) => any; @@ -6867,14 +7012,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Occurs when the volume is changed, or playback is muted or unmuted. * @param ev The event. */ - onvolumechange: (this: this, ev: Event) => any; + onvolumechange: (this: Document, ev: Event) => any; /** * Occurs when playback stops because the next frame of a video resource is not available. * @param ev The event. */ - onwaiting: (this: this, ev: Event) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; + onwaiting: (this: Document, ev: Event) => any; + onwebkitfullscreenchange: (this: Document, ev: Event) => any; + onwebkitfullscreenerror: (this: Document, ev: Event) => any; plugins: HTMLCollectionOf; readonly pointerLockElement: Element; /** @@ -6945,86 +7090,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Creates an instance of the element for the specified tag. * @param tagName The name of an element. */ - createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "applet"): HTMLAppletElement; - createElement(tagName: "area"): HTMLAreaElement; - createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "base"): HTMLBaseElement; - createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "blockquote"): HTMLQuoteElement; - createElement(tagName: "body"): HTMLBodyElement; - createElement(tagName: "br"): HTMLBRElement; - createElement(tagName: "button"): HTMLButtonElement; - createElement(tagName: "canvas"): HTMLCanvasElement; - createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "col"): HTMLTableColElement; - createElement(tagName: "colgroup"): HTMLTableColElement; - createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dir"): HTMLDirectoryElement; - createElement(tagName: "div"): HTMLDivElement; - createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "embed"): HTMLEmbedElement; - createElement(tagName: "fieldset"): HTMLFieldSetElement; - createElement(tagName: "font"): HTMLFontElement; - createElement(tagName: "form"): HTMLFormElement; - createElement(tagName: "frame"): HTMLFrameElement; - createElement(tagName: "frameset"): HTMLFrameSetElement; - createElement(tagName: "h1"): HTMLHeadingElement; - createElement(tagName: "h2"): HTMLHeadingElement; - createElement(tagName: "h3"): HTMLHeadingElement; - createElement(tagName: "h4"): HTMLHeadingElement; - createElement(tagName: "h5"): HTMLHeadingElement; - createElement(tagName: "h6"): HTMLHeadingElement; - createElement(tagName: "head"): HTMLHeadElement; - createElement(tagName: "hr"): HTMLHRElement; - createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "iframe"): HTMLIFrameElement; - createElement(tagName: "img"): HTMLImageElement; - createElement(tagName: "input"): HTMLInputElement; - createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLUnknownElement; - createElement(tagName: "label"): HTMLLabelElement; - createElement(tagName: "legend"): HTMLLegendElement; - createElement(tagName: "li"): HTMLLIElement; - createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLPreElement; - createElement(tagName: "map"): HTMLMapElement; - createElement(tagName: "marquee"): HTMLMarqueeElement; - createElement(tagName: "menu"): HTMLMenuElement; - createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "meter"): HTMLMeterElement; - createElement(tagName: "nextid"): HTMLUnknownElement; - createElement(tagName: "object"): HTMLObjectElement; - createElement(tagName: "ol"): HTMLOListElement; - createElement(tagName: "optgroup"): HTMLOptGroupElement; - createElement(tagName: "option"): HTMLOptionElement; - createElement(tagName: "p"): HTMLParagraphElement; - createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "picture"): HTMLPictureElement; - createElement(tagName: "pre"): HTMLPreElement; - createElement(tagName: "progress"): HTMLProgressElement; - createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "script"): HTMLScriptElement; - createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "source"): HTMLSourceElement; - createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "table"): HTMLTableElement; - createElement(tagName: "tbody"): HTMLTableSectionElement; - createElement(tagName: "td"): HTMLTableDataCellElement; - createElement(tagName: "template"): HTMLTemplateElement; - createElement(tagName: "textarea"): HTMLTextAreaElement; - createElement(tagName: "tfoot"): HTMLTableSectionElement; - createElement(tagName: "th"): HTMLTableHeaderCellElement; - createElement(tagName: "thead"): HTMLTableSectionElement; - createElement(tagName: "title"): HTMLTitleElement; - createElement(tagName: "tr"): HTMLTableRowElement; - createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "video"): HTMLVideoElement; - createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLPreElement; + createElement(tagName: K): HTMLElementTagNameMap[K]; createElement(tagName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement @@ -7126,7 +7192,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param y The y-offset */ elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; /** * Executes a command on the current document, current selection, or the given range. * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. @@ -7160,182 +7226,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Retrieves a collection of objects based on the specified element name. * @param name Specifies the name of an element. */ - getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; - getElementsByTagName(tagname: "applet"): NodeListOf; - getElementsByTagName(tagname: "area"): NodeListOf; - getElementsByTagName(tagname: "article"): NodeListOf; - getElementsByTagName(tagname: "aside"): NodeListOf; - getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; - getElementsByTagName(tagname: "base"): NodeListOf; - getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; - getElementsByTagName(tagname: "body"): NodeListOf; - getElementsByTagName(tagname: "br"): NodeListOf; - getElementsByTagName(tagname: "button"): NodeListOf; - getElementsByTagName(tagname: "canvas"): NodeListOf; - getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; - getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; - getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; - getElementsByTagName(tagname: "col"): NodeListOf; - getElementsByTagName(tagname: "colgroup"): NodeListOf; - getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; - getElementsByTagName(tagname: "defs"): NodeListOf; - getElementsByTagName(tagname: "del"): NodeListOf; - getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; - getElementsByTagName(tagname: "dir"): NodeListOf; - getElementsByTagName(tagname: "div"): NodeListOf; - getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; - getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; - getElementsByTagName(tagname: "embed"): NodeListOf; - getElementsByTagName(tagname: "feblend"): NodeListOf; - getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; - getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(tagname: "fecomposite"): NodeListOf; - getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; - getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; - getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; - getElementsByTagName(tagname: "fedistantlight"): NodeListOf; - getElementsByTagName(tagname: "feflood"): NodeListOf; - getElementsByTagName(tagname: "fefunca"): NodeListOf; - getElementsByTagName(tagname: "fefuncb"): NodeListOf; - getElementsByTagName(tagname: "fefuncg"): NodeListOf; - getElementsByTagName(tagname: "fefuncr"): NodeListOf; - getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; - getElementsByTagName(tagname: "feimage"): NodeListOf; - getElementsByTagName(tagname: "femerge"): NodeListOf; - getElementsByTagName(tagname: "femergenode"): NodeListOf; - getElementsByTagName(tagname: "femorphology"): NodeListOf; - getElementsByTagName(tagname: "feoffset"): NodeListOf; - getElementsByTagName(tagname: "fepointlight"): NodeListOf; - getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; - getElementsByTagName(tagname: "fespotlight"): NodeListOf; - getElementsByTagName(tagname: "fetile"): NodeListOf; - getElementsByTagName(tagname: "feturbulence"): NodeListOf; - getElementsByTagName(tagname: "fieldset"): NodeListOf; - getElementsByTagName(tagname: "figcaption"): NodeListOf; - getElementsByTagName(tagname: "figure"): NodeListOf; - getElementsByTagName(tagname: "filter"): NodeListOf; - getElementsByTagName(tagname: "font"): NodeListOf; - getElementsByTagName(tagname: "footer"): NodeListOf; - getElementsByTagName(tagname: "foreignobject"): NodeListOf; - getElementsByTagName(tagname: "form"): NodeListOf; - getElementsByTagName(tagname: "frame"): NodeListOf; - getElementsByTagName(tagname: "frameset"): NodeListOf; - getElementsByTagName(tagname: "g"): NodeListOf; - getElementsByTagName(tagname: "h1"): NodeListOf; - getElementsByTagName(tagname: "h2"): NodeListOf; - getElementsByTagName(tagname: "h3"): NodeListOf; - getElementsByTagName(tagname: "h4"): NodeListOf; - getElementsByTagName(tagname: "h5"): NodeListOf; - getElementsByTagName(tagname: "h6"): NodeListOf; - getElementsByTagName(tagname: "head"): NodeListOf; - getElementsByTagName(tagname: "header"): NodeListOf; - getElementsByTagName(tagname: "hgroup"): NodeListOf; - getElementsByTagName(tagname: "hr"): NodeListOf; - getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; - getElementsByTagName(tagname: "iframe"): NodeListOf; - getElementsByTagName(tagname: "image"): NodeListOf; - getElementsByTagName(tagname: "img"): NodeListOf; - getElementsByTagName(tagname: "input"): NodeListOf; - getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; - getElementsByTagName(tagname: "label"): NodeListOf; - getElementsByTagName(tagname: "legend"): NodeListOf; - getElementsByTagName(tagname: "li"): NodeListOf; - getElementsByTagName(tagname: "line"): NodeListOf; - getElementsByTagName(tagname: "lineargradient"): NodeListOf; - getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; - getElementsByTagName(tagname: "map"): NodeListOf; - getElementsByTagName(tagname: "mark"): NodeListOf; - getElementsByTagName(tagname: "marker"): NodeListOf; - getElementsByTagName(tagname: "marquee"): NodeListOf; - getElementsByTagName(tagname: "mask"): NodeListOf; - getElementsByTagName(tagname: "menu"): NodeListOf; - getElementsByTagName(tagname: "meta"): NodeListOf; - getElementsByTagName(tagname: "metadata"): NodeListOf; - getElementsByTagName(tagname: "meter"): NodeListOf; - getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; - getElementsByTagName(tagname: "noframes"): NodeListOf; - getElementsByTagName(tagname: "noscript"): NodeListOf; - getElementsByTagName(tagname: "object"): NodeListOf; - getElementsByTagName(tagname: "ol"): NodeListOf; - getElementsByTagName(tagname: "optgroup"): NodeListOf; - getElementsByTagName(tagname: "option"): NodeListOf; - getElementsByTagName(tagname: "p"): NodeListOf; - getElementsByTagName(tagname: "param"): NodeListOf; - getElementsByTagName(tagname: "path"): NodeListOf; - getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "picture"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; - getElementsByTagName(tagname: "polygon"): NodeListOf; - getElementsByTagName(tagname: "polyline"): NodeListOf; - getElementsByTagName(tagname: "pre"): NodeListOf; - getElementsByTagName(tagname: "progress"): NodeListOf; - getElementsByTagName(tagname: "q"): NodeListOf; - getElementsByTagName(tagname: "radialgradient"): NodeListOf; - getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; - getElementsByTagName(tagname: "script"): NodeListOf; - getElementsByTagName(tagname: "section"): NodeListOf; - getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; - getElementsByTagName(tagname: "source"): NodeListOf; - getElementsByTagName(tagname: "span"): NodeListOf; - getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; - getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; - getElementsByTagName(tagname: "svg"): NodeListOf; - getElementsByTagName(tagname: "switch"): NodeListOf; - getElementsByTagName(tagname: "symbol"): NodeListOf; - getElementsByTagName(tagname: "table"): NodeListOf; - getElementsByTagName(tagname: "tbody"): NodeListOf; - getElementsByTagName(tagname: "td"): NodeListOf; - getElementsByTagName(tagname: "template"): NodeListOf; - getElementsByTagName(tagname: "text"): NodeListOf; - getElementsByTagName(tagname: "textpath"): NodeListOf; - getElementsByTagName(tagname: "textarea"): NodeListOf; - getElementsByTagName(tagname: "tfoot"): NodeListOf; - getElementsByTagName(tagname: "th"): NodeListOf; - getElementsByTagName(tagname: "thead"): NodeListOf; - getElementsByTagName(tagname: "title"): NodeListOf; - getElementsByTagName(tagname: "tr"): NodeListOf; - getElementsByTagName(tagname: "track"): NodeListOf; - getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; - getElementsByTagName(tagname: "ul"): NodeListOf; - getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; - getElementsByTagName(tagname: "video"): NodeListOf; - getElementsByTagName(tagname: "view"): NodeListOf; - getElementsByTagName(tagname: "wbr"): NodeListOf; - getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: K): ElementListTagNameMap[K]; getElementsByTagName(tagname: string): NodeListOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; @@ -7406,103 +7297,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param content The text and HTML tags to write. */ writeln(...content: string[]): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7512,7 +7307,6 @@ declare var Document: { } interface DocumentFragment extends Node, NodeSelector, ParentNode { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var DocumentFragment: { @@ -7527,7 +7321,6 @@ interface DocumentType extends Node, ChildNode { readonly notations: NamedNodeMap; readonly publicId: string | null; readonly systemId: string | null; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var DocumentType: { @@ -7580,6 +7373,36 @@ declare var EXT_texture_filter_anisotropic: { readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } +interface ElementEventMap extends GlobalEventHandlersEventMap { + "ariarequest": AriaRequestEvent; + "command": CommandEvent; + "gotpointercapture": PointerEvent; + "lostpointercapture": PointerEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSGotPointerCapture": MSPointerEvent; + "MSInertiaStart": MSGestureEvent; + "MSLostPointerCapture": MSPointerEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { readonly classList: DOMTokenList; className: string; @@ -7590,33 +7413,33 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec id: string; msContentZoomFactor: number; readonly msRegionOverflow: string; - onariarequest: (this: this, ev: AriaRequestEvent) => any; - oncommand: (this: this, ev: CommandEvent) => any; - ongotpointercapture: (this: this, ev: PointerEvent) => any; - onlostpointercapture: (this: this, ev: PointerEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmslostpointercapture: (this: this, ev: MSPointerEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; + onariarequest: (this: Element, ev: AriaRequestEvent) => any; + oncommand: (this: Element, ev: CommandEvent) => any; + ongotpointercapture: (this: Element, ev: PointerEvent) => any; + onlostpointercapture: (this: Element, ev: PointerEvent) => any; + onmsgesturechange: (this: Element, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any; + onmsgestureend: (this: Element, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Element, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Element, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Element, ev: MSGestureEvent) => any; + onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmsinertiastart: (this: Element, ev: MSGestureEvent) => any; + onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmspointercancel: (this: Element, ev: MSPointerEvent) => any; + onmspointerdown: (this: Element, ev: MSPointerEvent) => any; + onmspointerenter: (this: Element, ev: MSPointerEvent) => any; + onmspointerleave: (this: Element, ev: MSPointerEvent) => any; + onmspointermove: (this: Element, ev: MSPointerEvent) => any; + onmspointerout: (this: Element, ev: MSPointerEvent) => any; + onmspointerover: (this: Element, ev: MSPointerEvent) => any; + onmspointerup: (this: Element, ev: MSPointerEvent) => any; ontouchcancel: (ev: TouchEvent) => any; ontouchend: (ev: TouchEvent) => any; ontouchmove: (ev: TouchEvent) => any; ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; + onwebkitfullscreenchange: (this: Element, ev: Event) => any; + onwebkitfullscreenerror: (this: Element, ev: Event) => any; readonly prefix: string | null; readonly scrollHeight: number; scrollLeft: number; @@ -7624,188 +7447,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec readonly scrollWidth: number; readonly tagName: string; innerHTML: string; + readonly assignedSlot: HTMLSlotElement | null; + slot: string; + readonly shadowRoot: ShadowRoot | null; getAttribute(name: string): string | null; getAttributeNS(namespaceURI: string, localName: string): string; getAttributeNode(name: string): Attr; getAttributeNodeNS(namespaceURI: string, localName: string): Attr; getBoundingClientRect(): ClientRect; getClientRects(): ClientRectList; - getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; - getElementsByTagName(name: "applet"): NodeListOf; - getElementsByTagName(name: "area"): NodeListOf; - getElementsByTagName(name: "article"): NodeListOf; - getElementsByTagName(name: "aside"): NodeListOf; - getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; - getElementsByTagName(name: "base"): NodeListOf; - getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; - getElementsByTagName(name: "body"): NodeListOf; - getElementsByTagName(name: "br"): NodeListOf; - getElementsByTagName(name: "button"): NodeListOf; - getElementsByTagName(name: "canvas"): NodeListOf; - getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; - getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; - getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; - getElementsByTagName(name: "col"): NodeListOf; - getElementsByTagName(name: "colgroup"): NodeListOf; - getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; - getElementsByTagName(name: "defs"): NodeListOf; - getElementsByTagName(name: "del"): NodeListOf; - getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; - getElementsByTagName(name: "dir"): NodeListOf; - getElementsByTagName(name: "div"): NodeListOf; - getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; - getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; - getElementsByTagName(name: "embed"): NodeListOf; - getElementsByTagName(name: "feblend"): NodeListOf; - getElementsByTagName(name: "fecolormatrix"): NodeListOf; - getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(name: "fecomposite"): NodeListOf; - getElementsByTagName(name: "feconvolvematrix"): NodeListOf; - getElementsByTagName(name: "fediffuselighting"): NodeListOf; - getElementsByTagName(name: "fedisplacementmap"): NodeListOf; - getElementsByTagName(name: "fedistantlight"): NodeListOf; - getElementsByTagName(name: "feflood"): NodeListOf; - getElementsByTagName(name: "fefunca"): NodeListOf; - getElementsByTagName(name: "fefuncb"): NodeListOf; - getElementsByTagName(name: "fefuncg"): NodeListOf; - getElementsByTagName(name: "fefuncr"): NodeListOf; - getElementsByTagName(name: "fegaussianblur"): NodeListOf; - getElementsByTagName(name: "feimage"): NodeListOf; - getElementsByTagName(name: "femerge"): NodeListOf; - getElementsByTagName(name: "femergenode"): NodeListOf; - getElementsByTagName(name: "femorphology"): NodeListOf; - getElementsByTagName(name: "feoffset"): NodeListOf; - getElementsByTagName(name: "fepointlight"): NodeListOf; - getElementsByTagName(name: "fespecularlighting"): NodeListOf; - getElementsByTagName(name: "fespotlight"): NodeListOf; - getElementsByTagName(name: "fetile"): NodeListOf; - getElementsByTagName(name: "feturbulence"): NodeListOf; - getElementsByTagName(name: "fieldset"): NodeListOf; - getElementsByTagName(name: "figcaption"): NodeListOf; - getElementsByTagName(name: "figure"): NodeListOf; - getElementsByTagName(name: "filter"): NodeListOf; - getElementsByTagName(name: "font"): NodeListOf; - getElementsByTagName(name: "footer"): NodeListOf; - getElementsByTagName(name: "foreignobject"): NodeListOf; - getElementsByTagName(name: "form"): NodeListOf; - getElementsByTagName(name: "frame"): NodeListOf; - getElementsByTagName(name: "frameset"): NodeListOf; - getElementsByTagName(name: "g"): NodeListOf; - getElementsByTagName(name: "h1"): NodeListOf; - getElementsByTagName(name: "h2"): NodeListOf; - getElementsByTagName(name: "h3"): NodeListOf; - getElementsByTagName(name: "h4"): NodeListOf; - getElementsByTagName(name: "h5"): NodeListOf; - getElementsByTagName(name: "h6"): NodeListOf; - getElementsByTagName(name: "head"): NodeListOf; - getElementsByTagName(name: "header"): NodeListOf; - getElementsByTagName(name: "hgroup"): NodeListOf; - getElementsByTagName(name: "hr"): NodeListOf; - getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; - getElementsByTagName(name: "iframe"): NodeListOf; - getElementsByTagName(name: "image"): NodeListOf; - getElementsByTagName(name: "img"): NodeListOf; - getElementsByTagName(name: "input"): NodeListOf; - getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; - getElementsByTagName(name: "label"): NodeListOf; - getElementsByTagName(name: "legend"): NodeListOf; - getElementsByTagName(name: "li"): NodeListOf; - getElementsByTagName(name: "line"): NodeListOf; - getElementsByTagName(name: "lineargradient"): NodeListOf; - getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; - getElementsByTagName(name: "map"): NodeListOf; - getElementsByTagName(name: "mark"): NodeListOf; - getElementsByTagName(name: "marker"): NodeListOf; - getElementsByTagName(name: "marquee"): NodeListOf; - getElementsByTagName(name: "mask"): NodeListOf; - getElementsByTagName(name: "menu"): NodeListOf; - getElementsByTagName(name: "meta"): NodeListOf; - getElementsByTagName(name: "metadata"): NodeListOf; - getElementsByTagName(name: "meter"): NodeListOf; - getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; - getElementsByTagName(name: "noframes"): NodeListOf; - getElementsByTagName(name: "noscript"): NodeListOf; - getElementsByTagName(name: "object"): NodeListOf; - getElementsByTagName(name: "ol"): NodeListOf; - getElementsByTagName(name: "optgroup"): NodeListOf; - getElementsByTagName(name: "option"): NodeListOf; - getElementsByTagName(name: "p"): NodeListOf; - getElementsByTagName(name: "param"): NodeListOf; - getElementsByTagName(name: "path"): NodeListOf; - getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "picture"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; - getElementsByTagName(name: "polygon"): NodeListOf; - getElementsByTagName(name: "polyline"): NodeListOf; - getElementsByTagName(name: "pre"): NodeListOf; - getElementsByTagName(name: "progress"): NodeListOf; - getElementsByTagName(name: "q"): NodeListOf; - getElementsByTagName(name: "radialgradient"): NodeListOf; - getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; - getElementsByTagName(name: "script"): NodeListOf; - getElementsByTagName(name: "section"): NodeListOf; - getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; - getElementsByTagName(name: "source"): NodeListOf; - getElementsByTagName(name: "span"): NodeListOf; - getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; - getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; - getElementsByTagName(name: "svg"): NodeListOf; - getElementsByTagName(name: "switch"): NodeListOf; - getElementsByTagName(name: "symbol"): NodeListOf; - getElementsByTagName(name: "table"): NodeListOf; - getElementsByTagName(name: "tbody"): NodeListOf; - getElementsByTagName(name: "td"): NodeListOf; - getElementsByTagName(name: "template"): NodeListOf; - getElementsByTagName(name: "text"): NodeListOf; - getElementsByTagName(name: "textpath"): NodeListOf; - getElementsByTagName(name: "textarea"): NodeListOf; - getElementsByTagName(name: "tfoot"): NodeListOf; - getElementsByTagName(name: "th"): NodeListOf; - getElementsByTagName(name: "thead"): NodeListOf; - getElementsByTagName(name: "title"): NodeListOf; - getElementsByTagName(name: "tr"): NodeListOf; - getElementsByTagName(name: "track"): NodeListOf; - getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; - getElementsByTagName(name: "ul"): NodeListOf; - getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; - getElementsByTagName(name: "video"): NodeListOf; - getElementsByTagName(name: "view"): NodeListOf; - getElementsByTagName(name: "wbr"): NodeListOf; - getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: K): ElementListTagNameMap[K]; getElementsByTagName(name: string): NodeListOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; @@ -7845,42 +7496,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot; + addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7916,10 +7533,12 @@ interface Event { readonly target: EventTarget; readonly timeStamp: number; readonly type: string; + readonly scoped: boolean; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; + deepPath(): EventTarget[]; readonly AT_TARGET: number; readonly BUBBLING_PHASE: number; readonly CAPTURING_PHASE: number; @@ -7980,6 +7599,7 @@ interface FileReader extends EventTarget, MSBaseReader { readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8150,6 +7770,8 @@ interface HTMLAnchorElement extends HTMLElement { * Returns a string representation of an object. */ toString(): string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAnchorElement: { @@ -8222,6 +7844,8 @@ interface HTMLAppletElement extends HTMLElement { useMap: string; vspace: number; width: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAppletElement: { @@ -8288,6 +7912,8 @@ interface HTMLAreaElement extends HTMLElement { * Returns a string representation of an object. */ toString(): string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAreaElement: { @@ -8312,6 +7938,8 @@ declare var HTMLAreasCollection: { } interface HTMLAudioElement extends HTMLMediaElement { + addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAudioElement: { @@ -8324,6 +7952,8 @@ interface HTMLBRElement extends HTMLElement { * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. */ clear: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLBRElement: { @@ -8340,6 +7970,8 @@ interface HTMLBaseElement extends HTMLElement { * Sets or retrieves the window or frame at which to target content. */ target: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLBaseElement: { @@ -8356,6 +7988,7 @@ interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty * Sets or retrieves the font size of the object. */ size: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8364,6 +7997,27 @@ declare var HTMLBaseFontElement: { new(): HTMLBaseFontElement; } +interface HTMLBodyElementEventMap extends HTMLElementEventMap { + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "popstate": PopStateEvent; + "resize": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + interface HTMLBodyElement extends HTMLElement { aLink: any; background: string; @@ -8371,147 +8025,27 @@ interface HTMLBodyElement extends HTMLElement { bgProperties: string; link: any; noWrap: boolean; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; + onafterprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any; + onblur: (this: HTMLBodyElement, ev: FocusEvent) => any; + onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any; + onload: (this: HTMLBodyElement, ev: Event) => any; + onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any; + onoffline: (this: HTMLBodyElement, ev: Event) => any; + ononline: (this: HTMLBodyElement, ev: Event) => any; + onorientationchange: (this: HTMLBodyElement, ev: Event) => any; + onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any; + onresize: (this: HTMLBodyElement, ev: UIEvent) => any; + onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any; + onunload: (this: HTMLBodyElement, ev: Event) => any; text: any; vLink: any; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8584,6 +8118,8 @@ interface HTMLButtonElement extends HTMLElement { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLButtonElement: { @@ -8617,6 +8153,8 @@ interface HTMLCanvasElement extends HTMLElement { */ toDataURL(type?: string, ...args: any[]): string; toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLCanvasElement: { @@ -8647,6 +8185,8 @@ declare var HTMLCollection: { interface HTMLDListElement extends HTMLElement { compact: boolean; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDListElement: { @@ -8656,6 +8196,8 @@ declare var HTMLDListElement: { interface HTMLDataListElement extends HTMLElement { options: HTMLCollectionOf; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDataListElement: { @@ -8665,6 +8207,8 @@ declare var HTMLDataListElement: { interface HTMLDirectoryElement extends HTMLElement { compact: boolean; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDirectoryElement: { @@ -8681,6 +8225,8 @@ interface HTMLDivElement extends HTMLElement { * Sets or retrieves whether the browser automatically performs wordwrap. */ noWrap: boolean; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDivElement: { @@ -8689,6 +8235,8 @@ declare var HTMLDivElement: { } interface HTMLDocument extends Document { + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDocument: { @@ -8696,6 +8244,76 @@ declare var HTMLDocument: { new(): HTMLDocument; } +interface HTMLElementEventMap extends ElementEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforecopy": ClipboardEvent; + "beforecut": ClipboardEvent; + "beforedeactivate": UIEvent; + "beforepaste": ClipboardEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "copy": ClipboardEvent; + "cuechange": Event; + "cut": ClipboardEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "paste": ClipboardEvent; + "pause": Event; + "play": Event; + "playing": Event; + "progress": ProgressEvent; + "ratechange": Event; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectstart": Event; + "stalled": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "volumechange": Event; + "waiting": Event; +} + interface HTMLElement extends Element { accessKey: string; readonly children: HTMLCollection; @@ -8714,73 +8332,73 @@ interface HTMLElement extends Element { readonly offsetParent: Element; readonly offsetTop: number; readonly offsetWidth: number; - onabort: (this: this, ev: UIEvent) => any; - onactivate: (this: this, ev: UIEvent) => any; - onbeforeactivate: (this: this, ev: UIEvent) => any; - onbeforecopy: (this: this, ev: ClipboardEvent) => any; - onbeforecut: (this: this, ev: ClipboardEvent) => any; - onbeforedeactivate: (this: this, ev: UIEvent) => any; - onbeforepaste: (this: this, ev: ClipboardEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - oncopy: (this: this, ev: ClipboardEvent) => any; - oncuechange: (this: this, ev: Event) => any; - oncut: (this: this, ev: ClipboardEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondeactivate: (this: this, ev: UIEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onpaste: (this: this, ev: ClipboardEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreset: (this: this, ev: Event) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onselectstart: (this: this, ev: Event) => any; - onstalled: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; + onabort: (this: HTMLElement, ev: UIEvent) => any; + onactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onblur: (this: HTMLElement, ev: FocusEvent) => any; + oncanplay: (this: HTMLElement, ev: Event) => any; + oncanplaythrough: (this: HTMLElement, ev: Event) => any; + onchange: (this: HTMLElement, ev: Event) => any; + onclick: (this: HTMLElement, ev: MouseEvent) => any; + oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any; + oncopy: (this: HTMLElement, ev: ClipboardEvent) => any; + oncuechange: (this: HTMLElement, ev: Event) => any; + oncut: (this: HTMLElement, ev: ClipboardEvent) => any; + ondblclick: (this: HTMLElement, ev: MouseEvent) => any; + ondeactivate: (this: HTMLElement, ev: UIEvent) => any; + ondrag: (this: HTMLElement, ev: DragEvent) => any; + ondragend: (this: HTMLElement, ev: DragEvent) => any; + ondragenter: (this: HTMLElement, ev: DragEvent) => any; + ondragleave: (this: HTMLElement, ev: DragEvent) => any; + ondragover: (this: HTMLElement, ev: DragEvent) => any; + ondragstart: (this: HTMLElement, ev: DragEvent) => any; + ondrop: (this: HTMLElement, ev: DragEvent) => any; + ondurationchange: (this: HTMLElement, ev: Event) => any; + onemptied: (this: HTMLElement, ev: Event) => any; + onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any; + onerror: (this: HTMLElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLElement, ev: FocusEvent) => any; + oninput: (this: HTMLElement, ev: Event) => any; + oninvalid: (this: HTMLElement, ev: Event) => any; + onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any; + onload: (this: HTMLElement, ev: Event) => any; + onloadeddata: (this: HTMLElement, ev: Event) => any; + onloadedmetadata: (this: HTMLElement, ev: Event) => any; + onloadstart: (this: HTMLElement, ev: Event) => any; + onmousedown: (this: HTMLElement, ev: MouseEvent) => any; + onmouseenter: (this: HTMLElement, ev: MouseEvent) => any; + onmouseleave: (this: HTMLElement, ev: MouseEvent) => any; + onmousemove: (this: HTMLElement, ev: MouseEvent) => any; + onmouseout: (this: HTMLElement, ev: MouseEvent) => any; + onmouseover: (this: HTMLElement, ev: MouseEvent) => any; + onmouseup: (this: HTMLElement, ev: MouseEvent) => any; + onmousewheel: (this: HTMLElement, ev: WheelEvent) => any; + onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any; + onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any; + onpaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onpause: (this: HTMLElement, ev: Event) => any; + onplay: (this: HTMLElement, ev: Event) => any; + onplaying: (this: HTMLElement, ev: Event) => any; + onprogress: (this: HTMLElement, ev: ProgressEvent) => any; + onratechange: (this: HTMLElement, ev: Event) => any; + onreset: (this: HTMLElement, ev: Event) => any; + onscroll: (this: HTMLElement, ev: UIEvent) => any; + onseeked: (this: HTMLElement, ev: Event) => any; + onseeking: (this: HTMLElement, ev: Event) => any; + onselect: (this: HTMLElement, ev: UIEvent) => any; + onselectstart: (this: HTMLElement, ev: Event) => any; + onstalled: (this: HTMLElement, ev: Event) => any; + onsubmit: (this: HTMLElement, ev: Event) => any; + onsuspend: (this: HTMLElement, ev: Event) => any; + ontimeupdate: (this: HTMLElement, ev: Event) => any; + onvolumechange: (this: HTMLElement, ev: Event) => any; + onwaiting: (this: HTMLElement, ev: Event) => any; outerHTML: string; outerText: string; spellcheck: boolean; @@ -8793,109 +8411,7 @@ interface HTMLElement extends Element { focus(): void; msGetInputContext(): MSInputMethodContext; 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8951,6 +8467,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { * Sets or retrieves the width of the object. */ width: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8990,6 +8507,8 @@ interface HTMLFieldSetElement extends HTMLElement { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLFieldSetElement: { @@ -9002,6 +8521,7 @@ interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOM * Sets or retrieves the current typeface family. */ face: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9077,6 +8597,8 @@ interface HTMLFormElement extends HTMLElement { * Fires when a FORM is about to be submitted. */ submit(): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; } @@ -9085,6 +8607,10 @@ declare var HTMLFormElement: { new(): HTMLFormElement; } +interface HTMLFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Specifies the properties of a border drawn around an object. @@ -9137,7 +8663,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Raised when the object has been completely received from the server. */ - onload: (this: this, ev: Event) => any; + onload: (this: HTMLFrameElement, ev: Event) => any; /** * Sets or retrieves whether the frame can be scrolled. */ @@ -9150,110 +8676,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves the width of the object. */ width: string | number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9262,6 +8685,25 @@ declare var HTMLFrameElement: { new(): HTMLFrameElement; } +interface HTMLFrameSetElementEventMap extends HTMLElementEventMap { + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "resize": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + interface HTMLFrameSetElement extends HTMLElement { border: string; /** @@ -9281,152 +8723,34 @@ interface HTMLFrameSetElement extends HTMLElement { */ frameSpacing: any; name: string; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; /** * Fires when the object loses the input focus. */ - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any; /** * Fires when the object receives focus. */ - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; + onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; + onload: (this: HTMLFrameSetElement, ev: Event) => any; + onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; + onoffline: (this: HTMLFrameSetElement, ev: Event) => any; + ononline: (this: HTMLFrameSetElement, ev: Event) => any; + onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any; + onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any; + onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any; + onunload: (this: HTMLFrameSetElement, ev: Event) => any; /** * Sets or retrieves the frame heights of the object. */ rows: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9448,6 +8772,7 @@ interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2 * Sets or retrieves the width of the object. */ width: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9458,6 +8783,8 @@ declare var HTMLHRElement: { interface HTMLHeadElement extends HTMLElement { profile: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLHeadElement: { @@ -9470,6 +8797,8 @@ interface HTMLHeadingElement extends HTMLElement { * Sets or retrieves a value that indicates the table alignment. */ align: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLHeadingElement: { @@ -9482,6 +8811,8 @@ interface HTMLHtmlElement extends HTMLElement { * Sets or retrieves the DTD version that governs the current document. */ version: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLHtmlElement: { @@ -9489,6 +8820,10 @@ declare var HTMLHtmlElement: { new(): HTMLHtmlElement; } +interface HTMLIFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Sets or retrieves how the object is aligned with adjacent text. @@ -9546,7 +8881,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Raised when the object has been completely received from the server. */ - onload: (this: this, ev: Event) => any; + onload: (this: HTMLIFrameElement, ev: Event) => any; readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. @@ -9564,110 +8899,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves the width of the object. */ width: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9758,6 +8990,8 @@ interface HTMLImageElement extends HTMLElement { readonly x: number; readonly y: number; msGetAsCastingSource(): any; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLImageElement: { @@ -9969,6 +9203,8 @@ interface HTMLInputElement extends HTMLElement { * @param n Value to increment the value by. */ stepUp(n?: number): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLInputElement: { @@ -9982,6 +9218,8 @@ interface HTMLLIElement extends HTMLElement { * Sets or retrieves the value of a list item. */ value: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLLIElement: { @@ -9998,6 +9236,8 @@ interface HTMLLabelElement extends HTMLElement { * Sets or retrieves the object to which the given label object is assigned. */ htmlFor: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLLabelElement: { @@ -10014,6 +9254,8 @@ interface HTMLLegendElement extends HTMLElement { * Retrieves a reference to the form that the object is embedded in. */ readonly form: HTMLFormElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLLegendElement: { @@ -10057,6 +9299,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle { type: string; import?: Document; integrity: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10074,6 +9317,8 @@ interface HTMLMapElement extends HTMLElement { * Sets or retrieves the name of the object. */ name: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMapElement: { @@ -10081,6 +9326,12 @@ declare var HTMLMapElement: { new(): HTMLMapElement; } +interface HTMLMarqueeElementEventMap extends HTMLElementEventMap { + "bounce": Event; + "finish": Event; + "start": Event; +} + interface HTMLMarqueeElement extends HTMLElement { behavior: string; bgColor: any; @@ -10088,9 +9339,9 @@ interface HTMLMarqueeElement extends HTMLElement { height: string; hspace: number; loop: number; - onbounce: (this: this, ev: Event) => any; - onfinish: (this: this, ev: Event) => any; - onstart: (this: this, ev: Event) => any; + onbounce: (this: HTMLMarqueeElement, ev: Event) => any; + onfinish: (this: HTMLMarqueeElement, ev: Event) => any; + onstart: (this: HTMLMarqueeElement, ev: Event) => any; scrollAmount: number; scrollDelay: number; trueSpeed: boolean; @@ -10098,112 +9349,7 @@ interface HTMLMarqueeElement extends HTMLElement { width: string; start(): void; stop(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10212,6 +9358,11 @@ declare var HTMLMarqueeElement: { new(): HTMLMarqueeElement; } +interface HTMLMediaElementEventMap extends HTMLElementEventMap { + "encrypted": MediaEncryptedEvent; + "msneedkey": MSMediaKeyNeededEvent; +} + interface HTMLMediaElement extends HTMLElement { /** * Returns an AudioTrackList object with the audio tracks for a given video element. @@ -10301,8 +9452,8 @@ interface HTMLMediaElement extends HTMLElement { * Gets the current network activity for the element. */ readonly networkState: number; - onencrypted: (this: this, ev: MediaEncryptedEvent) => any; - onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any; + onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any; + onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any; /** * Gets a flag that specifies whether playback is paused. */ @@ -10380,111 +9531,7 @@ interface HTMLMediaElement extends HTMLElement { readonly NETWORK_IDLE: number; readonly NETWORK_LOADING: number; readonly NETWORK_NO_SOURCE: number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10505,6 +9552,8 @@ declare var HTMLMediaElement: { interface HTMLMenuElement extends HTMLElement { compact: boolean; type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMenuElement: { @@ -10537,6 +9586,8 @@ interface HTMLMetaElement extends HTMLElement { * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. */ url: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMetaElement: { @@ -10551,6 +9602,8 @@ interface HTMLMeterElement extends HTMLElement { min: number; optimum: number; value: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMeterElement: { @@ -10567,6 +9620,8 @@ interface HTMLModElement extends HTMLElement { * Sets or retrieves the date and time of a modification to the object. */ dateTime: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLModElement: { @@ -10581,6 +9636,8 @@ interface HTMLOListElement extends HTMLElement { */ start: number; type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLOListElement: { @@ -10700,6 +9757,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10738,6 +9796,8 @@ interface HTMLOptGroupElement extends HTMLElement { * Sets or retrieves the value which is returned to the server when the form control is submitted. */ value: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLOptGroupElement: { @@ -10775,6 +9835,8 @@ interface HTMLOptionElement extends HTMLElement { * Sets or retrieves the value which is returned to the server when the form control is submitted. */ value: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLOptionElement: { @@ -10801,6 +9863,8 @@ interface HTMLParagraphElement extends HTMLElement { */ align: string; clear: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLParagraphElement: { @@ -10825,6 +9889,8 @@ interface HTMLParamElement extends HTMLElement { * Sets or retrieves the data type of the value attribute. */ valueType: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLParamElement: { @@ -10833,6 +9899,8 @@ declare var HTMLParamElement: { } interface HTMLPictureElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLPictureElement: { @@ -10845,6 +9913,8 @@ interface HTMLPreElement extends HTMLElement { * Sets or gets a value that you can use to implement your own width functionality for the object. */ width: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLPreElement: { @@ -10869,6 +9939,8 @@ interface HTMLProgressElement extends HTMLElement { * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. */ value: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLProgressElement: { @@ -10881,6 +9953,8 @@ interface HTMLQuoteElement extends HTMLElement { * Sets or retrieves reference information about the object. */ cite: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLQuoteElement: { @@ -10919,6 +9993,8 @@ interface HTMLScriptElement extends HTMLElement { */ type: string; integrity: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLScriptElement: { @@ -11013,6 +10089,8 @@ interface HTMLSelectElement extends HTMLElement { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; } @@ -11037,6 +10115,8 @@ interface HTMLSourceElement extends HTMLElement { * Gets or sets the MIME type of a media resource. */ type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLSourceElement: { @@ -11045,6 +10125,8 @@ declare var HTMLSourceElement: { } interface HTMLSpanElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLSpanElement: { @@ -11062,6 +10144,7 @@ interface HTMLStyleElement extends HTMLElement, LinkStyle { * Retrieves the CSS language in which the style sheet is written. */ type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11079,6 +10162,8 @@ interface HTMLTableCaptionElement extends HTMLElement { * Sets or retrieves whether the caption appears at the top or bottom of the table. */ vAlign: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTableCaptionElement: { @@ -11132,6 +10217,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { * Sets or retrieves the width of the object. */ width: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11153,6 +10239,7 @@ interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { * Sets or retrieves the width of the object. */ width: any; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11273,6 +10360,8 @@ interface HTMLTableElement extends HTMLElement { * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTableElement: { @@ -11324,6 +10413,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. */ insertCell(index?: number): HTMLTableDataCellElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11351,6 +10441,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11361,6 +10452,8 @@ declare var HTMLTableSectionElement: { interface HTMLTemplateElement extends HTMLElement { readonly content: DocumentFragment; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTemplateElement: { @@ -11466,6 +10559,8 @@ interface HTMLTextAreaElement extends HTMLElement { * @param end The offset into the text field for the end of the selection. */ setSelectionRange(start: number, end: number): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTextAreaElement: { @@ -11478,6 +10573,8 @@ interface HTMLTitleElement extends HTMLElement { * Retrieves or sets the text of the object as a string. */ text: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTitleElement: { @@ -11497,6 +10594,8 @@ interface HTMLTrackElement extends HTMLElement { readonly LOADED: number; readonly LOADING: number; readonly NONE: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTrackElement: { @@ -11511,6 +10610,8 @@ declare var HTMLTrackElement: { interface HTMLUListElement extends HTMLElement { compact: boolean; type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLUListElement: { @@ -11519,6 +10620,8 @@ declare var HTMLUListElement: { } interface HTMLUnknownElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLUnknownElement: { @@ -11526,6 +10629,12 @@ declare var HTMLUnknownElement: { new(): HTMLUnknownElement; } +interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap { + "MSVideoFormatChanged": Event; + "MSVideoFrameStepCompleted": Event; + "MSVideoOptimalLayoutChanged": Event; +} + interface HTMLVideoElement extends HTMLMediaElement { /** * Gets or sets the height of the video element. @@ -11537,9 +10646,9 @@ interface HTMLVideoElement extends HTMLMediaElement { msStereo3DPackingMode: string; msStereo3DRenderMode: string; msZoom: boolean; - onMSVideoFormatChanged: (this: this, ev: Event) => any; - onMSVideoFrameStepCompleted: (this: this, ev: Event) => any; - onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any; + onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any; /** * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. */ @@ -11566,114 +10675,7 @@ interface HTMLVideoElement extends HTMLMediaElement { webkitEnterFullscreen(): void; webkitExitFullScreen(): void; webkitExitFullscreen(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11741,11 +10743,16 @@ declare var IDBCursorWithValue: { new(): IDBCursorWithValue; } +interface IDBDatabaseEventMap { + "abort": Event; + "error": ErrorEvent; +} + interface IDBDatabase extends EventTarget { readonly name: string; readonly objectStoreNames: DOMStringList; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onabort: (this: IDBDatabase, ev: Event) => any; + onerror: (this: IDBDatabase, ev: ErrorEvent) => any; version: number; onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; @@ -11753,8 +10760,7 @@ interface IDBDatabase extends EventTarget { deleteObjectStore(name: string): void; transaction(storeNames: string | string[], mode?: string): IDBTransaction; addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - 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: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11831,13 +10837,15 @@ declare var IDBObjectStore: { new(): IDBObjectStore; } +interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { + "blocked": Event; + "upgradeneeded": IDBVersionChangeEvent; +} + interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: this, ev: Event) => any; - onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; - addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + onblocked: (this: IDBOpenDBRequest, ev: Event) => any; + onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; + addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11846,16 +10854,20 @@ declare var IDBOpenDBRequest: { new(): IDBOpenDBRequest; } +interface IDBRequestEventMap { + "error": ErrorEvent; + "success": Event; +} + interface IDBRequest extends EventTarget { readonly error: DOMError; - onerror: (this: this, ev: ErrorEvent) => any; - onsuccess: (this: this, ev: Event) => any; + onerror: (this: IDBRequest, ev: ErrorEvent) => any; + onsuccess: (this: IDBRequest, ev: Event) => any; readonly readyState: string; readonly result: any; source: IDBObjectStore | IDBIndex | IDBCursor; readonly transaction: IDBTransaction; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11864,21 +10876,25 @@ declare var IDBRequest: { new(): IDBRequest; } +interface IDBTransactionEventMap { + "abort": Event; + "complete": Event; + "error": ErrorEvent; +} + interface IDBTransaction extends EventTarget { readonly db: IDBDatabase; readonly error: DOMError; readonly mode: string; - onabort: (this: this, ev: Event) => any; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onabort: (this: IDBTransaction, ev: Event) => any; + oncomplete: (this: IDBTransaction, ev: Event) => any; + onerror: (this: IDBTransaction, ev: ErrorEvent) => any; abort(): void; objectStore(name: string): IDBObjectStore; readonly READ_ONLY: string; readonly READ_WRITE: string; readonly VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12011,18 +11027,22 @@ interface MSApp { } declare var MSApp: MSApp; +interface MSAppAsyncOperationEventMap { + "complete": Event; + "error": ErrorEvent; +} + interface MSAppAsyncOperation extends EventTarget { readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; + onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any; readonly readyState: number; readonly result: any; start(): void; readonly COMPLETED: number; readonly ERROR: number; readonly STARTED: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12177,6 +11197,8 @@ interface MSHTMLWebViewElement extends HTMLElement { navigateWithHttpRequestMessage(requestMessage: any): void; refresh(): void; stop(): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var MSHTMLWebViewElement: { @@ -12184,20 +11206,24 @@ declare var MSHTMLWebViewElement: { new(): MSHTMLWebViewElement; } +interface MSInputMethodContextEventMap { + "MSCandidateWindowHide": Event; + "MSCandidateWindowShow": Event; + "MSCandidateWindowUpdate": Event; +} + interface MSInputMethodContext extends EventTarget { readonly compositionEndOffset: number; readonly compositionStartOffset: number; - oncandidatewindowhide: (this: this, ev: Event) => any; - oncandidatewindowshow: (this: this, ev: Event) => any; - oncandidatewindowupdate: (this: this, ev: Event) => any; + oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any; readonly target: HTMLElement; getCandidateWindowClientRect(): ClientRect; getCompositionAlternatives(): string[]; hasComposition(): boolean; isCandidateWindowVisible(): boolean; - addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12363,6 +11389,7 @@ interface MSStreamReader extends EventTarget, MSBaseReader { readAsBlob(stream: MSStream, size?: number): void; readAsDataURL(stream: MSStream, size?: number): void; readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12371,10 +11398,15 @@ declare var MSStreamReader: { new(): MSStreamReader; } +interface MSWebViewAsyncOperationEventMap { + "complete": Event; + "error": ErrorEvent; +} + interface MSWebViewAsyncOperation extends EventTarget { readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any; + onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any; readonly readyState: number; readonly result: any; readonly target: MSHTMLWebViewElement; @@ -12386,8 +11418,7 @@ interface MSWebViewAsyncOperation extends EventTarget { readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; readonly TYPE_INVOKE_SCRIPT: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12424,12 +11455,16 @@ declare var MediaDeviceInfo: { new(): MediaDeviceInfo; } +interface MediaDevicesEventMap { + "devicechange": Event; +} + interface MediaDevices extends EventTarget { - ondevicechange: (this: this, ev: Event) => any; + ondevicechange: (this: MediaDevices, ev: Event) => any; enumerateDevices(): any; getSupportedConstraints(): MediaTrackSupportedConstraints; getUserMedia(constraints: MediaStreamConstraints): PromiseLike; - addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12579,13 +11614,20 @@ declare var MediaSource: { isTypeSupported(type: string): boolean; } +interface MediaStreamEventMap { + "active": Event; + "addtrack": TrackEvent; + "inactive": Event; + "removetrack": TrackEvent; +} + interface MediaStream extends EventTarget { readonly active: boolean; readonly id: string; - onactive: (this: this, ev: Event) => any; - onaddtrack: (this: this, ev: TrackEvent) => any; - oninactive: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; + onactive: (this: MediaStream, ev: Event) => any; + onaddtrack: (this: MediaStream, ev: TrackEvent) => any; + oninactive: (this: MediaStream, ev: Event) => any; + onremovetrack: (this: MediaStream, ev: TrackEvent) => any; addTrack(track: MediaStreamTrack): void; clone(): MediaStream; getAudioTracks(): MediaStreamTrack[]; @@ -12594,10 +11636,7 @@ interface MediaStream extends EventTarget { getVideoTracks(): MediaStreamTrack[]; removeTrack(track: MediaStreamTrack): void; stop(): void; - addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12634,16 +11673,23 @@ declare var MediaStreamErrorEvent: { new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; } +interface MediaStreamTrackEventMap { + "ended": MediaStreamErrorEvent; + "mute": Event; + "overconstrained": MediaStreamErrorEvent; + "unmute": Event; +} + interface MediaStreamTrack extends EventTarget { enabled: boolean; readonly id: string; readonly kind: string; readonly label: string; readonly muted: boolean; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onmute: (this: this, ev: Event) => any; - onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any; - onunmute: (this: this, ev: Event) => any; + onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onmute: (this: MediaStreamTrack, ev: Event) => any; + onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onunmute: (this: MediaStreamTrack, ev: Event) => any; readonly readonly: boolean; readonly readyState: string; readonly remote: boolean; @@ -12653,10 +11699,7 @@ interface MediaStreamTrack extends EventTarget { getConstraints(): MediaTrackConstraints; getSettings(): MediaTrackSettings; stop(): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12697,12 +11740,16 @@ declare var MessageEvent: { new(type: string, eventInitDict?: MessageEventInit): MessageEvent; } +interface MessagePortEventMap { + "message": MessageEvent; +} + interface MessagePort extends EventTarget { - onmessage: (this: this, ev: MessageEvent) => any; + onmessage: (this: MessagePort, ev: MessageEvent) => any; close(): void; postMessage(message?: any, ports?: any): void; start(): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12880,7 +11927,6 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; vibrate(pattern: number | number[]): boolean; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var Navigator: { @@ -13055,10 +12101,14 @@ declare var OfflineAudioCompletionEvent: { new(): OfflineAudioCompletionEvent; } +interface OfflineAudioContextEventMap { + "complete": Event; +} + interface OfflineAudioContext extends AudioContext { - oncomplete: (this: this, ev: Event) => any; + oncomplete: (this: OfflineAudioContext, ev: Event) => any; startRendering(): PromiseLike; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13067,15 +12117,19 @@ declare var OfflineAudioContext: { new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; } +interface OscillatorNodeEventMap { + "ended": MediaStreamErrorEvent; +} + interface OscillatorNode extends AudioNode { readonly detune: AudioParam; readonly frequency: AudioParam; - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any; type: string; setPeriodicWave(periodicWave: PeriodicWave): void; start(when?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13454,9 +12508,14 @@ declare var RTCDTMFToneChangeEvent: { new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; } +interface RTCDtlsTransportEventMap { + "dtlsstatechange": RTCDtlsTransportStateChangedEvent; + "error": ErrorEvent; +} + interface RTCDtlsTransport extends RTCStatsProvider { - ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null; - onerror: ((this: this, ev: ErrorEvent) => any) | null; + ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null; readonly state: string; readonly transport: RTCIceTransport; getLocalParameters(): RTCDtlsParameters; @@ -13464,8 +12523,7 @@ interface RTCDtlsTransport extends RTCStatsProvider { getRemoteParameters(): RTCDtlsParameters | null; start(remoteParameters: RTCDtlsParameters): void; stop(): void; - addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13483,15 +12541,19 @@ declare var RTCDtlsTransportStateChangedEvent: { new(): RTCDtlsTransportStateChangedEvent; } +interface RTCDtmfSenderEventMap { + "tonechange": RTCDTMFToneChangeEvent; +} + interface RTCDtmfSender extends EventTarget { readonly canInsertDTMF: boolean; readonly duration: number; readonly interToneGap: number; - ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any; + ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any; readonly sender: RTCRtpSender; readonly toneBuffer: string; insertDTMF(tones: string, duration?: number, interToneGap?: number): void; - addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13509,15 +12571,19 @@ declare var RTCIceCandidatePairChangedEvent: { new(): RTCIceCandidatePairChangedEvent; } +interface RTCIceGathererEventMap { + "error": ErrorEvent; + "localcandidate": RTCIceGathererEvent; +} + interface RTCIceGatherer extends RTCStatsProvider { readonly component: string; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null; + onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null; + onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null; createAssociatedGatherer(): RTCIceGatherer; getLocalCandidates(): RTCIceCandidate[]; getLocalParameters(): RTCIceParameters; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13535,11 +12601,16 @@ declare var RTCIceGathererEvent: { new(): RTCIceGathererEvent; } +interface RTCIceTransportEventMap { + "candidatepairchange": RTCIceCandidatePairChangedEvent; + "icestatechange": RTCIceTransportStateChangedEvent; +} + interface RTCIceTransport extends RTCStatsProvider { readonly component: string; readonly iceGatherer: RTCIceGatherer | null; - oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null; - onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null; + oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null; readonly role: string; readonly state: string; addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; @@ -13550,8 +12621,7 @@ interface RTCIceTransport extends RTCStatsProvider { setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; stop(): void; - addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13569,8 +12639,12 @@ declare var RTCIceTransportStateChangedEvent: { new(): RTCIceTransportStateChangedEvent; } +interface RTCRtpReceiverEventMap { + "error": ErrorEvent; +} + interface RTCRtpReceiver extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; + onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null; readonly rtcpTransport: RTCDtlsTransport; readonly track: MediaStreamTrack | null; readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; @@ -13579,7 +12653,7 @@ interface RTCRtpReceiver extends RTCStatsProvider { requestSendCSRC(csrc: number): void; setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13589,9 +12663,14 @@ declare var RTCRtpReceiver: { getCapabilities(kind?: string): RTCRtpCapabilities; } +interface RTCRtpSenderEventMap { + "error": ErrorEvent; + "ssrcconflict": RTCSsrcConflictEvent; +} + interface RTCRtpSender extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null; + onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null; + onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null; readonly rtcpTransport: RTCDtlsTransport; readonly track: MediaStreamTrack; readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; @@ -13599,8 +12678,7 @@ interface RTCRtpSender extends RTCStatsProvider { setTrack(track: MediaStreamTrack): void; setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13610,10 +12688,14 @@ declare var RTCRtpSender: { getCapabilities(kind?: string): RTCRtpCapabilities; } +interface RTCSrtpSdesTransportEventMap { + "error": ErrorEvent; +} + interface RTCSrtpSdesTransport extends EventTarget { - onerror: ((this: this, ev: ErrorEvent) => any) | null; + onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null; readonly transport: RTCIceTransport; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13688,6 +12770,7 @@ declare var Range: { interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { readonly target: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13844,6 +12927,7 @@ interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SV readonly cx: SVGAnimatedLength; readonly cy: SVGAnimatedLength; readonly r: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13854,6 +12938,7 @@ declare var SVGCircleElement: { interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { readonly clipPathUnits: SVGAnimatedEnumeration; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13876,6 +12961,8 @@ interface SVGComponentTransferFunctionElement extends SVGElement { readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGComponentTransferFunctionElement: { @@ -13890,6 +12977,7 @@ declare var SVGComponentTransferFunctionElement: { } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13899,6 +12987,7 @@ declare var SVGDefsElement: { } interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13907,67 +12996,35 @@ declare var SVGDescElement: { new(): SVGDescElement; } +interface SVGElementEventMap extends ElementEventMap { + "click": MouseEvent; + "dblclick": MouseEvent; + "focusin": FocusEvent; + "focusout": FocusEvent; + "load": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; +} + interface SVGElement extends Element { - onclick: (this: this, ev: MouseEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - onfocusin: (this: this, ev: FocusEvent) => any; - onfocusout: (this: this, ev: FocusEvent) => any; - onload: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; + onclick: (this: SVGElement, ev: MouseEvent) => any; + ondblclick: (this: SVGElement, ev: MouseEvent) => any; + onfocusin: (this: SVGElement, ev: FocusEvent) => any; + onfocusout: (this: SVGElement, ev: FocusEvent) => any; + onload: (this: SVGElement, ev: Event) => any; + onmousedown: (this: SVGElement, ev: MouseEvent) => any; + onmousemove: (this: SVGElement, ev: MouseEvent) => any; + onmouseout: (this: SVGElement, ev: MouseEvent) => any; + onmouseover: (this: SVGElement, ev: MouseEvent) => any; + onmouseup: (this: SVGElement, ev: MouseEvent) => any; readonly ownerSVGElement: SVGSVGElement; readonly viewportElement: SVGElement; xmlbase: string; className: any; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14007,6 +13064,7 @@ interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, S readonly cy: SVGAnimatedLength; readonly rx: SVGAnimatedLength; readonly ry: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14036,6 +13094,7 @@ interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttrib readonly SVG_FEBLEND_MODE_SCREEN: number; readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; readonly SVG_FEBLEND_MODE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14070,6 +13129,7 @@ interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandard readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14085,6 +13145,7 @@ declare var SVGFEColorMatrixElement: { interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14108,6 +13169,7 @@ interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAt readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14140,6 +13202,7 @@ interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStand readonly SVG_EDGEMODE_NONE: number; readonly SVG_EDGEMODE_UNKNOWN: number; readonly SVG_EDGEMODE_WRAP: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14158,6 +13221,7 @@ interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStan readonly kernelUnitLengthX: SVGAnimatedNumber; readonly kernelUnitLengthY: SVGAnimatedNumber; readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14177,6 +13241,7 @@ interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStan readonly SVG_CHANNEL_G: number; readonly SVG_CHANNEL_R: number; readonly SVG_CHANNEL_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14193,6 +13258,8 @@ declare var SVGFEDisplacementMapElement: { interface SVGFEDistantLightElement extends SVGElement { readonly azimuth: SVGAnimatedNumber; readonly elevation: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEDistantLightElement: { @@ -14201,6 +13268,7 @@ declare var SVGFEDistantLightElement: { } interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14246,6 +13314,7 @@ interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandar readonly stdDeviationX: SVGAnimatedNumber; readonly stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14256,6 +13325,7 @@ declare var SVGFEGaussianBlurElement: { interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14265,6 +13335,7 @@ declare var SVGFEImageElement: { } interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14275,6 +13346,8 @@ declare var SVGFEMergeElement: { interface SVGFEMergeNodeElement extends SVGElement { readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEMergeNodeElement: { @@ -14290,6 +13363,7 @@ interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardA readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14305,6 +13379,7 @@ interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttri readonly dx: SVGAnimatedNumber; readonly dy: SVGAnimatedNumber; readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14317,6 +13392,8 @@ interface SVGFEPointLightElement extends SVGElement { readonly x: SVGAnimatedNumber; readonly y: SVGAnimatedNumber; readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEPointLightElement: { @@ -14331,6 +13408,7 @@ interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveSta readonly specularConstant: SVGAnimatedNumber; readonly specularExponent: SVGAnimatedNumber; readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14348,6 +13426,8 @@ interface SVGFESpotLightElement extends SVGElement { readonly x: SVGAnimatedNumber; readonly y: SVGAnimatedNumber; readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFESpotLightElement: { @@ -14357,6 +13437,7 @@ declare var SVGFESpotLightElement: { interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14378,6 +13459,7 @@ interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardA readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14402,6 +13484,7 @@ interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLan readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; setFilterRes(filterResX: number, filterResY: number): void; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14415,6 +13498,7 @@ interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransforma readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14424,6 +13508,7 @@ declare var SVGForeignObjectElement: { } interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14440,6 +13525,7 @@ interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourc readonly SVG_SPREADMETHOD_REFLECT: number; readonly SVG_SPREADMETHOD_REPEAT: number; readonly SVG_SPREADMETHOD_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14458,6 +13544,7 @@ interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVG readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14523,6 +13610,7 @@ interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGT readonly x2: SVGAnimatedLength; readonly y1: SVGAnimatedLength; readonly y2: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14559,6 +13647,7 @@ interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExt readonly SVG_MARKER_ORIENT_ANGLE: number; readonly SVG_MARKER_ORIENT_AUTO: number; readonly SVG_MARKER_ORIENT_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14580,6 +13669,7 @@ interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14614,6 +13704,8 @@ declare var SVGMatrix: { } interface SVGMetadataElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGMetadataElement: { @@ -14669,6 +13761,7 @@ interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGT getPathSegAtLength(distance: number): number; getPointAtLength(distance: number): SVGPoint; getTotalLength(): number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14961,6 +14054,7 @@ interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSp readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14997,6 +14091,7 @@ declare var SVGPointList: { } interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15006,6 +14101,7 @@ declare var SVGPolygonElement: { } interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15084,6 +14180,7 @@ interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGT readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15092,18 +14189,27 @@ declare var SVGRectElement: { new(): SVGRectElement; } +interface SVGSVGElementEventMap extends SVGElementEventMap { + "SVGAbort": Event; + "SVGError": Event; + "resize": UIEvent; + "scroll": UIEvent; + "SVGUnload": Event; + "SVGZoom": SVGZoomEvent; +} + interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { contentScriptType: string; contentStyleType: string; currentScale: number; readonly currentTranslate: SVGPoint; readonly height: SVGAnimatedLength; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onunload: (this: this, ev: Event) => any; - onzoom: (this: this, ev: SVGZoomEvent) => any; + onabort: (this: SVGSVGElement, ev: Event) => any; + onerror: (this: SVGSVGElement, ev: Event) => any; + onresize: (this: SVGSVGElement, ev: UIEvent) => any; + onscroll: (this: SVGSVGElement, ev: UIEvent) => any; + onunload: (this: SVGSVGElement, ev: Event) => any; + onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any; readonly pixelUnitToMillimeterX: number; readonly pixelUnitToMillimeterY: number; readonly screenPixelToMillimeterX: number; @@ -15135,58 +14241,7 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest unpauseAnimations(): void; unsuspendRedraw(suspendHandleID: number): void; unsuspendRedrawAll(): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15197,6 +14252,7 @@ declare var SVGSVGElement: { interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { type: string; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15207,6 +14263,7 @@ declare var SVGScriptElement: { interface SVGStopElement extends SVGElement, SVGStylable { readonly offset: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15236,6 +14293,7 @@ interface SVGStyleElement extends SVGElement, SVGLangSpace { media: string; title: string; type: string; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15245,6 +14303,7 @@ declare var SVGStyleElement: { } interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15254,6 +14313,7 @@ declare var SVGSwitchElement: { } interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15285,6 +14345,7 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa readonly LENGTHADJUST_SPACING: number; readonly LENGTHADJUST_SPACINGANDGLYPHS: number; readonly LENGTHADJUST_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15297,7 +14358,6 @@ declare var SVGTextContentElement: { } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextElement: { @@ -15315,7 +14375,6 @@ interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { readonly TEXTPATH_SPACINGTYPE_AUTO: number; readonly TEXTPATH_SPACINGTYPE_EXACT: number; readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextPathElement: { @@ -15343,6 +14402,7 @@ declare var SVGTextPositioningElement: { } interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15414,6 +14474,7 @@ interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTe readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15424,6 +14485,7 @@ declare var SVGUseElement: { interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { readonly viewTarget: SVGStringList; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15455,6 +14517,10 @@ declare var SVGZoomEvent: { new(): SVGZoomEvent; } +interface ScreenEventMap { + "MSOrientationChange": Event; +} + interface Screen extends EventTarget { readonly availHeight: number; readonly availWidth: number; @@ -15467,14 +14533,14 @@ interface Screen extends EventTarget { readonly logicalXDPI: number; readonly logicalYDPI: number; readonly msOrientation: string; - onmsorientationchange: (this: this, ev: Event) => any; + onmsorientationchange: (this: Screen, ev: Event) => any; readonly pixelDepth: number; readonly systemXDPI: number; readonly systemYDPI: number; readonly width: number; msLockOrientation(orientations: string | string[]): boolean; msUnlockOrientation(): void; - addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15493,10 +14559,14 @@ declare var ScriptNotifyEvent: { new(): ScriptNotifyEvent; } +interface ScriptProcessorNodeEventMap { + "audioprocess": AudioProcessingEvent; +} + interface ScriptProcessorNode extends AudioNode { readonly bufferSize: number; - onaudioprocess: (this: this, ev: AudioProcessingEvent) => any; - addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void; + onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any; + addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15678,6 +14748,7 @@ declare var SubtleCrypto: { interface Text extends CharacterData { readonly wholeText: string; + readonly assignedSlot: HTMLSlotElement | null; splitText(offset: number): Text; } @@ -15727,6 +14798,12 @@ declare var TextMetrics: { new(): TextMetrics; } +interface TextTrackEventMap { + "cuechange": Event; + "error": ErrorEvent; + "load": Event; +} + interface TextTrack extends EventTarget { readonly activeCues: TextTrackCueList; readonly cues: TextTrackCueList; @@ -15735,9 +14812,9 @@ interface TextTrack extends EventTarget { readonly label: string; readonly language: string; mode: any; - oncuechange: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; + oncuechange: (this: TextTrack, ev: Event) => any; + onerror: (this: TextTrack, ev: ErrorEvent) => any; + onload: (this: TextTrack, ev: Event) => any; readonly readyState: number; addCue(cue: TextTrackCue): void; removeCue(cue: TextTrackCue): void; @@ -15748,9 +14825,7 @@ interface TextTrack extends EventTarget { readonly LOADING: number; readonly NONE: number; readonly SHOWING: number; - addEventListener(type: "cuechange", 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: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15766,18 +14841,22 @@ declare var TextTrack: { readonly SHOWING: number; } +interface TextTrackCueEventMap { + "enter": Event; + "exit": Event; +} + interface TextTrackCue extends EventTarget { endTime: number; id: string; - onenter: (this: this, ev: Event) => any; - onexit: (this: this, ev: Event) => any; + onenter: (this: TextTrackCue, ev: Event) => any; + onexit: (this: TextTrackCue, ev: Event) => any; pauseOnExit: boolean; startTime: number; text: string; readonly track: TextTrack; getCueAsHTML(): DocumentFragment; - addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15798,11 +14877,15 @@ declare var TextTrackCueList: { new(): TextTrackCueList; } +interface TextTrackListEventMap { + "addtrack": TrackEvent; +} + interface TextTrackList extends EventTarget { readonly length: number; - onaddtrack: ((this: this, ev: TrackEvent) => any) | null; + onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null; item(index: number): TextTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [index: number]: TextTrack; } @@ -15992,17 +15075,21 @@ declare var VideoTrack: { new(): VideoTrack; } +interface VideoTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + interface VideoTrackList extends EventTarget { readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; + onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any; + onchange: (this: VideoTrackList, ev: Event) => any; + onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any; readonly selectedIndex: number; getTrackById(id: string): VideoTrack | null; item(index: number): VideoTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [index: number]: VideoTrack; } @@ -16948,14 +16035,21 @@ declare var WebKitPoint: { new(x?: number, y?: number): WebKitPoint; } +interface WebSocketEventMap { + "close": CloseEvent; + "error": ErrorEvent; + "message": MessageEvent; + "open": Event; +} + interface WebSocket extends EventTarget { binaryType: string; readonly bufferedAmount: number; readonly extensions: string; - onclose: (this: this, ev: CloseEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onopen: (this: this, ev: Event) => any; + onclose: (this: WebSocket, ev: CloseEvent) => any; + onerror: (this: WebSocket, ev: ErrorEvent) => any; + onmessage: (this: WebSocket, ev: MessageEvent) => any; + onopen: (this: WebSocket, ev: Event) => any; readonly protocol: string; readonly readyState: number; readonly url: string; @@ -16965,10 +16059,7 @@ interface WebSocket extends EventTarget { readonly CLOSING: number; readonly CONNECTING: number; readonly OPEN: number; - addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17004,6 +16095,95 @@ declare var WheelEvent: { readonly DOM_DELTA_PIXEL: number; } +interface WindowEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "compassneedscalibration": Event; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "devicelight": DeviceLightEvent; + "devicemotion": DeviceMotionEvent; + "deviceorientation": DeviceOrientationEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "message": MessageEvent; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "pause": Event; + "play": Event; + "playing": Event; + "popstate": PopStateEvent; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": ProgressEvent; + "reset": Event; + "resize": UIEvent; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "stalled": Event; + "storage": StorageEvent; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "unload": Event; + "volumechange": Event; + "waiting": Event; +} + interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { readonly applicationCache: ApplicationCache; readonly clientInformation: Navigator; @@ -17028,97 +16208,97 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window name: string; readonly navigator: Navigator; offscreenBuffering: string | boolean; - onabort: (this: this, ev: UIEvent) => any; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncompassneedscalibration: (this: this, ev: Event) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondevicelight: (this: this, ev: DeviceLightEvent) => any; - ondevicemotion: (this: this, ev: DeviceMotionEvent) => any; - ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onabort: (this: Window, ev: UIEvent) => any; + onafterprint: (this: Window, ev: Event) => any; + onbeforeprint: (this: Window, ev: Event) => any; + onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; + onblur: (this: Window, ev: FocusEvent) => any; + oncanplay: (this: Window, ev: Event) => any; + oncanplaythrough: (this: Window, ev: Event) => any; + onchange: (this: Window, ev: Event) => any; + onclick: (this: Window, ev: MouseEvent) => any; + oncompassneedscalibration: (this: Window, ev: Event) => any; + oncontextmenu: (this: Window, ev: PointerEvent) => any; + ondblclick: (this: Window, ev: MouseEvent) => any; + ondevicelight: (this: Window, ev: DeviceLightEvent) => any; + ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; + ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; + ondrag: (this: Window, ev: DragEvent) => any; + ondragend: (this: Window, ev: DragEvent) => any; + ondragenter: (this: Window, ev: DragEvent) => any; + ondragleave: (this: Window, ev: DragEvent) => any; + ondragover: (this: Window, ev: DragEvent) => any; + ondragstart: (this: Window, ev: DragEvent) => any; + ondrop: (this: Window, ev: DragEvent) => any; + ondurationchange: (this: Window, ev: Event) => any; + onemptied: (this: Window, ev: Event) => any; + onended: (this: Window, ev: MediaStreamErrorEvent) => any; onerror: ErrorEventHandler; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreadystatechange: (this: this, ev: ProgressEvent) => any; - onreset: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onstalled: (this: this, ev: Event) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; + onfocus: (this: Window, ev: FocusEvent) => any; + onhashchange: (this: Window, ev: HashChangeEvent) => any; + oninput: (this: Window, ev: Event) => any; + oninvalid: (this: Window, ev: Event) => any; + onkeydown: (this: Window, ev: KeyboardEvent) => any; + onkeypress: (this: Window, ev: KeyboardEvent) => any; + onkeyup: (this: Window, ev: KeyboardEvent) => any; + onload: (this: Window, ev: Event) => any; + onloadeddata: (this: Window, ev: Event) => any; + onloadedmetadata: (this: Window, ev: Event) => any; + onloadstart: (this: Window, ev: Event) => any; + onmessage: (this: Window, ev: MessageEvent) => any; + onmousedown: (this: Window, ev: MouseEvent) => any; + onmouseenter: (this: Window, ev: MouseEvent) => any; + onmouseleave: (this: Window, ev: MouseEvent) => any; + onmousemove: (this: Window, ev: MouseEvent) => any; + onmouseout: (this: Window, ev: MouseEvent) => any; + onmouseover: (this: Window, ev: MouseEvent) => any; + onmouseup: (this: Window, ev: MouseEvent) => any; + onmousewheel: (this: Window, ev: WheelEvent) => any; + onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; + onmsgestureend: (this: Window, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; + onmspointercancel: (this: Window, ev: MSPointerEvent) => any; + onmspointerdown: (this: Window, ev: MSPointerEvent) => any; + onmspointerenter: (this: Window, ev: MSPointerEvent) => any; + onmspointerleave: (this: Window, ev: MSPointerEvent) => any; + onmspointermove: (this: Window, ev: MSPointerEvent) => any; + onmspointerout: (this: Window, ev: MSPointerEvent) => any; + onmspointerover: (this: Window, ev: MSPointerEvent) => any; + onmspointerup: (this: Window, ev: MSPointerEvent) => any; + onoffline: (this: Window, ev: Event) => any; + ononline: (this: Window, ev: Event) => any; + onorientationchange: (this: Window, ev: Event) => any; + onpagehide: (this: Window, ev: PageTransitionEvent) => any; + onpageshow: (this: Window, ev: PageTransitionEvent) => any; + onpause: (this: Window, ev: Event) => any; + onplay: (this: Window, ev: Event) => any; + onplaying: (this: Window, ev: Event) => any; + onpopstate: (this: Window, ev: PopStateEvent) => any; + onprogress: (this: Window, ev: ProgressEvent) => any; + onratechange: (this: Window, ev: Event) => any; + onreadystatechange: (this: Window, ev: ProgressEvent) => any; + onreset: (this: Window, ev: Event) => any; + onresize: (this: Window, ev: UIEvent) => any; + onscroll: (this: Window, ev: UIEvent) => any; + onseeked: (this: Window, ev: Event) => any; + onseeking: (this: Window, ev: Event) => any; + onselect: (this: Window, ev: UIEvent) => any; + onstalled: (this: Window, ev: Event) => any; + onstorage: (this: Window, ev: StorageEvent) => any; + onsubmit: (this: Window, ev: Event) => any; + onsuspend: (this: Window, ev: Event) => any; + ontimeupdate: (this: Window, ev: Event) => any; ontouchcancel: (ev: TouchEvent) => any; ontouchend: (ev: TouchEvent) => any; ontouchmove: (ev: TouchEvent) => any; ontouchstart: (ev: TouchEvent) => any; - onunload: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; + onunload: (this: Window, ev: Event) => any; + onvolumechange: (this: Window, ev: Event) => any; + onwaiting: (this: Window, ev: Event) => any; opener: any; orientation: string | number; readonly outerHeight: number; @@ -17177,101 +16357,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - 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: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17280,12 +16366,15 @@ declare var Window: { new(): Window; } +interface WorkerEventMap extends AbstractWorkerEventMap { + "message": MessageEvent; +} + interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: this, ev: MessageEvent) => any; + onmessage: (this: Worker, ev: MessageEvent) => any; postMessage(message: any, ports?: any): void; terminate(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17295,6 +16384,8 @@ declare var Worker: { } interface XMLDocument extends Document { + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var XMLDocument: { @@ -17302,8 +16393,12 @@ declare var XMLDocument: { new(): XMLDocument; } +interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { + "readystatechange": Event; +} + interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: this, ev: Event) => any; + onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; readonly readyState: number; readonly response: any; readonly responseText: string; @@ -17331,14 +16426,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { readonly LOADING: number; readonly OPENED: number; readonly UNSENT: number; - 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: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", 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: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17354,6 +16442,7 @@ declare var XMLHttpRequest: { } interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17374,7 +16463,7 @@ declare var XMLSerializer: { interface XPathEvaluator { createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; } declare var XPathEvaluator: { @@ -17383,7 +16472,7 @@ declare var XPathEvaluator: { } interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; + evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult; } declare var XPathExpression: { @@ -17453,9 +16542,13 @@ declare var XSLTProcessor: { new(): XSLTProcessor; } +interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + interface AbstractWorker { - onerror: (this: this, ev: ErrorEvent) => any; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + onerror: (this: AbstractWorker, ev: ErrorEvent) => any; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17566,25 +16659,29 @@ interface GetSVGDocument { getSVGDocument(): Document; } +interface GlobalEventHandlersEventMap { + "pointercancel": PointerEvent; + "pointerdown": PointerEvent; + "pointerenter": PointerEvent; + "pointerleave": PointerEvent; + "pointermove": PointerEvent; + "pointerout": PointerEvent; + "pointerover": PointerEvent; + "pointerup": PointerEvent; + "wheel": WheelEvent; +} + interface GlobalEventHandlers { - onpointercancel: (this: this, ev: PointerEvent) => any; - onpointerdown: (this: this, ev: PointerEvent) => any; - onpointerenter: (this: this, ev: PointerEvent) => any; - onpointerleave: (this: this, ev: PointerEvent) => any; - onpointermove: (this: this, ev: PointerEvent) => any; - onpointerout: (this: this, ev: PointerEvent) => any; - onpointerover: (this: this, ev: PointerEvent) => any; - onpointerup: (this: this, ev: PointerEvent) => any; - onwheel: (this: this, ev: WheelEvent) => any; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any; + addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17611,25 +16708,29 @@ interface LinkStyle { readonly sheet: StyleSheet; } +interface MSBaseReaderEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; +} + interface MSBaseReader { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; + onabort: (this: MSBaseReader, ev: Event) => any; + onerror: (this: MSBaseReader, ev: ErrorEvent) => any; + onload: (this: MSBaseReader, ev: Event) => any; + onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; + onloadstart: (this: MSBaseReader, ev: Event) => any; + onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; readonly readyState: number; readonly result: any; abort(): void; readonly DONE: number; readonly EMPTY: number; readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17678,359 +16779,9 @@ interface NavigatorUserMedia { } interface NodeSelector { - 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: K): ElementTagNameMap[K] | null; querySelector(selectors: string): Element | null; - querySelectorAll(selectors: "a"): NodeListOf; - querySelectorAll(selectors: "abbr"): NodeListOf; - querySelectorAll(selectors: "acronym"): NodeListOf; - querySelectorAll(selectors: "address"): NodeListOf; - querySelectorAll(selectors: "applet"): NodeListOf; - querySelectorAll(selectors: "area"): NodeListOf; - querySelectorAll(selectors: "article"): NodeListOf; - querySelectorAll(selectors: "aside"): NodeListOf; - querySelectorAll(selectors: "audio"): NodeListOf; - querySelectorAll(selectors: "b"): NodeListOf; - querySelectorAll(selectors: "base"): NodeListOf; - querySelectorAll(selectors: "basefont"): NodeListOf; - querySelectorAll(selectors: "bdo"): NodeListOf; - querySelectorAll(selectors: "big"): NodeListOf; - querySelectorAll(selectors: "blockquote"): NodeListOf; - querySelectorAll(selectors: "body"): NodeListOf; - querySelectorAll(selectors: "br"): NodeListOf; - querySelectorAll(selectors: "button"): NodeListOf; - querySelectorAll(selectors: "canvas"): NodeListOf; - querySelectorAll(selectors: "caption"): NodeListOf; - querySelectorAll(selectors: "center"): NodeListOf; - querySelectorAll(selectors: "circle"): NodeListOf; - querySelectorAll(selectors: "cite"): NodeListOf; - querySelectorAll(selectors: "clippath"): NodeListOf; - querySelectorAll(selectors: "code"): NodeListOf; - querySelectorAll(selectors: "col"): NodeListOf; - querySelectorAll(selectors: "colgroup"): NodeListOf; - querySelectorAll(selectors: "datalist"): NodeListOf; - querySelectorAll(selectors: "dd"): NodeListOf; - querySelectorAll(selectors: "defs"): NodeListOf; - querySelectorAll(selectors: "del"): NodeListOf; - querySelectorAll(selectors: "desc"): NodeListOf; - querySelectorAll(selectors: "dfn"): NodeListOf; - querySelectorAll(selectors: "dir"): NodeListOf; - querySelectorAll(selectors: "div"): NodeListOf; - querySelectorAll(selectors: "dl"): NodeListOf; - querySelectorAll(selectors: "dt"): NodeListOf; - querySelectorAll(selectors: "ellipse"): NodeListOf; - querySelectorAll(selectors: "em"): NodeListOf; - querySelectorAll(selectors: "embed"): NodeListOf; - querySelectorAll(selectors: "feblend"): NodeListOf; - querySelectorAll(selectors: "fecolormatrix"): NodeListOf; - querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf; - querySelectorAll(selectors: "fecomposite"): NodeListOf; - querySelectorAll(selectors: "feconvolvematrix"): NodeListOf; - querySelectorAll(selectors: "fediffuselighting"): NodeListOf; - querySelectorAll(selectors: "fedisplacementmap"): NodeListOf; - querySelectorAll(selectors: "fedistantlight"): NodeListOf; - querySelectorAll(selectors: "feflood"): NodeListOf; - querySelectorAll(selectors: "fefunca"): NodeListOf; - querySelectorAll(selectors: "fefuncb"): NodeListOf; - querySelectorAll(selectors: "fefuncg"): NodeListOf; - querySelectorAll(selectors: "fefuncr"): NodeListOf; - querySelectorAll(selectors: "fegaussianblur"): NodeListOf; - querySelectorAll(selectors: "feimage"): NodeListOf; - querySelectorAll(selectors: "femerge"): NodeListOf; - querySelectorAll(selectors: "femergenode"): NodeListOf; - querySelectorAll(selectors: "femorphology"): NodeListOf; - querySelectorAll(selectors: "feoffset"): NodeListOf; - querySelectorAll(selectors: "fepointlight"): NodeListOf; - querySelectorAll(selectors: "fespecularlighting"): NodeListOf; - querySelectorAll(selectors: "fespotlight"): NodeListOf; - querySelectorAll(selectors: "fetile"): NodeListOf; - querySelectorAll(selectors: "feturbulence"): NodeListOf; - querySelectorAll(selectors: "fieldset"): NodeListOf; - querySelectorAll(selectors: "figcaption"): NodeListOf; - querySelectorAll(selectors: "figure"): NodeListOf; - querySelectorAll(selectors: "filter"): NodeListOf; - querySelectorAll(selectors: "font"): NodeListOf; - querySelectorAll(selectors: "footer"): NodeListOf; - querySelectorAll(selectors: "foreignobject"): NodeListOf; - querySelectorAll(selectors: "form"): NodeListOf; - querySelectorAll(selectors: "frame"): NodeListOf; - querySelectorAll(selectors: "frameset"): NodeListOf; - querySelectorAll(selectors: "g"): NodeListOf; - querySelectorAll(selectors: "h1"): NodeListOf; - querySelectorAll(selectors: "h2"): NodeListOf; - querySelectorAll(selectors: "h3"): NodeListOf; - querySelectorAll(selectors: "h4"): NodeListOf; - querySelectorAll(selectors: "h5"): NodeListOf; - querySelectorAll(selectors: "h6"): NodeListOf; - querySelectorAll(selectors: "head"): NodeListOf; - querySelectorAll(selectors: "header"): NodeListOf; - querySelectorAll(selectors: "hgroup"): NodeListOf; - querySelectorAll(selectors: "hr"): NodeListOf; - querySelectorAll(selectors: "html"): NodeListOf; - querySelectorAll(selectors: "i"): NodeListOf; - querySelectorAll(selectors: "iframe"): NodeListOf; - querySelectorAll(selectors: "image"): NodeListOf; - querySelectorAll(selectors: "img"): NodeListOf; - querySelectorAll(selectors: "input"): NodeListOf; - querySelectorAll(selectors: "ins"): NodeListOf; - querySelectorAll(selectors: "isindex"): NodeListOf; - querySelectorAll(selectors: "kbd"): NodeListOf; - querySelectorAll(selectors: "keygen"): NodeListOf; - querySelectorAll(selectors: "label"): NodeListOf; - querySelectorAll(selectors: "legend"): NodeListOf; - querySelectorAll(selectors: "li"): NodeListOf; - querySelectorAll(selectors: "line"): NodeListOf; - querySelectorAll(selectors: "lineargradient"): NodeListOf; - querySelectorAll(selectors: "link"): NodeListOf; - querySelectorAll(selectors: "listing"): NodeListOf; - querySelectorAll(selectors: "map"): NodeListOf; - querySelectorAll(selectors: "mark"): NodeListOf; - querySelectorAll(selectors: "marker"): NodeListOf; - querySelectorAll(selectors: "marquee"): NodeListOf; - querySelectorAll(selectors: "mask"): NodeListOf; - querySelectorAll(selectors: "menu"): NodeListOf; - querySelectorAll(selectors: "meta"): NodeListOf; - querySelectorAll(selectors: "metadata"): NodeListOf; - querySelectorAll(selectors: "meter"): NodeListOf; - querySelectorAll(selectors: "nav"): NodeListOf; - querySelectorAll(selectors: "nextid"): NodeListOf; - querySelectorAll(selectors: "nobr"): NodeListOf; - querySelectorAll(selectors: "noframes"): NodeListOf; - querySelectorAll(selectors: "noscript"): NodeListOf; - querySelectorAll(selectors: "object"): NodeListOf; - querySelectorAll(selectors: "ol"): NodeListOf; - querySelectorAll(selectors: "optgroup"): NodeListOf; - querySelectorAll(selectors: "option"): NodeListOf; - querySelectorAll(selectors: "p"): NodeListOf; - querySelectorAll(selectors: "param"): NodeListOf; - querySelectorAll(selectors: "path"): NodeListOf; - querySelectorAll(selectors: "pattern"): NodeListOf; - querySelectorAll(selectors: "picture"): NodeListOf; - querySelectorAll(selectors: "plaintext"): NodeListOf; - querySelectorAll(selectors: "polygon"): NodeListOf; - querySelectorAll(selectors: "polyline"): NodeListOf; - querySelectorAll(selectors: "pre"): NodeListOf; - querySelectorAll(selectors: "progress"): NodeListOf; - querySelectorAll(selectors: "q"): NodeListOf; - querySelectorAll(selectors: "radialgradient"): NodeListOf; - querySelectorAll(selectors: "rect"): NodeListOf; - querySelectorAll(selectors: "rt"): NodeListOf; - querySelectorAll(selectors: "ruby"): NodeListOf; - querySelectorAll(selectors: "s"): NodeListOf; - querySelectorAll(selectors: "samp"): NodeListOf; - querySelectorAll(selectors: "script"): NodeListOf; - querySelectorAll(selectors: "section"): NodeListOf; - querySelectorAll(selectors: "select"): NodeListOf; - querySelectorAll(selectors: "small"): NodeListOf; - querySelectorAll(selectors: "source"): NodeListOf; - querySelectorAll(selectors: "span"): NodeListOf; - querySelectorAll(selectors: "stop"): NodeListOf; - querySelectorAll(selectors: "strike"): NodeListOf; - querySelectorAll(selectors: "strong"): NodeListOf; - querySelectorAll(selectors: "style"): NodeListOf; - querySelectorAll(selectors: "sub"): NodeListOf; - querySelectorAll(selectors: "sup"): NodeListOf; - querySelectorAll(selectors: "svg"): NodeListOf; - querySelectorAll(selectors: "switch"): NodeListOf; - querySelectorAll(selectors: "symbol"): NodeListOf; - querySelectorAll(selectors: "table"): NodeListOf; - querySelectorAll(selectors: "tbody"): NodeListOf; - querySelectorAll(selectors: "td"): NodeListOf; - querySelectorAll(selectors: "template"): NodeListOf; - querySelectorAll(selectors: "text"): NodeListOf; - querySelectorAll(selectors: "textpath"): NodeListOf; - querySelectorAll(selectors: "textarea"): NodeListOf; - querySelectorAll(selectors: "tfoot"): NodeListOf; - querySelectorAll(selectors: "th"): NodeListOf; - querySelectorAll(selectors: "thead"): NodeListOf; - querySelectorAll(selectors: "title"): NodeListOf; - querySelectorAll(selectors: "tr"): NodeListOf; - querySelectorAll(selectors: "track"): NodeListOf; - querySelectorAll(selectors: "tspan"): NodeListOf; - querySelectorAll(selectors: "tt"): NodeListOf; - querySelectorAll(selectors: "u"): NodeListOf; - querySelectorAll(selectors: "ul"): NodeListOf; - querySelectorAll(selectors: "use"): NodeListOf; - querySelectorAll(selectors: "var"): NodeListOf; - querySelectorAll(selectors: "video"): NodeListOf; - querySelectorAll(selectors: "view"): NodeListOf; - querySelectorAll(selectors: "wbr"): NodeListOf; - querySelectorAll(selectors: "x-ms-webview"): NodeListOf; - querySelectorAll(selectors: "xmp"): NodeListOf; + querySelectorAll(selectors: K): ElementListTagNameMap[K]; querySelectorAll(selectors: string): NodeListOf; } @@ -18130,21 +16881,25 @@ interface WindowTimersExtension { setImmediate(handler: any, ...args: any[]): number; } +interface XMLHttpRequestEventTargetEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; + "timeout": ProgressEvent; +} + interface XMLHttpRequestEventTarget { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - ontimeout: (this: this, ev: ProgressEvent) => any; - 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; + onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -18404,6 +17159,33 @@ interface ParentNode { readonly childElementCount: number; } +interface DocumentOrShadowRoot { + readonly activeElement: Element | null; + readonly stylesheets: StyleSheetList; + getSelection(): Selection | null; + elementFromPoint(x: number, y: number): Element | null; + elementsFromPoint(x: number, y: number): Element[]; +} + +interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment { + readonly host: Element; + innerHTML: string; +} + +interface ShadowRootInit { + mode: 'open'|'closed'; + delegatesFocus?: boolean; +} + +interface HTMLSlotElement extends HTMLElement { + name: string; + assignedNodes(options?: AssignedNodesOptions): Node[]; +} + +interface AssignedNodesOptions { + flatten?: boolean; +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -18451,6 +17233,447 @@ interface NavigatorUserMediaErrorCallback { interface ForEachCallback { (keyId: any, status: string): void; } +interface HTMLElementTagNameMap { + "a": HTMLAnchorElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "audio": HTMLAudioElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "datalist": HTMLDataListElement; + "del": HTMLModElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "embed": HTMLEmbedElement; + "fieldset": HTMLFieldSetElement; + "font": HTMLFontElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "iframe": HTMLIFrameElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "marquee": HTMLMarqueeElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "meter": HTMLMeterElement; + "nextid": HTMLUnknownElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "picture": HTMLPictureElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "script": HTMLScriptElement; + "select": HTMLSelectElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "style": HTMLStyleElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "ul": HTMLUListElement; + "video": HTMLVideoElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementTagNameMap { + "a": HTMLAnchorElement; + "abbr": HTMLElement; + "acronym": HTMLElement; + "address": HTMLElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "article": HTMLElement; + "aside": HTMLElement; + "audio": HTMLAudioElement; + "b": HTMLElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "bdo": HTMLElement; + "big": HTMLElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "center": HTMLElement; + "circle": SVGCircleElement; + "cite": HTMLElement; + "clippath": SVGClipPathElement; + "code": HTMLElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "datalist": HTMLDataListElement; + "dd": HTMLElement; + "defs": SVGDefsElement; + "del": HTMLModElement; + "desc": SVGDescElement; + "dfn": HTMLElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "dt": HTMLElement; + "ellipse": SVGEllipseElement; + "em": HTMLElement; + "embed": HTMLEmbedElement; + "feblend": SVGFEBlendElement; + "fecolormatrix": SVGFEColorMatrixElement; + "fecomponenttransfer": SVGFEComponentTransferElement; + "fecomposite": SVGFECompositeElement; + "feconvolvematrix": SVGFEConvolveMatrixElement; + "fediffuselighting": SVGFEDiffuseLightingElement; + "fedisplacementmap": SVGFEDisplacementMapElement; + "fedistantlight": SVGFEDistantLightElement; + "feflood": SVGFEFloodElement; + "fefunca": SVGFEFuncAElement; + "fefuncb": SVGFEFuncBElement; + "fefuncg": SVGFEFuncGElement; + "fefuncr": SVGFEFuncRElement; + "fegaussianblur": SVGFEGaussianBlurElement; + "feimage": SVGFEImageElement; + "femerge": SVGFEMergeElement; + "femergenode": SVGFEMergeNodeElement; + "femorphology": SVGFEMorphologyElement; + "feoffset": SVGFEOffsetElement; + "fepointlight": SVGFEPointLightElement; + "fespecularlighting": SVGFESpecularLightingElement; + "fespotlight": SVGFESpotLightElement; + "fetile": SVGFETileElement; + "feturbulence": SVGFETurbulenceElement; + "fieldset": HTMLFieldSetElement; + "figcaption": HTMLElement; + "figure": HTMLElement; + "filter": SVGFilterElement; + "font": HTMLFontElement; + "footer": HTMLElement; + "foreignobject": SVGForeignObjectElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "g": SVGGElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "header": HTMLElement; + "hgroup": HTMLElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "i": HTMLElement; + "iframe": HTMLIFrameElement; + "image": SVGImageElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "kbd": HTMLElement; + "keygen": HTMLElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "line": SVGLineElement; + "lineargradient": SVGLinearGradientElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "mark": HTMLElement; + "marker": SVGMarkerElement; + "marquee": HTMLMarqueeElement; + "mask": SVGMaskElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "metadata": SVGMetadataElement; + "meter": HTMLMeterElement; + "nav": HTMLElement; + "nextid": HTMLUnknownElement; + "nobr": HTMLElement; + "noframes": HTMLElement; + "noscript": HTMLElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "path": SVGPathElement; + "pattern": SVGPatternElement; + "picture": HTMLPictureElement; + "plaintext": HTMLElement; + "polygon": SVGPolygonElement; + "polyline": SVGPolylineElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "radialgradient": SVGRadialGradientElement; + "rect": SVGRectElement; + "rt": HTMLElement; + "ruby": HTMLElement; + "s": HTMLElement; + "samp": HTMLElement; + "script": HTMLScriptElement; + "section": HTMLElement; + "select": HTMLSelectElement; + "small": HTMLElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "stop": SVGStopElement; + "strike": HTMLElement; + "strong": HTMLElement; + "style": HTMLStyleElement; + "sub": HTMLElement; + "sup": HTMLElement; + "svg": SVGSVGElement; + "switch": SVGSwitchElement; + "symbol": SVGSymbolElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "text": SVGTextElement; + "textpath": SVGTextPathElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "tspan": SVGTSpanElement; + "tt": HTMLElement; + "u": HTMLElement; + "ul": HTMLUListElement; + "use": SVGUseElement; + "var": HTMLElement; + "video": HTMLVideoElement; + "view": SVGViewElement; + "wbr": HTMLElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementListTagNameMap { + "a": NodeListOf; + "abbr": NodeListOf; + "acronym": NodeListOf; + "address": NodeListOf; + "applet": NodeListOf; + "area": NodeListOf; + "article": NodeListOf; + "aside": NodeListOf; + "audio": NodeListOf; + "b": NodeListOf; + "base": NodeListOf; + "basefont": NodeListOf; + "bdo": NodeListOf; + "big": NodeListOf; + "blockquote": NodeListOf; + "body": NodeListOf; + "br": NodeListOf; + "button": NodeListOf; + "canvas": NodeListOf; + "caption": NodeListOf; + "center": NodeListOf; + "circle": NodeListOf; + "cite": NodeListOf; + "clippath": NodeListOf; + "code": NodeListOf; + "col": NodeListOf; + "colgroup": NodeListOf; + "datalist": NodeListOf; + "dd": NodeListOf; + "defs": NodeListOf; + "del": NodeListOf; + "desc": NodeListOf; + "dfn": NodeListOf; + "dir": NodeListOf; + "div": NodeListOf; + "dl": NodeListOf; + "dt": NodeListOf; + "ellipse": NodeListOf; + "em": NodeListOf; + "embed": NodeListOf; + "feblend": NodeListOf; + "fecolormatrix": NodeListOf; + "fecomponenttransfer": NodeListOf; + "fecomposite": NodeListOf; + "feconvolvematrix": NodeListOf; + "fediffuselighting": NodeListOf; + "fedisplacementmap": NodeListOf; + "fedistantlight": NodeListOf; + "feflood": NodeListOf; + "fefunca": NodeListOf; + "fefuncb": NodeListOf; + "fefuncg": NodeListOf; + "fefuncr": NodeListOf; + "fegaussianblur": NodeListOf; + "feimage": NodeListOf; + "femerge": NodeListOf; + "femergenode": NodeListOf; + "femorphology": NodeListOf; + "feoffset": NodeListOf; + "fepointlight": NodeListOf; + "fespecularlighting": NodeListOf; + "fespotlight": NodeListOf; + "fetile": NodeListOf; + "feturbulence": NodeListOf; + "fieldset": NodeListOf; + "figcaption": NodeListOf; + "figure": NodeListOf; + "filter": NodeListOf; + "font": NodeListOf; + "footer": NodeListOf; + "foreignobject": NodeListOf; + "form": NodeListOf; + "frame": NodeListOf; + "frameset": NodeListOf; + "g": NodeListOf; + "h1": NodeListOf; + "h2": NodeListOf; + "h3": NodeListOf; + "h4": NodeListOf; + "h5": NodeListOf; + "h6": NodeListOf; + "head": NodeListOf; + "header": NodeListOf; + "hgroup": NodeListOf; + "hr": NodeListOf; + "html": NodeListOf; + "i": NodeListOf; + "iframe": NodeListOf; + "image": NodeListOf; + "img": NodeListOf; + "input": NodeListOf; + "ins": NodeListOf; + "isindex": NodeListOf; + "kbd": NodeListOf; + "keygen": NodeListOf; + "label": NodeListOf; + "legend": NodeListOf; + "li": NodeListOf; + "line": NodeListOf; + "lineargradient": NodeListOf; + "link": NodeListOf; + "listing": NodeListOf; + "map": NodeListOf; + "mark": NodeListOf; + "marker": NodeListOf; + "marquee": NodeListOf; + "mask": NodeListOf; + "menu": NodeListOf; + "meta": NodeListOf; + "metadata": NodeListOf; + "meter": NodeListOf; + "nav": NodeListOf; + "nextid": NodeListOf; + "nobr": NodeListOf; + "noframes": NodeListOf; + "noscript": NodeListOf; + "object": NodeListOf; + "ol": NodeListOf; + "optgroup": NodeListOf; + "option": NodeListOf; + "p": NodeListOf; + "param": NodeListOf; + "path": NodeListOf; + "pattern": NodeListOf; + "picture": NodeListOf; + "plaintext": NodeListOf; + "polygon": NodeListOf; + "polyline": NodeListOf; + "pre": NodeListOf; + "progress": NodeListOf; + "q": NodeListOf; + "radialgradient": NodeListOf; + "rect": NodeListOf; + "rt": NodeListOf; + "ruby": NodeListOf; + "s": NodeListOf; + "samp": NodeListOf; + "script": NodeListOf; + "section": NodeListOf; + "select": NodeListOf; + "small": NodeListOf; + "source": NodeListOf; + "span": NodeListOf; + "stop": NodeListOf; + "strike": NodeListOf; + "strong": NodeListOf; + "style": NodeListOf; + "sub": NodeListOf; + "sup": NodeListOf; + "svg": NodeListOf; + "switch": NodeListOf; + "symbol": NodeListOf; + "table": NodeListOf; + "tbody": NodeListOf; + "td": NodeListOf; + "template": NodeListOf; + "text": NodeListOf; + "textpath": NodeListOf; + "textarea": NodeListOf; + "tfoot": NodeListOf; + "th": NodeListOf; + "thead": NodeListOf; + "title": NodeListOf; + "tr": NodeListOf; + "track": NodeListOf; + "tspan": NodeListOf; + "tt": NodeListOf; + "u": NodeListOf; + "ul": NodeListOf; + "use": NodeListOf; + "var": NodeListOf; + "video": NodeListOf; + "view": NodeListOf; + "wbr": NodeListOf; + "x-ms-webview": NodeListOf; + "xmp": NodeListOf; +} + declare var Audio: {new(src?: string): HTMLAudioElement; }; declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; @@ -18625,7 +17848,6 @@ 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; declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function clearInterval(handle: number): void; @@ -18652,101 +17874,7 @@ declare var onwheel: (this: Window, ev: WheelEvent) => any; declare var indexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; -declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; type AAGUID = string; type AlgorithmIdentifier = string | Algorithm; diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index a4e8ca398d9..6ee35cd6589 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -96,6 +96,7 @@ interface DoubleRange { } interface EventInit { + scoped?: boolean; bubbles?: boolean; cancelable?: boolean; } @@ -937,15 +938,26 @@ declare var AnimationEvent: { new(): AnimationEvent; } +interface ApplicationCacheEventMap { + "cached": Event; + "checking": Event; + "downloading": Event; + "error": ErrorEvent; + "noupdate": Event; + "obsolete": Event; + "progress": ProgressEvent; + "updateready": Event; +} + interface ApplicationCache extends EventTarget { - oncached: (this: this, ev: Event) => any; - onchecking: (this: this, ev: Event) => any; - ondownloading: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onnoupdate: (this: this, ev: Event) => any; - onobsolete: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onupdateready: (this: this, ev: Event) => any; + oncached: (this: ApplicationCache, ev: Event) => any; + onchecking: (this: ApplicationCache, ev: Event) => any; + ondownloading: (this: ApplicationCache, ev: Event) => any; + onerror: (this: ApplicationCache, ev: ErrorEvent) => any; + onnoupdate: (this: ApplicationCache, ev: Event) => any; + onobsolete: (this: ApplicationCache, ev: Event) => any; + onprogress: (this: ApplicationCache, ev: ProgressEvent) => any; + onupdateready: (this: ApplicationCache, ev: Event) => any; readonly status: number; abort(): void; swapCache(): void; @@ -956,14 +968,7 @@ interface ApplicationCache extends EventTarget { readonly OBSOLETE: number; readonly UNCACHED: number; readonly UPDATEREADY: number; - addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -1016,17 +1021,21 @@ declare var AudioBuffer: { new(): AudioBuffer; } +interface AudioBufferSourceNodeEventMap { + "ended": MediaStreamErrorEvent; +} + interface AudioBufferSourceNode extends AudioNode { buffer: AudioBuffer | null; readonly detune: AudioParam; loop: boolean; loopEnd: number; loopStart: number; - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any; readonly playbackRate: AudioParam; start(when?: number, offset?: number, duration?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -1148,16 +1157,20 @@ declare var AudioTrack: { new(): AudioTrack; } +interface AudioTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + interface AudioTrackList extends EventTarget { readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; + onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any; + onchange: (this: AudioTrackList, ev: Event) => any; + onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any; getTrackById(id: string): AudioTrack | null; item(index: number): AudioTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [index: number]: AudioTrack; } @@ -1858,7 +1871,6 @@ interface CharacterData extends Node, ChildNode { insertData(offset: number, arg: string): void; replaceData(offset: number, count: number, arg: string): void; substringData(offset: number, count: number): string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var CharacterData: { @@ -2183,6 +2195,8 @@ declare var DOMTokenList: { interface DataCue extends TextTrackCue { data: ArrayBuffer; + addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var DataCue: { @@ -2311,7 +2325,98 @@ declare var DeviceRotationRate: { new(): DeviceRotationRate; } -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode { +interface DocumentEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforedeactivate": UIEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "fullscreenchange": Event; + "fullscreenerror": Event; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "mssitemodejumplistitemremoved": MSSiteModeEvent; + "msthumbnailclick": MSSiteModeEvent; + "pause": Event; + "play": Event; + "playing": Event; + "pointerlockchange": Event; + "pointerlockerror": Event; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": ProgressEvent; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectionchange": Event; + "selectstart": Event; + "stalled": Event; + "stop": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "volumechange": Event; + "waiting": Event; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + +interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot { /** * Sets or gets the URL for the current document. */ @@ -2434,294 +2539,294 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Fires when the user aborts the download. * @param ev The event. */ - onabort: (this: this, ev: UIEvent) => any; + onabort: (this: Document, ev: UIEvent) => any; /** * Fires when the object is set as the active element. * @param ev The event. */ - onactivate: (this: this, ev: UIEvent) => any; + onactivate: (this: Document, ev: UIEvent) => any; /** * Fires immediately before the object is set as the active element. * @param ev The event. */ - onbeforeactivate: (this: this, ev: UIEvent) => any; + onbeforeactivate: (this: Document, ev: UIEvent) => any; /** * Fires immediately before the activeElement is changed from the current object to another object in the parent document. * @param ev The event. */ - onbeforedeactivate: (this: this, ev: UIEvent) => any; + onbeforedeactivate: (this: Document, ev: UIEvent) => any; /** * Fires when the object loses the input focus. * @param ev The focus event. */ - onblur: (this: this, ev: FocusEvent) => any; + onblur: (this: Document, ev: FocusEvent) => any; /** * Occurs when playback is possible, but would require further buffering. * @param ev The event. */ - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; + oncanplay: (this: Document, ev: Event) => any; + oncanplaythrough: (this: Document, ev: Event) => any; /** * Fires when the contents of the object or selection have changed. * @param ev The event. */ - onchange: (this: this, ev: Event) => any; + onchange: (this: Document, ev: Event) => any; /** * Fires when the user clicks the left mouse button on the object * @param ev The mouse event. */ - onclick: (this: this, ev: MouseEvent) => any; + onclick: (this: Document, ev: MouseEvent) => any; /** * Fires when the user clicks the right mouse button in the client area, opening the context menu. * @param ev The mouse event. */ - oncontextmenu: (this: this, ev: PointerEvent) => any; + oncontextmenu: (this: Document, ev: PointerEvent) => any; /** * Fires when the user double-clicks the object. * @param ev The mouse event. */ - ondblclick: (this: this, ev: MouseEvent) => any; + ondblclick: (this: Document, ev: MouseEvent) => any; /** * Fires when the activeElement is changed from the current object to another object in the parent document. * @param ev The UI Event */ - ondeactivate: (this: this, ev: UIEvent) => any; + ondeactivate: (this: Document, ev: UIEvent) => any; /** * Fires on the source object continuously during a drag operation. * @param ev The event. */ - ondrag: (this: this, ev: DragEvent) => any; + ondrag: (this: Document, ev: DragEvent) => any; /** * Fires on the source object when the user releases the mouse at the close of a drag operation. * @param ev The event. */ - ondragend: (this: this, ev: DragEvent) => any; + ondragend: (this: Document, ev: DragEvent) => any; /** * Fires on the target element when the user drags the object to a valid drop target. * @param ev The drag event. */ - ondragenter: (this: this, ev: DragEvent) => any; + ondragenter: (this: Document, ev: DragEvent) => any; /** * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. * @param ev The drag event. */ - ondragleave: (this: this, ev: DragEvent) => any; + ondragleave: (this: Document, ev: DragEvent) => any; /** * Fires on the target element continuously while the user drags the object over a valid drop target. * @param ev The event. */ - ondragover: (this: this, ev: DragEvent) => any; + ondragover: (this: Document, ev: DragEvent) => any; /** * Fires on the source object when the user starts to drag a text selection or selected object. * @param ev The event. */ - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; + ondragstart: (this: Document, ev: DragEvent) => any; + ondrop: (this: Document, ev: DragEvent) => any; /** * Occurs when the duration attribute is updated. * @param ev The event. */ - ondurationchange: (this: this, ev: Event) => any; + ondurationchange: (this: Document, ev: Event) => any; /** * Occurs when the media element is reset to its initial state. * @param ev The event. */ - onemptied: (this: this, ev: Event) => any; + onemptied: (this: Document, ev: Event) => any; /** * Occurs when the end of playback is reached. * @param ev The event */ - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onended: (this: Document, ev: MediaStreamErrorEvent) => any; /** * Fires when an error occurs during object loading. * @param ev The event. */ - onerror: (this: this, ev: ErrorEvent) => any; + onerror: (this: Document, ev: ErrorEvent) => any; /** * Fires when the object receives focus. * @param ev The event. */ - onfocus: (this: this, ev: FocusEvent) => any; - onfullscreenchange: (this: this, ev: Event) => any; - onfullscreenerror: (this: this, ev: Event) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; + onfocus: (this: Document, ev: FocusEvent) => any; + onfullscreenchange: (this: Document, ev: Event) => any; + onfullscreenerror: (this: Document, ev: Event) => any; + oninput: (this: Document, ev: Event) => any; + oninvalid: (this: Document, ev: Event) => any; /** * Fires when the user presses a key. * @param ev The keyboard event */ - onkeydown: (this: this, ev: KeyboardEvent) => any; + onkeydown: (this: Document, ev: KeyboardEvent) => any; /** * Fires when the user presses an alphanumeric key. * @param ev The event. */ - onkeypress: (this: this, ev: KeyboardEvent) => any; + onkeypress: (this: Document, ev: KeyboardEvent) => any; /** * Fires when the user releases a key. * @param ev The keyboard event */ - onkeyup: (this: this, ev: KeyboardEvent) => any; + onkeyup: (this: Document, ev: KeyboardEvent) => any; /** * Fires immediately after the browser loads the object. * @param ev The event. */ - onload: (this: this, ev: Event) => any; + onload: (this: Document, ev: Event) => any; /** * Occurs when media data is loaded at the current playback position. * @param ev The event. */ - onloadeddata: (this: this, ev: Event) => any; + onloadeddata: (this: Document, ev: Event) => any; /** * Occurs when the duration and dimensions of the media have been determined. * @param ev The event. */ - onloadedmetadata: (this: this, ev: Event) => any; + onloadedmetadata: (this: Document, ev: Event) => any; /** * Occurs when Internet Explorer begins looking for media data. * @param ev The event. */ - onloadstart: (this: this, ev: Event) => any; + onloadstart: (this: Document, ev: Event) => any; /** * Fires when the user clicks the object with either mouse button. * @param ev The mouse event. */ - onmousedown: (this: this, ev: MouseEvent) => any; + onmousedown: (this: Document, ev: MouseEvent) => any; /** * Fires when the user moves the mouse over the object. * @param ev The mouse event. */ - onmousemove: (this: this, ev: MouseEvent) => any; + onmousemove: (this: Document, ev: MouseEvent) => any; /** * Fires when the user moves the mouse pointer outside the boundaries of the object. * @param ev The mouse event. */ - onmouseout: (this: this, ev: MouseEvent) => any; + onmouseout: (this: Document, ev: MouseEvent) => any; /** * Fires when the user moves the mouse pointer into the object. * @param ev The mouse event. */ - onmouseover: (this: this, ev: MouseEvent) => any; + onmouseover: (this: Document, ev: MouseEvent) => any; /** * Fires when the user releases a mouse button while the mouse is over the object. * @param ev The mouse event. */ - onmouseup: (this: this, ev: MouseEvent) => any; + onmouseup: (this: Document, ev: MouseEvent) => any; /** * Fires when the wheel button is rotated. * @param ev The mouse event */ - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; + onmousewheel: (this: Document, ev: WheelEvent) => any; + onmscontentzoom: (this: Document, ev: UIEvent) => any; + onmsgesturechange: (this: Document, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any; + onmsgestureend: (this: Document, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Document, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Document, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Document, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Document, ev: MSGestureEvent) => any; + onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any; + onmspointercancel: (this: Document, ev: MSPointerEvent) => any; + onmspointerdown: (this: Document, ev: MSPointerEvent) => any; + onmspointerenter: (this: Document, ev: MSPointerEvent) => any; + onmspointerleave: (this: Document, ev: MSPointerEvent) => any; + onmspointermove: (this: Document, ev: MSPointerEvent) => any; + onmspointerout: (this: Document, ev: MSPointerEvent) => any; + onmspointerover: (this: Document, ev: MSPointerEvent) => any; + onmspointerup: (this: Document, ev: MSPointerEvent) => any; /** * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. * @param ev The event. */ - onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any; + onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any; /** * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. * @param ev The event. */ - onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any; + onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any; /** * Occurs when playback is paused. * @param ev The event. */ - onpause: (this: this, ev: Event) => any; + onpause: (this: Document, ev: Event) => any; /** * Occurs when the play method is requested. * @param ev The event. */ - onplay: (this: this, ev: Event) => any; + onplay: (this: Document, ev: Event) => any; /** * Occurs when the audio or video has started playing. * @param ev The event. */ - onplaying: (this: this, ev: Event) => any; - onpointerlockchange: (this: this, ev: Event) => any; - onpointerlockerror: (this: this, ev: Event) => any; + onplaying: (this: Document, ev: Event) => any; + onpointerlockchange: (this: Document, ev: Event) => any; + onpointerlockerror: (this: Document, ev: Event) => any; /** * Occurs to indicate progress while downloading media data. * @param ev The event. */ - onprogress: (this: this, ev: ProgressEvent) => any; + onprogress: (this: Document, ev: ProgressEvent) => any; /** * Occurs when the playback rate is increased or decreased. * @param ev The event. */ - onratechange: (this: this, ev: Event) => any; + onratechange: (this: Document, ev: Event) => any; /** * Fires when the state of the object has changed. * @param ev The event */ - onreadystatechange: (this: this, ev: ProgressEvent) => any; + onreadystatechange: (this: Document, ev: ProgressEvent) => any; /** * Fires when the user resets a form. * @param ev The event. */ - onreset: (this: this, ev: Event) => any; + onreset: (this: Document, ev: Event) => any; /** * Fires when the user repositions the scroll box in the scroll bar on the object. * @param ev The event. */ - onscroll: (this: this, ev: UIEvent) => any; + onscroll: (this: Document, ev: UIEvent) => any; /** * Occurs when the seek operation ends. * @param ev The event. */ - onseeked: (this: this, ev: Event) => any; + onseeked: (this: Document, ev: Event) => any; /** * Occurs when the current playback position is moved. * @param ev The event. */ - onseeking: (this: this, ev: Event) => any; + onseeking: (this: Document, ev: Event) => any; /** * Fires when the current selection changes. * @param ev The event. */ - onselect: (this: this, ev: UIEvent) => any; + onselect: (this: Document, ev: UIEvent) => any; /** * Fires when the selection state of a document changes. * @param ev The event. */ - onselectionchange: (this: this, ev: Event) => any; - onselectstart: (this: this, ev: Event) => any; + onselectionchange: (this: Document, ev: Event) => any; + onselectstart: (this: Document, ev: Event) => any; /** * Occurs when the download has stopped. * @param ev The event. */ - onstalled: (this: this, ev: Event) => any; + onstalled: (this: Document, ev: Event) => any; /** * Fires when the user clicks the Stop button or leaves the Web page. * @param ev The event. */ - onstop: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; + onstop: (this: Document, ev: Event) => any; + onsubmit: (this: Document, ev: Event) => any; /** * Occurs if the load operation has been intentionally halted. * @param ev The event. */ - onsuspend: (this: this, ev: Event) => any; + onsuspend: (this: Document, ev: Event) => any; /** * Occurs to indicate the current playback position. * @param ev The event. */ - ontimeupdate: (this: this, ev: Event) => any; + ontimeupdate: (this: Document, ev: Event) => any; ontouchcancel: (ev: TouchEvent) => any; ontouchend: (ev: TouchEvent) => any; ontouchmove: (ev: TouchEvent) => any; @@ -2730,14 +2835,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Occurs when the volume is changed, or playback is muted or unmuted. * @param ev The event. */ - onvolumechange: (this: this, ev: Event) => any; + onvolumechange: (this: Document, ev: Event) => any; /** * Occurs when playback stops because the next frame of a video resource is not available. * @param ev The event. */ - onwaiting: (this: this, ev: Event) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; + onwaiting: (this: Document, ev: Event) => any; + onwebkitfullscreenchange: (this: Document, ev: Event) => any; + onwebkitfullscreenerror: (this: Document, ev: Event) => any; plugins: HTMLCollectionOf; readonly pointerLockElement: Element; /** @@ -2808,86 +2913,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Creates an instance of the element for the specified tag. * @param tagName The name of an element. */ - createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "applet"): HTMLAppletElement; - createElement(tagName: "area"): HTMLAreaElement; - createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "base"): HTMLBaseElement; - createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "blockquote"): HTMLQuoteElement; - createElement(tagName: "body"): HTMLBodyElement; - createElement(tagName: "br"): HTMLBRElement; - createElement(tagName: "button"): HTMLButtonElement; - createElement(tagName: "canvas"): HTMLCanvasElement; - createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "col"): HTMLTableColElement; - createElement(tagName: "colgroup"): HTMLTableColElement; - createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dir"): HTMLDirectoryElement; - createElement(tagName: "div"): HTMLDivElement; - createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "embed"): HTMLEmbedElement; - createElement(tagName: "fieldset"): HTMLFieldSetElement; - createElement(tagName: "font"): HTMLFontElement; - createElement(tagName: "form"): HTMLFormElement; - createElement(tagName: "frame"): HTMLFrameElement; - createElement(tagName: "frameset"): HTMLFrameSetElement; - createElement(tagName: "h1"): HTMLHeadingElement; - createElement(tagName: "h2"): HTMLHeadingElement; - createElement(tagName: "h3"): HTMLHeadingElement; - createElement(tagName: "h4"): HTMLHeadingElement; - createElement(tagName: "h5"): HTMLHeadingElement; - createElement(tagName: "h6"): HTMLHeadingElement; - createElement(tagName: "head"): HTMLHeadElement; - createElement(tagName: "hr"): HTMLHRElement; - createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "iframe"): HTMLIFrameElement; - createElement(tagName: "img"): HTMLImageElement; - createElement(tagName: "input"): HTMLInputElement; - createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLUnknownElement; - createElement(tagName: "label"): HTMLLabelElement; - createElement(tagName: "legend"): HTMLLegendElement; - createElement(tagName: "li"): HTMLLIElement; - createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLPreElement; - createElement(tagName: "map"): HTMLMapElement; - createElement(tagName: "marquee"): HTMLMarqueeElement; - createElement(tagName: "menu"): HTMLMenuElement; - createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "meter"): HTMLMeterElement; - createElement(tagName: "nextid"): HTMLUnknownElement; - createElement(tagName: "object"): HTMLObjectElement; - createElement(tagName: "ol"): HTMLOListElement; - createElement(tagName: "optgroup"): HTMLOptGroupElement; - createElement(tagName: "option"): HTMLOptionElement; - createElement(tagName: "p"): HTMLParagraphElement; - createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "picture"): HTMLPictureElement; - createElement(tagName: "pre"): HTMLPreElement; - createElement(tagName: "progress"): HTMLProgressElement; - createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "script"): HTMLScriptElement; - createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "source"): HTMLSourceElement; - createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "table"): HTMLTableElement; - createElement(tagName: "tbody"): HTMLTableSectionElement; - createElement(tagName: "td"): HTMLTableDataCellElement; - createElement(tagName: "template"): HTMLTemplateElement; - createElement(tagName: "textarea"): HTMLTextAreaElement; - createElement(tagName: "tfoot"): HTMLTableSectionElement; - createElement(tagName: "th"): HTMLTableHeaderCellElement; - createElement(tagName: "thead"): HTMLTableSectionElement; - createElement(tagName: "title"): HTMLTitleElement; - createElement(tagName: "tr"): HTMLTableRowElement; - createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "video"): HTMLVideoElement; - createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLPreElement; + createElement(tagName: K): HTMLElementTagNameMap[K]; createElement(tagName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement @@ -2989,7 +3015,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param y The y-offset */ elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; /** * Executes a command on the current document, current selection, or the given range. * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. @@ -3023,182 +3049,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Retrieves a collection of objects based on the specified element name. * @param name Specifies the name of an element. */ - getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; - getElementsByTagName(tagname: "applet"): NodeListOf; - getElementsByTagName(tagname: "area"): NodeListOf; - getElementsByTagName(tagname: "article"): NodeListOf; - getElementsByTagName(tagname: "aside"): NodeListOf; - getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; - getElementsByTagName(tagname: "base"): NodeListOf; - getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; - getElementsByTagName(tagname: "body"): NodeListOf; - getElementsByTagName(tagname: "br"): NodeListOf; - getElementsByTagName(tagname: "button"): NodeListOf; - getElementsByTagName(tagname: "canvas"): NodeListOf; - getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; - getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; - getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; - getElementsByTagName(tagname: "col"): NodeListOf; - getElementsByTagName(tagname: "colgroup"): NodeListOf; - getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; - getElementsByTagName(tagname: "defs"): NodeListOf; - getElementsByTagName(tagname: "del"): NodeListOf; - getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; - getElementsByTagName(tagname: "dir"): NodeListOf; - getElementsByTagName(tagname: "div"): NodeListOf; - getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; - getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; - getElementsByTagName(tagname: "embed"): NodeListOf; - getElementsByTagName(tagname: "feblend"): NodeListOf; - getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; - getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(tagname: "fecomposite"): NodeListOf; - getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; - getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; - getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; - getElementsByTagName(tagname: "fedistantlight"): NodeListOf; - getElementsByTagName(tagname: "feflood"): NodeListOf; - getElementsByTagName(tagname: "fefunca"): NodeListOf; - getElementsByTagName(tagname: "fefuncb"): NodeListOf; - getElementsByTagName(tagname: "fefuncg"): NodeListOf; - getElementsByTagName(tagname: "fefuncr"): NodeListOf; - getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; - getElementsByTagName(tagname: "feimage"): NodeListOf; - getElementsByTagName(tagname: "femerge"): NodeListOf; - getElementsByTagName(tagname: "femergenode"): NodeListOf; - getElementsByTagName(tagname: "femorphology"): NodeListOf; - getElementsByTagName(tagname: "feoffset"): NodeListOf; - getElementsByTagName(tagname: "fepointlight"): NodeListOf; - getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; - getElementsByTagName(tagname: "fespotlight"): NodeListOf; - getElementsByTagName(tagname: "fetile"): NodeListOf; - getElementsByTagName(tagname: "feturbulence"): NodeListOf; - getElementsByTagName(tagname: "fieldset"): NodeListOf; - getElementsByTagName(tagname: "figcaption"): NodeListOf; - getElementsByTagName(tagname: "figure"): NodeListOf; - getElementsByTagName(tagname: "filter"): NodeListOf; - getElementsByTagName(tagname: "font"): NodeListOf; - getElementsByTagName(tagname: "footer"): NodeListOf; - getElementsByTagName(tagname: "foreignobject"): NodeListOf; - getElementsByTagName(tagname: "form"): NodeListOf; - getElementsByTagName(tagname: "frame"): NodeListOf; - getElementsByTagName(tagname: "frameset"): NodeListOf; - getElementsByTagName(tagname: "g"): NodeListOf; - getElementsByTagName(tagname: "h1"): NodeListOf; - getElementsByTagName(tagname: "h2"): NodeListOf; - getElementsByTagName(tagname: "h3"): NodeListOf; - getElementsByTagName(tagname: "h4"): NodeListOf; - getElementsByTagName(tagname: "h5"): NodeListOf; - getElementsByTagName(tagname: "h6"): NodeListOf; - getElementsByTagName(tagname: "head"): NodeListOf; - getElementsByTagName(tagname: "header"): NodeListOf; - getElementsByTagName(tagname: "hgroup"): NodeListOf; - getElementsByTagName(tagname: "hr"): NodeListOf; - getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; - getElementsByTagName(tagname: "iframe"): NodeListOf; - getElementsByTagName(tagname: "image"): NodeListOf; - getElementsByTagName(tagname: "img"): NodeListOf; - getElementsByTagName(tagname: "input"): NodeListOf; - getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; - getElementsByTagName(tagname: "label"): NodeListOf; - getElementsByTagName(tagname: "legend"): NodeListOf; - getElementsByTagName(tagname: "li"): NodeListOf; - getElementsByTagName(tagname: "line"): NodeListOf; - getElementsByTagName(tagname: "lineargradient"): NodeListOf; - getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; - getElementsByTagName(tagname: "map"): NodeListOf; - getElementsByTagName(tagname: "mark"): NodeListOf; - getElementsByTagName(tagname: "marker"): NodeListOf; - getElementsByTagName(tagname: "marquee"): NodeListOf; - getElementsByTagName(tagname: "mask"): NodeListOf; - getElementsByTagName(tagname: "menu"): NodeListOf; - getElementsByTagName(tagname: "meta"): NodeListOf; - getElementsByTagName(tagname: "metadata"): NodeListOf; - getElementsByTagName(tagname: "meter"): NodeListOf; - getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; - getElementsByTagName(tagname: "noframes"): NodeListOf; - getElementsByTagName(tagname: "noscript"): NodeListOf; - getElementsByTagName(tagname: "object"): NodeListOf; - getElementsByTagName(tagname: "ol"): NodeListOf; - getElementsByTagName(tagname: "optgroup"): NodeListOf; - getElementsByTagName(tagname: "option"): NodeListOf; - getElementsByTagName(tagname: "p"): NodeListOf; - getElementsByTagName(tagname: "param"): NodeListOf; - getElementsByTagName(tagname: "path"): NodeListOf; - getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "picture"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; - getElementsByTagName(tagname: "polygon"): NodeListOf; - getElementsByTagName(tagname: "polyline"): NodeListOf; - getElementsByTagName(tagname: "pre"): NodeListOf; - getElementsByTagName(tagname: "progress"): NodeListOf; - getElementsByTagName(tagname: "q"): NodeListOf; - getElementsByTagName(tagname: "radialgradient"): NodeListOf; - getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; - getElementsByTagName(tagname: "script"): NodeListOf; - getElementsByTagName(tagname: "section"): NodeListOf; - getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; - getElementsByTagName(tagname: "source"): NodeListOf; - getElementsByTagName(tagname: "span"): NodeListOf; - getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; - getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; - getElementsByTagName(tagname: "svg"): NodeListOf; - getElementsByTagName(tagname: "switch"): NodeListOf; - getElementsByTagName(tagname: "symbol"): NodeListOf; - getElementsByTagName(tagname: "table"): NodeListOf; - getElementsByTagName(tagname: "tbody"): NodeListOf; - getElementsByTagName(tagname: "td"): NodeListOf; - getElementsByTagName(tagname: "template"): NodeListOf; - getElementsByTagName(tagname: "text"): NodeListOf; - getElementsByTagName(tagname: "textpath"): NodeListOf; - getElementsByTagName(tagname: "textarea"): NodeListOf; - getElementsByTagName(tagname: "tfoot"): NodeListOf; - getElementsByTagName(tagname: "th"): NodeListOf; - getElementsByTagName(tagname: "thead"): NodeListOf; - getElementsByTagName(tagname: "title"): NodeListOf; - getElementsByTagName(tagname: "tr"): NodeListOf; - getElementsByTagName(tagname: "track"): NodeListOf; - getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; - getElementsByTagName(tagname: "ul"): NodeListOf; - getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; - getElementsByTagName(tagname: "video"): NodeListOf; - getElementsByTagName(tagname: "view"): NodeListOf; - getElementsByTagName(tagname: "wbr"): NodeListOf; - getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: K): ElementListTagNameMap[K]; getElementsByTagName(tagname: string): NodeListOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; @@ -3269,103 +3120,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param content The text and HTML tags to write. */ writeln(...content: string[]): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -3375,7 +3130,6 @@ declare var Document: { } interface DocumentFragment extends Node, NodeSelector, ParentNode { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var DocumentFragment: { @@ -3390,7 +3144,6 @@ interface DocumentType extends Node, ChildNode { readonly notations: NamedNodeMap; readonly publicId: string | null; readonly systemId: string | null; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var DocumentType: { @@ -3443,6 +3196,36 @@ declare var EXT_texture_filter_anisotropic: { readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } +interface ElementEventMap extends GlobalEventHandlersEventMap { + "ariarequest": AriaRequestEvent; + "command": CommandEvent; + "gotpointercapture": PointerEvent; + "lostpointercapture": PointerEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSGotPointerCapture": MSPointerEvent; + "MSInertiaStart": MSGestureEvent; + "MSLostPointerCapture": MSPointerEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { readonly classList: DOMTokenList; className: string; @@ -3453,33 +3236,33 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec id: string; msContentZoomFactor: number; readonly msRegionOverflow: string; - onariarequest: (this: this, ev: AriaRequestEvent) => any; - oncommand: (this: this, ev: CommandEvent) => any; - ongotpointercapture: (this: this, ev: PointerEvent) => any; - onlostpointercapture: (this: this, ev: PointerEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmslostpointercapture: (this: this, ev: MSPointerEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; + onariarequest: (this: Element, ev: AriaRequestEvent) => any; + oncommand: (this: Element, ev: CommandEvent) => any; + ongotpointercapture: (this: Element, ev: PointerEvent) => any; + onlostpointercapture: (this: Element, ev: PointerEvent) => any; + onmsgesturechange: (this: Element, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any; + onmsgestureend: (this: Element, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Element, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Element, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Element, ev: MSGestureEvent) => any; + onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmsinertiastart: (this: Element, ev: MSGestureEvent) => any; + onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmspointercancel: (this: Element, ev: MSPointerEvent) => any; + onmspointerdown: (this: Element, ev: MSPointerEvent) => any; + onmspointerenter: (this: Element, ev: MSPointerEvent) => any; + onmspointerleave: (this: Element, ev: MSPointerEvent) => any; + onmspointermove: (this: Element, ev: MSPointerEvent) => any; + onmspointerout: (this: Element, ev: MSPointerEvent) => any; + onmspointerover: (this: Element, ev: MSPointerEvent) => any; + onmspointerup: (this: Element, ev: MSPointerEvent) => any; ontouchcancel: (ev: TouchEvent) => any; ontouchend: (ev: TouchEvent) => any; ontouchmove: (ev: TouchEvent) => any; ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; + onwebkitfullscreenchange: (this: Element, ev: Event) => any; + onwebkitfullscreenerror: (this: Element, ev: Event) => any; readonly prefix: string | null; readonly scrollHeight: number; scrollLeft: number; @@ -3487,188 +3270,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec readonly scrollWidth: number; readonly tagName: string; innerHTML: string; + readonly assignedSlot: HTMLSlotElement | null; + slot: string; + readonly shadowRoot: ShadowRoot | null; getAttribute(name: string): string | null; getAttributeNS(namespaceURI: string, localName: string): string; getAttributeNode(name: string): Attr; getAttributeNodeNS(namespaceURI: string, localName: string): Attr; getBoundingClientRect(): ClientRect; getClientRects(): ClientRectList; - getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; - getElementsByTagName(name: "applet"): NodeListOf; - getElementsByTagName(name: "area"): NodeListOf; - getElementsByTagName(name: "article"): NodeListOf; - getElementsByTagName(name: "aside"): NodeListOf; - getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; - getElementsByTagName(name: "base"): NodeListOf; - getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; - getElementsByTagName(name: "body"): NodeListOf; - getElementsByTagName(name: "br"): NodeListOf; - getElementsByTagName(name: "button"): NodeListOf; - getElementsByTagName(name: "canvas"): NodeListOf; - getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; - getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; - getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; - getElementsByTagName(name: "col"): NodeListOf; - getElementsByTagName(name: "colgroup"): NodeListOf; - getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; - getElementsByTagName(name: "defs"): NodeListOf; - getElementsByTagName(name: "del"): NodeListOf; - getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; - getElementsByTagName(name: "dir"): NodeListOf; - getElementsByTagName(name: "div"): NodeListOf; - getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; - getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; - getElementsByTagName(name: "embed"): NodeListOf; - getElementsByTagName(name: "feblend"): NodeListOf; - getElementsByTagName(name: "fecolormatrix"): NodeListOf; - getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(name: "fecomposite"): NodeListOf; - getElementsByTagName(name: "feconvolvematrix"): NodeListOf; - getElementsByTagName(name: "fediffuselighting"): NodeListOf; - getElementsByTagName(name: "fedisplacementmap"): NodeListOf; - getElementsByTagName(name: "fedistantlight"): NodeListOf; - getElementsByTagName(name: "feflood"): NodeListOf; - getElementsByTagName(name: "fefunca"): NodeListOf; - getElementsByTagName(name: "fefuncb"): NodeListOf; - getElementsByTagName(name: "fefuncg"): NodeListOf; - getElementsByTagName(name: "fefuncr"): NodeListOf; - getElementsByTagName(name: "fegaussianblur"): NodeListOf; - getElementsByTagName(name: "feimage"): NodeListOf; - getElementsByTagName(name: "femerge"): NodeListOf; - getElementsByTagName(name: "femergenode"): NodeListOf; - getElementsByTagName(name: "femorphology"): NodeListOf; - getElementsByTagName(name: "feoffset"): NodeListOf; - getElementsByTagName(name: "fepointlight"): NodeListOf; - getElementsByTagName(name: "fespecularlighting"): NodeListOf; - getElementsByTagName(name: "fespotlight"): NodeListOf; - getElementsByTagName(name: "fetile"): NodeListOf; - getElementsByTagName(name: "feturbulence"): NodeListOf; - getElementsByTagName(name: "fieldset"): NodeListOf; - getElementsByTagName(name: "figcaption"): NodeListOf; - getElementsByTagName(name: "figure"): NodeListOf; - getElementsByTagName(name: "filter"): NodeListOf; - getElementsByTagName(name: "font"): NodeListOf; - getElementsByTagName(name: "footer"): NodeListOf; - getElementsByTagName(name: "foreignobject"): NodeListOf; - getElementsByTagName(name: "form"): NodeListOf; - getElementsByTagName(name: "frame"): NodeListOf; - getElementsByTagName(name: "frameset"): NodeListOf; - getElementsByTagName(name: "g"): NodeListOf; - getElementsByTagName(name: "h1"): NodeListOf; - getElementsByTagName(name: "h2"): NodeListOf; - getElementsByTagName(name: "h3"): NodeListOf; - getElementsByTagName(name: "h4"): NodeListOf; - getElementsByTagName(name: "h5"): NodeListOf; - getElementsByTagName(name: "h6"): NodeListOf; - getElementsByTagName(name: "head"): NodeListOf; - getElementsByTagName(name: "header"): NodeListOf; - getElementsByTagName(name: "hgroup"): NodeListOf; - getElementsByTagName(name: "hr"): NodeListOf; - getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; - getElementsByTagName(name: "iframe"): NodeListOf; - getElementsByTagName(name: "image"): NodeListOf; - getElementsByTagName(name: "img"): NodeListOf; - getElementsByTagName(name: "input"): NodeListOf; - getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; - getElementsByTagName(name: "label"): NodeListOf; - getElementsByTagName(name: "legend"): NodeListOf; - getElementsByTagName(name: "li"): NodeListOf; - getElementsByTagName(name: "line"): NodeListOf; - getElementsByTagName(name: "lineargradient"): NodeListOf; - getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; - getElementsByTagName(name: "map"): NodeListOf; - getElementsByTagName(name: "mark"): NodeListOf; - getElementsByTagName(name: "marker"): NodeListOf; - getElementsByTagName(name: "marquee"): NodeListOf; - getElementsByTagName(name: "mask"): NodeListOf; - getElementsByTagName(name: "menu"): NodeListOf; - getElementsByTagName(name: "meta"): NodeListOf; - getElementsByTagName(name: "metadata"): NodeListOf; - getElementsByTagName(name: "meter"): NodeListOf; - getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; - getElementsByTagName(name: "noframes"): NodeListOf; - getElementsByTagName(name: "noscript"): NodeListOf; - getElementsByTagName(name: "object"): NodeListOf; - getElementsByTagName(name: "ol"): NodeListOf; - getElementsByTagName(name: "optgroup"): NodeListOf; - getElementsByTagName(name: "option"): NodeListOf; - getElementsByTagName(name: "p"): NodeListOf; - getElementsByTagName(name: "param"): NodeListOf; - getElementsByTagName(name: "path"): NodeListOf; - getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "picture"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; - getElementsByTagName(name: "polygon"): NodeListOf; - getElementsByTagName(name: "polyline"): NodeListOf; - getElementsByTagName(name: "pre"): NodeListOf; - getElementsByTagName(name: "progress"): NodeListOf; - getElementsByTagName(name: "q"): NodeListOf; - getElementsByTagName(name: "radialgradient"): NodeListOf; - getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; - getElementsByTagName(name: "script"): NodeListOf; - getElementsByTagName(name: "section"): NodeListOf; - getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; - getElementsByTagName(name: "source"): NodeListOf; - getElementsByTagName(name: "span"): NodeListOf; - getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; - getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; - getElementsByTagName(name: "svg"): NodeListOf; - getElementsByTagName(name: "switch"): NodeListOf; - getElementsByTagName(name: "symbol"): NodeListOf; - getElementsByTagName(name: "table"): NodeListOf; - getElementsByTagName(name: "tbody"): NodeListOf; - getElementsByTagName(name: "td"): NodeListOf; - getElementsByTagName(name: "template"): NodeListOf; - getElementsByTagName(name: "text"): NodeListOf; - getElementsByTagName(name: "textpath"): NodeListOf; - getElementsByTagName(name: "textarea"): NodeListOf; - getElementsByTagName(name: "tfoot"): NodeListOf; - getElementsByTagName(name: "th"): NodeListOf; - getElementsByTagName(name: "thead"): NodeListOf; - getElementsByTagName(name: "title"): NodeListOf; - getElementsByTagName(name: "tr"): NodeListOf; - getElementsByTagName(name: "track"): NodeListOf; - getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; - getElementsByTagName(name: "ul"): NodeListOf; - getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; - getElementsByTagName(name: "video"): NodeListOf; - getElementsByTagName(name: "view"): NodeListOf; - getElementsByTagName(name: "wbr"): NodeListOf; - getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: K): ElementListTagNameMap[K]; getElementsByTagName(name: string): NodeListOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; @@ -3708,42 +3319,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot; + addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -3779,10 +3356,12 @@ interface Event { readonly target: EventTarget; readonly timeStamp: number; readonly type: string; + readonly scoped: boolean; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; + deepPath(): EventTarget[]; readonly AT_TARGET: number; readonly BUBBLING_PHASE: number; readonly CAPTURING_PHASE: number; @@ -3843,6 +3422,7 @@ interface FileReader extends EventTarget, MSBaseReader { readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -4013,6 +3593,8 @@ interface HTMLAnchorElement extends HTMLElement { * Returns a string representation of an object. */ toString(): string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAnchorElement: { @@ -4085,6 +3667,8 @@ interface HTMLAppletElement extends HTMLElement { useMap: string; vspace: number; width: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAppletElement: { @@ -4151,6 +3735,8 @@ interface HTMLAreaElement extends HTMLElement { * Returns a string representation of an object. */ toString(): string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAreaElement: { @@ -4175,6 +3761,8 @@ declare var HTMLAreasCollection: { } interface HTMLAudioElement extends HTMLMediaElement { + addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAudioElement: { @@ -4187,6 +3775,8 @@ interface HTMLBRElement extends HTMLElement { * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. */ clear: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLBRElement: { @@ -4203,6 +3793,8 @@ interface HTMLBaseElement extends HTMLElement { * Sets or retrieves the window or frame at which to target content. */ target: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLBaseElement: { @@ -4219,6 +3811,7 @@ interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty * Sets or retrieves the font size of the object. */ size: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -4227,6 +3820,27 @@ declare var HTMLBaseFontElement: { new(): HTMLBaseFontElement; } +interface HTMLBodyElementEventMap extends HTMLElementEventMap { + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "popstate": PopStateEvent; + "resize": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + interface HTMLBodyElement extends HTMLElement { aLink: any; background: string; @@ -4234,147 +3848,27 @@ interface HTMLBodyElement extends HTMLElement { bgProperties: string; link: any; noWrap: boolean; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; + onafterprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any; + onblur: (this: HTMLBodyElement, ev: FocusEvent) => any; + onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any; + onload: (this: HTMLBodyElement, ev: Event) => any; + onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any; + onoffline: (this: HTMLBodyElement, ev: Event) => any; + ononline: (this: HTMLBodyElement, ev: Event) => any; + onorientationchange: (this: HTMLBodyElement, ev: Event) => any; + onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any; + onresize: (this: HTMLBodyElement, ev: UIEvent) => any; + onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any; + onunload: (this: HTMLBodyElement, ev: Event) => any; text: any; vLink: any; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -4447,6 +3941,8 @@ interface HTMLButtonElement extends HTMLElement { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLButtonElement: { @@ -4480,6 +3976,8 @@ interface HTMLCanvasElement extends HTMLElement { */ toDataURL(type?: string, ...args: any[]): string; toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLCanvasElement: { @@ -4510,6 +4008,8 @@ declare var HTMLCollection: { interface HTMLDListElement extends HTMLElement { compact: boolean; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDListElement: { @@ -4519,6 +4019,8 @@ declare var HTMLDListElement: { interface HTMLDataListElement extends HTMLElement { options: HTMLCollectionOf; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDataListElement: { @@ -4528,6 +4030,8 @@ declare var HTMLDataListElement: { interface HTMLDirectoryElement extends HTMLElement { compact: boolean; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDirectoryElement: { @@ -4544,6 +4048,8 @@ interface HTMLDivElement extends HTMLElement { * Sets or retrieves whether the browser automatically performs wordwrap. */ noWrap: boolean; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDivElement: { @@ -4552,6 +4058,8 @@ declare var HTMLDivElement: { } interface HTMLDocument extends Document { + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDocument: { @@ -4559,6 +4067,76 @@ declare var HTMLDocument: { new(): HTMLDocument; } +interface HTMLElementEventMap extends ElementEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforecopy": ClipboardEvent; + "beforecut": ClipboardEvent; + "beforedeactivate": UIEvent; + "beforepaste": ClipboardEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "copy": ClipboardEvent; + "cuechange": Event; + "cut": ClipboardEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "paste": ClipboardEvent; + "pause": Event; + "play": Event; + "playing": Event; + "progress": ProgressEvent; + "ratechange": Event; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectstart": Event; + "stalled": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "volumechange": Event; + "waiting": Event; +} + interface HTMLElement extends Element { accessKey: string; readonly children: HTMLCollection; @@ -4577,73 +4155,73 @@ interface HTMLElement extends Element { readonly offsetParent: Element; readonly offsetTop: number; readonly offsetWidth: number; - onabort: (this: this, ev: UIEvent) => any; - onactivate: (this: this, ev: UIEvent) => any; - onbeforeactivate: (this: this, ev: UIEvent) => any; - onbeforecopy: (this: this, ev: ClipboardEvent) => any; - onbeforecut: (this: this, ev: ClipboardEvent) => any; - onbeforedeactivate: (this: this, ev: UIEvent) => any; - onbeforepaste: (this: this, ev: ClipboardEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - oncopy: (this: this, ev: ClipboardEvent) => any; - oncuechange: (this: this, ev: Event) => any; - oncut: (this: this, ev: ClipboardEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondeactivate: (this: this, ev: UIEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onpaste: (this: this, ev: ClipboardEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreset: (this: this, ev: Event) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onselectstart: (this: this, ev: Event) => any; - onstalled: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; + onabort: (this: HTMLElement, ev: UIEvent) => any; + onactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onblur: (this: HTMLElement, ev: FocusEvent) => any; + oncanplay: (this: HTMLElement, ev: Event) => any; + oncanplaythrough: (this: HTMLElement, ev: Event) => any; + onchange: (this: HTMLElement, ev: Event) => any; + onclick: (this: HTMLElement, ev: MouseEvent) => any; + oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any; + oncopy: (this: HTMLElement, ev: ClipboardEvent) => any; + oncuechange: (this: HTMLElement, ev: Event) => any; + oncut: (this: HTMLElement, ev: ClipboardEvent) => any; + ondblclick: (this: HTMLElement, ev: MouseEvent) => any; + ondeactivate: (this: HTMLElement, ev: UIEvent) => any; + ondrag: (this: HTMLElement, ev: DragEvent) => any; + ondragend: (this: HTMLElement, ev: DragEvent) => any; + ondragenter: (this: HTMLElement, ev: DragEvent) => any; + ondragleave: (this: HTMLElement, ev: DragEvent) => any; + ondragover: (this: HTMLElement, ev: DragEvent) => any; + ondragstart: (this: HTMLElement, ev: DragEvent) => any; + ondrop: (this: HTMLElement, ev: DragEvent) => any; + ondurationchange: (this: HTMLElement, ev: Event) => any; + onemptied: (this: HTMLElement, ev: Event) => any; + onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any; + onerror: (this: HTMLElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLElement, ev: FocusEvent) => any; + oninput: (this: HTMLElement, ev: Event) => any; + oninvalid: (this: HTMLElement, ev: Event) => any; + onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any; + onload: (this: HTMLElement, ev: Event) => any; + onloadeddata: (this: HTMLElement, ev: Event) => any; + onloadedmetadata: (this: HTMLElement, ev: Event) => any; + onloadstart: (this: HTMLElement, ev: Event) => any; + onmousedown: (this: HTMLElement, ev: MouseEvent) => any; + onmouseenter: (this: HTMLElement, ev: MouseEvent) => any; + onmouseleave: (this: HTMLElement, ev: MouseEvent) => any; + onmousemove: (this: HTMLElement, ev: MouseEvent) => any; + onmouseout: (this: HTMLElement, ev: MouseEvent) => any; + onmouseover: (this: HTMLElement, ev: MouseEvent) => any; + onmouseup: (this: HTMLElement, ev: MouseEvent) => any; + onmousewheel: (this: HTMLElement, ev: WheelEvent) => any; + onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any; + onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any; + onpaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onpause: (this: HTMLElement, ev: Event) => any; + onplay: (this: HTMLElement, ev: Event) => any; + onplaying: (this: HTMLElement, ev: Event) => any; + onprogress: (this: HTMLElement, ev: ProgressEvent) => any; + onratechange: (this: HTMLElement, ev: Event) => any; + onreset: (this: HTMLElement, ev: Event) => any; + onscroll: (this: HTMLElement, ev: UIEvent) => any; + onseeked: (this: HTMLElement, ev: Event) => any; + onseeking: (this: HTMLElement, ev: Event) => any; + onselect: (this: HTMLElement, ev: UIEvent) => any; + onselectstart: (this: HTMLElement, ev: Event) => any; + onstalled: (this: HTMLElement, ev: Event) => any; + onsubmit: (this: HTMLElement, ev: Event) => any; + onsuspend: (this: HTMLElement, ev: Event) => any; + ontimeupdate: (this: HTMLElement, ev: Event) => any; + onvolumechange: (this: HTMLElement, ev: Event) => any; + onwaiting: (this: HTMLElement, ev: Event) => any; outerHTML: string; outerText: string; spellcheck: boolean; @@ -4656,109 +4234,7 @@ interface HTMLElement extends Element { focus(): void; msGetInputContext(): MSInputMethodContext; 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -4814,6 +4290,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { * Sets or retrieves the width of the object. */ width: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -4853,6 +4330,8 @@ interface HTMLFieldSetElement extends HTMLElement { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLFieldSetElement: { @@ -4865,6 +4344,7 @@ interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOM * Sets or retrieves the current typeface family. */ face: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -4940,6 +4420,8 @@ interface HTMLFormElement extends HTMLElement { * Fires when a FORM is about to be submitted. */ submit(): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; } @@ -4948,6 +4430,10 @@ declare var HTMLFormElement: { new(): HTMLFormElement; } +interface HTMLFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Specifies the properties of a border drawn around an object. @@ -5000,7 +4486,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Raised when the object has been completely received from the server. */ - onload: (this: this, ev: Event) => any; + onload: (this: HTMLFrameElement, ev: Event) => any; /** * Sets or retrieves whether the frame can be scrolled. */ @@ -5013,110 +4499,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves the width of the object. */ width: string | number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5125,6 +4508,25 @@ declare var HTMLFrameElement: { new(): HTMLFrameElement; } +interface HTMLFrameSetElementEventMap extends HTMLElementEventMap { + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "resize": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + interface HTMLFrameSetElement extends HTMLElement { border: string; /** @@ -5144,152 +4546,34 @@ interface HTMLFrameSetElement extends HTMLElement { */ frameSpacing: any; name: string; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; /** * Fires when the object loses the input focus. */ - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any; /** * Fires when the object receives focus. */ - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; + onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; + onload: (this: HTMLFrameSetElement, ev: Event) => any; + onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; + onoffline: (this: HTMLFrameSetElement, ev: Event) => any; + ononline: (this: HTMLFrameSetElement, ev: Event) => any; + onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any; + onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any; + onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any; + onunload: (this: HTMLFrameSetElement, ev: Event) => any; /** * Sets or retrieves the frame heights of the object. */ rows: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5311,6 +4595,7 @@ interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2 * Sets or retrieves the width of the object. */ width: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5321,6 +4606,8 @@ declare var HTMLHRElement: { interface HTMLHeadElement extends HTMLElement { profile: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLHeadElement: { @@ -5333,6 +4620,8 @@ interface HTMLHeadingElement extends HTMLElement { * Sets or retrieves a value that indicates the table alignment. */ align: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLHeadingElement: { @@ -5345,6 +4634,8 @@ interface HTMLHtmlElement extends HTMLElement { * Sets or retrieves the DTD version that governs the current document. */ version: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLHtmlElement: { @@ -5352,6 +4643,10 @@ declare var HTMLHtmlElement: { new(): HTMLHtmlElement; } +interface HTMLIFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Sets or retrieves how the object is aligned with adjacent text. @@ -5409,7 +4704,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Raised when the object has been completely received from the server. */ - onload: (this: this, ev: Event) => any; + onload: (this: HTMLIFrameElement, ev: Event) => any; readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. @@ -5427,110 +4722,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves the width of the object. */ width: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5621,6 +4813,8 @@ interface HTMLImageElement extends HTMLElement { readonly x: number; readonly y: number; msGetAsCastingSource(): any; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLImageElement: { @@ -5832,6 +5026,8 @@ interface HTMLInputElement extends HTMLElement { * @param n Value to increment the value by. */ stepUp(n?: number): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLInputElement: { @@ -5845,6 +5041,8 @@ interface HTMLLIElement extends HTMLElement { * Sets or retrieves the value of a list item. */ value: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLLIElement: { @@ -5861,6 +5059,8 @@ interface HTMLLabelElement extends HTMLElement { * Sets or retrieves the object to which the given label object is assigned. */ htmlFor: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLLabelElement: { @@ -5877,6 +5077,8 @@ interface HTMLLegendElement extends HTMLElement { * Retrieves a reference to the form that the object is embedded in. */ readonly form: HTMLFormElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLLegendElement: { @@ -5920,6 +5122,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle { type: string; import?: Document; integrity: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5937,6 +5140,8 @@ interface HTMLMapElement extends HTMLElement { * Sets or retrieves the name of the object. */ name: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMapElement: { @@ -5944,6 +5149,12 @@ declare var HTMLMapElement: { new(): HTMLMapElement; } +interface HTMLMarqueeElementEventMap extends HTMLElementEventMap { + "bounce": Event; + "finish": Event; + "start": Event; +} + interface HTMLMarqueeElement extends HTMLElement { behavior: string; bgColor: any; @@ -5951,9 +5162,9 @@ interface HTMLMarqueeElement extends HTMLElement { height: string; hspace: number; loop: number; - onbounce: (this: this, ev: Event) => any; - onfinish: (this: this, ev: Event) => any; - onstart: (this: this, ev: Event) => any; + onbounce: (this: HTMLMarqueeElement, ev: Event) => any; + onfinish: (this: HTMLMarqueeElement, ev: Event) => any; + onstart: (this: HTMLMarqueeElement, ev: Event) => any; scrollAmount: number; scrollDelay: number; trueSpeed: boolean; @@ -5961,112 +5172,7 @@ interface HTMLMarqueeElement extends HTMLElement { width: string; start(): void; stop(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6075,6 +5181,11 @@ declare var HTMLMarqueeElement: { new(): HTMLMarqueeElement; } +interface HTMLMediaElementEventMap extends HTMLElementEventMap { + "encrypted": MediaEncryptedEvent; + "msneedkey": MSMediaKeyNeededEvent; +} + interface HTMLMediaElement extends HTMLElement { /** * Returns an AudioTrackList object with the audio tracks for a given video element. @@ -6164,8 +5275,8 @@ interface HTMLMediaElement extends HTMLElement { * Gets the current network activity for the element. */ readonly networkState: number; - onencrypted: (this: this, ev: MediaEncryptedEvent) => any; - onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any; + onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any; + onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any; /** * Gets a flag that specifies whether playback is paused. */ @@ -6243,111 +5354,7 @@ interface HTMLMediaElement extends HTMLElement { readonly NETWORK_IDLE: number; readonly NETWORK_LOADING: number; readonly NETWORK_NO_SOURCE: number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6368,6 +5375,8 @@ declare var HTMLMediaElement: { interface HTMLMenuElement extends HTMLElement { compact: boolean; type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMenuElement: { @@ -6400,6 +5409,8 @@ interface HTMLMetaElement extends HTMLElement { * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. */ url: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMetaElement: { @@ -6414,6 +5425,8 @@ interface HTMLMeterElement extends HTMLElement { min: number; optimum: number; value: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMeterElement: { @@ -6430,6 +5443,8 @@ interface HTMLModElement extends HTMLElement { * Sets or retrieves the date and time of a modification to the object. */ dateTime: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLModElement: { @@ -6444,6 +5459,8 @@ interface HTMLOListElement extends HTMLElement { */ start: number; type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLOListElement: { @@ -6563,6 +5580,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6601,6 +5619,8 @@ interface HTMLOptGroupElement extends HTMLElement { * Sets or retrieves the value which is returned to the server when the form control is submitted. */ value: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLOptGroupElement: { @@ -6638,6 +5658,8 @@ interface HTMLOptionElement extends HTMLElement { * Sets or retrieves the value which is returned to the server when the form control is submitted. */ value: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLOptionElement: { @@ -6664,6 +5686,8 @@ interface HTMLParagraphElement extends HTMLElement { */ align: string; clear: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLParagraphElement: { @@ -6688,6 +5712,8 @@ interface HTMLParamElement extends HTMLElement { * Sets or retrieves the data type of the value attribute. */ valueType: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLParamElement: { @@ -6696,6 +5722,8 @@ declare var HTMLParamElement: { } interface HTMLPictureElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLPictureElement: { @@ -6708,6 +5736,8 @@ interface HTMLPreElement extends HTMLElement { * Sets or gets a value that you can use to implement your own width functionality for the object. */ width: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLPreElement: { @@ -6732,6 +5762,8 @@ interface HTMLProgressElement extends HTMLElement { * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. */ value: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLProgressElement: { @@ -6744,6 +5776,8 @@ interface HTMLQuoteElement extends HTMLElement { * Sets or retrieves reference information about the object. */ cite: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLQuoteElement: { @@ -6782,6 +5816,8 @@ interface HTMLScriptElement extends HTMLElement { */ type: string; integrity: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLScriptElement: { @@ -6876,6 +5912,8 @@ interface HTMLSelectElement extends HTMLElement { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; } @@ -6900,6 +5938,8 @@ interface HTMLSourceElement extends HTMLElement { * Gets or sets the MIME type of a media resource. */ type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLSourceElement: { @@ -6908,6 +5948,8 @@ declare var HTMLSourceElement: { } interface HTMLSpanElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLSpanElement: { @@ -6925,6 +5967,7 @@ interface HTMLStyleElement extends HTMLElement, LinkStyle { * Retrieves the CSS language in which the style sheet is written. */ type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6942,6 +5985,8 @@ interface HTMLTableCaptionElement extends HTMLElement { * Sets or retrieves whether the caption appears at the top or bottom of the table. */ vAlign: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTableCaptionElement: { @@ -6995,6 +6040,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { * Sets or retrieves the width of the object. */ width: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7016,6 +6062,7 @@ interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { * Sets or retrieves the width of the object. */ width: any; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7136,6 +6183,8 @@ interface HTMLTableElement extends HTMLElement { * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTableElement: { @@ -7187,6 +6236,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. */ insertCell(index?: number): HTMLTableDataCellElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7214,6 +6264,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7224,6 +6275,8 @@ declare var HTMLTableSectionElement: { interface HTMLTemplateElement extends HTMLElement { readonly content: DocumentFragment; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTemplateElement: { @@ -7329,6 +6382,8 @@ interface HTMLTextAreaElement extends HTMLElement { * @param end The offset into the text field for the end of the selection. */ setSelectionRange(start: number, end: number): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTextAreaElement: { @@ -7341,6 +6396,8 @@ interface HTMLTitleElement extends HTMLElement { * Retrieves or sets the text of the object as a string. */ text: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTitleElement: { @@ -7360,6 +6417,8 @@ interface HTMLTrackElement extends HTMLElement { readonly LOADED: number; readonly LOADING: number; readonly NONE: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTrackElement: { @@ -7374,6 +6433,8 @@ declare var HTMLTrackElement: { interface HTMLUListElement extends HTMLElement { compact: boolean; type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLUListElement: { @@ -7382,6 +6443,8 @@ declare var HTMLUListElement: { } interface HTMLUnknownElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLUnknownElement: { @@ -7389,6 +6452,12 @@ declare var HTMLUnknownElement: { new(): HTMLUnknownElement; } +interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap { + "MSVideoFormatChanged": Event; + "MSVideoFrameStepCompleted": Event; + "MSVideoOptimalLayoutChanged": Event; +} + interface HTMLVideoElement extends HTMLMediaElement { /** * Gets or sets the height of the video element. @@ -7400,9 +6469,9 @@ interface HTMLVideoElement extends HTMLMediaElement { msStereo3DPackingMode: string; msStereo3DRenderMode: string; msZoom: boolean; - onMSVideoFormatChanged: (this: this, ev: Event) => any; - onMSVideoFrameStepCompleted: (this: this, ev: Event) => any; - onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any; + onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any; /** * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. */ @@ -7429,114 +6498,7 @@ interface HTMLVideoElement extends HTMLMediaElement { webkitEnterFullscreen(): void; webkitExitFullScreen(): void; webkitExitFullscreen(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7604,11 +6566,16 @@ declare var IDBCursorWithValue: { new(): IDBCursorWithValue; } +interface IDBDatabaseEventMap { + "abort": Event; + "error": ErrorEvent; +} + interface IDBDatabase extends EventTarget { readonly name: string; readonly objectStoreNames: DOMStringList; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onabort: (this: IDBDatabase, ev: Event) => any; + onerror: (this: IDBDatabase, ev: ErrorEvent) => any; version: number; onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; @@ -7616,8 +6583,7 @@ interface IDBDatabase extends EventTarget { deleteObjectStore(name: string): void; transaction(storeNames: string | string[], mode?: string): IDBTransaction; addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - 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: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7694,13 +6660,15 @@ declare var IDBObjectStore: { new(): IDBObjectStore; } +interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { + "blocked": Event; + "upgradeneeded": IDBVersionChangeEvent; +} + interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: this, ev: Event) => any; - onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; - addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + onblocked: (this: IDBOpenDBRequest, ev: Event) => any; + onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; + addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7709,16 +6677,20 @@ declare var IDBOpenDBRequest: { new(): IDBOpenDBRequest; } +interface IDBRequestEventMap { + "error": ErrorEvent; + "success": Event; +} + interface IDBRequest extends EventTarget { readonly error: DOMError; - onerror: (this: this, ev: ErrorEvent) => any; - onsuccess: (this: this, ev: Event) => any; + onerror: (this: IDBRequest, ev: ErrorEvent) => any; + onsuccess: (this: IDBRequest, ev: Event) => any; readonly readyState: string; readonly result: any; source: IDBObjectStore | IDBIndex | IDBCursor; readonly transaction: IDBTransaction; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7727,21 +6699,25 @@ declare var IDBRequest: { new(): IDBRequest; } +interface IDBTransactionEventMap { + "abort": Event; + "complete": Event; + "error": ErrorEvent; +} + interface IDBTransaction extends EventTarget { readonly db: IDBDatabase; readonly error: DOMError; readonly mode: string; - onabort: (this: this, ev: Event) => any; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onabort: (this: IDBTransaction, ev: Event) => any; + oncomplete: (this: IDBTransaction, ev: Event) => any; + onerror: (this: IDBTransaction, ev: ErrorEvent) => any; abort(): void; objectStore(name: string): IDBObjectStore; readonly READ_ONLY: string; readonly READ_WRITE: string; readonly VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7874,18 +6850,22 @@ interface MSApp { } declare var MSApp: MSApp; +interface MSAppAsyncOperationEventMap { + "complete": Event; + "error": ErrorEvent; +} + interface MSAppAsyncOperation extends EventTarget { readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; + onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any; readonly readyState: number; readonly result: any; start(): void; readonly COMPLETED: number; readonly ERROR: number; readonly STARTED: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8040,6 +7020,8 @@ interface MSHTMLWebViewElement extends HTMLElement { navigateWithHttpRequestMessage(requestMessage: any): void; refresh(): void; stop(): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var MSHTMLWebViewElement: { @@ -8047,20 +7029,24 @@ declare var MSHTMLWebViewElement: { new(): MSHTMLWebViewElement; } +interface MSInputMethodContextEventMap { + "MSCandidateWindowHide": Event; + "MSCandidateWindowShow": Event; + "MSCandidateWindowUpdate": Event; +} + interface MSInputMethodContext extends EventTarget { readonly compositionEndOffset: number; readonly compositionStartOffset: number; - oncandidatewindowhide: (this: this, ev: Event) => any; - oncandidatewindowshow: (this: this, ev: Event) => any; - oncandidatewindowupdate: (this: this, ev: Event) => any; + oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any; readonly target: HTMLElement; getCandidateWindowClientRect(): ClientRect; getCompositionAlternatives(): string[]; hasComposition(): boolean; isCandidateWindowVisible(): boolean; - addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8226,6 +7212,7 @@ interface MSStreamReader extends EventTarget, MSBaseReader { readAsBlob(stream: MSStream, size?: number): void; readAsDataURL(stream: MSStream, size?: number): void; readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8234,10 +7221,15 @@ declare var MSStreamReader: { new(): MSStreamReader; } +interface MSWebViewAsyncOperationEventMap { + "complete": Event; + "error": ErrorEvent; +} + interface MSWebViewAsyncOperation extends EventTarget { readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any; + onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any; readonly readyState: number; readonly result: any; readonly target: MSHTMLWebViewElement; @@ -8249,8 +7241,7 @@ interface MSWebViewAsyncOperation extends EventTarget { readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; readonly TYPE_INVOKE_SCRIPT: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8287,12 +7278,16 @@ declare var MediaDeviceInfo: { new(): MediaDeviceInfo; } +interface MediaDevicesEventMap { + "devicechange": Event; +} + interface MediaDevices extends EventTarget { - ondevicechange: (this: this, ev: Event) => any; + ondevicechange: (this: MediaDevices, ev: Event) => any; enumerateDevices(): any; getSupportedConstraints(): MediaTrackSupportedConstraints; getUserMedia(constraints: MediaStreamConstraints): PromiseLike; - addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8442,13 +7437,20 @@ declare var MediaSource: { isTypeSupported(type: string): boolean; } +interface MediaStreamEventMap { + "active": Event; + "addtrack": TrackEvent; + "inactive": Event; + "removetrack": TrackEvent; +} + interface MediaStream extends EventTarget { readonly active: boolean; readonly id: string; - onactive: (this: this, ev: Event) => any; - onaddtrack: (this: this, ev: TrackEvent) => any; - oninactive: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; + onactive: (this: MediaStream, ev: Event) => any; + onaddtrack: (this: MediaStream, ev: TrackEvent) => any; + oninactive: (this: MediaStream, ev: Event) => any; + onremovetrack: (this: MediaStream, ev: TrackEvent) => any; addTrack(track: MediaStreamTrack): void; clone(): MediaStream; getAudioTracks(): MediaStreamTrack[]; @@ -8457,10 +7459,7 @@ interface MediaStream extends EventTarget { getVideoTracks(): MediaStreamTrack[]; removeTrack(track: MediaStreamTrack): void; stop(): void; - addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8497,16 +7496,23 @@ declare var MediaStreamErrorEvent: { new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; } +interface MediaStreamTrackEventMap { + "ended": MediaStreamErrorEvent; + "mute": Event; + "overconstrained": MediaStreamErrorEvent; + "unmute": Event; +} + interface MediaStreamTrack extends EventTarget { enabled: boolean; readonly id: string; readonly kind: string; readonly label: string; readonly muted: boolean; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onmute: (this: this, ev: Event) => any; - onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any; - onunmute: (this: this, ev: Event) => any; + onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onmute: (this: MediaStreamTrack, ev: Event) => any; + onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onunmute: (this: MediaStreamTrack, ev: Event) => any; readonly readonly: boolean; readonly readyState: string; readonly remote: boolean; @@ -8516,10 +7522,7 @@ interface MediaStreamTrack extends EventTarget { getConstraints(): MediaTrackConstraints; getSettings(): MediaTrackSettings; stop(): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8560,12 +7563,16 @@ declare var MessageEvent: { new(type: string, eventInitDict?: MessageEventInit): MessageEvent; } +interface MessagePortEventMap { + "message": MessageEvent; +} + interface MessagePort extends EventTarget { - onmessage: (this: this, ev: MessageEvent) => any; + onmessage: (this: MessagePort, ev: MessageEvent) => any; close(): void; postMessage(message?: any, ports?: any): void; start(): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8743,7 +7750,6 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; vibrate(pattern: number | number[]): boolean; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var Navigator: { @@ -8918,10 +7924,14 @@ declare var OfflineAudioCompletionEvent: { new(): OfflineAudioCompletionEvent; } +interface OfflineAudioContextEventMap { + "complete": Event; +} + interface OfflineAudioContext extends AudioContext { - oncomplete: (this: this, ev: Event) => any; + oncomplete: (this: OfflineAudioContext, ev: Event) => any; startRendering(): PromiseLike; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8930,15 +7940,19 @@ declare var OfflineAudioContext: { new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; } +interface OscillatorNodeEventMap { + "ended": MediaStreamErrorEvent; +} + interface OscillatorNode extends AudioNode { readonly detune: AudioParam; readonly frequency: AudioParam; - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any; type: string; setPeriodicWave(periodicWave: PeriodicWave): void; start(when?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9317,9 +8331,14 @@ declare var RTCDTMFToneChangeEvent: { new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; } +interface RTCDtlsTransportEventMap { + "dtlsstatechange": RTCDtlsTransportStateChangedEvent; + "error": ErrorEvent; +} + interface RTCDtlsTransport extends RTCStatsProvider { - ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null; - onerror: ((this: this, ev: ErrorEvent) => any) | null; + ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null; readonly state: string; readonly transport: RTCIceTransport; getLocalParameters(): RTCDtlsParameters; @@ -9327,8 +8346,7 @@ interface RTCDtlsTransport extends RTCStatsProvider { getRemoteParameters(): RTCDtlsParameters | null; start(remoteParameters: RTCDtlsParameters): void; stop(): void; - addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9346,15 +8364,19 @@ declare var RTCDtlsTransportStateChangedEvent: { new(): RTCDtlsTransportStateChangedEvent; } +interface RTCDtmfSenderEventMap { + "tonechange": RTCDTMFToneChangeEvent; +} + interface RTCDtmfSender extends EventTarget { readonly canInsertDTMF: boolean; readonly duration: number; readonly interToneGap: number; - ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any; + ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any; readonly sender: RTCRtpSender; readonly toneBuffer: string; insertDTMF(tones: string, duration?: number, interToneGap?: number): void; - addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9372,15 +8394,19 @@ declare var RTCIceCandidatePairChangedEvent: { new(): RTCIceCandidatePairChangedEvent; } +interface RTCIceGathererEventMap { + "error": ErrorEvent; + "localcandidate": RTCIceGathererEvent; +} + interface RTCIceGatherer extends RTCStatsProvider { readonly component: string; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null; + onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null; + onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null; createAssociatedGatherer(): RTCIceGatherer; getLocalCandidates(): RTCIceCandidate[]; getLocalParameters(): RTCIceParameters; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9398,11 +8424,16 @@ declare var RTCIceGathererEvent: { new(): RTCIceGathererEvent; } +interface RTCIceTransportEventMap { + "candidatepairchange": RTCIceCandidatePairChangedEvent; + "icestatechange": RTCIceTransportStateChangedEvent; +} + interface RTCIceTransport extends RTCStatsProvider { readonly component: string; readonly iceGatherer: RTCIceGatherer | null; - oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null; - onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null; + oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null; readonly role: string; readonly state: string; addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; @@ -9413,8 +8444,7 @@ interface RTCIceTransport extends RTCStatsProvider { setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; stop(): void; - addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9432,8 +8462,12 @@ declare var RTCIceTransportStateChangedEvent: { new(): RTCIceTransportStateChangedEvent; } +interface RTCRtpReceiverEventMap { + "error": ErrorEvent; +} + interface RTCRtpReceiver extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; + onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null; readonly rtcpTransport: RTCDtlsTransport; readonly track: MediaStreamTrack | null; readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; @@ -9442,7 +8476,7 @@ interface RTCRtpReceiver extends RTCStatsProvider { requestSendCSRC(csrc: number): void; setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9452,9 +8486,14 @@ declare var RTCRtpReceiver: { getCapabilities(kind?: string): RTCRtpCapabilities; } +interface RTCRtpSenderEventMap { + "error": ErrorEvent; + "ssrcconflict": RTCSsrcConflictEvent; +} + interface RTCRtpSender extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null; + onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null; + onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null; readonly rtcpTransport: RTCDtlsTransport; readonly track: MediaStreamTrack; readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; @@ -9462,8 +8501,7 @@ interface RTCRtpSender extends RTCStatsProvider { setTrack(track: MediaStreamTrack): void; setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9473,10 +8511,14 @@ declare var RTCRtpSender: { getCapabilities(kind?: string): RTCRtpCapabilities; } +interface RTCSrtpSdesTransportEventMap { + "error": ErrorEvent; +} + interface RTCSrtpSdesTransport extends EventTarget { - onerror: ((this: this, ev: ErrorEvent) => any) | null; + onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null; readonly transport: RTCIceTransport; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9551,6 +8593,7 @@ declare var Range: { interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { readonly target: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9707,6 +8750,7 @@ interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SV readonly cx: SVGAnimatedLength; readonly cy: SVGAnimatedLength; readonly r: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9717,6 +8761,7 @@ declare var SVGCircleElement: { interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { readonly clipPathUnits: SVGAnimatedEnumeration; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9739,6 +8784,8 @@ interface SVGComponentTransferFunctionElement extends SVGElement { readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGComponentTransferFunctionElement: { @@ -9753,6 +8800,7 @@ declare var SVGComponentTransferFunctionElement: { } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9762,6 +8810,7 @@ declare var SVGDefsElement: { } interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9770,67 +8819,35 @@ declare var SVGDescElement: { new(): SVGDescElement; } +interface SVGElementEventMap extends ElementEventMap { + "click": MouseEvent; + "dblclick": MouseEvent; + "focusin": FocusEvent; + "focusout": FocusEvent; + "load": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; +} + interface SVGElement extends Element { - onclick: (this: this, ev: MouseEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - onfocusin: (this: this, ev: FocusEvent) => any; - onfocusout: (this: this, ev: FocusEvent) => any; - onload: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; + onclick: (this: SVGElement, ev: MouseEvent) => any; + ondblclick: (this: SVGElement, ev: MouseEvent) => any; + onfocusin: (this: SVGElement, ev: FocusEvent) => any; + onfocusout: (this: SVGElement, ev: FocusEvent) => any; + onload: (this: SVGElement, ev: Event) => any; + onmousedown: (this: SVGElement, ev: MouseEvent) => any; + onmousemove: (this: SVGElement, ev: MouseEvent) => any; + onmouseout: (this: SVGElement, ev: MouseEvent) => any; + onmouseover: (this: SVGElement, ev: MouseEvent) => any; + onmouseup: (this: SVGElement, ev: MouseEvent) => any; readonly ownerSVGElement: SVGSVGElement; readonly viewportElement: SVGElement; xmlbase: string; className: any; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9870,6 +8887,7 @@ interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, S readonly cy: SVGAnimatedLength; readonly rx: SVGAnimatedLength; readonly ry: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9899,6 +8917,7 @@ interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttrib readonly SVG_FEBLEND_MODE_SCREEN: number; readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; readonly SVG_FEBLEND_MODE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9933,6 +8952,7 @@ interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandard readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9948,6 +8968,7 @@ declare var SVGFEColorMatrixElement: { interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9971,6 +8992,7 @@ interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAt readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10003,6 +9025,7 @@ interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStand readonly SVG_EDGEMODE_NONE: number; readonly SVG_EDGEMODE_UNKNOWN: number; readonly SVG_EDGEMODE_WRAP: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10021,6 +9044,7 @@ interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStan readonly kernelUnitLengthX: SVGAnimatedNumber; readonly kernelUnitLengthY: SVGAnimatedNumber; readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10040,6 +9064,7 @@ interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStan readonly SVG_CHANNEL_G: number; readonly SVG_CHANNEL_R: number; readonly SVG_CHANNEL_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10056,6 +9081,8 @@ declare var SVGFEDisplacementMapElement: { interface SVGFEDistantLightElement extends SVGElement { readonly azimuth: SVGAnimatedNumber; readonly elevation: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEDistantLightElement: { @@ -10064,6 +9091,7 @@ declare var SVGFEDistantLightElement: { } interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10109,6 +9137,7 @@ interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandar readonly stdDeviationX: SVGAnimatedNumber; readonly stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10119,6 +9148,7 @@ declare var SVGFEGaussianBlurElement: { interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10128,6 +9158,7 @@ declare var SVGFEImageElement: { } interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10138,6 +9169,8 @@ declare var SVGFEMergeElement: { interface SVGFEMergeNodeElement extends SVGElement { readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEMergeNodeElement: { @@ -10153,6 +9186,7 @@ interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardA readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10168,6 +9202,7 @@ interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttri readonly dx: SVGAnimatedNumber; readonly dy: SVGAnimatedNumber; readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10180,6 +9215,8 @@ interface SVGFEPointLightElement extends SVGElement { readonly x: SVGAnimatedNumber; readonly y: SVGAnimatedNumber; readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEPointLightElement: { @@ -10194,6 +9231,7 @@ interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveSta readonly specularConstant: SVGAnimatedNumber; readonly specularExponent: SVGAnimatedNumber; readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10211,6 +9249,8 @@ interface SVGFESpotLightElement extends SVGElement { readonly x: SVGAnimatedNumber; readonly y: SVGAnimatedNumber; readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFESpotLightElement: { @@ -10220,6 +9260,7 @@ declare var SVGFESpotLightElement: { interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10241,6 +9282,7 @@ interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardA readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10265,6 +9307,7 @@ interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLan readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; setFilterRes(filterResX: number, filterResY: number): void; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10278,6 +9321,7 @@ interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransforma readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10287,6 +9331,7 @@ declare var SVGForeignObjectElement: { } interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10303,6 +9348,7 @@ interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourc readonly SVG_SPREADMETHOD_REFLECT: number; readonly SVG_SPREADMETHOD_REPEAT: number; readonly SVG_SPREADMETHOD_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10321,6 +9367,7 @@ interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVG readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10386,6 +9433,7 @@ interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGT readonly x2: SVGAnimatedLength; readonly y1: SVGAnimatedLength; readonly y2: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10422,6 +9470,7 @@ interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExt readonly SVG_MARKER_ORIENT_ANGLE: number; readonly SVG_MARKER_ORIENT_AUTO: number; readonly SVG_MARKER_ORIENT_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10443,6 +9492,7 @@ interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10477,6 +9527,8 @@ declare var SVGMatrix: { } interface SVGMetadataElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGMetadataElement: { @@ -10532,6 +9584,7 @@ interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGT getPathSegAtLength(distance: number): number; getPointAtLength(distance: number): SVGPoint; getTotalLength(): number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10824,6 +9877,7 @@ interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSp readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10860,6 +9914,7 @@ declare var SVGPointList: { } interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10869,6 +9924,7 @@ declare var SVGPolygonElement: { } interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10947,6 +10003,7 @@ interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGT readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10955,18 +10012,27 @@ declare var SVGRectElement: { new(): SVGRectElement; } +interface SVGSVGElementEventMap extends SVGElementEventMap { + "SVGAbort": Event; + "SVGError": Event; + "resize": UIEvent; + "scroll": UIEvent; + "SVGUnload": Event; + "SVGZoom": SVGZoomEvent; +} + interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { contentScriptType: string; contentStyleType: string; currentScale: number; readonly currentTranslate: SVGPoint; readonly height: SVGAnimatedLength; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onunload: (this: this, ev: Event) => any; - onzoom: (this: this, ev: SVGZoomEvent) => any; + onabort: (this: SVGSVGElement, ev: Event) => any; + onerror: (this: SVGSVGElement, ev: Event) => any; + onresize: (this: SVGSVGElement, ev: UIEvent) => any; + onscroll: (this: SVGSVGElement, ev: UIEvent) => any; + onunload: (this: SVGSVGElement, ev: Event) => any; + onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any; readonly pixelUnitToMillimeterX: number; readonly pixelUnitToMillimeterY: number; readonly screenPixelToMillimeterX: number; @@ -10998,58 +10064,7 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest unpauseAnimations(): void; unsuspendRedraw(suspendHandleID: number): void; unsuspendRedrawAll(): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11060,6 +10075,7 @@ declare var SVGSVGElement: { interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { type: string; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11070,6 +10086,7 @@ declare var SVGScriptElement: { interface SVGStopElement extends SVGElement, SVGStylable { readonly offset: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11099,6 +10116,7 @@ interface SVGStyleElement extends SVGElement, SVGLangSpace { media: string; title: string; type: string; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11108,6 +10126,7 @@ declare var SVGStyleElement: { } interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11117,6 +10136,7 @@ declare var SVGSwitchElement: { } interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11148,6 +10168,7 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa readonly LENGTHADJUST_SPACING: number; readonly LENGTHADJUST_SPACINGANDGLYPHS: number; readonly LENGTHADJUST_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11160,7 +10181,6 @@ declare var SVGTextContentElement: { } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextElement: { @@ -11178,7 +10198,6 @@ interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { readonly TEXTPATH_SPACINGTYPE_AUTO: number; readonly TEXTPATH_SPACINGTYPE_EXACT: number; readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextPathElement: { @@ -11206,6 +10225,7 @@ declare var SVGTextPositioningElement: { } interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11277,6 +10297,7 @@ interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTe readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11287,6 +10308,7 @@ declare var SVGUseElement: { interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { readonly viewTarget: SVGStringList; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11318,6 +10340,10 @@ declare var SVGZoomEvent: { new(): SVGZoomEvent; } +interface ScreenEventMap { + "MSOrientationChange": Event; +} + interface Screen extends EventTarget { readonly availHeight: number; readonly availWidth: number; @@ -11330,14 +10356,14 @@ interface Screen extends EventTarget { readonly logicalXDPI: number; readonly logicalYDPI: number; readonly msOrientation: string; - onmsorientationchange: (this: this, ev: Event) => any; + onmsorientationchange: (this: Screen, ev: Event) => any; readonly pixelDepth: number; readonly systemXDPI: number; readonly systemYDPI: number; readonly width: number; msLockOrientation(orientations: string | string[]): boolean; msUnlockOrientation(): void; - addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11356,10 +10382,14 @@ declare var ScriptNotifyEvent: { new(): ScriptNotifyEvent; } +interface ScriptProcessorNodeEventMap { + "audioprocess": AudioProcessingEvent; +} + interface ScriptProcessorNode extends AudioNode { readonly bufferSize: number; - onaudioprocess: (this: this, ev: AudioProcessingEvent) => any; - addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void; + onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any; + addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11541,6 +10571,7 @@ declare var SubtleCrypto: { interface Text extends CharacterData { readonly wholeText: string; + readonly assignedSlot: HTMLSlotElement | null; splitText(offset: number): Text; } @@ -11590,6 +10621,12 @@ declare var TextMetrics: { new(): TextMetrics; } +interface TextTrackEventMap { + "cuechange": Event; + "error": ErrorEvent; + "load": Event; +} + interface TextTrack extends EventTarget { readonly activeCues: TextTrackCueList; readonly cues: TextTrackCueList; @@ -11598,9 +10635,9 @@ interface TextTrack extends EventTarget { readonly label: string; readonly language: string; mode: any; - oncuechange: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; + oncuechange: (this: TextTrack, ev: Event) => any; + onerror: (this: TextTrack, ev: ErrorEvent) => any; + onload: (this: TextTrack, ev: Event) => any; readonly readyState: number; addCue(cue: TextTrackCue): void; removeCue(cue: TextTrackCue): void; @@ -11611,9 +10648,7 @@ interface TextTrack extends EventTarget { readonly LOADING: number; readonly NONE: number; readonly SHOWING: number; - addEventListener(type: "cuechange", 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: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11629,18 +10664,22 @@ declare var TextTrack: { readonly SHOWING: number; } +interface TextTrackCueEventMap { + "enter": Event; + "exit": Event; +} + interface TextTrackCue extends EventTarget { endTime: number; id: string; - onenter: (this: this, ev: Event) => any; - onexit: (this: this, ev: Event) => any; + onenter: (this: TextTrackCue, ev: Event) => any; + onexit: (this: TextTrackCue, ev: Event) => any; pauseOnExit: boolean; startTime: number; text: string; readonly track: TextTrack; getCueAsHTML(): DocumentFragment; - addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11661,11 +10700,15 @@ declare var TextTrackCueList: { new(): TextTrackCueList; } +interface TextTrackListEventMap { + "addtrack": TrackEvent; +} + interface TextTrackList extends EventTarget { readonly length: number; - onaddtrack: ((this: this, ev: TrackEvent) => any) | null; + onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null; item(index: number): TextTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [index: number]: TextTrack; } @@ -11855,17 +10898,21 @@ declare var VideoTrack: { new(): VideoTrack; } +interface VideoTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + interface VideoTrackList extends EventTarget { readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; + onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any; + onchange: (this: VideoTrackList, ev: Event) => any; + onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any; readonly selectedIndex: number; getTrackById(id: string): VideoTrack | null; item(index: number): VideoTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [index: number]: VideoTrack; } @@ -12811,14 +11858,21 @@ declare var WebKitPoint: { new(x?: number, y?: number): WebKitPoint; } +interface WebSocketEventMap { + "close": CloseEvent; + "error": ErrorEvent; + "message": MessageEvent; + "open": Event; +} + interface WebSocket extends EventTarget { binaryType: string; readonly bufferedAmount: number; readonly extensions: string; - onclose: (this: this, ev: CloseEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onopen: (this: this, ev: Event) => any; + onclose: (this: WebSocket, ev: CloseEvent) => any; + onerror: (this: WebSocket, ev: ErrorEvent) => any; + onmessage: (this: WebSocket, ev: MessageEvent) => any; + onopen: (this: WebSocket, ev: Event) => any; readonly protocol: string; readonly readyState: number; readonly url: string; @@ -12828,10 +11882,7 @@ interface WebSocket extends EventTarget { readonly CLOSING: number; readonly CONNECTING: number; readonly OPEN: number; - addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12867,6 +11918,95 @@ declare var WheelEvent: { readonly DOM_DELTA_PIXEL: number; } +interface WindowEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "compassneedscalibration": Event; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "devicelight": DeviceLightEvent; + "devicemotion": DeviceMotionEvent; + "deviceorientation": DeviceOrientationEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "message": MessageEvent; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "pause": Event; + "play": Event; + "playing": Event; + "popstate": PopStateEvent; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": ProgressEvent; + "reset": Event; + "resize": UIEvent; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "stalled": Event; + "storage": StorageEvent; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "unload": Event; + "volumechange": Event; + "waiting": Event; +} + interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { readonly applicationCache: ApplicationCache; readonly clientInformation: Navigator; @@ -12891,97 +12031,97 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window name: string; readonly navigator: Navigator; offscreenBuffering: string | boolean; - onabort: (this: this, ev: UIEvent) => any; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncompassneedscalibration: (this: this, ev: Event) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondevicelight: (this: this, ev: DeviceLightEvent) => any; - ondevicemotion: (this: this, ev: DeviceMotionEvent) => any; - ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onabort: (this: Window, ev: UIEvent) => any; + onafterprint: (this: Window, ev: Event) => any; + onbeforeprint: (this: Window, ev: Event) => any; + onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; + onblur: (this: Window, ev: FocusEvent) => any; + oncanplay: (this: Window, ev: Event) => any; + oncanplaythrough: (this: Window, ev: Event) => any; + onchange: (this: Window, ev: Event) => any; + onclick: (this: Window, ev: MouseEvent) => any; + oncompassneedscalibration: (this: Window, ev: Event) => any; + oncontextmenu: (this: Window, ev: PointerEvent) => any; + ondblclick: (this: Window, ev: MouseEvent) => any; + ondevicelight: (this: Window, ev: DeviceLightEvent) => any; + ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; + ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; + ondrag: (this: Window, ev: DragEvent) => any; + ondragend: (this: Window, ev: DragEvent) => any; + ondragenter: (this: Window, ev: DragEvent) => any; + ondragleave: (this: Window, ev: DragEvent) => any; + ondragover: (this: Window, ev: DragEvent) => any; + ondragstart: (this: Window, ev: DragEvent) => any; + ondrop: (this: Window, ev: DragEvent) => any; + ondurationchange: (this: Window, ev: Event) => any; + onemptied: (this: Window, ev: Event) => any; + onended: (this: Window, ev: MediaStreamErrorEvent) => any; onerror: ErrorEventHandler; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreadystatechange: (this: this, ev: ProgressEvent) => any; - onreset: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onstalled: (this: this, ev: Event) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; + onfocus: (this: Window, ev: FocusEvent) => any; + onhashchange: (this: Window, ev: HashChangeEvent) => any; + oninput: (this: Window, ev: Event) => any; + oninvalid: (this: Window, ev: Event) => any; + onkeydown: (this: Window, ev: KeyboardEvent) => any; + onkeypress: (this: Window, ev: KeyboardEvent) => any; + onkeyup: (this: Window, ev: KeyboardEvent) => any; + onload: (this: Window, ev: Event) => any; + onloadeddata: (this: Window, ev: Event) => any; + onloadedmetadata: (this: Window, ev: Event) => any; + onloadstart: (this: Window, ev: Event) => any; + onmessage: (this: Window, ev: MessageEvent) => any; + onmousedown: (this: Window, ev: MouseEvent) => any; + onmouseenter: (this: Window, ev: MouseEvent) => any; + onmouseleave: (this: Window, ev: MouseEvent) => any; + onmousemove: (this: Window, ev: MouseEvent) => any; + onmouseout: (this: Window, ev: MouseEvent) => any; + onmouseover: (this: Window, ev: MouseEvent) => any; + onmouseup: (this: Window, ev: MouseEvent) => any; + onmousewheel: (this: Window, ev: WheelEvent) => any; + onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; + onmsgestureend: (this: Window, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; + onmspointercancel: (this: Window, ev: MSPointerEvent) => any; + onmspointerdown: (this: Window, ev: MSPointerEvent) => any; + onmspointerenter: (this: Window, ev: MSPointerEvent) => any; + onmspointerleave: (this: Window, ev: MSPointerEvent) => any; + onmspointermove: (this: Window, ev: MSPointerEvent) => any; + onmspointerout: (this: Window, ev: MSPointerEvent) => any; + onmspointerover: (this: Window, ev: MSPointerEvent) => any; + onmspointerup: (this: Window, ev: MSPointerEvent) => any; + onoffline: (this: Window, ev: Event) => any; + ononline: (this: Window, ev: Event) => any; + onorientationchange: (this: Window, ev: Event) => any; + onpagehide: (this: Window, ev: PageTransitionEvent) => any; + onpageshow: (this: Window, ev: PageTransitionEvent) => any; + onpause: (this: Window, ev: Event) => any; + onplay: (this: Window, ev: Event) => any; + onplaying: (this: Window, ev: Event) => any; + onpopstate: (this: Window, ev: PopStateEvent) => any; + onprogress: (this: Window, ev: ProgressEvent) => any; + onratechange: (this: Window, ev: Event) => any; + onreadystatechange: (this: Window, ev: ProgressEvent) => any; + onreset: (this: Window, ev: Event) => any; + onresize: (this: Window, ev: UIEvent) => any; + onscroll: (this: Window, ev: UIEvent) => any; + onseeked: (this: Window, ev: Event) => any; + onseeking: (this: Window, ev: Event) => any; + onselect: (this: Window, ev: UIEvent) => any; + onstalled: (this: Window, ev: Event) => any; + onstorage: (this: Window, ev: StorageEvent) => any; + onsubmit: (this: Window, ev: Event) => any; + onsuspend: (this: Window, ev: Event) => any; + ontimeupdate: (this: Window, ev: Event) => any; ontouchcancel: (ev: TouchEvent) => any; ontouchend: (ev: TouchEvent) => any; ontouchmove: (ev: TouchEvent) => any; ontouchstart: (ev: TouchEvent) => any; - onunload: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; + onunload: (this: Window, ev: Event) => any; + onvolumechange: (this: Window, ev: Event) => any; + onwaiting: (this: Window, ev: Event) => any; opener: any; orientation: string | number; readonly outerHeight: number; @@ -13040,101 +12180,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - 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: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13143,12 +12189,15 @@ declare var Window: { new(): Window; } +interface WorkerEventMap extends AbstractWorkerEventMap { + "message": MessageEvent; +} + interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: this, ev: MessageEvent) => any; + onmessage: (this: Worker, ev: MessageEvent) => any; postMessage(message: any, ports?: any): void; terminate(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13158,6 +12207,8 @@ declare var Worker: { } interface XMLDocument extends Document { + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var XMLDocument: { @@ -13165,8 +12216,12 @@ declare var XMLDocument: { new(): XMLDocument; } +interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { + "readystatechange": Event; +} + interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: this, ev: Event) => any; + onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; readonly readyState: number; readonly response: any; readonly responseText: string; @@ -13194,14 +12249,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { readonly LOADING: number; readonly OPENED: number; readonly UNSENT: number; - 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: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", 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: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13217,6 +12265,7 @@ declare var XMLHttpRequest: { } interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13237,7 +12286,7 @@ declare var XMLSerializer: { interface XPathEvaluator { createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; } declare var XPathEvaluator: { @@ -13246,7 +12295,7 @@ declare var XPathEvaluator: { } interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; + evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult; } declare var XPathExpression: { @@ -13316,9 +12365,13 @@ declare var XSLTProcessor: { new(): XSLTProcessor; } +interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + interface AbstractWorker { - onerror: (this: this, ev: ErrorEvent) => any; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + onerror: (this: AbstractWorker, ev: ErrorEvent) => any; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13429,25 +12482,29 @@ interface GetSVGDocument { getSVGDocument(): Document; } +interface GlobalEventHandlersEventMap { + "pointercancel": PointerEvent; + "pointerdown": PointerEvent; + "pointerenter": PointerEvent; + "pointerleave": PointerEvent; + "pointermove": PointerEvent; + "pointerout": PointerEvent; + "pointerover": PointerEvent; + "pointerup": PointerEvent; + "wheel": WheelEvent; +} + interface GlobalEventHandlers { - onpointercancel: (this: this, ev: PointerEvent) => any; - onpointerdown: (this: this, ev: PointerEvent) => any; - onpointerenter: (this: this, ev: PointerEvent) => any; - onpointerleave: (this: this, ev: PointerEvent) => any; - onpointermove: (this: this, ev: PointerEvent) => any; - onpointerout: (this: this, ev: PointerEvent) => any; - onpointerover: (this: this, ev: PointerEvent) => any; - onpointerup: (this: this, ev: PointerEvent) => any; - onwheel: (this: this, ev: WheelEvent) => any; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any; + addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13474,25 +12531,29 @@ interface LinkStyle { readonly sheet: StyleSheet; } +interface MSBaseReaderEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; +} + interface MSBaseReader { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; + onabort: (this: MSBaseReader, ev: Event) => any; + onerror: (this: MSBaseReader, ev: ErrorEvent) => any; + onload: (this: MSBaseReader, ev: Event) => any; + onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; + onloadstart: (this: MSBaseReader, ev: Event) => any; + onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; readonly readyState: number; readonly result: any; abort(): void; readonly DONE: number; readonly EMPTY: number; readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13541,359 +12602,9 @@ interface NavigatorUserMedia { } interface NodeSelector { - 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: K): ElementTagNameMap[K] | null; querySelector(selectors: string): Element | null; - querySelectorAll(selectors: "a"): NodeListOf; - querySelectorAll(selectors: "abbr"): NodeListOf; - querySelectorAll(selectors: "acronym"): NodeListOf; - querySelectorAll(selectors: "address"): NodeListOf; - querySelectorAll(selectors: "applet"): NodeListOf; - querySelectorAll(selectors: "area"): NodeListOf; - querySelectorAll(selectors: "article"): NodeListOf; - querySelectorAll(selectors: "aside"): NodeListOf; - querySelectorAll(selectors: "audio"): NodeListOf; - querySelectorAll(selectors: "b"): NodeListOf; - querySelectorAll(selectors: "base"): NodeListOf; - querySelectorAll(selectors: "basefont"): NodeListOf; - querySelectorAll(selectors: "bdo"): NodeListOf; - querySelectorAll(selectors: "big"): NodeListOf; - querySelectorAll(selectors: "blockquote"): NodeListOf; - querySelectorAll(selectors: "body"): NodeListOf; - querySelectorAll(selectors: "br"): NodeListOf; - querySelectorAll(selectors: "button"): NodeListOf; - querySelectorAll(selectors: "canvas"): NodeListOf; - querySelectorAll(selectors: "caption"): NodeListOf; - querySelectorAll(selectors: "center"): NodeListOf; - querySelectorAll(selectors: "circle"): NodeListOf; - querySelectorAll(selectors: "cite"): NodeListOf; - querySelectorAll(selectors: "clippath"): NodeListOf; - querySelectorAll(selectors: "code"): NodeListOf; - querySelectorAll(selectors: "col"): NodeListOf; - querySelectorAll(selectors: "colgroup"): NodeListOf; - querySelectorAll(selectors: "datalist"): NodeListOf; - querySelectorAll(selectors: "dd"): NodeListOf; - querySelectorAll(selectors: "defs"): NodeListOf; - querySelectorAll(selectors: "del"): NodeListOf; - querySelectorAll(selectors: "desc"): NodeListOf; - querySelectorAll(selectors: "dfn"): NodeListOf; - querySelectorAll(selectors: "dir"): NodeListOf; - querySelectorAll(selectors: "div"): NodeListOf; - querySelectorAll(selectors: "dl"): NodeListOf; - querySelectorAll(selectors: "dt"): NodeListOf; - querySelectorAll(selectors: "ellipse"): NodeListOf; - querySelectorAll(selectors: "em"): NodeListOf; - querySelectorAll(selectors: "embed"): NodeListOf; - querySelectorAll(selectors: "feblend"): NodeListOf; - querySelectorAll(selectors: "fecolormatrix"): NodeListOf; - querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf; - querySelectorAll(selectors: "fecomposite"): NodeListOf; - querySelectorAll(selectors: "feconvolvematrix"): NodeListOf; - querySelectorAll(selectors: "fediffuselighting"): NodeListOf; - querySelectorAll(selectors: "fedisplacementmap"): NodeListOf; - querySelectorAll(selectors: "fedistantlight"): NodeListOf; - querySelectorAll(selectors: "feflood"): NodeListOf; - querySelectorAll(selectors: "fefunca"): NodeListOf; - querySelectorAll(selectors: "fefuncb"): NodeListOf; - querySelectorAll(selectors: "fefuncg"): NodeListOf; - querySelectorAll(selectors: "fefuncr"): NodeListOf; - querySelectorAll(selectors: "fegaussianblur"): NodeListOf; - querySelectorAll(selectors: "feimage"): NodeListOf; - querySelectorAll(selectors: "femerge"): NodeListOf; - querySelectorAll(selectors: "femergenode"): NodeListOf; - querySelectorAll(selectors: "femorphology"): NodeListOf; - querySelectorAll(selectors: "feoffset"): NodeListOf; - querySelectorAll(selectors: "fepointlight"): NodeListOf; - querySelectorAll(selectors: "fespecularlighting"): NodeListOf; - querySelectorAll(selectors: "fespotlight"): NodeListOf; - querySelectorAll(selectors: "fetile"): NodeListOf; - querySelectorAll(selectors: "feturbulence"): NodeListOf; - querySelectorAll(selectors: "fieldset"): NodeListOf; - querySelectorAll(selectors: "figcaption"): NodeListOf; - querySelectorAll(selectors: "figure"): NodeListOf; - querySelectorAll(selectors: "filter"): NodeListOf; - querySelectorAll(selectors: "font"): NodeListOf; - querySelectorAll(selectors: "footer"): NodeListOf; - querySelectorAll(selectors: "foreignobject"): NodeListOf; - querySelectorAll(selectors: "form"): NodeListOf; - querySelectorAll(selectors: "frame"): NodeListOf; - querySelectorAll(selectors: "frameset"): NodeListOf; - querySelectorAll(selectors: "g"): NodeListOf; - querySelectorAll(selectors: "h1"): NodeListOf; - querySelectorAll(selectors: "h2"): NodeListOf; - querySelectorAll(selectors: "h3"): NodeListOf; - querySelectorAll(selectors: "h4"): NodeListOf; - querySelectorAll(selectors: "h5"): NodeListOf; - querySelectorAll(selectors: "h6"): NodeListOf; - querySelectorAll(selectors: "head"): NodeListOf; - querySelectorAll(selectors: "header"): NodeListOf; - querySelectorAll(selectors: "hgroup"): NodeListOf; - querySelectorAll(selectors: "hr"): NodeListOf; - querySelectorAll(selectors: "html"): NodeListOf; - querySelectorAll(selectors: "i"): NodeListOf; - querySelectorAll(selectors: "iframe"): NodeListOf; - querySelectorAll(selectors: "image"): NodeListOf; - querySelectorAll(selectors: "img"): NodeListOf; - querySelectorAll(selectors: "input"): NodeListOf; - querySelectorAll(selectors: "ins"): NodeListOf; - querySelectorAll(selectors: "isindex"): NodeListOf; - querySelectorAll(selectors: "kbd"): NodeListOf; - querySelectorAll(selectors: "keygen"): NodeListOf; - querySelectorAll(selectors: "label"): NodeListOf; - querySelectorAll(selectors: "legend"): NodeListOf; - querySelectorAll(selectors: "li"): NodeListOf; - querySelectorAll(selectors: "line"): NodeListOf; - querySelectorAll(selectors: "lineargradient"): NodeListOf; - querySelectorAll(selectors: "link"): NodeListOf; - querySelectorAll(selectors: "listing"): NodeListOf; - querySelectorAll(selectors: "map"): NodeListOf; - querySelectorAll(selectors: "mark"): NodeListOf; - querySelectorAll(selectors: "marker"): NodeListOf; - querySelectorAll(selectors: "marquee"): NodeListOf; - querySelectorAll(selectors: "mask"): NodeListOf; - querySelectorAll(selectors: "menu"): NodeListOf; - querySelectorAll(selectors: "meta"): NodeListOf; - querySelectorAll(selectors: "metadata"): NodeListOf; - querySelectorAll(selectors: "meter"): NodeListOf; - querySelectorAll(selectors: "nav"): NodeListOf; - querySelectorAll(selectors: "nextid"): NodeListOf; - querySelectorAll(selectors: "nobr"): NodeListOf; - querySelectorAll(selectors: "noframes"): NodeListOf; - querySelectorAll(selectors: "noscript"): NodeListOf; - querySelectorAll(selectors: "object"): NodeListOf; - querySelectorAll(selectors: "ol"): NodeListOf; - querySelectorAll(selectors: "optgroup"): NodeListOf; - querySelectorAll(selectors: "option"): NodeListOf; - querySelectorAll(selectors: "p"): NodeListOf; - querySelectorAll(selectors: "param"): NodeListOf; - querySelectorAll(selectors: "path"): NodeListOf; - querySelectorAll(selectors: "pattern"): NodeListOf; - querySelectorAll(selectors: "picture"): NodeListOf; - querySelectorAll(selectors: "plaintext"): NodeListOf; - querySelectorAll(selectors: "polygon"): NodeListOf; - querySelectorAll(selectors: "polyline"): NodeListOf; - querySelectorAll(selectors: "pre"): NodeListOf; - querySelectorAll(selectors: "progress"): NodeListOf; - querySelectorAll(selectors: "q"): NodeListOf; - querySelectorAll(selectors: "radialgradient"): NodeListOf; - querySelectorAll(selectors: "rect"): NodeListOf; - querySelectorAll(selectors: "rt"): NodeListOf; - querySelectorAll(selectors: "ruby"): NodeListOf; - querySelectorAll(selectors: "s"): NodeListOf; - querySelectorAll(selectors: "samp"): NodeListOf; - querySelectorAll(selectors: "script"): NodeListOf; - querySelectorAll(selectors: "section"): NodeListOf; - querySelectorAll(selectors: "select"): NodeListOf; - querySelectorAll(selectors: "small"): NodeListOf; - querySelectorAll(selectors: "source"): NodeListOf; - querySelectorAll(selectors: "span"): NodeListOf; - querySelectorAll(selectors: "stop"): NodeListOf; - querySelectorAll(selectors: "strike"): NodeListOf; - querySelectorAll(selectors: "strong"): NodeListOf; - querySelectorAll(selectors: "style"): NodeListOf; - querySelectorAll(selectors: "sub"): NodeListOf; - querySelectorAll(selectors: "sup"): NodeListOf; - querySelectorAll(selectors: "svg"): NodeListOf; - querySelectorAll(selectors: "switch"): NodeListOf; - querySelectorAll(selectors: "symbol"): NodeListOf; - querySelectorAll(selectors: "table"): NodeListOf; - querySelectorAll(selectors: "tbody"): NodeListOf; - querySelectorAll(selectors: "td"): NodeListOf; - querySelectorAll(selectors: "template"): NodeListOf; - querySelectorAll(selectors: "text"): NodeListOf; - querySelectorAll(selectors: "textpath"): NodeListOf; - querySelectorAll(selectors: "textarea"): NodeListOf; - querySelectorAll(selectors: "tfoot"): NodeListOf; - querySelectorAll(selectors: "th"): NodeListOf; - querySelectorAll(selectors: "thead"): NodeListOf; - querySelectorAll(selectors: "title"): NodeListOf; - querySelectorAll(selectors: "tr"): NodeListOf; - querySelectorAll(selectors: "track"): NodeListOf; - querySelectorAll(selectors: "tspan"): NodeListOf; - querySelectorAll(selectors: "tt"): NodeListOf; - querySelectorAll(selectors: "u"): NodeListOf; - querySelectorAll(selectors: "ul"): NodeListOf; - querySelectorAll(selectors: "use"): NodeListOf; - querySelectorAll(selectors: "var"): NodeListOf; - querySelectorAll(selectors: "video"): NodeListOf; - querySelectorAll(selectors: "view"): NodeListOf; - querySelectorAll(selectors: "wbr"): NodeListOf; - querySelectorAll(selectors: "x-ms-webview"): NodeListOf; - querySelectorAll(selectors: "xmp"): NodeListOf; + querySelectorAll(selectors: K): ElementListTagNameMap[K]; querySelectorAll(selectors: string): NodeListOf; } @@ -13993,21 +12704,25 @@ interface WindowTimersExtension { setImmediate(handler: any, ...args: any[]): number; } +interface XMLHttpRequestEventTargetEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; + "timeout": ProgressEvent; +} + interface XMLHttpRequestEventTarget { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - ontimeout: (this: this, ev: ProgressEvent) => any; - 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; + onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14267,6 +12982,33 @@ interface ParentNode { readonly childElementCount: number; } +interface DocumentOrShadowRoot { + readonly activeElement: Element | null; + readonly stylesheets: StyleSheetList; + getSelection(): Selection | null; + elementFromPoint(x: number, y: number): Element | null; + elementsFromPoint(x: number, y: number): Element[]; +} + +interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment { + readonly host: Element; + innerHTML: string; +} + +interface ShadowRootInit { + mode: 'open'|'closed'; + delegatesFocus?: boolean; +} + +interface HTMLSlotElement extends HTMLElement { + name: string; + assignedNodes(options?: AssignedNodesOptions): Node[]; +} + +interface AssignedNodesOptions { + flatten?: boolean; +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -14314,6 +13056,447 @@ interface NavigatorUserMediaErrorCallback { interface ForEachCallback { (keyId: any, status: string): void; } +interface HTMLElementTagNameMap { + "a": HTMLAnchorElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "audio": HTMLAudioElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "datalist": HTMLDataListElement; + "del": HTMLModElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "embed": HTMLEmbedElement; + "fieldset": HTMLFieldSetElement; + "font": HTMLFontElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "iframe": HTMLIFrameElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "marquee": HTMLMarqueeElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "meter": HTMLMeterElement; + "nextid": HTMLUnknownElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "picture": HTMLPictureElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "script": HTMLScriptElement; + "select": HTMLSelectElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "style": HTMLStyleElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "ul": HTMLUListElement; + "video": HTMLVideoElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementTagNameMap { + "a": HTMLAnchorElement; + "abbr": HTMLElement; + "acronym": HTMLElement; + "address": HTMLElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "article": HTMLElement; + "aside": HTMLElement; + "audio": HTMLAudioElement; + "b": HTMLElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "bdo": HTMLElement; + "big": HTMLElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "center": HTMLElement; + "circle": SVGCircleElement; + "cite": HTMLElement; + "clippath": SVGClipPathElement; + "code": HTMLElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "datalist": HTMLDataListElement; + "dd": HTMLElement; + "defs": SVGDefsElement; + "del": HTMLModElement; + "desc": SVGDescElement; + "dfn": HTMLElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "dt": HTMLElement; + "ellipse": SVGEllipseElement; + "em": HTMLElement; + "embed": HTMLEmbedElement; + "feblend": SVGFEBlendElement; + "fecolormatrix": SVGFEColorMatrixElement; + "fecomponenttransfer": SVGFEComponentTransferElement; + "fecomposite": SVGFECompositeElement; + "feconvolvematrix": SVGFEConvolveMatrixElement; + "fediffuselighting": SVGFEDiffuseLightingElement; + "fedisplacementmap": SVGFEDisplacementMapElement; + "fedistantlight": SVGFEDistantLightElement; + "feflood": SVGFEFloodElement; + "fefunca": SVGFEFuncAElement; + "fefuncb": SVGFEFuncBElement; + "fefuncg": SVGFEFuncGElement; + "fefuncr": SVGFEFuncRElement; + "fegaussianblur": SVGFEGaussianBlurElement; + "feimage": SVGFEImageElement; + "femerge": SVGFEMergeElement; + "femergenode": SVGFEMergeNodeElement; + "femorphology": SVGFEMorphologyElement; + "feoffset": SVGFEOffsetElement; + "fepointlight": SVGFEPointLightElement; + "fespecularlighting": SVGFESpecularLightingElement; + "fespotlight": SVGFESpotLightElement; + "fetile": SVGFETileElement; + "feturbulence": SVGFETurbulenceElement; + "fieldset": HTMLFieldSetElement; + "figcaption": HTMLElement; + "figure": HTMLElement; + "filter": SVGFilterElement; + "font": HTMLFontElement; + "footer": HTMLElement; + "foreignobject": SVGForeignObjectElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "g": SVGGElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "header": HTMLElement; + "hgroup": HTMLElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "i": HTMLElement; + "iframe": HTMLIFrameElement; + "image": SVGImageElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "kbd": HTMLElement; + "keygen": HTMLElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "line": SVGLineElement; + "lineargradient": SVGLinearGradientElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "mark": HTMLElement; + "marker": SVGMarkerElement; + "marquee": HTMLMarqueeElement; + "mask": SVGMaskElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "metadata": SVGMetadataElement; + "meter": HTMLMeterElement; + "nav": HTMLElement; + "nextid": HTMLUnknownElement; + "nobr": HTMLElement; + "noframes": HTMLElement; + "noscript": HTMLElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "path": SVGPathElement; + "pattern": SVGPatternElement; + "picture": HTMLPictureElement; + "plaintext": HTMLElement; + "polygon": SVGPolygonElement; + "polyline": SVGPolylineElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "radialgradient": SVGRadialGradientElement; + "rect": SVGRectElement; + "rt": HTMLElement; + "ruby": HTMLElement; + "s": HTMLElement; + "samp": HTMLElement; + "script": HTMLScriptElement; + "section": HTMLElement; + "select": HTMLSelectElement; + "small": HTMLElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "stop": SVGStopElement; + "strike": HTMLElement; + "strong": HTMLElement; + "style": HTMLStyleElement; + "sub": HTMLElement; + "sup": HTMLElement; + "svg": SVGSVGElement; + "switch": SVGSwitchElement; + "symbol": SVGSymbolElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "text": SVGTextElement; + "textpath": SVGTextPathElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "tspan": SVGTSpanElement; + "tt": HTMLElement; + "u": HTMLElement; + "ul": HTMLUListElement; + "use": SVGUseElement; + "var": HTMLElement; + "video": HTMLVideoElement; + "view": SVGViewElement; + "wbr": HTMLElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementListTagNameMap { + "a": NodeListOf; + "abbr": NodeListOf; + "acronym": NodeListOf; + "address": NodeListOf; + "applet": NodeListOf; + "area": NodeListOf; + "article": NodeListOf; + "aside": NodeListOf; + "audio": NodeListOf; + "b": NodeListOf; + "base": NodeListOf; + "basefont": NodeListOf; + "bdo": NodeListOf; + "big": NodeListOf; + "blockquote": NodeListOf; + "body": NodeListOf; + "br": NodeListOf; + "button": NodeListOf; + "canvas": NodeListOf; + "caption": NodeListOf; + "center": NodeListOf; + "circle": NodeListOf; + "cite": NodeListOf; + "clippath": NodeListOf; + "code": NodeListOf; + "col": NodeListOf; + "colgroup": NodeListOf; + "datalist": NodeListOf; + "dd": NodeListOf; + "defs": NodeListOf; + "del": NodeListOf; + "desc": NodeListOf; + "dfn": NodeListOf; + "dir": NodeListOf; + "div": NodeListOf; + "dl": NodeListOf; + "dt": NodeListOf; + "ellipse": NodeListOf; + "em": NodeListOf; + "embed": NodeListOf; + "feblend": NodeListOf; + "fecolormatrix": NodeListOf; + "fecomponenttransfer": NodeListOf; + "fecomposite": NodeListOf; + "feconvolvematrix": NodeListOf; + "fediffuselighting": NodeListOf; + "fedisplacementmap": NodeListOf; + "fedistantlight": NodeListOf; + "feflood": NodeListOf; + "fefunca": NodeListOf; + "fefuncb": NodeListOf; + "fefuncg": NodeListOf; + "fefuncr": NodeListOf; + "fegaussianblur": NodeListOf; + "feimage": NodeListOf; + "femerge": NodeListOf; + "femergenode": NodeListOf; + "femorphology": NodeListOf; + "feoffset": NodeListOf; + "fepointlight": NodeListOf; + "fespecularlighting": NodeListOf; + "fespotlight": NodeListOf; + "fetile": NodeListOf; + "feturbulence": NodeListOf; + "fieldset": NodeListOf; + "figcaption": NodeListOf; + "figure": NodeListOf; + "filter": NodeListOf; + "font": NodeListOf; + "footer": NodeListOf; + "foreignobject": NodeListOf; + "form": NodeListOf; + "frame": NodeListOf; + "frameset": NodeListOf; + "g": NodeListOf; + "h1": NodeListOf; + "h2": NodeListOf; + "h3": NodeListOf; + "h4": NodeListOf; + "h5": NodeListOf; + "h6": NodeListOf; + "head": NodeListOf; + "header": NodeListOf; + "hgroup": NodeListOf; + "hr": NodeListOf; + "html": NodeListOf; + "i": NodeListOf; + "iframe": NodeListOf; + "image": NodeListOf; + "img": NodeListOf; + "input": NodeListOf; + "ins": NodeListOf; + "isindex": NodeListOf; + "kbd": NodeListOf; + "keygen": NodeListOf; + "label": NodeListOf; + "legend": NodeListOf; + "li": NodeListOf; + "line": NodeListOf; + "lineargradient": NodeListOf; + "link": NodeListOf; + "listing": NodeListOf; + "map": NodeListOf; + "mark": NodeListOf; + "marker": NodeListOf; + "marquee": NodeListOf; + "mask": NodeListOf; + "menu": NodeListOf; + "meta": NodeListOf; + "metadata": NodeListOf; + "meter": NodeListOf; + "nav": NodeListOf; + "nextid": NodeListOf; + "nobr": NodeListOf; + "noframes": NodeListOf; + "noscript": NodeListOf; + "object": NodeListOf; + "ol": NodeListOf; + "optgroup": NodeListOf; + "option": NodeListOf; + "p": NodeListOf; + "param": NodeListOf; + "path": NodeListOf; + "pattern": NodeListOf; + "picture": NodeListOf; + "plaintext": NodeListOf; + "polygon": NodeListOf; + "polyline": NodeListOf; + "pre": NodeListOf; + "progress": NodeListOf; + "q": NodeListOf; + "radialgradient": NodeListOf; + "rect": NodeListOf; + "rt": NodeListOf; + "ruby": NodeListOf; + "s": NodeListOf; + "samp": NodeListOf; + "script": NodeListOf; + "section": NodeListOf; + "select": NodeListOf; + "small": NodeListOf; + "source": NodeListOf; + "span": NodeListOf; + "stop": NodeListOf; + "strike": NodeListOf; + "strong": NodeListOf; + "style": NodeListOf; + "sub": NodeListOf; + "sup": NodeListOf; + "svg": NodeListOf; + "switch": NodeListOf; + "symbol": NodeListOf; + "table": NodeListOf; + "tbody": NodeListOf; + "td": NodeListOf; + "template": NodeListOf; + "text": NodeListOf; + "textpath": NodeListOf; + "textarea": NodeListOf; + "tfoot": NodeListOf; + "th": NodeListOf; + "thead": NodeListOf; + "title": NodeListOf; + "tr": NodeListOf; + "track": NodeListOf; + "tspan": NodeListOf; + "tt": NodeListOf; + "u": NodeListOf; + "ul": NodeListOf; + "use": NodeListOf; + "var": NodeListOf; + "video": NodeListOf; + "view": NodeListOf; + "wbr": NodeListOf; + "x-ms-webview": NodeListOf; + "xmp": NodeListOf; +} + declare var Audio: {new(src?: string): HTMLAudioElement; }; declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; @@ -14488,7 +13671,6 @@ 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; declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function clearInterval(handle: number): void; @@ -14515,101 +13697,7 @@ declare var onwheel: (this: Window, ev: WheelEvent) => any; declare var indexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; -declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; type AAGUID = string; type AlgorithmIdentifier = string | Algorithm; diff --git a/lib/lib.es2015.core.d.ts b/lib/lib.es2015.core.d.ts index 66666fe1f18..7f03aaec04d 100644 --- a/lib/lib.es2015.core.d.ts +++ b/lib/lib.es2015.core.d.ts @@ -225,13 +225,13 @@ interface NumberConstructor { * number. Only finite values of the type number, result in true. * @param number A numeric value. */ - isFinite(value: any): value is number; + isFinite(number: number): boolean; /** * Returns true if the value passed is an integer, false otherwise. * @param number A numeric value. */ - isInteger(value: any): value is number; + isInteger(number: number): boolean; /** * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a @@ -239,13 +239,13 @@ interface NumberConstructor { * to a number. Only values of the type number, that are also NaN, result in true. * @param number A numeric value. */ - isNaN(value: any): value is number; + isNaN(number: number): boolean; /** * Returns true if the value passed is a safe integer. * @param number A numeric value. */ - isSafeInteger(value: any): value is number; + isSafeInteger(number: number): boolean; /** * The value of the largest integer n such that n and n + 1 are both exactly representable as diff --git a/lib/lib.es2016.array.include.d.ts b/lib/lib.es2016.array.include.d.ts index 8ec56cc6418..f2e80297db0 100644 --- a/lib/lib.es2016.array.include.d.ts +++ b/lib/lib.es2016.array.include.d.ts @@ -27,6 +27,15 @@ interface Array { includes(searchElement: T, fromIndex?: number): boolean; } +interface ReadonlyArray { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: T, fromIndex?: number): boolean; +} + interface Int8Array { /** * Determines whether an array includes a certain element, returning true or false as appropriate. diff --git a/lib/lib.es2017.object.d.ts b/lib/lib.es2017.object.d.ts index 3fc6966f843..2e4e673d060 100644 --- a/lib/lib.es2017.object.d.ts +++ b/lib/lib.es2017.object.d.ts @@ -24,11 +24,22 @@ interface ObjectConstructor { * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ values(o: { [s: string]: T }): T[]; + + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ values(o: any): any[]; + + /** + * Returns an array of key/values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + entries(o: { [s: string]: T }): [string, T][]; + /** * Returns an array of key/values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - entries(o: T): [keyof T, T[K]][]; entries(o: any): [string, any][]; } diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts index 3fc18505dbd..4d48fed85ed 100644 --- a/lib/lib.es5.d.ts +++ b/lib/lib.es5.d.ts @@ -200,7 +200,19 @@ interface ObjectConstructor { * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - freeze(o: T): T; + freeze(a: T[]): ReadonlyArray; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(f: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): Readonly; /** * Prevents the addition of new properties to an object. @@ -1363,6 +1375,34 @@ interface ArrayLike { readonly [n: number]: T; } +/** + * Make all properties in T optional + */ +type Partial = { + [P in keyof T]?: T[P]; +}; + +/** + * Make all properties in T readonly + */ +type Readonly = { + readonly [P in keyof T]: T[P]; +}; + +/** + * From T pick a set of properties K + */ +type Pick = { + [P in K]: T[P]; +} + +/** + * Construct a type with a set of properties K of type T + */ +type Record = { + [P in K]: T; +} + /** * Represents a raw buffer of binary data, which is used to store data for the * different typed arrays. ArrayBuffers cannot be read from or written to directly, diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 2006211c905..9530bf7bfbc 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -200,7 +200,19 @@ interface ObjectConstructor { * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - freeze(o: T): T; + freeze(a: T[]): ReadonlyArray; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(f: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): Readonly; /** * Prevents the addition of new properties to an object. @@ -1363,6 +1375,34 @@ interface ArrayLike { readonly [n: number]: T; } +/** + * Make all properties in T optional + */ +type Partial = { + [P in keyof T]?: T[P]; +}; + +/** + * Make all properties in T readonly + */ +type Readonly = { + readonly [P in keyof T]: T[P]; +}; + +/** + * From T pick a set of properties K + */ +type Pick = { + [P in K]: T[P]; +} + +/** + * Construct a type with a set of properties K of type T + */ +type Record = { + [P in K]: T; +} + /** * Represents a raw buffer of binary data, which is used to store data for the * different typed arrays. ArrayBuffers cannot be read from or written to directly, @@ -4362,13 +4402,13 @@ interface NumberConstructor { * number. Only finite values of the type number, result in true. * @param number A numeric value. */ - isFinite(value: any): value is number; + isFinite(number: number): boolean; /** * Returns true if the value passed is an integer, false otherwise. * @param number A numeric value. */ - isInteger(value: any): value is number; + isInteger(number: number): boolean; /** * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a @@ -4376,13 +4416,13 @@ interface NumberConstructor { * to a number. Only values of the type number, that are also NaN, result in true. * @param number A numeric value. */ - isNaN(value: any): value is number; + isNaN(number: number): boolean; /** * Returns true if the value passed is a safe integer. * @param number A numeric value. */ - isSafeInteger(value: any): value is number; + isSafeInteger(number: number): boolean; /** * The value of the largest integer n such that n and n + 1 are both exactly representable as @@ -5953,6 +5993,7 @@ interface DoubleRange { } interface EventInit { + scoped?: boolean; bubbles?: boolean; cancelable?: boolean; } @@ -6794,15 +6835,26 @@ declare var AnimationEvent: { new(): AnimationEvent; } +interface ApplicationCacheEventMap { + "cached": Event; + "checking": Event; + "downloading": Event; + "error": ErrorEvent; + "noupdate": Event; + "obsolete": Event; + "progress": ProgressEvent; + "updateready": Event; +} + interface ApplicationCache extends EventTarget { - oncached: (this: this, ev: Event) => any; - onchecking: (this: this, ev: Event) => any; - ondownloading: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onnoupdate: (this: this, ev: Event) => any; - onobsolete: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onupdateready: (this: this, ev: Event) => any; + oncached: (this: ApplicationCache, ev: Event) => any; + onchecking: (this: ApplicationCache, ev: Event) => any; + ondownloading: (this: ApplicationCache, ev: Event) => any; + onerror: (this: ApplicationCache, ev: ErrorEvent) => any; + onnoupdate: (this: ApplicationCache, ev: Event) => any; + onobsolete: (this: ApplicationCache, ev: Event) => any; + onprogress: (this: ApplicationCache, ev: ProgressEvent) => any; + onupdateready: (this: ApplicationCache, ev: Event) => any; readonly status: number; abort(): void; swapCache(): void; @@ -6813,14 +6865,7 @@ interface ApplicationCache extends EventTarget { readonly OBSOLETE: number; readonly UNCACHED: number; readonly UPDATEREADY: number; - addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6873,17 +6918,21 @@ declare var AudioBuffer: { new(): AudioBuffer; } +interface AudioBufferSourceNodeEventMap { + "ended": MediaStreamErrorEvent; +} + interface AudioBufferSourceNode extends AudioNode { buffer: AudioBuffer | null; readonly detune: AudioParam; loop: boolean; loopEnd: number; loopStart: number; - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any; readonly playbackRate: AudioParam; start(when?: number, offset?: number, duration?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7005,16 +7054,20 @@ declare var AudioTrack: { new(): AudioTrack; } +interface AudioTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + interface AudioTrackList extends EventTarget { readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; + onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any; + onchange: (this: AudioTrackList, ev: Event) => any; + onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any; getTrackById(id: string): AudioTrack | null; item(index: number): AudioTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [index: number]: AudioTrack; } @@ -7715,7 +7768,6 @@ interface CharacterData extends Node, ChildNode { insertData(offset: number, arg: string): void; replaceData(offset: number, count: number, arg: string): void; substringData(offset: number, count: number): string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var CharacterData: { @@ -8040,6 +8092,8 @@ declare var DOMTokenList: { interface DataCue extends TextTrackCue { data: ArrayBuffer; + addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var DataCue: { @@ -8168,7 +8222,98 @@ declare var DeviceRotationRate: { new(): DeviceRotationRate; } -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode { +interface DocumentEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforedeactivate": UIEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "fullscreenchange": Event; + "fullscreenerror": Event; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "mssitemodejumplistitemremoved": MSSiteModeEvent; + "msthumbnailclick": MSSiteModeEvent; + "pause": Event; + "play": Event; + "playing": Event; + "pointerlockchange": Event; + "pointerlockerror": Event; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": ProgressEvent; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectionchange": Event; + "selectstart": Event; + "stalled": Event; + "stop": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "volumechange": Event; + "waiting": Event; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + +interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot { /** * Sets or gets the URL for the current document. */ @@ -8291,294 +8436,294 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Fires when the user aborts the download. * @param ev The event. */ - onabort: (this: this, ev: UIEvent) => any; + onabort: (this: Document, ev: UIEvent) => any; /** * Fires when the object is set as the active element. * @param ev The event. */ - onactivate: (this: this, ev: UIEvent) => any; + onactivate: (this: Document, ev: UIEvent) => any; /** * Fires immediately before the object is set as the active element. * @param ev The event. */ - onbeforeactivate: (this: this, ev: UIEvent) => any; + onbeforeactivate: (this: Document, ev: UIEvent) => any; /** * Fires immediately before the activeElement is changed from the current object to another object in the parent document. * @param ev The event. */ - onbeforedeactivate: (this: this, ev: UIEvent) => any; + onbeforedeactivate: (this: Document, ev: UIEvent) => any; /** * Fires when the object loses the input focus. * @param ev The focus event. */ - onblur: (this: this, ev: FocusEvent) => any; + onblur: (this: Document, ev: FocusEvent) => any; /** * Occurs when playback is possible, but would require further buffering. * @param ev The event. */ - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; + oncanplay: (this: Document, ev: Event) => any; + oncanplaythrough: (this: Document, ev: Event) => any; /** * Fires when the contents of the object or selection have changed. * @param ev The event. */ - onchange: (this: this, ev: Event) => any; + onchange: (this: Document, ev: Event) => any; /** * Fires when the user clicks the left mouse button on the object * @param ev The mouse event. */ - onclick: (this: this, ev: MouseEvent) => any; + onclick: (this: Document, ev: MouseEvent) => any; /** * Fires when the user clicks the right mouse button in the client area, opening the context menu. * @param ev The mouse event. */ - oncontextmenu: (this: this, ev: PointerEvent) => any; + oncontextmenu: (this: Document, ev: PointerEvent) => any; /** * Fires when the user double-clicks the object. * @param ev The mouse event. */ - ondblclick: (this: this, ev: MouseEvent) => any; + ondblclick: (this: Document, ev: MouseEvent) => any; /** * Fires when the activeElement is changed from the current object to another object in the parent document. * @param ev The UI Event */ - ondeactivate: (this: this, ev: UIEvent) => any; + ondeactivate: (this: Document, ev: UIEvent) => any; /** * Fires on the source object continuously during a drag operation. * @param ev The event. */ - ondrag: (this: this, ev: DragEvent) => any; + ondrag: (this: Document, ev: DragEvent) => any; /** * Fires on the source object when the user releases the mouse at the close of a drag operation. * @param ev The event. */ - ondragend: (this: this, ev: DragEvent) => any; + ondragend: (this: Document, ev: DragEvent) => any; /** * Fires on the target element when the user drags the object to a valid drop target. * @param ev The drag event. */ - ondragenter: (this: this, ev: DragEvent) => any; + ondragenter: (this: Document, ev: DragEvent) => any; /** * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. * @param ev The drag event. */ - ondragleave: (this: this, ev: DragEvent) => any; + ondragleave: (this: Document, ev: DragEvent) => any; /** * Fires on the target element continuously while the user drags the object over a valid drop target. * @param ev The event. */ - ondragover: (this: this, ev: DragEvent) => any; + ondragover: (this: Document, ev: DragEvent) => any; /** * Fires on the source object when the user starts to drag a text selection or selected object. * @param ev The event. */ - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; + ondragstart: (this: Document, ev: DragEvent) => any; + ondrop: (this: Document, ev: DragEvent) => any; /** * Occurs when the duration attribute is updated. * @param ev The event. */ - ondurationchange: (this: this, ev: Event) => any; + ondurationchange: (this: Document, ev: Event) => any; /** * Occurs when the media element is reset to its initial state. * @param ev The event. */ - onemptied: (this: this, ev: Event) => any; + onemptied: (this: Document, ev: Event) => any; /** * Occurs when the end of playback is reached. * @param ev The event */ - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onended: (this: Document, ev: MediaStreamErrorEvent) => any; /** * Fires when an error occurs during object loading. * @param ev The event. */ - onerror: (this: this, ev: ErrorEvent) => any; + onerror: (this: Document, ev: ErrorEvent) => any; /** * Fires when the object receives focus. * @param ev The event. */ - onfocus: (this: this, ev: FocusEvent) => any; - onfullscreenchange: (this: this, ev: Event) => any; - onfullscreenerror: (this: this, ev: Event) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; + onfocus: (this: Document, ev: FocusEvent) => any; + onfullscreenchange: (this: Document, ev: Event) => any; + onfullscreenerror: (this: Document, ev: Event) => any; + oninput: (this: Document, ev: Event) => any; + oninvalid: (this: Document, ev: Event) => any; /** * Fires when the user presses a key. * @param ev The keyboard event */ - onkeydown: (this: this, ev: KeyboardEvent) => any; + onkeydown: (this: Document, ev: KeyboardEvent) => any; /** * Fires when the user presses an alphanumeric key. * @param ev The event. */ - onkeypress: (this: this, ev: KeyboardEvent) => any; + onkeypress: (this: Document, ev: KeyboardEvent) => any; /** * Fires when the user releases a key. * @param ev The keyboard event */ - onkeyup: (this: this, ev: KeyboardEvent) => any; + onkeyup: (this: Document, ev: KeyboardEvent) => any; /** * Fires immediately after the browser loads the object. * @param ev The event. */ - onload: (this: this, ev: Event) => any; + onload: (this: Document, ev: Event) => any; /** * Occurs when media data is loaded at the current playback position. * @param ev The event. */ - onloadeddata: (this: this, ev: Event) => any; + onloadeddata: (this: Document, ev: Event) => any; /** * Occurs when the duration and dimensions of the media have been determined. * @param ev The event. */ - onloadedmetadata: (this: this, ev: Event) => any; + onloadedmetadata: (this: Document, ev: Event) => any; /** * Occurs when Internet Explorer begins looking for media data. * @param ev The event. */ - onloadstart: (this: this, ev: Event) => any; + onloadstart: (this: Document, ev: Event) => any; /** * Fires when the user clicks the object with either mouse button. * @param ev The mouse event. */ - onmousedown: (this: this, ev: MouseEvent) => any; + onmousedown: (this: Document, ev: MouseEvent) => any; /** * Fires when the user moves the mouse over the object. * @param ev The mouse event. */ - onmousemove: (this: this, ev: MouseEvent) => any; + onmousemove: (this: Document, ev: MouseEvent) => any; /** * Fires when the user moves the mouse pointer outside the boundaries of the object. * @param ev The mouse event. */ - onmouseout: (this: this, ev: MouseEvent) => any; + onmouseout: (this: Document, ev: MouseEvent) => any; /** * Fires when the user moves the mouse pointer into the object. * @param ev The mouse event. */ - onmouseover: (this: this, ev: MouseEvent) => any; + onmouseover: (this: Document, ev: MouseEvent) => any; /** * Fires when the user releases a mouse button while the mouse is over the object. * @param ev The mouse event. */ - onmouseup: (this: this, ev: MouseEvent) => any; + onmouseup: (this: Document, ev: MouseEvent) => any; /** * Fires when the wheel button is rotated. * @param ev The mouse event */ - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; + onmousewheel: (this: Document, ev: WheelEvent) => any; + onmscontentzoom: (this: Document, ev: UIEvent) => any; + onmsgesturechange: (this: Document, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any; + onmsgestureend: (this: Document, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Document, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Document, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Document, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Document, ev: MSGestureEvent) => any; + onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any; + onmspointercancel: (this: Document, ev: MSPointerEvent) => any; + onmspointerdown: (this: Document, ev: MSPointerEvent) => any; + onmspointerenter: (this: Document, ev: MSPointerEvent) => any; + onmspointerleave: (this: Document, ev: MSPointerEvent) => any; + onmspointermove: (this: Document, ev: MSPointerEvent) => any; + onmspointerout: (this: Document, ev: MSPointerEvent) => any; + onmspointerover: (this: Document, ev: MSPointerEvent) => any; + onmspointerup: (this: Document, ev: MSPointerEvent) => any; /** * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. * @param ev The event. */ - onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any; + onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any; /** * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. * @param ev The event. */ - onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any; + onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any; /** * Occurs when playback is paused. * @param ev The event. */ - onpause: (this: this, ev: Event) => any; + onpause: (this: Document, ev: Event) => any; /** * Occurs when the play method is requested. * @param ev The event. */ - onplay: (this: this, ev: Event) => any; + onplay: (this: Document, ev: Event) => any; /** * Occurs when the audio or video has started playing. * @param ev The event. */ - onplaying: (this: this, ev: Event) => any; - onpointerlockchange: (this: this, ev: Event) => any; - onpointerlockerror: (this: this, ev: Event) => any; + onplaying: (this: Document, ev: Event) => any; + onpointerlockchange: (this: Document, ev: Event) => any; + onpointerlockerror: (this: Document, ev: Event) => any; /** * Occurs to indicate progress while downloading media data. * @param ev The event. */ - onprogress: (this: this, ev: ProgressEvent) => any; + onprogress: (this: Document, ev: ProgressEvent) => any; /** * Occurs when the playback rate is increased or decreased. * @param ev The event. */ - onratechange: (this: this, ev: Event) => any; + onratechange: (this: Document, ev: Event) => any; /** * Fires when the state of the object has changed. * @param ev The event */ - onreadystatechange: (this: this, ev: ProgressEvent) => any; + onreadystatechange: (this: Document, ev: ProgressEvent) => any; /** * Fires when the user resets a form. * @param ev The event. */ - onreset: (this: this, ev: Event) => any; + onreset: (this: Document, ev: Event) => any; /** * Fires when the user repositions the scroll box in the scroll bar on the object. * @param ev The event. */ - onscroll: (this: this, ev: UIEvent) => any; + onscroll: (this: Document, ev: UIEvent) => any; /** * Occurs when the seek operation ends. * @param ev The event. */ - onseeked: (this: this, ev: Event) => any; + onseeked: (this: Document, ev: Event) => any; /** * Occurs when the current playback position is moved. * @param ev The event. */ - onseeking: (this: this, ev: Event) => any; + onseeking: (this: Document, ev: Event) => any; /** * Fires when the current selection changes. * @param ev The event. */ - onselect: (this: this, ev: UIEvent) => any; + onselect: (this: Document, ev: UIEvent) => any; /** * Fires when the selection state of a document changes. * @param ev The event. */ - onselectionchange: (this: this, ev: Event) => any; - onselectstart: (this: this, ev: Event) => any; + onselectionchange: (this: Document, ev: Event) => any; + onselectstart: (this: Document, ev: Event) => any; /** * Occurs when the download has stopped. * @param ev The event. */ - onstalled: (this: this, ev: Event) => any; + onstalled: (this: Document, ev: Event) => any; /** * Fires when the user clicks the Stop button or leaves the Web page. * @param ev The event. */ - onstop: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; + onstop: (this: Document, ev: Event) => any; + onsubmit: (this: Document, ev: Event) => any; /** * Occurs if the load operation has been intentionally halted. * @param ev The event. */ - onsuspend: (this: this, ev: Event) => any; + onsuspend: (this: Document, ev: Event) => any; /** * Occurs to indicate the current playback position. * @param ev The event. */ - ontimeupdate: (this: this, ev: Event) => any; + ontimeupdate: (this: Document, ev: Event) => any; ontouchcancel: (ev: TouchEvent) => any; ontouchend: (ev: TouchEvent) => any; ontouchmove: (ev: TouchEvent) => any; @@ -8587,14 +8732,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Occurs when the volume is changed, or playback is muted or unmuted. * @param ev The event. */ - onvolumechange: (this: this, ev: Event) => any; + onvolumechange: (this: Document, ev: Event) => any; /** * Occurs when playback stops because the next frame of a video resource is not available. * @param ev The event. */ - onwaiting: (this: this, ev: Event) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; + onwaiting: (this: Document, ev: Event) => any; + onwebkitfullscreenchange: (this: Document, ev: Event) => any; + onwebkitfullscreenerror: (this: Document, ev: Event) => any; plugins: HTMLCollectionOf; readonly pointerLockElement: Element; /** @@ -8665,86 +8810,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Creates an instance of the element for the specified tag. * @param tagName The name of an element. */ - createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "applet"): HTMLAppletElement; - createElement(tagName: "area"): HTMLAreaElement; - createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "base"): HTMLBaseElement; - createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "blockquote"): HTMLQuoteElement; - createElement(tagName: "body"): HTMLBodyElement; - createElement(tagName: "br"): HTMLBRElement; - createElement(tagName: "button"): HTMLButtonElement; - createElement(tagName: "canvas"): HTMLCanvasElement; - createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "col"): HTMLTableColElement; - createElement(tagName: "colgroup"): HTMLTableColElement; - createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dir"): HTMLDirectoryElement; - createElement(tagName: "div"): HTMLDivElement; - createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "embed"): HTMLEmbedElement; - createElement(tagName: "fieldset"): HTMLFieldSetElement; - createElement(tagName: "font"): HTMLFontElement; - createElement(tagName: "form"): HTMLFormElement; - createElement(tagName: "frame"): HTMLFrameElement; - createElement(tagName: "frameset"): HTMLFrameSetElement; - createElement(tagName: "h1"): HTMLHeadingElement; - createElement(tagName: "h2"): HTMLHeadingElement; - createElement(tagName: "h3"): HTMLHeadingElement; - createElement(tagName: "h4"): HTMLHeadingElement; - createElement(tagName: "h5"): HTMLHeadingElement; - createElement(tagName: "h6"): HTMLHeadingElement; - createElement(tagName: "head"): HTMLHeadElement; - createElement(tagName: "hr"): HTMLHRElement; - createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "iframe"): HTMLIFrameElement; - createElement(tagName: "img"): HTMLImageElement; - createElement(tagName: "input"): HTMLInputElement; - createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLUnknownElement; - createElement(tagName: "label"): HTMLLabelElement; - createElement(tagName: "legend"): HTMLLegendElement; - createElement(tagName: "li"): HTMLLIElement; - createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLPreElement; - createElement(tagName: "map"): HTMLMapElement; - createElement(tagName: "marquee"): HTMLMarqueeElement; - createElement(tagName: "menu"): HTMLMenuElement; - createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "meter"): HTMLMeterElement; - createElement(tagName: "nextid"): HTMLUnknownElement; - createElement(tagName: "object"): HTMLObjectElement; - createElement(tagName: "ol"): HTMLOListElement; - createElement(tagName: "optgroup"): HTMLOptGroupElement; - createElement(tagName: "option"): HTMLOptionElement; - createElement(tagName: "p"): HTMLParagraphElement; - createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "picture"): HTMLPictureElement; - createElement(tagName: "pre"): HTMLPreElement; - createElement(tagName: "progress"): HTMLProgressElement; - createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "script"): HTMLScriptElement; - createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "source"): HTMLSourceElement; - createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "table"): HTMLTableElement; - createElement(tagName: "tbody"): HTMLTableSectionElement; - createElement(tagName: "td"): HTMLTableDataCellElement; - createElement(tagName: "template"): HTMLTemplateElement; - createElement(tagName: "textarea"): HTMLTextAreaElement; - createElement(tagName: "tfoot"): HTMLTableSectionElement; - createElement(tagName: "th"): HTMLTableHeaderCellElement; - createElement(tagName: "thead"): HTMLTableSectionElement; - createElement(tagName: "title"): HTMLTitleElement; - createElement(tagName: "tr"): HTMLTableRowElement; - createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "video"): HTMLVideoElement; - createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLPreElement; + createElement(tagName: K): HTMLElementTagNameMap[K]; createElement(tagName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement @@ -8846,7 +8912,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param y The y-offset */ elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; /** * Executes a command on the current document, current selection, or the given range. * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. @@ -8880,182 +8946,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Retrieves a collection of objects based on the specified element name. * @param name Specifies the name of an element. */ - getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; - getElementsByTagName(tagname: "applet"): NodeListOf; - getElementsByTagName(tagname: "area"): NodeListOf; - getElementsByTagName(tagname: "article"): NodeListOf; - getElementsByTagName(tagname: "aside"): NodeListOf; - getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; - getElementsByTagName(tagname: "base"): NodeListOf; - getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; - getElementsByTagName(tagname: "body"): NodeListOf; - getElementsByTagName(tagname: "br"): NodeListOf; - getElementsByTagName(tagname: "button"): NodeListOf; - getElementsByTagName(tagname: "canvas"): NodeListOf; - getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; - getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; - getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; - getElementsByTagName(tagname: "col"): NodeListOf; - getElementsByTagName(tagname: "colgroup"): NodeListOf; - getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; - getElementsByTagName(tagname: "defs"): NodeListOf; - getElementsByTagName(tagname: "del"): NodeListOf; - getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; - getElementsByTagName(tagname: "dir"): NodeListOf; - getElementsByTagName(tagname: "div"): NodeListOf; - getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; - getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; - getElementsByTagName(tagname: "embed"): NodeListOf; - getElementsByTagName(tagname: "feblend"): NodeListOf; - getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; - getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(tagname: "fecomposite"): NodeListOf; - getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; - getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; - getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; - getElementsByTagName(tagname: "fedistantlight"): NodeListOf; - getElementsByTagName(tagname: "feflood"): NodeListOf; - getElementsByTagName(tagname: "fefunca"): NodeListOf; - getElementsByTagName(tagname: "fefuncb"): NodeListOf; - getElementsByTagName(tagname: "fefuncg"): NodeListOf; - getElementsByTagName(tagname: "fefuncr"): NodeListOf; - getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; - getElementsByTagName(tagname: "feimage"): NodeListOf; - getElementsByTagName(tagname: "femerge"): NodeListOf; - getElementsByTagName(tagname: "femergenode"): NodeListOf; - getElementsByTagName(tagname: "femorphology"): NodeListOf; - getElementsByTagName(tagname: "feoffset"): NodeListOf; - getElementsByTagName(tagname: "fepointlight"): NodeListOf; - getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; - getElementsByTagName(tagname: "fespotlight"): NodeListOf; - getElementsByTagName(tagname: "fetile"): NodeListOf; - getElementsByTagName(tagname: "feturbulence"): NodeListOf; - getElementsByTagName(tagname: "fieldset"): NodeListOf; - getElementsByTagName(tagname: "figcaption"): NodeListOf; - getElementsByTagName(tagname: "figure"): NodeListOf; - getElementsByTagName(tagname: "filter"): NodeListOf; - getElementsByTagName(tagname: "font"): NodeListOf; - getElementsByTagName(tagname: "footer"): NodeListOf; - getElementsByTagName(tagname: "foreignobject"): NodeListOf; - getElementsByTagName(tagname: "form"): NodeListOf; - getElementsByTagName(tagname: "frame"): NodeListOf; - getElementsByTagName(tagname: "frameset"): NodeListOf; - getElementsByTagName(tagname: "g"): NodeListOf; - getElementsByTagName(tagname: "h1"): NodeListOf; - getElementsByTagName(tagname: "h2"): NodeListOf; - getElementsByTagName(tagname: "h3"): NodeListOf; - getElementsByTagName(tagname: "h4"): NodeListOf; - getElementsByTagName(tagname: "h5"): NodeListOf; - getElementsByTagName(tagname: "h6"): NodeListOf; - getElementsByTagName(tagname: "head"): NodeListOf; - getElementsByTagName(tagname: "header"): NodeListOf; - getElementsByTagName(tagname: "hgroup"): NodeListOf; - getElementsByTagName(tagname: "hr"): NodeListOf; - getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; - getElementsByTagName(tagname: "iframe"): NodeListOf; - getElementsByTagName(tagname: "image"): NodeListOf; - getElementsByTagName(tagname: "img"): NodeListOf; - getElementsByTagName(tagname: "input"): NodeListOf; - getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; - getElementsByTagName(tagname: "label"): NodeListOf; - getElementsByTagName(tagname: "legend"): NodeListOf; - getElementsByTagName(tagname: "li"): NodeListOf; - getElementsByTagName(tagname: "line"): NodeListOf; - getElementsByTagName(tagname: "lineargradient"): NodeListOf; - getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; - getElementsByTagName(tagname: "map"): NodeListOf; - getElementsByTagName(tagname: "mark"): NodeListOf; - getElementsByTagName(tagname: "marker"): NodeListOf; - getElementsByTagName(tagname: "marquee"): NodeListOf; - getElementsByTagName(tagname: "mask"): NodeListOf; - getElementsByTagName(tagname: "menu"): NodeListOf; - getElementsByTagName(tagname: "meta"): NodeListOf; - getElementsByTagName(tagname: "metadata"): NodeListOf; - getElementsByTagName(tagname: "meter"): NodeListOf; - getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; - getElementsByTagName(tagname: "noframes"): NodeListOf; - getElementsByTagName(tagname: "noscript"): NodeListOf; - getElementsByTagName(tagname: "object"): NodeListOf; - getElementsByTagName(tagname: "ol"): NodeListOf; - getElementsByTagName(tagname: "optgroup"): NodeListOf; - getElementsByTagName(tagname: "option"): NodeListOf; - getElementsByTagName(tagname: "p"): NodeListOf; - getElementsByTagName(tagname: "param"): NodeListOf; - getElementsByTagName(tagname: "path"): NodeListOf; - getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "picture"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; - getElementsByTagName(tagname: "polygon"): NodeListOf; - getElementsByTagName(tagname: "polyline"): NodeListOf; - getElementsByTagName(tagname: "pre"): NodeListOf; - getElementsByTagName(tagname: "progress"): NodeListOf; - getElementsByTagName(tagname: "q"): NodeListOf; - getElementsByTagName(tagname: "radialgradient"): NodeListOf; - getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; - getElementsByTagName(tagname: "script"): NodeListOf; - getElementsByTagName(tagname: "section"): NodeListOf; - getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; - getElementsByTagName(tagname: "source"): NodeListOf; - getElementsByTagName(tagname: "span"): NodeListOf; - getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; - getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; - getElementsByTagName(tagname: "svg"): NodeListOf; - getElementsByTagName(tagname: "switch"): NodeListOf; - getElementsByTagName(tagname: "symbol"): NodeListOf; - getElementsByTagName(tagname: "table"): NodeListOf; - getElementsByTagName(tagname: "tbody"): NodeListOf; - getElementsByTagName(tagname: "td"): NodeListOf; - getElementsByTagName(tagname: "template"): NodeListOf; - getElementsByTagName(tagname: "text"): NodeListOf; - getElementsByTagName(tagname: "textpath"): NodeListOf; - getElementsByTagName(tagname: "textarea"): NodeListOf; - getElementsByTagName(tagname: "tfoot"): NodeListOf; - getElementsByTagName(tagname: "th"): NodeListOf; - getElementsByTagName(tagname: "thead"): NodeListOf; - getElementsByTagName(tagname: "title"): NodeListOf; - getElementsByTagName(tagname: "tr"): NodeListOf; - getElementsByTagName(tagname: "track"): NodeListOf; - getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; - getElementsByTagName(tagname: "ul"): NodeListOf; - getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; - getElementsByTagName(tagname: "video"): NodeListOf; - getElementsByTagName(tagname: "view"): NodeListOf; - getElementsByTagName(tagname: "wbr"): NodeListOf; - getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: K): ElementListTagNameMap[K]; getElementsByTagName(tagname: string): NodeListOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; @@ -9126,103 +9017,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param content The text and HTML tags to write. */ writeln(...content: string[]): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9232,7 +9027,6 @@ declare var Document: { } interface DocumentFragment extends Node, NodeSelector, ParentNode { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var DocumentFragment: { @@ -9247,7 +9041,6 @@ interface DocumentType extends Node, ChildNode { readonly notations: NamedNodeMap; readonly publicId: string | null; readonly systemId: string | null; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var DocumentType: { @@ -9300,6 +9093,36 @@ declare var EXT_texture_filter_anisotropic: { readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } +interface ElementEventMap extends GlobalEventHandlersEventMap { + "ariarequest": AriaRequestEvent; + "command": CommandEvent; + "gotpointercapture": PointerEvent; + "lostpointercapture": PointerEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSGotPointerCapture": MSPointerEvent; + "MSInertiaStart": MSGestureEvent; + "MSLostPointerCapture": MSPointerEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { readonly classList: DOMTokenList; className: string; @@ -9310,33 +9133,33 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec id: string; msContentZoomFactor: number; readonly msRegionOverflow: string; - onariarequest: (this: this, ev: AriaRequestEvent) => any; - oncommand: (this: this, ev: CommandEvent) => any; - ongotpointercapture: (this: this, ev: PointerEvent) => any; - onlostpointercapture: (this: this, ev: PointerEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmslostpointercapture: (this: this, ev: MSPointerEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; + onariarequest: (this: Element, ev: AriaRequestEvent) => any; + oncommand: (this: Element, ev: CommandEvent) => any; + ongotpointercapture: (this: Element, ev: PointerEvent) => any; + onlostpointercapture: (this: Element, ev: PointerEvent) => any; + onmsgesturechange: (this: Element, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any; + onmsgestureend: (this: Element, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Element, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Element, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Element, ev: MSGestureEvent) => any; + onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmsinertiastart: (this: Element, ev: MSGestureEvent) => any; + onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmspointercancel: (this: Element, ev: MSPointerEvent) => any; + onmspointerdown: (this: Element, ev: MSPointerEvent) => any; + onmspointerenter: (this: Element, ev: MSPointerEvent) => any; + onmspointerleave: (this: Element, ev: MSPointerEvent) => any; + onmspointermove: (this: Element, ev: MSPointerEvent) => any; + onmspointerout: (this: Element, ev: MSPointerEvent) => any; + onmspointerover: (this: Element, ev: MSPointerEvent) => any; + onmspointerup: (this: Element, ev: MSPointerEvent) => any; ontouchcancel: (ev: TouchEvent) => any; ontouchend: (ev: TouchEvent) => any; ontouchmove: (ev: TouchEvent) => any; ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; + onwebkitfullscreenchange: (this: Element, ev: Event) => any; + onwebkitfullscreenerror: (this: Element, ev: Event) => any; readonly prefix: string | null; readonly scrollHeight: number; scrollLeft: number; @@ -9344,188 +9167,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec readonly scrollWidth: number; readonly tagName: string; innerHTML: string; + readonly assignedSlot: HTMLSlotElement | null; + slot: string; + readonly shadowRoot: ShadowRoot | null; getAttribute(name: string): string | null; getAttributeNS(namespaceURI: string, localName: string): string; getAttributeNode(name: string): Attr; getAttributeNodeNS(namespaceURI: string, localName: string): Attr; getBoundingClientRect(): ClientRect; getClientRects(): ClientRectList; - getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; - getElementsByTagName(name: "applet"): NodeListOf; - getElementsByTagName(name: "area"): NodeListOf; - getElementsByTagName(name: "article"): NodeListOf; - getElementsByTagName(name: "aside"): NodeListOf; - getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; - getElementsByTagName(name: "base"): NodeListOf; - getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; - getElementsByTagName(name: "body"): NodeListOf; - getElementsByTagName(name: "br"): NodeListOf; - getElementsByTagName(name: "button"): NodeListOf; - getElementsByTagName(name: "canvas"): NodeListOf; - getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; - getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; - getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; - getElementsByTagName(name: "col"): NodeListOf; - getElementsByTagName(name: "colgroup"): NodeListOf; - getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; - getElementsByTagName(name: "defs"): NodeListOf; - getElementsByTagName(name: "del"): NodeListOf; - getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; - getElementsByTagName(name: "dir"): NodeListOf; - getElementsByTagName(name: "div"): NodeListOf; - getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; - getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; - getElementsByTagName(name: "embed"): NodeListOf; - getElementsByTagName(name: "feblend"): NodeListOf; - getElementsByTagName(name: "fecolormatrix"): NodeListOf; - getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(name: "fecomposite"): NodeListOf; - getElementsByTagName(name: "feconvolvematrix"): NodeListOf; - getElementsByTagName(name: "fediffuselighting"): NodeListOf; - getElementsByTagName(name: "fedisplacementmap"): NodeListOf; - getElementsByTagName(name: "fedistantlight"): NodeListOf; - getElementsByTagName(name: "feflood"): NodeListOf; - getElementsByTagName(name: "fefunca"): NodeListOf; - getElementsByTagName(name: "fefuncb"): NodeListOf; - getElementsByTagName(name: "fefuncg"): NodeListOf; - getElementsByTagName(name: "fefuncr"): NodeListOf; - getElementsByTagName(name: "fegaussianblur"): NodeListOf; - getElementsByTagName(name: "feimage"): NodeListOf; - getElementsByTagName(name: "femerge"): NodeListOf; - getElementsByTagName(name: "femergenode"): NodeListOf; - getElementsByTagName(name: "femorphology"): NodeListOf; - getElementsByTagName(name: "feoffset"): NodeListOf; - getElementsByTagName(name: "fepointlight"): NodeListOf; - getElementsByTagName(name: "fespecularlighting"): NodeListOf; - getElementsByTagName(name: "fespotlight"): NodeListOf; - getElementsByTagName(name: "fetile"): NodeListOf; - getElementsByTagName(name: "feturbulence"): NodeListOf; - getElementsByTagName(name: "fieldset"): NodeListOf; - getElementsByTagName(name: "figcaption"): NodeListOf; - getElementsByTagName(name: "figure"): NodeListOf; - getElementsByTagName(name: "filter"): NodeListOf; - getElementsByTagName(name: "font"): NodeListOf; - getElementsByTagName(name: "footer"): NodeListOf; - getElementsByTagName(name: "foreignobject"): NodeListOf; - getElementsByTagName(name: "form"): NodeListOf; - getElementsByTagName(name: "frame"): NodeListOf; - getElementsByTagName(name: "frameset"): NodeListOf; - getElementsByTagName(name: "g"): NodeListOf; - getElementsByTagName(name: "h1"): NodeListOf; - getElementsByTagName(name: "h2"): NodeListOf; - getElementsByTagName(name: "h3"): NodeListOf; - getElementsByTagName(name: "h4"): NodeListOf; - getElementsByTagName(name: "h5"): NodeListOf; - getElementsByTagName(name: "h6"): NodeListOf; - getElementsByTagName(name: "head"): NodeListOf; - getElementsByTagName(name: "header"): NodeListOf; - getElementsByTagName(name: "hgroup"): NodeListOf; - getElementsByTagName(name: "hr"): NodeListOf; - getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; - getElementsByTagName(name: "iframe"): NodeListOf; - getElementsByTagName(name: "image"): NodeListOf; - getElementsByTagName(name: "img"): NodeListOf; - getElementsByTagName(name: "input"): NodeListOf; - getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; - getElementsByTagName(name: "label"): NodeListOf; - getElementsByTagName(name: "legend"): NodeListOf; - getElementsByTagName(name: "li"): NodeListOf; - getElementsByTagName(name: "line"): NodeListOf; - getElementsByTagName(name: "lineargradient"): NodeListOf; - getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; - getElementsByTagName(name: "map"): NodeListOf; - getElementsByTagName(name: "mark"): NodeListOf; - getElementsByTagName(name: "marker"): NodeListOf; - getElementsByTagName(name: "marquee"): NodeListOf; - getElementsByTagName(name: "mask"): NodeListOf; - getElementsByTagName(name: "menu"): NodeListOf; - getElementsByTagName(name: "meta"): NodeListOf; - getElementsByTagName(name: "metadata"): NodeListOf; - getElementsByTagName(name: "meter"): NodeListOf; - getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; - getElementsByTagName(name: "noframes"): NodeListOf; - getElementsByTagName(name: "noscript"): NodeListOf; - getElementsByTagName(name: "object"): NodeListOf; - getElementsByTagName(name: "ol"): NodeListOf; - getElementsByTagName(name: "optgroup"): NodeListOf; - getElementsByTagName(name: "option"): NodeListOf; - getElementsByTagName(name: "p"): NodeListOf; - getElementsByTagName(name: "param"): NodeListOf; - getElementsByTagName(name: "path"): NodeListOf; - getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "picture"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; - getElementsByTagName(name: "polygon"): NodeListOf; - getElementsByTagName(name: "polyline"): NodeListOf; - getElementsByTagName(name: "pre"): NodeListOf; - getElementsByTagName(name: "progress"): NodeListOf; - getElementsByTagName(name: "q"): NodeListOf; - getElementsByTagName(name: "radialgradient"): NodeListOf; - getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; - getElementsByTagName(name: "script"): NodeListOf; - getElementsByTagName(name: "section"): NodeListOf; - getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; - getElementsByTagName(name: "source"): NodeListOf; - getElementsByTagName(name: "span"): NodeListOf; - getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; - getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; - getElementsByTagName(name: "svg"): NodeListOf; - getElementsByTagName(name: "switch"): NodeListOf; - getElementsByTagName(name: "symbol"): NodeListOf; - getElementsByTagName(name: "table"): NodeListOf; - getElementsByTagName(name: "tbody"): NodeListOf; - getElementsByTagName(name: "td"): NodeListOf; - getElementsByTagName(name: "template"): NodeListOf; - getElementsByTagName(name: "text"): NodeListOf; - getElementsByTagName(name: "textpath"): NodeListOf; - getElementsByTagName(name: "textarea"): NodeListOf; - getElementsByTagName(name: "tfoot"): NodeListOf; - getElementsByTagName(name: "th"): NodeListOf; - getElementsByTagName(name: "thead"): NodeListOf; - getElementsByTagName(name: "title"): NodeListOf; - getElementsByTagName(name: "tr"): NodeListOf; - getElementsByTagName(name: "track"): NodeListOf; - getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; - getElementsByTagName(name: "ul"): NodeListOf; - getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; - getElementsByTagName(name: "video"): NodeListOf; - getElementsByTagName(name: "view"): NodeListOf; - getElementsByTagName(name: "wbr"): NodeListOf; - getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: K): ElementListTagNameMap[K]; getElementsByTagName(name: string): NodeListOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; @@ -9565,42 +9216,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot; + addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9636,10 +9253,12 @@ interface Event { readonly target: EventTarget; readonly timeStamp: number; readonly type: string; + readonly scoped: boolean; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; + deepPath(): EventTarget[]; readonly AT_TARGET: number; readonly BUBBLING_PHASE: number; readonly CAPTURING_PHASE: number; @@ -9700,6 +9319,7 @@ interface FileReader extends EventTarget, MSBaseReader { readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9870,6 +9490,8 @@ interface HTMLAnchorElement extends HTMLElement { * Returns a string representation of an object. */ toString(): string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAnchorElement: { @@ -9942,6 +9564,8 @@ interface HTMLAppletElement extends HTMLElement { useMap: string; vspace: number; width: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAppletElement: { @@ -10008,6 +9632,8 @@ interface HTMLAreaElement extends HTMLElement { * Returns a string representation of an object. */ toString(): string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAreaElement: { @@ -10032,6 +9658,8 @@ declare var HTMLAreasCollection: { } interface HTMLAudioElement extends HTMLMediaElement { + addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLAudioElement: { @@ -10044,6 +9672,8 @@ interface HTMLBRElement extends HTMLElement { * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. */ clear: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLBRElement: { @@ -10060,6 +9690,8 @@ interface HTMLBaseElement extends HTMLElement { * Sets or retrieves the window or frame at which to target content. */ target: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLBaseElement: { @@ -10076,6 +9708,7 @@ interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty * Sets or retrieves the font size of the object. */ size: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10084,6 +9717,27 @@ declare var HTMLBaseFontElement: { new(): HTMLBaseFontElement; } +interface HTMLBodyElementEventMap extends HTMLElementEventMap { + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "popstate": PopStateEvent; + "resize": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + interface HTMLBodyElement extends HTMLElement { aLink: any; background: string; @@ -10091,147 +9745,27 @@ interface HTMLBodyElement extends HTMLElement { bgProperties: string; link: any; noWrap: boolean; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; + onafterprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any; + onblur: (this: HTMLBodyElement, ev: FocusEvent) => any; + onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any; + onload: (this: HTMLBodyElement, ev: Event) => any; + onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any; + onoffline: (this: HTMLBodyElement, ev: Event) => any; + ononline: (this: HTMLBodyElement, ev: Event) => any; + onorientationchange: (this: HTMLBodyElement, ev: Event) => any; + onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any; + onresize: (this: HTMLBodyElement, ev: UIEvent) => any; + onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any; + onunload: (this: HTMLBodyElement, ev: Event) => any; text: any; vLink: any; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10304,6 +9838,8 @@ interface HTMLButtonElement extends HTMLElement { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLButtonElement: { @@ -10337,6 +9873,8 @@ interface HTMLCanvasElement extends HTMLElement { */ toDataURL(type?: string, ...args: any[]): string; toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLCanvasElement: { @@ -10367,6 +9905,8 @@ declare var HTMLCollection: { interface HTMLDListElement extends HTMLElement { compact: boolean; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDListElement: { @@ -10376,6 +9916,8 @@ declare var HTMLDListElement: { interface HTMLDataListElement extends HTMLElement { options: HTMLCollectionOf; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDataListElement: { @@ -10385,6 +9927,8 @@ declare var HTMLDataListElement: { interface HTMLDirectoryElement extends HTMLElement { compact: boolean; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDirectoryElement: { @@ -10401,6 +9945,8 @@ interface HTMLDivElement extends HTMLElement { * Sets or retrieves whether the browser automatically performs wordwrap. */ noWrap: boolean; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDivElement: { @@ -10409,6 +9955,8 @@ declare var HTMLDivElement: { } interface HTMLDocument extends Document { + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLDocument: { @@ -10416,6 +9964,76 @@ declare var HTMLDocument: { new(): HTMLDocument; } +interface HTMLElementEventMap extends ElementEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforecopy": ClipboardEvent; + "beforecut": ClipboardEvent; + "beforedeactivate": UIEvent; + "beforepaste": ClipboardEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "copy": ClipboardEvent; + "cuechange": Event; + "cut": ClipboardEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "paste": ClipboardEvent; + "pause": Event; + "play": Event; + "playing": Event; + "progress": ProgressEvent; + "ratechange": Event; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectstart": Event; + "stalled": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "volumechange": Event; + "waiting": Event; +} + interface HTMLElement extends Element { accessKey: string; readonly children: HTMLCollection; @@ -10434,73 +10052,73 @@ interface HTMLElement extends Element { readonly offsetParent: Element; readonly offsetTop: number; readonly offsetWidth: number; - onabort: (this: this, ev: UIEvent) => any; - onactivate: (this: this, ev: UIEvent) => any; - onbeforeactivate: (this: this, ev: UIEvent) => any; - onbeforecopy: (this: this, ev: ClipboardEvent) => any; - onbeforecut: (this: this, ev: ClipboardEvent) => any; - onbeforedeactivate: (this: this, ev: UIEvent) => any; - onbeforepaste: (this: this, ev: ClipboardEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - oncopy: (this: this, ev: ClipboardEvent) => any; - oncuechange: (this: this, ev: Event) => any; - oncut: (this: this, ev: ClipboardEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondeactivate: (this: this, ev: UIEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onpaste: (this: this, ev: ClipboardEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreset: (this: this, ev: Event) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onselectstart: (this: this, ev: Event) => any; - onstalled: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; + onabort: (this: HTMLElement, ev: UIEvent) => any; + onactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onblur: (this: HTMLElement, ev: FocusEvent) => any; + oncanplay: (this: HTMLElement, ev: Event) => any; + oncanplaythrough: (this: HTMLElement, ev: Event) => any; + onchange: (this: HTMLElement, ev: Event) => any; + onclick: (this: HTMLElement, ev: MouseEvent) => any; + oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any; + oncopy: (this: HTMLElement, ev: ClipboardEvent) => any; + oncuechange: (this: HTMLElement, ev: Event) => any; + oncut: (this: HTMLElement, ev: ClipboardEvent) => any; + ondblclick: (this: HTMLElement, ev: MouseEvent) => any; + ondeactivate: (this: HTMLElement, ev: UIEvent) => any; + ondrag: (this: HTMLElement, ev: DragEvent) => any; + ondragend: (this: HTMLElement, ev: DragEvent) => any; + ondragenter: (this: HTMLElement, ev: DragEvent) => any; + ondragleave: (this: HTMLElement, ev: DragEvent) => any; + ondragover: (this: HTMLElement, ev: DragEvent) => any; + ondragstart: (this: HTMLElement, ev: DragEvent) => any; + ondrop: (this: HTMLElement, ev: DragEvent) => any; + ondurationchange: (this: HTMLElement, ev: Event) => any; + onemptied: (this: HTMLElement, ev: Event) => any; + onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any; + onerror: (this: HTMLElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLElement, ev: FocusEvent) => any; + oninput: (this: HTMLElement, ev: Event) => any; + oninvalid: (this: HTMLElement, ev: Event) => any; + onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any; + onload: (this: HTMLElement, ev: Event) => any; + onloadeddata: (this: HTMLElement, ev: Event) => any; + onloadedmetadata: (this: HTMLElement, ev: Event) => any; + onloadstart: (this: HTMLElement, ev: Event) => any; + onmousedown: (this: HTMLElement, ev: MouseEvent) => any; + onmouseenter: (this: HTMLElement, ev: MouseEvent) => any; + onmouseleave: (this: HTMLElement, ev: MouseEvent) => any; + onmousemove: (this: HTMLElement, ev: MouseEvent) => any; + onmouseout: (this: HTMLElement, ev: MouseEvent) => any; + onmouseover: (this: HTMLElement, ev: MouseEvent) => any; + onmouseup: (this: HTMLElement, ev: MouseEvent) => any; + onmousewheel: (this: HTMLElement, ev: WheelEvent) => any; + onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any; + onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any; + onpaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onpause: (this: HTMLElement, ev: Event) => any; + onplay: (this: HTMLElement, ev: Event) => any; + onplaying: (this: HTMLElement, ev: Event) => any; + onprogress: (this: HTMLElement, ev: ProgressEvent) => any; + onratechange: (this: HTMLElement, ev: Event) => any; + onreset: (this: HTMLElement, ev: Event) => any; + onscroll: (this: HTMLElement, ev: UIEvent) => any; + onseeked: (this: HTMLElement, ev: Event) => any; + onseeking: (this: HTMLElement, ev: Event) => any; + onselect: (this: HTMLElement, ev: UIEvent) => any; + onselectstart: (this: HTMLElement, ev: Event) => any; + onstalled: (this: HTMLElement, ev: Event) => any; + onsubmit: (this: HTMLElement, ev: Event) => any; + onsuspend: (this: HTMLElement, ev: Event) => any; + ontimeupdate: (this: HTMLElement, ev: Event) => any; + onvolumechange: (this: HTMLElement, ev: Event) => any; + onwaiting: (this: HTMLElement, ev: Event) => any; outerHTML: string; outerText: string; spellcheck: boolean; @@ -10513,109 +10131,7 @@ interface HTMLElement extends Element { focus(): void; msGetInputContext(): MSInputMethodContext; 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10671,6 +10187,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { * Sets or retrieves the width of the object. */ width: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10710,6 +10227,8 @@ interface HTMLFieldSetElement extends HTMLElement { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLFieldSetElement: { @@ -10722,6 +10241,7 @@ interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOM * Sets or retrieves the current typeface family. */ face: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10797,6 +10317,8 @@ interface HTMLFormElement extends HTMLElement { * Fires when a FORM is about to be submitted. */ submit(): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; } @@ -10805,6 +10327,10 @@ declare var HTMLFormElement: { new(): HTMLFormElement; } +interface HTMLFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Specifies the properties of a border drawn around an object. @@ -10857,7 +10383,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Raised when the object has been completely received from the server. */ - onload: (this: this, ev: Event) => any; + onload: (this: HTMLFrameElement, ev: Event) => any; /** * Sets or retrieves whether the frame can be scrolled. */ @@ -10870,110 +10396,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves the width of the object. */ width: string | number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10982,6 +10405,25 @@ declare var HTMLFrameElement: { new(): HTMLFrameElement; } +interface HTMLFrameSetElementEventMap extends HTMLElementEventMap { + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "resize": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + interface HTMLFrameSetElement extends HTMLElement { border: string; /** @@ -11001,152 +10443,34 @@ interface HTMLFrameSetElement extends HTMLElement { */ frameSpacing: any; name: string; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; + onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; /** * Fires when the object loses the input focus. */ - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any; /** * Fires when the object receives focus. */ - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; + onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; + onload: (this: HTMLFrameSetElement, ev: Event) => any; + onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; + onoffline: (this: HTMLFrameSetElement, ev: Event) => any; + ononline: (this: HTMLFrameSetElement, ev: Event) => any; + onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any; + onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any; + onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any; + onunload: (this: HTMLFrameSetElement, ev: Event) => any; /** * Sets or retrieves the frame heights of the object. */ rows: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11168,6 +10492,7 @@ interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2 * Sets or retrieves the width of the object. */ width: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11178,6 +10503,8 @@ declare var HTMLHRElement: { interface HTMLHeadElement extends HTMLElement { profile: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLHeadElement: { @@ -11190,6 +10517,8 @@ interface HTMLHeadingElement extends HTMLElement { * Sets or retrieves a value that indicates the table alignment. */ align: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLHeadingElement: { @@ -11202,6 +10531,8 @@ interface HTMLHtmlElement extends HTMLElement { * Sets or retrieves the DTD version that governs the current document. */ version: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLHtmlElement: { @@ -11209,6 +10540,10 @@ declare var HTMLHtmlElement: { new(): HTMLHtmlElement; } +interface HTMLIFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Sets or retrieves how the object is aligned with adjacent text. @@ -11266,7 +10601,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Raised when the object has been completely received from the server. */ - onload: (this: this, ev: Event) => any; + onload: (this: HTMLIFrameElement, ev: Event) => any; readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. @@ -11284,110 +10619,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves the width of the object. */ width: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11478,6 +10710,8 @@ interface HTMLImageElement extends HTMLElement { readonly x: number; readonly y: number; msGetAsCastingSource(): any; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLImageElement: { @@ -11689,6 +10923,8 @@ interface HTMLInputElement extends HTMLElement { * @param n Value to increment the value by. */ stepUp(n?: number): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLInputElement: { @@ -11702,6 +10938,8 @@ interface HTMLLIElement extends HTMLElement { * Sets or retrieves the value of a list item. */ value: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLLIElement: { @@ -11718,6 +10956,8 @@ interface HTMLLabelElement extends HTMLElement { * Sets or retrieves the object to which the given label object is assigned. */ htmlFor: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLLabelElement: { @@ -11734,6 +10974,8 @@ interface HTMLLegendElement extends HTMLElement { * Retrieves a reference to the form that the object is embedded in. */ readonly form: HTMLFormElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLLegendElement: { @@ -11777,6 +11019,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle { type: string; import?: Document; integrity: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11794,6 +11037,8 @@ interface HTMLMapElement extends HTMLElement { * Sets or retrieves the name of the object. */ name: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMapElement: { @@ -11801,6 +11046,12 @@ declare var HTMLMapElement: { new(): HTMLMapElement; } +interface HTMLMarqueeElementEventMap extends HTMLElementEventMap { + "bounce": Event; + "finish": Event; + "start": Event; +} + interface HTMLMarqueeElement extends HTMLElement { behavior: string; bgColor: any; @@ -11808,9 +11059,9 @@ interface HTMLMarqueeElement extends HTMLElement { height: string; hspace: number; loop: number; - onbounce: (this: this, ev: Event) => any; - onfinish: (this: this, ev: Event) => any; - onstart: (this: this, ev: Event) => any; + onbounce: (this: HTMLMarqueeElement, ev: Event) => any; + onfinish: (this: HTMLMarqueeElement, ev: Event) => any; + onstart: (this: HTMLMarqueeElement, ev: Event) => any; scrollAmount: number; scrollDelay: number; trueSpeed: boolean; @@ -11818,112 +11069,7 @@ interface HTMLMarqueeElement extends HTMLElement { width: string; start(): void; stop(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11932,6 +11078,11 @@ declare var HTMLMarqueeElement: { new(): HTMLMarqueeElement; } +interface HTMLMediaElementEventMap extends HTMLElementEventMap { + "encrypted": MediaEncryptedEvent; + "msneedkey": MSMediaKeyNeededEvent; +} + interface HTMLMediaElement extends HTMLElement { /** * Returns an AudioTrackList object with the audio tracks for a given video element. @@ -12021,8 +11172,8 @@ interface HTMLMediaElement extends HTMLElement { * Gets the current network activity for the element. */ readonly networkState: number; - onencrypted: (this: this, ev: MediaEncryptedEvent) => any; - onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any; + onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any; + onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any; /** * Gets a flag that specifies whether playback is paused. */ @@ -12100,111 +11251,7 @@ interface HTMLMediaElement extends HTMLElement { readonly NETWORK_IDLE: number; readonly NETWORK_LOADING: number; readonly NETWORK_NO_SOURCE: number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12225,6 +11272,8 @@ declare var HTMLMediaElement: { interface HTMLMenuElement extends HTMLElement { compact: boolean; type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMenuElement: { @@ -12257,6 +11306,8 @@ interface HTMLMetaElement extends HTMLElement { * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. */ url: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMetaElement: { @@ -12271,6 +11322,8 @@ interface HTMLMeterElement extends HTMLElement { min: number; optimum: number; value: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLMeterElement: { @@ -12287,6 +11340,8 @@ interface HTMLModElement extends HTMLElement { * Sets or retrieves the date and time of a modification to the object. */ dateTime: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLModElement: { @@ -12301,6 +11356,8 @@ interface HTMLOListElement extends HTMLElement { */ start: number; type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLOListElement: { @@ -12420,6 +11477,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12458,6 +11516,8 @@ interface HTMLOptGroupElement extends HTMLElement { * Sets or retrieves the value which is returned to the server when the form control is submitted. */ value: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLOptGroupElement: { @@ -12495,6 +11555,8 @@ interface HTMLOptionElement extends HTMLElement { * Sets or retrieves the value which is returned to the server when the form control is submitted. */ value: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLOptionElement: { @@ -12521,6 +11583,8 @@ interface HTMLParagraphElement extends HTMLElement { */ align: string; clear: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLParagraphElement: { @@ -12545,6 +11609,8 @@ interface HTMLParamElement extends HTMLElement { * Sets or retrieves the data type of the value attribute. */ valueType: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLParamElement: { @@ -12553,6 +11619,8 @@ declare var HTMLParamElement: { } interface HTMLPictureElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLPictureElement: { @@ -12565,6 +11633,8 @@ interface HTMLPreElement extends HTMLElement { * Sets or gets a value that you can use to implement your own width functionality for the object. */ width: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLPreElement: { @@ -12589,6 +11659,8 @@ interface HTMLProgressElement extends HTMLElement { * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. */ value: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLProgressElement: { @@ -12601,6 +11673,8 @@ interface HTMLQuoteElement extends HTMLElement { * Sets or retrieves reference information about the object. */ cite: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLQuoteElement: { @@ -12639,6 +11713,8 @@ interface HTMLScriptElement extends HTMLElement { */ type: string; integrity: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLScriptElement: { @@ -12733,6 +11809,8 @@ interface HTMLSelectElement extends HTMLElement { * @param error Sets a custom error message that is displayed when a form is submitted. */ setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [name: string]: any; } @@ -12757,6 +11835,8 @@ interface HTMLSourceElement extends HTMLElement { * Gets or sets the MIME type of a media resource. */ type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLSourceElement: { @@ -12765,6 +11845,8 @@ declare var HTMLSourceElement: { } interface HTMLSpanElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLSpanElement: { @@ -12782,6 +11864,7 @@ interface HTMLStyleElement extends HTMLElement, LinkStyle { * Retrieves the CSS language in which the style sheet is written. */ type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12799,6 +11882,8 @@ interface HTMLTableCaptionElement extends HTMLElement { * Sets or retrieves whether the caption appears at the top or bottom of the table. */ vAlign: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTableCaptionElement: { @@ -12852,6 +11937,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { * Sets or retrieves the width of the object. */ width: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12873,6 +11959,7 @@ interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { * Sets or retrieves the width of the object. */ width: any; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12993,6 +12080,8 @@ interface HTMLTableElement extends HTMLElement { * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTableElement: { @@ -13044,6 +12133,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. */ insertCell(index?: number): HTMLTableDataCellElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13071,6 +12161,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. */ insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13081,6 +12172,8 @@ declare var HTMLTableSectionElement: { interface HTMLTemplateElement extends HTMLElement { readonly content: DocumentFragment; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTemplateElement: { @@ -13186,6 +12279,8 @@ interface HTMLTextAreaElement extends HTMLElement { * @param end The offset into the text field for the end of the selection. */ setSelectionRange(start: number, end: number): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTextAreaElement: { @@ -13198,6 +12293,8 @@ interface HTMLTitleElement extends HTMLElement { * Retrieves or sets the text of the object as a string. */ text: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTitleElement: { @@ -13217,6 +12314,8 @@ interface HTMLTrackElement extends HTMLElement { readonly LOADED: number; readonly LOADING: number; readonly NONE: number; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLTrackElement: { @@ -13231,6 +12330,8 @@ declare var HTMLTrackElement: { interface HTMLUListElement extends HTMLElement { compact: boolean; type: string; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLUListElement: { @@ -13239,6 +12340,8 @@ declare var HTMLUListElement: { } interface HTMLUnknownElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var HTMLUnknownElement: { @@ -13246,6 +12349,12 @@ declare var HTMLUnknownElement: { new(): HTMLUnknownElement; } +interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap { + "MSVideoFormatChanged": Event; + "MSVideoFrameStepCompleted": Event; + "MSVideoOptimalLayoutChanged": Event; +} + interface HTMLVideoElement extends HTMLMediaElement { /** * Gets or sets the height of the video element. @@ -13257,9 +12366,9 @@ interface HTMLVideoElement extends HTMLMediaElement { msStereo3DPackingMode: string; msStereo3DRenderMode: string; msZoom: boolean; - onMSVideoFormatChanged: (this: this, ev: Event) => any; - onMSVideoFrameStepCompleted: (this: this, ev: Event) => any; - onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any; + onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any; /** * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. */ @@ -13286,114 +12395,7 @@ interface HTMLVideoElement extends HTMLMediaElement { webkitEnterFullscreen(): void; webkitExitFullScreen(): void; webkitExitFullscreen(): 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; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13461,11 +12463,16 @@ declare var IDBCursorWithValue: { new(): IDBCursorWithValue; } +interface IDBDatabaseEventMap { + "abort": Event; + "error": ErrorEvent; +} + interface IDBDatabase extends EventTarget { readonly name: string; readonly objectStoreNames: DOMStringList; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onabort: (this: IDBDatabase, ev: Event) => any; + onerror: (this: IDBDatabase, ev: ErrorEvent) => any; version: number; onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; @@ -13473,8 +12480,7 @@ interface IDBDatabase extends EventTarget { deleteObjectStore(name: string): void; transaction(storeNames: string | string[], mode?: string): IDBTransaction; addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - 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: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13551,13 +12557,15 @@ declare var IDBObjectStore: { new(): IDBObjectStore; } +interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { + "blocked": Event; + "upgradeneeded": IDBVersionChangeEvent; +} + interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: this, ev: Event) => any; - onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; - addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + onblocked: (this: IDBOpenDBRequest, ev: Event) => any; + onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; + addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13566,16 +12574,20 @@ declare var IDBOpenDBRequest: { new(): IDBOpenDBRequest; } +interface IDBRequestEventMap { + "error": ErrorEvent; + "success": Event; +} + interface IDBRequest extends EventTarget { readonly error: DOMError; - onerror: (this: this, ev: ErrorEvent) => any; - onsuccess: (this: this, ev: Event) => any; + onerror: (this: IDBRequest, ev: ErrorEvent) => any; + onsuccess: (this: IDBRequest, ev: Event) => any; readonly readyState: string; readonly result: any; source: IDBObjectStore | IDBIndex | IDBCursor; readonly transaction: IDBTransaction; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13584,21 +12596,25 @@ declare var IDBRequest: { new(): IDBRequest; } +interface IDBTransactionEventMap { + "abort": Event; + "complete": Event; + "error": ErrorEvent; +} + interface IDBTransaction extends EventTarget { readonly db: IDBDatabase; readonly error: DOMError; readonly mode: string; - onabort: (this: this, ev: Event) => any; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onabort: (this: IDBTransaction, ev: Event) => any; + oncomplete: (this: IDBTransaction, ev: Event) => any; + onerror: (this: IDBTransaction, ev: ErrorEvent) => any; abort(): void; objectStore(name: string): IDBObjectStore; readonly READ_ONLY: string; readonly READ_WRITE: string; readonly VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13731,18 +12747,22 @@ interface MSApp { } declare var MSApp: MSApp; +interface MSAppAsyncOperationEventMap { + "complete": Event; + "error": ErrorEvent; +} + interface MSAppAsyncOperation extends EventTarget { readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; + onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any; readonly readyState: number; readonly result: any; start(): void; readonly COMPLETED: number; readonly ERROR: number; readonly STARTED: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13897,6 +12917,8 @@ interface MSHTMLWebViewElement extends HTMLElement { navigateWithHttpRequestMessage(requestMessage: any): void; refresh(): void; stop(): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var MSHTMLWebViewElement: { @@ -13904,20 +12926,24 @@ declare var MSHTMLWebViewElement: { new(): MSHTMLWebViewElement; } +interface MSInputMethodContextEventMap { + "MSCandidateWindowHide": Event; + "MSCandidateWindowShow": Event; + "MSCandidateWindowUpdate": Event; +} + interface MSInputMethodContext extends EventTarget { readonly compositionEndOffset: number; readonly compositionStartOffset: number; - oncandidatewindowhide: (this: this, ev: Event) => any; - oncandidatewindowshow: (this: this, ev: Event) => any; - oncandidatewindowupdate: (this: this, ev: Event) => any; + oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any; readonly target: HTMLElement; getCandidateWindowClientRect(): ClientRect; getCompositionAlternatives(): string[]; hasComposition(): boolean; isCandidateWindowVisible(): boolean; - addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14083,6 +13109,7 @@ interface MSStreamReader extends EventTarget, MSBaseReader { readAsBlob(stream: MSStream, size?: number): void; readAsDataURL(stream: MSStream, size?: number): void; readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14091,10 +13118,15 @@ declare var MSStreamReader: { new(): MSStreamReader; } +interface MSWebViewAsyncOperationEventMap { + "complete": Event; + "error": ErrorEvent; +} + interface MSWebViewAsyncOperation extends EventTarget { readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any; + onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any; readonly readyState: number; readonly result: any; readonly target: MSHTMLWebViewElement; @@ -14106,8 +13138,7 @@ interface MSWebViewAsyncOperation extends EventTarget { readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; readonly TYPE_INVOKE_SCRIPT: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14144,12 +13175,16 @@ declare var MediaDeviceInfo: { new(): MediaDeviceInfo; } +interface MediaDevicesEventMap { + "devicechange": Event; +} + interface MediaDevices extends EventTarget { - ondevicechange: (this: this, ev: Event) => any; + ondevicechange: (this: MediaDevices, ev: Event) => any; enumerateDevices(): any; getSupportedConstraints(): MediaTrackSupportedConstraints; getUserMedia(constraints: MediaStreamConstraints): PromiseLike; - addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14299,13 +13334,20 @@ declare var MediaSource: { isTypeSupported(type: string): boolean; } +interface MediaStreamEventMap { + "active": Event; + "addtrack": TrackEvent; + "inactive": Event; + "removetrack": TrackEvent; +} + interface MediaStream extends EventTarget { readonly active: boolean; readonly id: string; - onactive: (this: this, ev: Event) => any; - onaddtrack: (this: this, ev: TrackEvent) => any; - oninactive: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; + onactive: (this: MediaStream, ev: Event) => any; + onaddtrack: (this: MediaStream, ev: TrackEvent) => any; + oninactive: (this: MediaStream, ev: Event) => any; + onremovetrack: (this: MediaStream, ev: TrackEvent) => any; addTrack(track: MediaStreamTrack): void; clone(): MediaStream; getAudioTracks(): MediaStreamTrack[]; @@ -14314,10 +13356,7 @@ interface MediaStream extends EventTarget { getVideoTracks(): MediaStreamTrack[]; removeTrack(track: MediaStreamTrack): void; stop(): void; - addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14354,16 +13393,23 @@ declare var MediaStreamErrorEvent: { new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; } +interface MediaStreamTrackEventMap { + "ended": MediaStreamErrorEvent; + "mute": Event; + "overconstrained": MediaStreamErrorEvent; + "unmute": Event; +} + interface MediaStreamTrack extends EventTarget { enabled: boolean; readonly id: string; readonly kind: string; readonly label: string; readonly muted: boolean; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onmute: (this: this, ev: Event) => any; - onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any; - onunmute: (this: this, ev: Event) => any; + onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onmute: (this: MediaStreamTrack, ev: Event) => any; + onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onunmute: (this: MediaStreamTrack, ev: Event) => any; readonly readonly: boolean; readonly readyState: string; readonly remote: boolean; @@ -14373,10 +13419,7 @@ interface MediaStreamTrack extends EventTarget { getConstraints(): MediaTrackConstraints; getSettings(): MediaTrackSettings; stop(): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14417,12 +13460,16 @@ declare var MessageEvent: { new(type: string, eventInitDict?: MessageEventInit): MessageEvent; } +interface MessagePortEventMap { + "message": MessageEvent; +} + interface MessagePort extends EventTarget { - onmessage: (this: this, ev: MessageEvent) => any; + onmessage: (this: MessagePort, ev: MessageEvent) => any; close(): void; postMessage(message?: any, ports?: any): void; start(): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14600,7 +13647,6 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; vibrate(pattern: number | number[]): boolean; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var Navigator: { @@ -14775,10 +13821,14 @@ declare var OfflineAudioCompletionEvent: { new(): OfflineAudioCompletionEvent; } +interface OfflineAudioContextEventMap { + "complete": Event; +} + interface OfflineAudioContext extends AudioContext { - oncomplete: (this: this, ev: Event) => any; + oncomplete: (this: OfflineAudioContext, ev: Event) => any; startRendering(): PromiseLike; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14787,15 +13837,19 @@ declare var OfflineAudioContext: { new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; } +interface OscillatorNodeEventMap { + "ended": MediaStreamErrorEvent; +} + interface OscillatorNode extends AudioNode { readonly detune: AudioParam; readonly frequency: AudioParam; - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any; type: string; setPeriodicWave(periodicWave: PeriodicWave): void; start(when?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15174,9 +14228,14 @@ declare var RTCDTMFToneChangeEvent: { new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; } +interface RTCDtlsTransportEventMap { + "dtlsstatechange": RTCDtlsTransportStateChangedEvent; + "error": ErrorEvent; +} + interface RTCDtlsTransport extends RTCStatsProvider { - ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null; - onerror: ((this: this, ev: ErrorEvent) => any) | null; + ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null; readonly state: string; readonly transport: RTCIceTransport; getLocalParameters(): RTCDtlsParameters; @@ -15184,8 +14243,7 @@ interface RTCDtlsTransport extends RTCStatsProvider { getRemoteParameters(): RTCDtlsParameters | null; start(remoteParameters: RTCDtlsParameters): void; stop(): void; - addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15203,15 +14261,19 @@ declare var RTCDtlsTransportStateChangedEvent: { new(): RTCDtlsTransportStateChangedEvent; } +interface RTCDtmfSenderEventMap { + "tonechange": RTCDTMFToneChangeEvent; +} + interface RTCDtmfSender extends EventTarget { readonly canInsertDTMF: boolean; readonly duration: number; readonly interToneGap: number; - ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any; + ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any; readonly sender: RTCRtpSender; readonly toneBuffer: string; insertDTMF(tones: string, duration?: number, interToneGap?: number): void; - addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15229,15 +14291,19 @@ declare var RTCIceCandidatePairChangedEvent: { new(): RTCIceCandidatePairChangedEvent; } +interface RTCIceGathererEventMap { + "error": ErrorEvent; + "localcandidate": RTCIceGathererEvent; +} + interface RTCIceGatherer extends RTCStatsProvider { readonly component: string; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null; + onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null; + onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null; createAssociatedGatherer(): RTCIceGatherer; getLocalCandidates(): RTCIceCandidate[]; getLocalParameters(): RTCIceParameters; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15255,11 +14321,16 @@ declare var RTCIceGathererEvent: { new(): RTCIceGathererEvent; } +interface RTCIceTransportEventMap { + "candidatepairchange": RTCIceCandidatePairChangedEvent; + "icestatechange": RTCIceTransportStateChangedEvent; +} + interface RTCIceTransport extends RTCStatsProvider { readonly component: string; readonly iceGatherer: RTCIceGatherer | null; - oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null; - onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null; + oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null; readonly role: string; readonly state: string; addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; @@ -15270,8 +14341,7 @@ interface RTCIceTransport extends RTCStatsProvider { setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; stop(): void; - addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15289,8 +14359,12 @@ declare var RTCIceTransportStateChangedEvent: { new(): RTCIceTransportStateChangedEvent; } +interface RTCRtpReceiverEventMap { + "error": ErrorEvent; +} + interface RTCRtpReceiver extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; + onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null; readonly rtcpTransport: RTCDtlsTransport; readonly track: MediaStreamTrack | null; readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; @@ -15299,7 +14373,7 @@ interface RTCRtpReceiver extends RTCStatsProvider { requestSendCSRC(csrc: number): void; setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15309,9 +14383,14 @@ declare var RTCRtpReceiver: { getCapabilities(kind?: string): RTCRtpCapabilities; } +interface RTCRtpSenderEventMap { + "error": ErrorEvent; + "ssrcconflict": RTCSsrcConflictEvent; +} + interface RTCRtpSender extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null; + onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null; + onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null; readonly rtcpTransport: RTCDtlsTransport; readonly track: MediaStreamTrack; readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; @@ -15319,8 +14398,7 @@ interface RTCRtpSender extends RTCStatsProvider { setTrack(track: MediaStreamTrack): void; setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15330,10 +14408,14 @@ declare var RTCRtpSender: { getCapabilities(kind?: string): RTCRtpCapabilities; } +interface RTCSrtpSdesTransportEventMap { + "error": ErrorEvent; +} + interface RTCSrtpSdesTransport extends EventTarget { - onerror: ((this: this, ev: ErrorEvent) => any) | null; + onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null; readonly transport: RTCIceTransport; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15408,6 +14490,7 @@ declare var Range: { interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { readonly target: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15564,6 +14647,7 @@ interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SV readonly cx: SVGAnimatedLength; readonly cy: SVGAnimatedLength; readonly r: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15574,6 +14658,7 @@ declare var SVGCircleElement: { interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { readonly clipPathUnits: SVGAnimatedEnumeration; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15596,6 +14681,8 @@ interface SVGComponentTransferFunctionElement extends SVGElement { readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGComponentTransferFunctionElement: { @@ -15610,6 +14697,7 @@ declare var SVGComponentTransferFunctionElement: { } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15619,6 +14707,7 @@ declare var SVGDefsElement: { } interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15627,67 +14716,35 @@ declare var SVGDescElement: { new(): SVGDescElement; } +interface SVGElementEventMap extends ElementEventMap { + "click": MouseEvent; + "dblclick": MouseEvent; + "focusin": FocusEvent; + "focusout": FocusEvent; + "load": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; +} + interface SVGElement extends Element { - onclick: (this: this, ev: MouseEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - onfocusin: (this: this, ev: FocusEvent) => any; - onfocusout: (this: this, ev: FocusEvent) => any; - onload: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; + onclick: (this: SVGElement, ev: MouseEvent) => any; + ondblclick: (this: SVGElement, ev: MouseEvent) => any; + onfocusin: (this: SVGElement, ev: FocusEvent) => any; + onfocusout: (this: SVGElement, ev: FocusEvent) => any; + onload: (this: SVGElement, ev: Event) => any; + onmousedown: (this: SVGElement, ev: MouseEvent) => any; + onmousemove: (this: SVGElement, ev: MouseEvent) => any; + onmouseout: (this: SVGElement, ev: MouseEvent) => any; + onmouseover: (this: SVGElement, ev: MouseEvent) => any; + onmouseup: (this: SVGElement, ev: MouseEvent) => any; readonly ownerSVGElement: SVGSVGElement; readonly viewportElement: SVGElement; xmlbase: string; className: any; - 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15727,6 +14784,7 @@ interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, S readonly cy: SVGAnimatedLength; readonly rx: SVGAnimatedLength; readonly ry: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15756,6 +14814,7 @@ interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttrib readonly SVG_FEBLEND_MODE_SCREEN: number; readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; readonly SVG_FEBLEND_MODE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15790,6 +14849,7 @@ interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandard readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15805,6 +14865,7 @@ declare var SVGFEColorMatrixElement: { interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15828,6 +14889,7 @@ interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAt readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15860,6 +14922,7 @@ interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStand readonly SVG_EDGEMODE_NONE: number; readonly SVG_EDGEMODE_UNKNOWN: number; readonly SVG_EDGEMODE_WRAP: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15878,6 +14941,7 @@ interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStan readonly kernelUnitLengthX: SVGAnimatedNumber; readonly kernelUnitLengthY: SVGAnimatedNumber; readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15897,6 +14961,7 @@ interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStan readonly SVG_CHANNEL_G: number; readonly SVG_CHANNEL_R: number; readonly SVG_CHANNEL_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15913,6 +14978,8 @@ declare var SVGFEDisplacementMapElement: { interface SVGFEDistantLightElement extends SVGElement { readonly azimuth: SVGAnimatedNumber; readonly elevation: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEDistantLightElement: { @@ -15921,6 +14988,7 @@ declare var SVGFEDistantLightElement: { } interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15966,6 +15034,7 @@ interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandar readonly stdDeviationX: SVGAnimatedNumber; readonly stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15976,6 +15045,7 @@ declare var SVGFEGaussianBlurElement: { interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15985,6 +15055,7 @@ declare var SVGFEImageElement: { } interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15995,6 +15066,8 @@ declare var SVGFEMergeElement: { interface SVGFEMergeNodeElement extends SVGElement { readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEMergeNodeElement: { @@ -16010,6 +15083,7 @@ interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardA readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16025,6 +15099,7 @@ interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttri readonly dx: SVGAnimatedNumber; readonly dy: SVGAnimatedNumber; readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16037,6 +15112,8 @@ interface SVGFEPointLightElement extends SVGElement { readonly x: SVGAnimatedNumber; readonly y: SVGAnimatedNumber; readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEPointLightElement: { @@ -16051,6 +15128,7 @@ interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveSta readonly specularConstant: SVGAnimatedNumber; readonly specularExponent: SVGAnimatedNumber; readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16068,6 +15146,8 @@ interface SVGFESpotLightElement extends SVGElement { readonly x: SVGAnimatedNumber; readonly y: SVGAnimatedNumber; readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFESpotLightElement: { @@ -16077,6 +15157,7 @@ declare var SVGFESpotLightElement: { interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16098,6 +15179,7 @@ interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardA readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16122,6 +15204,7 @@ interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLan readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; setFilterRes(filterResX: number, filterResY: number): void; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16135,6 +15218,7 @@ interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransforma readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16144,6 +15228,7 @@ declare var SVGForeignObjectElement: { } interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16160,6 +15245,7 @@ interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourc readonly SVG_SPREADMETHOD_REFLECT: number; readonly SVG_SPREADMETHOD_REPEAT: number; readonly SVG_SPREADMETHOD_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16178,6 +15264,7 @@ interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVG readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16243,6 +15330,7 @@ interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGT readonly x2: SVGAnimatedLength; readonly y1: SVGAnimatedLength; readonly y2: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16279,6 +15367,7 @@ interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExt readonly SVG_MARKER_ORIENT_ANGLE: number; readonly SVG_MARKER_ORIENT_AUTO: number; readonly SVG_MARKER_ORIENT_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16300,6 +15389,7 @@ interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16334,6 +15424,8 @@ declare var SVGMatrix: { } interface SVGMetadataElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGMetadataElement: { @@ -16389,6 +15481,7 @@ interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGT getPathSegAtLength(distance: number): number; getPointAtLength(distance: number): SVGPoint; getTotalLength(): number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16681,6 +15774,7 @@ interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSp readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16717,6 +15811,7 @@ declare var SVGPointList: { } interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16726,6 +15821,7 @@ declare var SVGPolygonElement: { } interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16804,6 +15900,7 @@ interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGT readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16812,18 +15909,27 @@ declare var SVGRectElement: { new(): SVGRectElement; } +interface SVGSVGElementEventMap extends SVGElementEventMap { + "SVGAbort": Event; + "SVGError": Event; + "resize": UIEvent; + "scroll": UIEvent; + "SVGUnload": Event; + "SVGZoom": SVGZoomEvent; +} + interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { contentScriptType: string; contentStyleType: string; currentScale: number; readonly currentTranslate: SVGPoint; readonly height: SVGAnimatedLength; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onunload: (this: this, ev: Event) => any; - onzoom: (this: this, ev: SVGZoomEvent) => any; + onabort: (this: SVGSVGElement, ev: Event) => any; + onerror: (this: SVGSVGElement, ev: Event) => any; + onresize: (this: SVGSVGElement, ev: UIEvent) => any; + onscroll: (this: SVGSVGElement, ev: UIEvent) => any; + onunload: (this: SVGSVGElement, ev: Event) => any; + onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any; readonly pixelUnitToMillimeterX: number; readonly pixelUnitToMillimeterY: number; readonly screenPixelToMillimeterX: number; @@ -16855,58 +15961,7 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest unpauseAnimations(): void; unsuspendRedraw(suspendHandleID: number): void; unsuspendRedrawAll(): 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16917,6 +15972,7 @@ declare var SVGSVGElement: { interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { type: string; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16927,6 +15983,7 @@ declare var SVGScriptElement: { interface SVGStopElement extends SVGElement, SVGStylable { readonly offset: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16956,6 +16013,7 @@ interface SVGStyleElement extends SVGElement, SVGLangSpace { media: string; title: string; type: string; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16965,6 +16023,7 @@ declare var SVGStyleElement: { } interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -16974,6 +16033,7 @@ declare var SVGSwitchElement: { } interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17005,6 +16065,7 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa readonly LENGTHADJUST_SPACING: number; readonly LENGTHADJUST_SPACINGANDGLYPHS: number; readonly LENGTHADJUST_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17017,7 +16078,6 @@ declare var SVGTextContentElement: { } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextElement: { @@ -17035,7 +16095,6 @@ interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { readonly TEXTPATH_SPACINGTYPE_AUTO: number; readonly TEXTPATH_SPACINGTYPE_EXACT: number; readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextPathElement: { @@ -17063,6 +16122,7 @@ declare var SVGTextPositioningElement: { } interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17134,6 +16194,7 @@ interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTe readonly width: SVGAnimatedLength; readonly x: SVGAnimatedLength; readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17144,6 +16205,7 @@ declare var SVGUseElement: { interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { readonly viewTarget: SVGStringList; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17175,6 +16237,10 @@ declare var SVGZoomEvent: { new(): SVGZoomEvent; } +interface ScreenEventMap { + "MSOrientationChange": Event; +} + interface Screen extends EventTarget { readonly availHeight: number; readonly availWidth: number; @@ -17187,14 +16253,14 @@ interface Screen extends EventTarget { readonly logicalXDPI: number; readonly logicalYDPI: number; readonly msOrientation: string; - onmsorientationchange: (this: this, ev: Event) => any; + onmsorientationchange: (this: Screen, ev: Event) => any; readonly pixelDepth: number; readonly systemXDPI: number; readonly systemYDPI: number; readonly width: number; msLockOrientation(orientations: string | string[]): boolean; msUnlockOrientation(): void; - addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17213,10 +16279,14 @@ declare var ScriptNotifyEvent: { new(): ScriptNotifyEvent; } +interface ScriptProcessorNodeEventMap { + "audioprocess": AudioProcessingEvent; +} + interface ScriptProcessorNode extends AudioNode { readonly bufferSize: number; - onaudioprocess: (this: this, ev: AudioProcessingEvent) => any; - addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void; + onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any; + addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17398,6 +16468,7 @@ declare var SubtleCrypto: { interface Text extends CharacterData { readonly wholeText: string; + readonly assignedSlot: HTMLSlotElement | null; splitText(offset: number): Text; } @@ -17447,6 +16518,12 @@ declare var TextMetrics: { new(): TextMetrics; } +interface TextTrackEventMap { + "cuechange": Event; + "error": ErrorEvent; + "load": Event; +} + interface TextTrack extends EventTarget { readonly activeCues: TextTrackCueList; readonly cues: TextTrackCueList; @@ -17455,9 +16532,9 @@ interface TextTrack extends EventTarget { readonly label: string; readonly language: string; mode: any; - oncuechange: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; + oncuechange: (this: TextTrack, ev: Event) => any; + onerror: (this: TextTrack, ev: ErrorEvent) => any; + onload: (this: TextTrack, ev: Event) => any; readonly readyState: number; addCue(cue: TextTrackCue): void; removeCue(cue: TextTrackCue): void; @@ -17468,9 +16545,7 @@ interface TextTrack extends EventTarget { readonly LOADING: number; readonly NONE: number; readonly SHOWING: number; - addEventListener(type: "cuechange", 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: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17486,18 +16561,22 @@ declare var TextTrack: { readonly SHOWING: number; } +interface TextTrackCueEventMap { + "enter": Event; + "exit": Event; +} + interface TextTrackCue extends EventTarget { endTime: number; id: string; - onenter: (this: this, ev: Event) => any; - onexit: (this: this, ev: Event) => any; + onenter: (this: TextTrackCue, ev: Event) => any; + onexit: (this: TextTrackCue, ev: Event) => any; pauseOnExit: boolean; startTime: number; text: string; readonly track: TextTrack; getCueAsHTML(): DocumentFragment; - addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -17518,11 +16597,15 @@ declare var TextTrackCueList: { new(): TextTrackCueList; } +interface TextTrackListEventMap { + "addtrack": TrackEvent; +} + interface TextTrackList extends EventTarget { readonly length: number; - onaddtrack: ((this: this, ev: TrackEvent) => any) | null; + onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null; item(index: number): TextTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [index: number]: TextTrack; } @@ -17712,17 +16795,21 @@ declare var VideoTrack: { new(): VideoTrack; } +interface VideoTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + interface VideoTrackList extends EventTarget { readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; + onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any; + onchange: (this: VideoTrackList, ev: Event) => any; + onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any; readonly selectedIndex: number; getTrackById(id: string): VideoTrack | null; item(index: number): VideoTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; [index: number]: VideoTrack; } @@ -18668,14 +17755,21 @@ declare var WebKitPoint: { new(x?: number, y?: number): WebKitPoint; } +interface WebSocketEventMap { + "close": CloseEvent; + "error": ErrorEvent; + "message": MessageEvent; + "open": Event; +} + interface WebSocket extends EventTarget { binaryType: string; readonly bufferedAmount: number; readonly extensions: string; - onclose: (this: this, ev: CloseEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onopen: (this: this, ev: Event) => any; + onclose: (this: WebSocket, ev: CloseEvent) => any; + onerror: (this: WebSocket, ev: ErrorEvent) => any; + onmessage: (this: WebSocket, ev: MessageEvent) => any; + onopen: (this: WebSocket, ev: Event) => any; readonly protocol: string; readonly readyState: number; readonly url: string; @@ -18685,10 +17779,7 @@ interface WebSocket extends EventTarget { readonly CLOSING: number; readonly CONNECTING: number; readonly OPEN: number; - addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -18724,6 +17815,95 @@ declare var WheelEvent: { readonly DOM_DELTA_PIXEL: number; } +interface WindowEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "compassneedscalibration": Event; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "devicelight": DeviceLightEvent; + "devicemotion": DeviceMotionEvent; + "deviceorientation": DeviceOrientationEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "message": MessageEvent; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "pause": Event; + "play": Event; + "playing": Event; + "popstate": PopStateEvent; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": ProgressEvent; + "reset": Event; + "resize": UIEvent; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "stalled": Event; + "storage": StorageEvent; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "unload": Event; + "volumechange": Event; + "waiting": Event; +} + interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { readonly applicationCache: ApplicationCache; readonly clientInformation: Navigator; @@ -18748,97 +17928,97 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window name: string; readonly navigator: Navigator; offscreenBuffering: string | boolean; - onabort: (this: this, ev: UIEvent) => any; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncompassneedscalibration: (this: this, ev: Event) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondevicelight: (this: this, ev: DeviceLightEvent) => any; - ondevicemotion: (this: this, ev: DeviceMotionEvent) => any; - ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; + onabort: (this: Window, ev: UIEvent) => any; + onafterprint: (this: Window, ev: Event) => any; + onbeforeprint: (this: Window, ev: Event) => any; + onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; + onblur: (this: Window, ev: FocusEvent) => any; + oncanplay: (this: Window, ev: Event) => any; + oncanplaythrough: (this: Window, ev: Event) => any; + onchange: (this: Window, ev: Event) => any; + onclick: (this: Window, ev: MouseEvent) => any; + oncompassneedscalibration: (this: Window, ev: Event) => any; + oncontextmenu: (this: Window, ev: PointerEvent) => any; + ondblclick: (this: Window, ev: MouseEvent) => any; + ondevicelight: (this: Window, ev: DeviceLightEvent) => any; + ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; + ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; + ondrag: (this: Window, ev: DragEvent) => any; + ondragend: (this: Window, ev: DragEvent) => any; + ondragenter: (this: Window, ev: DragEvent) => any; + ondragleave: (this: Window, ev: DragEvent) => any; + ondragover: (this: Window, ev: DragEvent) => any; + ondragstart: (this: Window, ev: DragEvent) => any; + ondrop: (this: Window, ev: DragEvent) => any; + ondurationchange: (this: Window, ev: Event) => any; + onemptied: (this: Window, ev: Event) => any; + onended: (this: Window, ev: MediaStreamErrorEvent) => any; onerror: ErrorEventHandler; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreadystatechange: (this: this, ev: ProgressEvent) => any; - onreset: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onstalled: (this: this, ev: Event) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; + onfocus: (this: Window, ev: FocusEvent) => any; + onhashchange: (this: Window, ev: HashChangeEvent) => any; + oninput: (this: Window, ev: Event) => any; + oninvalid: (this: Window, ev: Event) => any; + onkeydown: (this: Window, ev: KeyboardEvent) => any; + onkeypress: (this: Window, ev: KeyboardEvent) => any; + onkeyup: (this: Window, ev: KeyboardEvent) => any; + onload: (this: Window, ev: Event) => any; + onloadeddata: (this: Window, ev: Event) => any; + onloadedmetadata: (this: Window, ev: Event) => any; + onloadstart: (this: Window, ev: Event) => any; + onmessage: (this: Window, ev: MessageEvent) => any; + onmousedown: (this: Window, ev: MouseEvent) => any; + onmouseenter: (this: Window, ev: MouseEvent) => any; + onmouseleave: (this: Window, ev: MouseEvent) => any; + onmousemove: (this: Window, ev: MouseEvent) => any; + onmouseout: (this: Window, ev: MouseEvent) => any; + onmouseover: (this: Window, ev: MouseEvent) => any; + onmouseup: (this: Window, ev: MouseEvent) => any; + onmousewheel: (this: Window, ev: WheelEvent) => any; + onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; + onmsgestureend: (this: Window, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; + onmspointercancel: (this: Window, ev: MSPointerEvent) => any; + onmspointerdown: (this: Window, ev: MSPointerEvent) => any; + onmspointerenter: (this: Window, ev: MSPointerEvent) => any; + onmspointerleave: (this: Window, ev: MSPointerEvent) => any; + onmspointermove: (this: Window, ev: MSPointerEvent) => any; + onmspointerout: (this: Window, ev: MSPointerEvent) => any; + onmspointerover: (this: Window, ev: MSPointerEvent) => any; + onmspointerup: (this: Window, ev: MSPointerEvent) => any; + onoffline: (this: Window, ev: Event) => any; + ononline: (this: Window, ev: Event) => any; + onorientationchange: (this: Window, ev: Event) => any; + onpagehide: (this: Window, ev: PageTransitionEvent) => any; + onpageshow: (this: Window, ev: PageTransitionEvent) => any; + onpause: (this: Window, ev: Event) => any; + onplay: (this: Window, ev: Event) => any; + onplaying: (this: Window, ev: Event) => any; + onpopstate: (this: Window, ev: PopStateEvent) => any; + onprogress: (this: Window, ev: ProgressEvent) => any; + onratechange: (this: Window, ev: Event) => any; + onreadystatechange: (this: Window, ev: ProgressEvent) => any; + onreset: (this: Window, ev: Event) => any; + onresize: (this: Window, ev: UIEvent) => any; + onscroll: (this: Window, ev: UIEvent) => any; + onseeked: (this: Window, ev: Event) => any; + onseeking: (this: Window, ev: Event) => any; + onselect: (this: Window, ev: UIEvent) => any; + onstalled: (this: Window, ev: Event) => any; + onstorage: (this: Window, ev: StorageEvent) => any; + onsubmit: (this: Window, ev: Event) => any; + onsuspend: (this: Window, ev: Event) => any; + ontimeupdate: (this: Window, ev: Event) => any; ontouchcancel: (ev: TouchEvent) => any; ontouchend: (ev: TouchEvent) => any; ontouchmove: (ev: TouchEvent) => any; ontouchstart: (ev: TouchEvent) => any; - onunload: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; + onunload: (this: Window, ev: Event) => any; + onvolumechange: (this: Window, ev: Event) => any; + onwaiting: (this: Window, ev: Event) => any; opener: any; orientation: string | number; readonly outerHeight: number; @@ -18897,101 +18077,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window 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; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - 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: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -19000,12 +18086,15 @@ declare var Window: { new(): Window; } +interface WorkerEventMap extends AbstractWorkerEventMap { + "message": MessageEvent; +} + interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: this, ev: MessageEvent) => any; + onmessage: (this: Worker, ev: MessageEvent) => any; postMessage(message: any, ports?: any): void; terminate(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -19015,6 +18104,8 @@ declare var Worker: { } interface XMLDocument extends Document { + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var XMLDocument: { @@ -19022,8 +18113,12 @@ declare var XMLDocument: { new(): XMLDocument; } +interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { + "readystatechange": Event; +} + interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: this, ev: Event) => any; + onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; readonly readyState: number; readonly response: any; readonly responseText: string; @@ -19051,14 +18146,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { readonly LOADING: number; readonly OPENED: number; readonly UNSENT: number; - 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: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", 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: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -19074,6 +18162,7 @@ declare var XMLHttpRequest: { } interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -19094,7 +18183,7 @@ declare var XMLSerializer: { interface XPathEvaluator { createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; } declare var XPathEvaluator: { @@ -19103,7 +18192,7 @@ declare var XPathEvaluator: { } interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; + evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult; } declare var XPathExpression: { @@ -19173,9 +18262,13 @@ declare var XSLTProcessor: { new(): XSLTProcessor; } +interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + interface AbstractWorker { - onerror: (this: this, ev: ErrorEvent) => any; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + onerror: (this: AbstractWorker, ev: ErrorEvent) => any; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -19286,25 +18379,29 @@ interface GetSVGDocument { getSVGDocument(): Document; } +interface GlobalEventHandlersEventMap { + "pointercancel": PointerEvent; + "pointerdown": PointerEvent; + "pointerenter": PointerEvent; + "pointerleave": PointerEvent; + "pointermove": PointerEvent; + "pointerout": PointerEvent; + "pointerover": PointerEvent; + "pointerup": PointerEvent; + "wheel": WheelEvent; +} + interface GlobalEventHandlers { - onpointercancel: (this: this, ev: PointerEvent) => any; - onpointerdown: (this: this, ev: PointerEvent) => any; - onpointerenter: (this: this, ev: PointerEvent) => any; - onpointerleave: (this: this, ev: PointerEvent) => any; - onpointermove: (this: this, ev: PointerEvent) => any; - onpointerout: (this: this, ev: PointerEvent) => any; - onpointerover: (this: this, ev: PointerEvent) => any; - onpointerup: (this: this, ev: PointerEvent) => any; - onwheel: (this: this, ev: WheelEvent) => any; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; + onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any; + addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -19331,25 +18428,29 @@ interface LinkStyle { readonly sheet: StyleSheet; } +interface MSBaseReaderEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; +} + interface MSBaseReader { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; + onabort: (this: MSBaseReader, ev: Event) => any; + onerror: (this: MSBaseReader, ev: ErrorEvent) => any; + onload: (this: MSBaseReader, ev: Event) => any; + onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; + onloadstart: (this: MSBaseReader, ev: Event) => any; + onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; readonly readyState: number; readonly result: any; abort(): void; readonly DONE: number; readonly EMPTY: number; readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -19398,359 +18499,9 @@ interface NavigatorUserMedia { } interface NodeSelector { - 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: K): ElementTagNameMap[K] | null; querySelector(selectors: string): Element | null; - querySelectorAll(selectors: "a"): NodeListOf; - querySelectorAll(selectors: "abbr"): NodeListOf; - querySelectorAll(selectors: "acronym"): NodeListOf; - querySelectorAll(selectors: "address"): NodeListOf; - querySelectorAll(selectors: "applet"): NodeListOf; - querySelectorAll(selectors: "area"): NodeListOf; - querySelectorAll(selectors: "article"): NodeListOf; - querySelectorAll(selectors: "aside"): NodeListOf; - querySelectorAll(selectors: "audio"): NodeListOf; - querySelectorAll(selectors: "b"): NodeListOf; - querySelectorAll(selectors: "base"): NodeListOf; - querySelectorAll(selectors: "basefont"): NodeListOf; - querySelectorAll(selectors: "bdo"): NodeListOf; - querySelectorAll(selectors: "big"): NodeListOf; - querySelectorAll(selectors: "blockquote"): NodeListOf; - querySelectorAll(selectors: "body"): NodeListOf; - querySelectorAll(selectors: "br"): NodeListOf; - querySelectorAll(selectors: "button"): NodeListOf; - querySelectorAll(selectors: "canvas"): NodeListOf; - querySelectorAll(selectors: "caption"): NodeListOf; - querySelectorAll(selectors: "center"): NodeListOf; - querySelectorAll(selectors: "circle"): NodeListOf; - querySelectorAll(selectors: "cite"): NodeListOf; - querySelectorAll(selectors: "clippath"): NodeListOf; - querySelectorAll(selectors: "code"): NodeListOf; - querySelectorAll(selectors: "col"): NodeListOf; - querySelectorAll(selectors: "colgroup"): NodeListOf; - querySelectorAll(selectors: "datalist"): NodeListOf; - querySelectorAll(selectors: "dd"): NodeListOf; - querySelectorAll(selectors: "defs"): NodeListOf; - querySelectorAll(selectors: "del"): NodeListOf; - querySelectorAll(selectors: "desc"): NodeListOf; - querySelectorAll(selectors: "dfn"): NodeListOf; - querySelectorAll(selectors: "dir"): NodeListOf; - querySelectorAll(selectors: "div"): NodeListOf; - querySelectorAll(selectors: "dl"): NodeListOf; - querySelectorAll(selectors: "dt"): NodeListOf; - querySelectorAll(selectors: "ellipse"): NodeListOf; - querySelectorAll(selectors: "em"): NodeListOf; - querySelectorAll(selectors: "embed"): NodeListOf; - querySelectorAll(selectors: "feblend"): NodeListOf; - querySelectorAll(selectors: "fecolormatrix"): NodeListOf; - querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf; - querySelectorAll(selectors: "fecomposite"): NodeListOf; - querySelectorAll(selectors: "feconvolvematrix"): NodeListOf; - querySelectorAll(selectors: "fediffuselighting"): NodeListOf; - querySelectorAll(selectors: "fedisplacementmap"): NodeListOf; - querySelectorAll(selectors: "fedistantlight"): NodeListOf; - querySelectorAll(selectors: "feflood"): NodeListOf; - querySelectorAll(selectors: "fefunca"): NodeListOf; - querySelectorAll(selectors: "fefuncb"): NodeListOf; - querySelectorAll(selectors: "fefuncg"): NodeListOf; - querySelectorAll(selectors: "fefuncr"): NodeListOf; - querySelectorAll(selectors: "fegaussianblur"): NodeListOf; - querySelectorAll(selectors: "feimage"): NodeListOf; - querySelectorAll(selectors: "femerge"): NodeListOf; - querySelectorAll(selectors: "femergenode"): NodeListOf; - querySelectorAll(selectors: "femorphology"): NodeListOf; - querySelectorAll(selectors: "feoffset"): NodeListOf; - querySelectorAll(selectors: "fepointlight"): NodeListOf; - querySelectorAll(selectors: "fespecularlighting"): NodeListOf; - querySelectorAll(selectors: "fespotlight"): NodeListOf; - querySelectorAll(selectors: "fetile"): NodeListOf; - querySelectorAll(selectors: "feturbulence"): NodeListOf; - querySelectorAll(selectors: "fieldset"): NodeListOf; - querySelectorAll(selectors: "figcaption"): NodeListOf; - querySelectorAll(selectors: "figure"): NodeListOf; - querySelectorAll(selectors: "filter"): NodeListOf; - querySelectorAll(selectors: "font"): NodeListOf; - querySelectorAll(selectors: "footer"): NodeListOf; - querySelectorAll(selectors: "foreignobject"): NodeListOf; - querySelectorAll(selectors: "form"): NodeListOf; - querySelectorAll(selectors: "frame"): NodeListOf; - querySelectorAll(selectors: "frameset"): NodeListOf; - querySelectorAll(selectors: "g"): NodeListOf; - querySelectorAll(selectors: "h1"): NodeListOf; - querySelectorAll(selectors: "h2"): NodeListOf; - querySelectorAll(selectors: "h3"): NodeListOf; - querySelectorAll(selectors: "h4"): NodeListOf; - querySelectorAll(selectors: "h5"): NodeListOf; - querySelectorAll(selectors: "h6"): NodeListOf; - querySelectorAll(selectors: "head"): NodeListOf; - querySelectorAll(selectors: "header"): NodeListOf; - querySelectorAll(selectors: "hgroup"): NodeListOf; - querySelectorAll(selectors: "hr"): NodeListOf; - querySelectorAll(selectors: "html"): NodeListOf; - querySelectorAll(selectors: "i"): NodeListOf; - querySelectorAll(selectors: "iframe"): NodeListOf; - querySelectorAll(selectors: "image"): NodeListOf; - querySelectorAll(selectors: "img"): NodeListOf; - querySelectorAll(selectors: "input"): NodeListOf; - querySelectorAll(selectors: "ins"): NodeListOf; - querySelectorAll(selectors: "isindex"): NodeListOf; - querySelectorAll(selectors: "kbd"): NodeListOf; - querySelectorAll(selectors: "keygen"): NodeListOf; - querySelectorAll(selectors: "label"): NodeListOf; - querySelectorAll(selectors: "legend"): NodeListOf; - querySelectorAll(selectors: "li"): NodeListOf; - querySelectorAll(selectors: "line"): NodeListOf; - querySelectorAll(selectors: "lineargradient"): NodeListOf; - querySelectorAll(selectors: "link"): NodeListOf; - querySelectorAll(selectors: "listing"): NodeListOf; - querySelectorAll(selectors: "map"): NodeListOf; - querySelectorAll(selectors: "mark"): NodeListOf; - querySelectorAll(selectors: "marker"): NodeListOf; - querySelectorAll(selectors: "marquee"): NodeListOf; - querySelectorAll(selectors: "mask"): NodeListOf; - querySelectorAll(selectors: "menu"): NodeListOf; - querySelectorAll(selectors: "meta"): NodeListOf; - querySelectorAll(selectors: "metadata"): NodeListOf; - querySelectorAll(selectors: "meter"): NodeListOf; - querySelectorAll(selectors: "nav"): NodeListOf; - querySelectorAll(selectors: "nextid"): NodeListOf; - querySelectorAll(selectors: "nobr"): NodeListOf; - querySelectorAll(selectors: "noframes"): NodeListOf; - querySelectorAll(selectors: "noscript"): NodeListOf; - querySelectorAll(selectors: "object"): NodeListOf; - querySelectorAll(selectors: "ol"): NodeListOf; - querySelectorAll(selectors: "optgroup"): NodeListOf; - querySelectorAll(selectors: "option"): NodeListOf; - querySelectorAll(selectors: "p"): NodeListOf; - querySelectorAll(selectors: "param"): NodeListOf; - querySelectorAll(selectors: "path"): NodeListOf; - querySelectorAll(selectors: "pattern"): NodeListOf; - querySelectorAll(selectors: "picture"): NodeListOf; - querySelectorAll(selectors: "plaintext"): NodeListOf; - querySelectorAll(selectors: "polygon"): NodeListOf; - querySelectorAll(selectors: "polyline"): NodeListOf; - querySelectorAll(selectors: "pre"): NodeListOf; - querySelectorAll(selectors: "progress"): NodeListOf; - querySelectorAll(selectors: "q"): NodeListOf; - querySelectorAll(selectors: "radialgradient"): NodeListOf; - querySelectorAll(selectors: "rect"): NodeListOf; - querySelectorAll(selectors: "rt"): NodeListOf; - querySelectorAll(selectors: "ruby"): NodeListOf; - querySelectorAll(selectors: "s"): NodeListOf; - querySelectorAll(selectors: "samp"): NodeListOf; - querySelectorAll(selectors: "script"): NodeListOf; - querySelectorAll(selectors: "section"): NodeListOf; - querySelectorAll(selectors: "select"): NodeListOf; - querySelectorAll(selectors: "small"): NodeListOf; - querySelectorAll(selectors: "source"): NodeListOf; - querySelectorAll(selectors: "span"): NodeListOf; - querySelectorAll(selectors: "stop"): NodeListOf; - querySelectorAll(selectors: "strike"): NodeListOf; - querySelectorAll(selectors: "strong"): NodeListOf; - querySelectorAll(selectors: "style"): NodeListOf; - querySelectorAll(selectors: "sub"): NodeListOf; - querySelectorAll(selectors: "sup"): NodeListOf; - querySelectorAll(selectors: "svg"): NodeListOf; - querySelectorAll(selectors: "switch"): NodeListOf; - querySelectorAll(selectors: "symbol"): NodeListOf; - querySelectorAll(selectors: "table"): NodeListOf; - querySelectorAll(selectors: "tbody"): NodeListOf; - querySelectorAll(selectors: "td"): NodeListOf; - querySelectorAll(selectors: "template"): NodeListOf; - querySelectorAll(selectors: "text"): NodeListOf; - querySelectorAll(selectors: "textpath"): NodeListOf; - querySelectorAll(selectors: "textarea"): NodeListOf; - querySelectorAll(selectors: "tfoot"): NodeListOf; - querySelectorAll(selectors: "th"): NodeListOf; - querySelectorAll(selectors: "thead"): NodeListOf; - querySelectorAll(selectors: "title"): NodeListOf; - querySelectorAll(selectors: "tr"): NodeListOf; - querySelectorAll(selectors: "track"): NodeListOf; - querySelectorAll(selectors: "tspan"): NodeListOf; - querySelectorAll(selectors: "tt"): NodeListOf; - querySelectorAll(selectors: "u"): NodeListOf; - querySelectorAll(selectors: "ul"): NodeListOf; - querySelectorAll(selectors: "use"): NodeListOf; - querySelectorAll(selectors: "var"): NodeListOf; - querySelectorAll(selectors: "video"): NodeListOf; - querySelectorAll(selectors: "view"): NodeListOf; - querySelectorAll(selectors: "wbr"): NodeListOf; - querySelectorAll(selectors: "x-ms-webview"): NodeListOf; - querySelectorAll(selectors: "xmp"): NodeListOf; + querySelectorAll(selectors: K): ElementListTagNameMap[K]; querySelectorAll(selectors: string): NodeListOf; } @@ -19850,21 +18601,25 @@ interface WindowTimersExtension { setImmediate(handler: any, ...args: any[]): number; } +interface XMLHttpRequestEventTargetEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; + "timeout": ProgressEvent; +} + interface XMLHttpRequestEventTarget { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - ontimeout: (this: this, ev: ProgressEvent) => any; - 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; + onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -20124,6 +18879,33 @@ interface ParentNode { readonly childElementCount: number; } +interface DocumentOrShadowRoot { + readonly activeElement: Element | null; + readonly stylesheets: StyleSheetList; + getSelection(): Selection | null; + elementFromPoint(x: number, y: number): Element | null; + elementsFromPoint(x: number, y: number): Element[]; +} + +interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment { + readonly host: Element; + innerHTML: string; +} + +interface ShadowRootInit { + mode: 'open'|'closed'; + delegatesFocus?: boolean; +} + +interface HTMLSlotElement extends HTMLElement { + name: string; + assignedNodes(options?: AssignedNodesOptions): Node[]; +} + +interface AssignedNodesOptions { + flatten?: boolean; +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -20171,6 +18953,447 @@ interface NavigatorUserMediaErrorCallback { interface ForEachCallback { (keyId: any, status: string): void; } +interface HTMLElementTagNameMap { + "a": HTMLAnchorElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "audio": HTMLAudioElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "datalist": HTMLDataListElement; + "del": HTMLModElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "embed": HTMLEmbedElement; + "fieldset": HTMLFieldSetElement; + "font": HTMLFontElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "iframe": HTMLIFrameElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "marquee": HTMLMarqueeElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "meter": HTMLMeterElement; + "nextid": HTMLUnknownElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "picture": HTMLPictureElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "script": HTMLScriptElement; + "select": HTMLSelectElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "style": HTMLStyleElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "ul": HTMLUListElement; + "video": HTMLVideoElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementTagNameMap { + "a": HTMLAnchorElement; + "abbr": HTMLElement; + "acronym": HTMLElement; + "address": HTMLElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "article": HTMLElement; + "aside": HTMLElement; + "audio": HTMLAudioElement; + "b": HTMLElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "bdo": HTMLElement; + "big": HTMLElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "center": HTMLElement; + "circle": SVGCircleElement; + "cite": HTMLElement; + "clippath": SVGClipPathElement; + "code": HTMLElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "datalist": HTMLDataListElement; + "dd": HTMLElement; + "defs": SVGDefsElement; + "del": HTMLModElement; + "desc": SVGDescElement; + "dfn": HTMLElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "dt": HTMLElement; + "ellipse": SVGEllipseElement; + "em": HTMLElement; + "embed": HTMLEmbedElement; + "feblend": SVGFEBlendElement; + "fecolormatrix": SVGFEColorMatrixElement; + "fecomponenttransfer": SVGFEComponentTransferElement; + "fecomposite": SVGFECompositeElement; + "feconvolvematrix": SVGFEConvolveMatrixElement; + "fediffuselighting": SVGFEDiffuseLightingElement; + "fedisplacementmap": SVGFEDisplacementMapElement; + "fedistantlight": SVGFEDistantLightElement; + "feflood": SVGFEFloodElement; + "fefunca": SVGFEFuncAElement; + "fefuncb": SVGFEFuncBElement; + "fefuncg": SVGFEFuncGElement; + "fefuncr": SVGFEFuncRElement; + "fegaussianblur": SVGFEGaussianBlurElement; + "feimage": SVGFEImageElement; + "femerge": SVGFEMergeElement; + "femergenode": SVGFEMergeNodeElement; + "femorphology": SVGFEMorphologyElement; + "feoffset": SVGFEOffsetElement; + "fepointlight": SVGFEPointLightElement; + "fespecularlighting": SVGFESpecularLightingElement; + "fespotlight": SVGFESpotLightElement; + "fetile": SVGFETileElement; + "feturbulence": SVGFETurbulenceElement; + "fieldset": HTMLFieldSetElement; + "figcaption": HTMLElement; + "figure": HTMLElement; + "filter": SVGFilterElement; + "font": HTMLFontElement; + "footer": HTMLElement; + "foreignobject": SVGForeignObjectElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "g": SVGGElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "header": HTMLElement; + "hgroup": HTMLElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "i": HTMLElement; + "iframe": HTMLIFrameElement; + "image": SVGImageElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "kbd": HTMLElement; + "keygen": HTMLElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "line": SVGLineElement; + "lineargradient": SVGLinearGradientElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "mark": HTMLElement; + "marker": SVGMarkerElement; + "marquee": HTMLMarqueeElement; + "mask": SVGMaskElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "metadata": SVGMetadataElement; + "meter": HTMLMeterElement; + "nav": HTMLElement; + "nextid": HTMLUnknownElement; + "nobr": HTMLElement; + "noframes": HTMLElement; + "noscript": HTMLElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "path": SVGPathElement; + "pattern": SVGPatternElement; + "picture": HTMLPictureElement; + "plaintext": HTMLElement; + "polygon": SVGPolygonElement; + "polyline": SVGPolylineElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "radialgradient": SVGRadialGradientElement; + "rect": SVGRectElement; + "rt": HTMLElement; + "ruby": HTMLElement; + "s": HTMLElement; + "samp": HTMLElement; + "script": HTMLScriptElement; + "section": HTMLElement; + "select": HTMLSelectElement; + "small": HTMLElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "stop": SVGStopElement; + "strike": HTMLElement; + "strong": HTMLElement; + "style": HTMLStyleElement; + "sub": HTMLElement; + "sup": HTMLElement; + "svg": SVGSVGElement; + "switch": SVGSwitchElement; + "symbol": SVGSymbolElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "text": SVGTextElement; + "textpath": SVGTextPathElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "tspan": SVGTSpanElement; + "tt": HTMLElement; + "u": HTMLElement; + "ul": HTMLUListElement; + "use": SVGUseElement; + "var": HTMLElement; + "video": HTMLVideoElement; + "view": SVGViewElement; + "wbr": HTMLElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementListTagNameMap { + "a": NodeListOf; + "abbr": NodeListOf; + "acronym": NodeListOf; + "address": NodeListOf; + "applet": NodeListOf; + "area": NodeListOf; + "article": NodeListOf; + "aside": NodeListOf; + "audio": NodeListOf; + "b": NodeListOf; + "base": NodeListOf; + "basefont": NodeListOf; + "bdo": NodeListOf; + "big": NodeListOf; + "blockquote": NodeListOf; + "body": NodeListOf; + "br": NodeListOf; + "button": NodeListOf; + "canvas": NodeListOf; + "caption": NodeListOf; + "center": NodeListOf; + "circle": NodeListOf; + "cite": NodeListOf; + "clippath": NodeListOf; + "code": NodeListOf; + "col": NodeListOf; + "colgroup": NodeListOf; + "datalist": NodeListOf; + "dd": NodeListOf; + "defs": NodeListOf; + "del": NodeListOf; + "desc": NodeListOf; + "dfn": NodeListOf; + "dir": NodeListOf; + "div": NodeListOf; + "dl": NodeListOf; + "dt": NodeListOf; + "ellipse": NodeListOf; + "em": NodeListOf; + "embed": NodeListOf; + "feblend": NodeListOf; + "fecolormatrix": NodeListOf; + "fecomponenttransfer": NodeListOf; + "fecomposite": NodeListOf; + "feconvolvematrix": NodeListOf; + "fediffuselighting": NodeListOf; + "fedisplacementmap": NodeListOf; + "fedistantlight": NodeListOf; + "feflood": NodeListOf; + "fefunca": NodeListOf; + "fefuncb": NodeListOf; + "fefuncg": NodeListOf; + "fefuncr": NodeListOf; + "fegaussianblur": NodeListOf; + "feimage": NodeListOf; + "femerge": NodeListOf; + "femergenode": NodeListOf; + "femorphology": NodeListOf; + "feoffset": NodeListOf; + "fepointlight": NodeListOf; + "fespecularlighting": NodeListOf; + "fespotlight": NodeListOf; + "fetile": NodeListOf; + "feturbulence": NodeListOf; + "fieldset": NodeListOf; + "figcaption": NodeListOf; + "figure": NodeListOf; + "filter": NodeListOf; + "font": NodeListOf; + "footer": NodeListOf; + "foreignobject": NodeListOf; + "form": NodeListOf; + "frame": NodeListOf; + "frameset": NodeListOf; + "g": NodeListOf; + "h1": NodeListOf; + "h2": NodeListOf; + "h3": NodeListOf; + "h4": NodeListOf; + "h5": NodeListOf; + "h6": NodeListOf; + "head": NodeListOf; + "header": NodeListOf; + "hgroup": NodeListOf; + "hr": NodeListOf; + "html": NodeListOf; + "i": NodeListOf; + "iframe": NodeListOf; + "image": NodeListOf; + "img": NodeListOf; + "input": NodeListOf; + "ins": NodeListOf; + "isindex": NodeListOf; + "kbd": NodeListOf; + "keygen": NodeListOf; + "label": NodeListOf; + "legend": NodeListOf; + "li": NodeListOf; + "line": NodeListOf; + "lineargradient": NodeListOf; + "link": NodeListOf; + "listing": NodeListOf; + "map": NodeListOf; + "mark": NodeListOf; + "marker": NodeListOf; + "marquee": NodeListOf; + "mask": NodeListOf; + "menu": NodeListOf; + "meta": NodeListOf; + "metadata": NodeListOf; + "meter": NodeListOf; + "nav": NodeListOf; + "nextid": NodeListOf; + "nobr": NodeListOf; + "noframes": NodeListOf; + "noscript": NodeListOf; + "object": NodeListOf; + "ol": NodeListOf; + "optgroup": NodeListOf; + "option": NodeListOf; + "p": NodeListOf; + "param": NodeListOf; + "path": NodeListOf; + "pattern": NodeListOf; + "picture": NodeListOf; + "plaintext": NodeListOf; + "polygon": NodeListOf; + "polyline": NodeListOf; + "pre": NodeListOf; + "progress": NodeListOf; + "q": NodeListOf; + "radialgradient": NodeListOf; + "rect": NodeListOf; + "rt": NodeListOf; + "ruby": NodeListOf; + "s": NodeListOf; + "samp": NodeListOf; + "script": NodeListOf; + "section": NodeListOf; + "select": NodeListOf; + "small": NodeListOf; + "source": NodeListOf; + "span": NodeListOf; + "stop": NodeListOf; + "strike": NodeListOf; + "strong": NodeListOf; + "style": NodeListOf; + "sub": NodeListOf; + "sup": NodeListOf; + "svg": NodeListOf; + "switch": NodeListOf; + "symbol": NodeListOf; + "table": NodeListOf; + "tbody": NodeListOf; + "td": NodeListOf; + "template": NodeListOf; + "text": NodeListOf; + "textpath": NodeListOf; + "textarea": NodeListOf; + "tfoot": NodeListOf; + "th": NodeListOf; + "thead": NodeListOf; + "title": NodeListOf; + "tr": NodeListOf; + "track": NodeListOf; + "tspan": NodeListOf; + "tt": NodeListOf; + "u": NodeListOf; + "ul": NodeListOf; + "use": NodeListOf; + "var": NodeListOf; + "video": NodeListOf; + "view": NodeListOf; + "wbr": NodeListOf; + "x-ms-webview": NodeListOf; + "xmp": NodeListOf; +} + declare var Audio: {new(src?: string): HTMLAudioElement; }; declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; @@ -20345,7 +19568,6 @@ 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; declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function clearInterval(handle: number): void; @@ -20372,101 +19594,7 @@ declare var onwheel: (this: Window, ev: WheelEvent) => any; declare var indexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; -declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; type AAGUID = string; type AlgorithmIdentifier = string | Algorithm; diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index b505b17a0d1..4ee2566928d 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -28,6 +28,7 @@ interface Algorithm { } interface EventInit { + scoped?: boolean; bubbles?: boolean; cancelable?: boolean; } @@ -262,10 +263,12 @@ interface Event { readonly target: EventTarget; readonly timeStamp: number; readonly type: string; + readonly scoped: boolean; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; + deepPath(): EventTarget[]; readonly AT_TARGET: number; readonly BUBBLING_PHASE: number; readonly CAPTURING_PHASE: number; @@ -318,6 +321,7 @@ interface FileReader extends EventTarget, MSBaseReader { readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -359,11 +363,16 @@ declare var IDBCursorWithValue: { new(): IDBCursorWithValue; } +interface IDBDatabaseEventMap { + "abort": Event; + "error": ErrorEvent; +} + interface IDBDatabase extends EventTarget { readonly name: string; readonly objectStoreNames: DOMStringList; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onabort: (this: IDBDatabase, ev: Event) => any; + onerror: (this: IDBDatabase, ev: ErrorEvent) => any; version: number; onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; @@ -371,8 +380,7 @@ interface IDBDatabase extends EventTarget { deleteObjectStore(name: string): void; transaction(storeNames: string | string[], mode?: string): IDBTransaction; addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - 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: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -449,13 +457,15 @@ declare var IDBObjectStore: { new(): IDBObjectStore; } +interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { + "blocked": Event; + "upgradeneeded": IDBVersionChangeEvent; +} + interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: this, ev: Event) => any; - onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; - addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + onblocked: (this: IDBOpenDBRequest, ev: Event) => any; + onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; + addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -464,16 +474,20 @@ declare var IDBOpenDBRequest: { new(): IDBOpenDBRequest; } +interface IDBRequestEventMap { + "error": ErrorEvent; + "success": Event; +} + interface IDBRequest extends EventTarget { readonly error: DOMError; - onerror: (this: this, ev: ErrorEvent) => any; - onsuccess: (this: this, ev: Event) => any; + onerror: (this: IDBRequest, ev: ErrorEvent) => any; + onsuccess: (this: IDBRequest, ev: Event) => any; readonly readyState: string; readonly result: any; source: IDBObjectStore | IDBIndex | IDBCursor; readonly transaction: IDBTransaction; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -482,21 +496,25 @@ declare var IDBRequest: { new(): IDBRequest; } +interface IDBTransactionEventMap { + "abort": Event; + "complete": Event; + "error": ErrorEvent; +} + interface IDBTransaction extends EventTarget { readonly db: IDBDatabase; readonly error: DOMError; readonly mode: string; - onabort: (this: this, ev: Event) => any; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + onabort: (this: IDBTransaction, ev: Event) => any; + oncomplete: (this: IDBTransaction, ev: Event) => any; + onerror: (this: IDBTransaction, ev: ErrorEvent) => any; abort(): void; objectStore(name: string): IDBObjectStore; readonly READ_ONLY: string; readonly READ_WRITE: string; readonly VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -553,18 +571,22 @@ interface MSApp { } declare var MSApp: MSApp; +interface MSAppAsyncOperationEventMap { + "complete": Event; + "error": ErrorEvent; +} + interface MSAppAsyncOperation extends EventTarget { readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; + oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; + onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any; readonly readyState: number; readonly result: any; start(): void; readonly COMPLETED: number; readonly ERROR: number; readonly STARTED: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -604,6 +626,7 @@ interface MSStreamReader extends EventTarget, MSBaseReader { readAsBlob(stream: MSStream, size?: number): void; readAsDataURL(stream: MSStream, size?: number): void; readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -647,12 +670,16 @@ declare var MessageEvent: { new(type: string, eventInitDict?: MessageEventInit): MessageEvent; } +interface MessagePortEventMap { + "message": MessageEvent; +} + interface MessagePort extends EventTarget { - onmessage: (this: this, ev: MessageEvent) => any; + onmessage: (this: MessagePort, ev: MessageEvent) => any; close(): void; postMessage(message?: any, ports?: any): void; start(): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -700,14 +727,21 @@ declare var ProgressEvent: { new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; } +interface WebSocketEventMap { + "close": CloseEvent; + "error": ErrorEvent; + "message": MessageEvent; + "open": Event; +} + interface WebSocket extends EventTarget { binaryType: string; readonly bufferedAmount: number; readonly extensions: string; - onclose: (this: this, ev: CloseEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onopen: (this: this, ev: Event) => any; + onclose: (this: WebSocket, ev: CloseEvent) => any; + onerror: (this: WebSocket, ev: ErrorEvent) => any; + onmessage: (this: WebSocket, ev: MessageEvent) => any; + onopen: (this: WebSocket, ev: Event) => any; readonly protocol: string; readonly readyState: number; readonly url: string; @@ -717,10 +751,7 @@ interface WebSocket extends EventTarget { readonly CLOSING: number; readonly CONNECTING: number; readonly OPEN: number; - addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -733,12 +764,15 @@ declare var WebSocket: { readonly OPEN: number; } +interface WorkerEventMap extends AbstractWorkerEventMap { + "message": MessageEvent; +} + interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: this, ev: MessageEvent) => any; + onmessage: (this: Worker, ev: MessageEvent) => any; postMessage(message: any, ports?: any): void; terminate(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -747,8 +781,12 @@ declare var Worker: { new(stringUrl: string): Worker; } +interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { + "readystatechange": Event; +} + interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: this, ev: Event) => any; + onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; readonly readyState: number; readonly response: any; readonly responseText: string; @@ -775,14 +813,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { readonly LOADING: number; readonly OPENED: number; readonly UNSENT: number; - 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: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", 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: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -798,6 +829,7 @@ declare var XMLHttpRequest: { } interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -806,31 +838,39 @@ declare var XMLHttpRequestUpload: { new(): XMLHttpRequestUpload; } +interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + interface AbstractWorker { - onerror: (this: this, ev: ErrorEvent) => any; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; + onerror: (this: AbstractWorker, ev: ErrorEvent) => any; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface MSBaseReaderEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; +} + interface MSBaseReader { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; + onabort: (this: MSBaseReader, ev: Event) => any; + onerror: (this: MSBaseReader, ev: ErrorEvent) => any; + onload: (this: MSBaseReader, ev: Event) => any; + onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; + onloadstart: (this: MSBaseReader, ev: Event) => any; + onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; readonly readyState: number; readonly result: any; abort(): void; readonly DONE: number; readonly EMPTY: number; readonly LOADING: 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -858,21 +898,25 @@ interface WindowConsole { readonly console: Console; } +interface XMLHttpRequestEventTargetEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; + "timeout": ProgressEvent; +} + interface XMLHttpRequestEventTarget { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - ontimeout: (this: this, ev: ProgressEvent) => any; - 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: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; + onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; + onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -888,15 +932,18 @@ declare var FileReaderSync: { new(): FileReaderSync; } +interface WorkerGlobalScopeEventMap extends DedicatedWorkerGlobalScopeEventMap { + "error": ErrorEvent; +} + interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole { readonly location: WorkerLocation; - onerror: (this: this, ev: ErrorEvent) => any; + onerror: (this: WorkerGlobalScope, ev: ErrorEvent) => any; readonly self: WorkerGlobalScope; close(): void; msWriteProfilerMark(profilerMarkName: string): void; toString(): string; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -924,7 +971,6 @@ declare var WorkerLocation: { interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine { readonly hardwareConcurrency: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var WorkerNavigator: { @@ -932,10 +978,14 @@ declare var WorkerNavigator: { new(): WorkerNavigator; } +interface DedicatedWorkerGlobalScopeEventMap { + "message": MessageEvent; +} + interface DedicatedWorkerGlobalScope { - onmessage: (this: this, ev: MessageEvent) => any; + onmessage: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any; postMessage(data: any): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -1196,7 +1246,6 @@ declare var self: WorkerGlobalScope; declare function close(): void; declare function msWriteProfilerMark(profilerMarkName: string): void; declare function toString(): string; -declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare var indexedDB: IDBFactory; @@ -1217,8 +1266,7 @@ declare function btoa(rawString: string): string; declare var onmessage: (this: WorkerGlobalScope, ev: MessageEvent) => any; declare function postMessage(data: any): void; declare var console: Console; -declare function addEventListener(type: "error", listener: (this: WorkerGlobalScope, ev: ErrorEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "message", listener: (this: WorkerGlobalScope, ev: MessageEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; type AlgorithmIdentifier = string | Algorithm; type IDBKeyPath = string; diff --git a/lib/protocol.d.ts b/lib/protocol.d.ts index 855a4f5fe00..f3737c76c46 100644 --- a/lib/protocol.d.ts +++ b/lib/protocol.d.ts @@ -680,9 +680,13 @@ declare namespace ts.server.protocol { */ options: ExternalProjectCompilerOptions; /** - * Explicitly specified typing options for the project + * @deprecated typingOptions. Use typeAcquisition instead */ - typingOptions?: TypingOptions; + typingOptions?: TypeAcquisition; + /** + * Explicitly specified type acquisition for the project + */ + typeAcquisition?: TypeAcquisition; } interface CompileOnSaveMixin { /** @@ -707,6 +711,10 @@ declare namespace ts.server.protocol { * List of removed files */ removed: string[]; + /** + * List of updated files + */ + updated: string[]; } /** * Information found in a configure request. @@ -725,6 +733,10 @@ declare namespace ts.server.protocol { * The format options to use during formatting and other code editing features. */ formatOptions?: FormatCodeSettings; + /** + * The host's additional supported file extensions + */ + extraFileExtensions?: FileExtensionInfo[]; } /** * Configure request; value of command field is "configure". Specifies @@ -1400,6 +1412,25 @@ declare namespace ts.server.protocol { body?: ConfigFileDiagnosticEventBody; event: "configFileDiag"; } + type ProjectLanguageServiceStateEventName = "projectLanguageServiceState"; + interface ProjectLanguageServiceStateEvent extends Event { + event: ProjectLanguageServiceStateEventName; + body?: ProjectLanguageServiceStateEventBody; + } + interface ProjectLanguageServiceStateEventBody { + /** + * Project name that has changes in the state of language service. + * For configured projects this will be the config file path. + * For external projects this will be the name of the projects specified when project was open. + * For inferred projects this event is not raised. + */ + projectName: string; + /** + * True if language service state switched from disabled to enabled + * and false otherwise. + */ + languageServiceEnabled: boolean; + } /** * Arguments for reload request. */ @@ -1634,6 +1665,38 @@ declare namespace ts.server.protocol { * true if install request succeeded, otherwise - false */ installSuccess: boolean; + /** + * version of typings installer + */ + typingsInstallerVersion: string; + } + type BeginInstallTypesEventName = "beginInstallTypes"; + type EndInstallTypesEventName = "endInstallTypes"; + interface BeginInstallTypesEvent extends Event { + event: BeginInstallTypesEventName; + body: BeginInstallTypesEventBody; + } + interface EndInstallTypesEvent extends Event { + event: EndInstallTypesEventName; + body: EndInstallTypesEventBody; + } + interface InstallTypesEventBody { + /** + * correlation id to match begin and end events + */ + eventId: number; + /** + * list of packages to install + */ + packages: ReadonlyArray; + } + interface BeginInstallTypesEventBody extends InstallTypesEventBody { + } + interface EndInstallTypesEventBody extends InstallTypesEventBody { + /** + * true if installation succeeded, otherwise false + */ + success: boolean; } interface NavBarResponse extends Response { body?: NavigationBarItem[]; @@ -1783,13 +1846,20 @@ declare namespace ts.server.protocol { position: number; } - interface TypingOptions { + interface TypeAcquisition { enableAutoDiscovery?: boolean; + enable?: boolean; include?: string[]; exclude?: string[]; [option: string]: string[] | boolean | undefined; } + interface FileExtensionInfo { + extension: string; + scriptKind: ScriptKind; + isMixedContent: boolean; + } + interface MapLike { [index: string]: T; } diff --git a/lib/tsc.js b/lib/tsc.js index 1e69c7a4d16..840e832f3bf 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -21,12 +21,13 @@ var ts; return OperationCanceledException; }()); ts.OperationCanceledException = OperationCanceledException; + var ExitStatus; (function (ExitStatus) { ExitStatus[ExitStatus["Success"] = 0] = "Success"; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; - })(ts.ExitStatus || (ts.ExitStatus = {})); - var ExitStatus = ts.ExitStatus; + })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {})); + var TypeReferenceSerializationKind; (function (TypeReferenceSerializationKind) { TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown"; TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithConstructSignatureAndValue"] = 1] = "TypeWithConstructSignatureAndValue"; @@ -39,19 +40,19 @@ var ts; TypeReferenceSerializationKind[TypeReferenceSerializationKind["Promise"] = 8] = "Promise"; TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 9] = "TypeWithCallSignature"; TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 10] = "ObjectType"; - })(ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {})); - var TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind; + })(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {})); + var DiagnosticCategory; (function (DiagnosticCategory) { DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; - })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); - var DiagnosticCategory = ts.DiagnosticCategory; + })(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); + var ModuleResolutionKind; (function (ModuleResolutionKind) { ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic"; ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs"; - })(ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {})); - var ModuleResolutionKind = ts.ModuleResolutionKind; + })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {})); + var ModuleKind; (function (ModuleKind) { ModuleKind[ModuleKind["None"] = 0] = "None"; ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS"; @@ -59,8 +60,8 @@ var ts; ModuleKind[ModuleKind["UMD"] = 3] = "UMD"; ModuleKind[ModuleKind["System"] = 4] = "System"; ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015"; - })(ts.ModuleKind || (ts.ModuleKind = {})); - var ModuleKind = ts.ModuleKind; + })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {})); + var Extension; (function (Extension) { Extension[Extension["Ts"] = 0] = "Ts"; Extension[Extension["Tsx"] = 1] = "Tsx"; @@ -68,8 +69,7 @@ var ts; Extension[Extension["Js"] = 3] = "Js"; Extension[Extension["Jsx"] = 4] = "Jsx"; Extension[Extension["LastTypeScriptExtension"] = 2] = "LastTypeScriptExtension"; - })(ts.Extension || (ts.Extension = {})); - var Extension = ts.Extension; + })(Extension = ts.Extension || (ts.Extension = {})); })(ts || (ts = {})); var ts; (function (ts) { @@ -131,6 +131,9 @@ var ts; })(performance = ts.performance || (ts.performance = {})); })(ts || (ts = {})); var ts; +(function (ts) { + ts.version = "2.2.0"; +})(ts || (ts = {})); (function (ts) { var createObject = Object.create; ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; @@ -601,7 +604,7 @@ var ts; if (value === undefined) return to; if (to === undefined) - to = []; + return [value]; to.push(value); return to; } @@ -616,6 +619,14 @@ var ts; return to; } ts.addRange = addRange; + function stableSort(array, comparer) { + if (comparer === void 0) { comparer = compareValues; } + return array + .map(function (_, i) { return i; }) + .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); }) + .map(function (i) { return array[i]; }); + } + ts.stableSort = stableSort; function rangeEquals(array1, array2, pos, end) { while (pos < end) { if (array1[pos] !== array2[pos]) { @@ -770,6 +781,15 @@ var ts; } } ts.copyProperties = copyProperties; + function appendProperty(map, key, value) { + if (key === undefined || value === undefined) + return map; + if (map === undefined) + map = createMap(); + map[key] = value; + return map; + } + ts.appendProperty = appendProperty; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -793,15 +813,6 @@ var ts; return result; } ts.reduceProperties = reduceProperties; - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -1222,6 +1233,14 @@ var ts; getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS; } ts.getEmitModuleKind = getEmitModuleKind; + function getEmitModuleResolutionKind(compilerOptions) { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + } + return moduleResolution; + } + ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind; function hasZeroOrOneAsteriskCharacter(str) { var seenAsterisk = false; for (var i = 0; i < str.length; i++) { @@ -1640,8 +1659,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (needAllExtensions || extInfo.scriptKind === 3) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -1652,11 +1682,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -1772,6 +1802,16 @@ var ts; } Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); + function orderedRemoveItem(array, item) { + for (var i = 0; i < array.length; i++) { + if (array[i] === item) { + orderedRemoveItemAt(array, i); + return true; + } + } + return false; + } + ts.orderedRemoveItem = orderedRemoveItem; function orderedRemoveItemAt(array, index) { for (var i = index; i < array.length - 1; i++) { array[i] = array[i + 1]; @@ -2586,6 +2626,7 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2629,6 +2670,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -2639,6 +2681,7 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, @@ -2806,7 +2849,7 @@ var ts; Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." }, - Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." }, + Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." }, Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." }, Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." }, Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." }, @@ -2871,7 +2914,8 @@ var ts; An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, - An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." }, + The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, + _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2942,7 +2986,10 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, @@ -2984,7 +3031,7 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -3145,6 +3192,7 @@ var ts; type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, + Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", message: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, @@ -3155,9 +3203,10 @@ var ts; A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, - Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." }, + Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, - The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." }, + A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, @@ -3169,6 +3218,9 @@ var ts; Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, }; })(ts || (ts = {})); var ts; @@ -4752,6 +4804,7 @@ var ts; writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, writeLine: function () { return str_1 += " "; }, increaseIndent: ts.noop, @@ -4824,17 +4877,17 @@ var ts; ts.hasChangesInResolutions = hasChangesInResolutions; function containsParseError(node) { aggregateChildData(node); - return (node.flags & 4194304) !== 0; + return (node.flags & 131072) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.flags & 8388608)) { - var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576) !== 0) || + if (!(node.flags & 262144)) { + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { - node.flags |= 4194304; + node.flags |= 131072; } - node.flags |= 8388608; + node.flags |= 262144; } } function getSourceFileOfNode(node) { @@ -4905,28 +4958,28 @@ var ts; return !nodeIsMissing(node); } ts.nodeIsPresent = nodeIsPresent; - function getTokenPosOfNode(node, sourceFile, includeJsDocComment) { + function getTokenPosOfNode(node, sourceFile, includeJsDoc) { if (nodeIsMissing(node)) { return node.pos; } if (isJSDocNode(node)) { return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true); } - if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) { - return getTokenPosOfNode(node.jsDocComments[0]); + if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { + return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 291 && node._children.length > 0) { - return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment); + if (node.kind === 292 && node._children.length > 0) { + return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 && node.kind <= 287; + return node.kind >= 262 && node.kind <= 288; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 && node.kind <= 290; + return node.kind >= 278 && node.kind <= 291; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -5058,6 +5111,10 @@ var ts; return false; } ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { case 261: @@ -5103,7 +5160,7 @@ var ts; case 8: return name.text; case 142: - if (isStringOrNumericLiteral(name.expression.kind)) { + if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } } @@ -5225,7 +5282,8 @@ var ts; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 && node.expression.kind === 9; + return node.kind === 207 + && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -5236,25 +5294,20 @@ var ts; return ts.getLeadingCommentRanges(text, node.pos); } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; - function getJsDocComments(node, sourceFileOfNode) { - return getJsDocCommentsFromText(node, sourceFileOfNode.text); - } - ts.getJsDocComments = getJsDocComments; - function getJsDocCommentsFromText(node, text) { + function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 144 || node.kind === 143 || node.kind === 184 || node.kind === 185) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); - return ts.filter(commentRanges, isJsDocComment); - function isJsDocComment(comment) { + return ts.filter(commentRanges, function (comment) { return text.charCodeAt(comment.pos + 1) === 42 && text.charCodeAt(comment.pos + 2) === 42 && text.charCodeAt(comment.pos + 3) !== 47; - } + }); } - ts.getJsDocCommentsFromText = getJsDocCommentsFromText; + ts.getJSDocCommentRanges = getJSDocCommentRanges; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; @@ -5386,6 +5439,18 @@ var ts; } } ts.forEachYieldExpression = forEachYieldExpression; + function getRestParameterElementType(node) { + if (node && node.kind === 162) { + return node.elementType; + } + else if (node && node.kind === 157) { + return ts.singleOrUndefined(node.typeArguments); + } + else { + return undefined; + } + } + ts.getRestParameterElementType = getRestParameterElementType; function isVariableLike(node) { if (node) { switch (node.kind) { @@ -5780,6 +5845,7 @@ var ts; case 145: case 252: case 251: + case 259: return true; case 199: return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); @@ -5816,7 +5882,7 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.flags & 2097152); + return node && !!(node.flags & 65536); } ts.isInJavaScriptFile = isInJavaScriptFile; function isRequireCall(expression, checkArgumentIsStringLiteral) { @@ -5934,152 +6000,118 @@ var ts; node.parameters[0].type.kind === 276; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getJSDocTag(node, kind, checkParentVariableStatement) { - if (!node) { - return undefined; - } - var jsDocTags = getJSDocTags(node, checkParentVariableStatement); - if (!jsDocTags) { - return undefined; - } - for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) { - var tag = jsDocTags_1[_i]; - if (tag.kind === kind) { - return tag; - } - } + function getCommentsFromJSDoc(node) { + return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); } - function append(previous, additional) { - if (additional) { - if (!previous) { - previous = []; - } - for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) { - var x = additional_1[_i]; - previous.push(x); - } - } - return previous; - } - function getJSDocComments(node, checkParentVariableStatement) { - return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); }); - } - ts.getJSDocComments = getJSDocComments; - function getJSDocTags(node, checkParentVariableStatement) { - return getJSDocs(node, checkParentVariableStatement, function (docs) { + ts.getCommentsFromJSDoc = getCommentsFromJSDoc; + function getJSDocTags(node, kind) { + var docs = getJSDocs(node); + if (docs) { var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.tags) { - result.push.apply(result, doc.tags); + if (doc.kind === 281) { + if (doc.kind === kind) { + result.push(doc); + } + } + else { + result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; })); } } return result; - }, function (tags) { return tags; }); + } } - function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) { - var result = undefined; - if (checkParentVariableStatement) { - var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) && - (node.parent).initializer === node && - node.parent.parent.parent.kind === 205; + function getFirstJSDocTag(node, kind) { + return node && ts.firstOrUndefined(getJSDocTags(node, kind)); + } + function getJSDocs(node) { + var cache = node.jsDocCache; + if (!cache) { + getJSDocsWorker(node); + node.jsDocCache = cache; + } + return cache; + function getJSDocsWorker(node) { + var parent = node.parent; + var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && + parent.initializer === node && + parent.parent.parent.kind === 205; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - node.parent.parent.kind === 205; - var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : - isVariableOfVariableDeclarationStatement ? node.parent.parent : + parent.parent.kind === 205; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : + isVariableOfVariableDeclarationStatement ? parent.parent : undefined; if (variableStatementNode) { - result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags)); + getJSDocsWorker(variableStatementNode); } - if (node.kind === 230 && - node.parent && node.parent.kind === 230) { - result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags)); - } - var parent_4 = node.parent; - var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent && - parent_4.kind === 192 && - parent_4.operatorToken.kind === 57 && - parent_4.parent.kind === 207; + var isSourceOfAssignmentExpressionStatement = parent && parent.parent && + parent.kind === 192 && + parent.operatorToken.kind === 57 && + parent.parent.kind === 207; if (isSourceOfAssignmentExpressionStatement) { - result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags)); + getJSDocsWorker(parent.parent); } - var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 257; - if (isPropertyAssignmentExpression) { - result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags)); + var isModuleDeclaration = node.kind === 230 && + parent && parent.kind === 230; + var isPropertyAssignmentExpression = parent && parent.kind === 257; + if (isModuleDeclaration || isPropertyAssignmentExpression) { + getJSDocsWorker(parent); } if (node.kind === 144) { - var paramTags = getJSDocParameterTag(node, checkParentVariableStatement); - if (paramTags) { - result = append(result, getTags(paramTags)); - } + cache = ts.concatenate(cache, getJSDocParameterTags(node)); } - } - if (isVariableLike(node) && node.initializer) { - result = append(result, getJSDocs(node.initializer, false, getDocs, getTags)); - } - if (node.jsDocComments) { - if (result) { - result = append(result, getDocs(node.jsDocComments)); - } - else { - return getDocs(node.jsDocComments); + if (isVariableLike(node) && node.initializer) { + cache = ts.concatenate(cache, node.initializer.jsDoc); } + cache = ts.concatenate(cache, node.jsDoc); } - return result; } - function getJSDocParameterTag(param, checkParentVariableStatement) { + function getJSDocParameterTags(param) { + if (!isParameter(param)) { + return undefined; + } var func = param.parent; - var tags = getJSDocTags(func, checkParentVariableStatement); + var tags = getJSDocTags(func, 281); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { var name_6 = param.name.text; - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 && tag.parameterName.text === name_6; }); - if (paramTags) { - return paramTags; - } + return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_6; }); } else { return undefined; } } - function getJSDocTypeTag(node) { - return getJSDocTag(node, 282, false); + ts.getJSDocParameterTags = getJSDocParameterTags; + function getJSDocType(node) { + var tag = getFirstJSDocTag(node, 283); + if (!tag && node.kind === 144) { + var paramTags = getJSDocParameterTags(node); + if (paramTags) { + tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); + } + } + return tag && tag.typeExpression && tag.typeExpression.type; } - ts.getJSDocTypeTag = getJSDocTypeTag; + ts.getJSDocType = getJSDocType; + function getJSDocAugmentsTag(node) { + return getFirstJSDocTag(node, 280); + } + ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 281, true); + return getFirstJSDocTag(node, 282); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 283, false); + return getFirstJSDocTag(node, 284); } ts.getJSDocTemplateTag = getJSDocTemplateTag; - function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 70) { - var parameterName = parameter.name.text; - var jsDocTags = getJSDocTags(parameter.parent, true); - if (!jsDocTags) { - return undefined; - } - for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) { - var tag = jsDocTags_2[_i]; - if (tag.kind === 280) { - var parameterTag = tag; - if (parameterTag.parameterName.text === parameterName) { - return parameterTag; - } - } - } - } - return undefined; - } - ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; function hasRestParameter(s) { return isRestParameter(ts.lastOrUndefined(s.parameters)); } @@ -6089,14 +6121,11 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 2097152)) { - if (node.type && node.type.kind === 275) { + if (node && (node.flags & 65536)) { + if (node.type && node.type.kind === 275 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) { return true; } - var paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 275; - } } return isDeclaredRestParam(node); } @@ -6319,8 +6348,10 @@ var ts; return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; - function isStringOrNumericLiteral(kind) { - return kind === 9 || kind === 8; + function isStringOrNumericLiteral(node) { + var kind = node.kind; + return kind === 9 + || kind === 8; } ts.isStringOrNumericLiteral = isStringOrNumericLiteral; function hasDynamicName(declaration) { @@ -6329,7 +6360,7 @@ var ts; ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { return name.kind === 142 && - !isStringOrNumericLiteral(name.expression.kind) && + !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } ts.isDynamicName = isDynamicName; @@ -6535,6 +6566,7 @@ var ts; case 194: case 183: case 198: + case 297: return 19; case 181: case 177: @@ -7296,19 +7328,19 @@ var ts; } } ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments; - function isAssignmentExpression(node) { + function isAssignmentExpression(node, excludeCompoundAssignment) { return isBinaryExpression(node) - && isAssignmentOperator(node.operatorToken.kind) + && (excludeCompoundAssignment + ? node.operatorToken.kind === 57 + : isAssignmentOperator(node.operatorToken.kind)) && isLeftHandSideExpression(node.left); } ts.isAssignmentExpression = isAssignmentExpression; function isDestructuringAssignment(node) { - if (isBinaryExpression(node)) { - if (node.operatorToken.kind === 57) { - var kind = node.left.kind; - return kind === 176 - || kind === 175; - } + if (isAssignmentExpression(node, true)) { + var kind = node.left.kind; + return kind === 176 + || kind === 175; } return false; } @@ -7390,39 +7422,6 @@ var ts; } return output; } - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - function stringifyFallback(value) { - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; - } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; - } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; - } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); - } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function convertToBase64(input) { var result = ""; @@ -7619,122 +7618,6 @@ var ts; return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos); } ts.getStartPositionOfRange = getStartPositionOfRange; - function collectExternalModuleInfo(sourceFile, resolver) { - var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); - var uniqueExports = ts.createMap(); - var hasExportDefault = false; - var exportEquals = undefined; - var hasExportStarsToExportValues = false; - for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { - var node = _a[_i]; - switch (node.kind) { - case 235: - externalImports.push(node); - break; - case 234: - if (node.moduleReference.kind === 245) { - externalImports.push(node); - } - break; - case 241: - if (node.moduleSpecifier) { - if (!node.exportClause) { - externalImports.push(node); - hasExportStarsToExportValues = true; - } - else { - externalImports.push(node); - } - } - else { - for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { - var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_8 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_8.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_8) - || resolver.getReferencedValueDeclaration(name_8); - if (decl) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name); - } - uniqueExports[specifier.name.text] = specifier.name; - } - } - } - break; - case 240: - if (node.isExportEquals && !exportEquals) { - exportEquals = node; - } - break; - case 205: - if (hasModifier(node, 1)) { - for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { - var decl = _e[_d]; - collectExportedVariableInfo(decl, uniqueExports); - } - } - break; - case 225: - if (hasModifier(node, 1)) { - if (hasModifier(node, 512)) { - if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); - hasExportDefault = true; - } - } - else { - var name_9 = node.name; - if (!uniqueExports[name_9.text]) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_9); - uniqueExports[name_9.text] = name_9; - } - } - } - break; - case 226: - if (hasModifier(node, 1)) { - if (hasModifier(node, 512)) { - if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); - hasExportDefault = true; - } - } - else { - var name_10 = node.name; - if (!uniqueExports[name_10.text]) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_10); - uniqueExports[name_10.text] = name_10; - } - } - } - break; - } - } - var exportedNames; - for (var key in uniqueExports) { - exportedNames = ts.append(exportedNames, uniqueExports[key]); - } - return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames }; - } - ts.collectExternalModuleInfo = collectExternalModuleInfo; - function collectExportedVariableInfo(decl, uniqueExports) { - if (isBindingPattern(decl.name)) { - for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (!isOmittedExpression(element)) { - collectExportedVariableInfo(element, uniqueExports); - } - } - } - else if (!isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = decl.name; - } - } - } function isDeclarationNameOfEnumOrNamespace(node) { var parseNode = getParseTreeNode(node); if (parseNode) { @@ -7905,6 +7788,14 @@ var ts; return isTypeNodeKind(node.kind); } ts.isTypeNode = isTypeNode; + function isArrayBindingPattern(node) { + return node.kind === 173; + } + ts.isArrayBindingPattern = isArrayBindingPattern; + function isObjectBindingPattern(node) { + return node.kind === 172; + } + ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; @@ -7914,6 +7805,12 @@ var ts; return false; } ts.isBindingPattern = isBindingPattern; + function isAssignmentPattern(node) { + var kind = node.kind; + return kind === 175 + || kind === 176; + } + ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { return node.kind === 174; } @@ -7924,6 +7821,39 @@ var ts; || kind === 198; } ts.isArrayBindingElement = isArrayBindingElement; + function isDeclarationBindingElement(bindingElement) { + switch (bindingElement.kind) { + case 223: + case 144: + case 174: + return true; + } + return false; + } + ts.isDeclarationBindingElement = isDeclarationBindingElement; + function isBindingOrAssignmentPattern(node) { + return isObjectBindingOrAssignmentPattern(node) + || isArrayBindingOrAssignmentPattern(node); + } + ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; + function isObjectBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 172: + case 176: + return true; + } + return false; + } + ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; + function isArrayBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 173: + case 175: + return true; + } + return false; + } + ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; function isArrayLiteralExpression(node) { return node.kind === 175; } @@ -7990,7 +7920,8 @@ var ts; || kind === 98 || kind === 100 || kind === 96 - || kind === 201; + || kind === 201 + || kind === 297; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); @@ -8018,6 +7949,7 @@ var ts; || kind === 196 || kind === 200 || kind === 198 + || kind === 297 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -8031,11 +7963,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 293; + return node.kind === 294; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 292; + return node.kind === 293; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -8147,7 +8079,7 @@ var ts; || kind === 228 || kind === 143 || kind === 223 - || kind === 284; + || kind === 285; } function isDeclarationStatementKind(kind) { return kind === 225 @@ -8182,9 +8114,9 @@ var ts; || kind === 205 || kind === 210 || kind === 217 - || kind === 292 - || kind === 295 - || kind === 294; + || kind === 293 + || kind === 296 + || kind === 295; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -8472,6 +8404,53 @@ var ts; return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; + function validateLocaleAndSetLanguage(locale, sys, errors) { + var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); + if (!matchResult) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); + } + return; + } + var language = matchResult[1]; + var territory = matchResult[3]; + if (!trySetLanguageAndTerritory(language, territory, errors)) { + trySetLanguageAndTerritory(language, undefined, errors); + } + function trySetLanguageAndTerritory(language, territory, errors) { + var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath()); + var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath); + var filePath = ts.combinePaths(containingDirectoryPath, language); + if (territory) { + filePath = filePath + "-" + territory; + } + filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")); + if (!sys.fileExists(filePath)) { + return false; + } + var fileContents = ""; + try { + fileContents = sys.readFile(filePath); + } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)); + } + return false; + } + try { + ts.localizedDiagnosticMessages = JSON.parse(fileContents); + } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)); + } + return false; + } + return true; + } + } + ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; })(ts || (ts = {})); var ts; (function (ts) { @@ -8672,9 +8651,9 @@ var ts; return node; } ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node); + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) { + return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node); } return node; } @@ -8807,9 +8786,9 @@ var ts; return node; } ts.createBindingElement = createBindingElement; - function updateBindingElement(node, propertyName, name, initializer) { - if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) { - return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node); + function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { + if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) { + return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node); } return node; } @@ -8849,7 +8828,7 @@ var ts; function createPropertyAccess(expression, name, location, flags) { var node = createNode(177, location, flags); node.expression = parenthesizeForAccess(expression); - (node.emitNode || (node.emitNode = {})).flags |= 1048576; + (node.emitNode || (node.emitNode = {})).flags |= 65536; node.name = typeof name === "string" ? createIdentifier(name) : name; return node; } @@ -9070,13 +9049,21 @@ var ts; return node; } ts.updateBinary = updateBinary; - function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) { - var node = createNode(193, location); - node.condition = condition; - node.questionToken = questionToken; - node.whenTrue = whenTrue; - node.colonToken = colonToken; - node.whenFalse = whenFalse; + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { + var node = createNode(193, whenFalse ? location : colonTokenOrLocation); + node.condition = parenthesizeForConditionalHead(condition); + if (whenFalse) { + node.questionToken = questionTokenOrWhenTrue; + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); + node.colonToken = colonTokenOrLocation; + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); + } + else { + node.questionToken = createToken(54); + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); + node.colonToken = createToken(55); + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); + } return node; } ts.createConditional = createConditional; @@ -9886,35 +9873,33 @@ var ts; updated.imports = node.imports; if (node.moduleAugmentations !== undefined) updated.moduleAugmentations = node.moduleAugmentations; - if (node.externalHelpersModuleName !== undefined) - updated.externalHelpersModuleName = node.externalHelpersModuleName; return updateNode(updated, node); } return node; } ts.updateSourceFileNode = updateSourceFileNode; function createNotEmittedStatement(original) { - var node = createNode(292, original); + var node = createNode(293, original); node.original = original; return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(295); + var node = createNode(296); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(294); + var node = createNode(295); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(293, location || original); + var node = createNode(294, location || original); node.expression = expression; node.original = original; return node; @@ -9927,6 +9912,12 @@ var ts; return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; + function createRawExpression(text) { + var node = createNode(297); + node.text = text; + return node; + } + ts.createRawExpression = createRawExpression; function createComma(left, right) { return createBinary(left, 25, right); } @@ -9975,13 +9966,19 @@ var ts; return createVoid(createLiteral(0)); } ts.createVoidZero = createVoidZero; + function createTypeCheck(value, tag) { + return tag === "undefined" + ? createStrictEquality(value, createVoidZero()) + : createStrictEquality(createTypeOf(value), createLiteral(tag)); + } + ts.createTypeCheck = createTypeCheck; function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) { return createElementAccess(target, memberName.expression, location); } else { var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - (expression.emitNode || (expression.emitNode = {})).flags |= 2048; + (expression.emitNode || (expression.emitNode = {})).flags |= 64; return expression; } } @@ -10023,7 +10020,10 @@ var ts; } function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { - return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536)); + var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); + var right = createSynthesizedNode(70); + right.text = jsxFactory.right.text; + return createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); @@ -10077,114 +10077,10 @@ var ts; return createVariableDeclarationList(declarations, location, 2); } ts.createConstDeclarationList = createConstDeclarationList; - function createHelperName(externalHelpersModuleName, name) { - return externalHelpersModuleName - ? createPropertyAccess(externalHelpersModuleName, name) - : createIdentifier(name); + function getHelperName(name) { + return setEmitFlags(createIdentifier(name), 4096 | 2); } - ts.createHelperName = createHelperName; - function createExtendsHelper(externalHelpersModuleName, name) { - return createCall(createHelperName(externalHelpersModuleName, "__extends"), undefined, [ - name, - createIdentifier("_super") - ]); - } - ts.createExtendsHelper = createExtendsHelper; - function createAssignHelper(externalHelpersModuleName, attributesSegments) { - return createCall(createHelperName(externalHelpersModuleName, "__assign"), undefined, attributesSegments); - } - ts.createAssignHelper = createAssignHelper; - function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) { - return createCall(createHelperName(externalHelpersModuleName, "__param"), undefined, [ - createLiteral(parameterOffset), - expression - ], location); - } - ts.createParamHelper = createParamHelper; - function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) { - return createCall(createHelperName(externalHelpersModuleName, "__metadata"), undefined, [ - createLiteral(metadataKey), - metadataValue - ]); - } - ts.createMetadataHelper = createMetadataHelper; - function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) { - var argumentsArray = []; - argumentsArray.push(createArrayLiteral(decoratorExpressions, undefined, true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); - } - } - return createCall(createHelperName(externalHelpersModuleName, "__decorate"), undefined, argumentsArray, location); - } - ts.createDecorateHelper = createDecorateHelper; - function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) { - var generatorFunc = createFunctionExpression(undefined, createToken(38), undefined, undefined, [], undefined, body); - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152; - return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), undefined, [ - createThis(), - hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(), - promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(), - generatorFunc - ]); - } - ts.createAwaiterHelper = createAwaiterHelper; - function createHasOwnProperty(target, propertyName) { - return createCall(createPropertyAccess(target, "hasOwnProperty"), undefined, [propertyName]); - } - ts.createHasOwnProperty = createHasOwnProperty; - function createObjectCreate(prototype) { - return createCall(createPropertyAccess(createIdentifier("Object"), "create"), undefined, [prototype]); - } - function createGeti(target) { - return createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createElementAccess(target, createIdentifier("name"))); - } - function createSeti(target) { - return createArrowFunction(undefined, undefined, [ - createParameter(undefined, undefined, undefined, "name"), - createParameter(undefined, undefined, undefined, "value") - ], undefined, createToken(35), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value"))); - } - function createAdvancedAsyncSuperHelper() { - var createCache = createVariableStatement(undefined, createConstDeclarationList([ - createVariableDeclaration("cache", undefined, createObjectCreate(createNull())) - ])); - var getter = createGetAccessor(undefined, undefined, "value", [], undefined, createBlock([ - createReturn(createCall(createIdentifier("geti"), undefined, [createIdentifier("name")])) - ])); - var setter = createSetAccessor(undefined, undefined, "value", [createParameter(undefined, undefined, undefined, "v")], createBlock([ - createStatement(createCall(createIdentifier("seti"), undefined, [ - createIdentifier("name"), - createIdentifier("v") - ])) - ])); - var getOrCreateAccessorsForName = createReturn(createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([ - getter, - setter - ])))))); - return createVariableStatement(undefined, createConstDeclarationList([ - createVariableDeclaration("_super", undefined, createCall(createParen(createFunctionExpression(undefined, undefined, undefined, undefined, [ - createParameter(undefined, undefined, undefined, "geti"), - createParameter(undefined, undefined, undefined, "seti") - ], undefined, createBlock([ - createCache, - getOrCreateAccessorsForName - ]))), undefined, [ - createGeti(createSuper()), - createSeti(createSuper()) - ])) - ])); - } - ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper; - function createSimpleAsyncSuperHelper() { - return createVariableStatement(undefined, createConstDeclarationList([ - createVariableDeclaration("_super", undefined, createGeti(createSuper())) - ])); - } - ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper; + ts.getHelperName = getHelperName; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -10330,19 +10226,19 @@ var ts; return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method)); } function getLocalName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 262144); + return getName(node, allowComments, allowSourceMaps, 16384); } ts.getLocalName = getLocalName; function isLocalName(node) { - return (getEmitFlags(node) & 262144) !== 0; + return (getEmitFlags(node) & 16384) !== 0; } ts.isLocalName = isLocalName; function getExportName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 131072); + return getName(node, allowComments, allowSourceMaps, 8192); } ts.getExportName = getExportName; function isExportName(node) { - return (getEmitFlags(node) & 131072) !== 0; + return (getEmitFlags(node) & 8192) !== 0; } ts.isExportName = isExportName; function getDeclarationName(node, allowComments, allowSourceMaps) { @@ -10351,15 +10247,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_11 = getMutableClone(node.name); + var name_8 = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) - emitFlags |= 1536; + emitFlags |= 48; if (!allowComments) - emitFlags |= 49152; + emitFlags |= 1536; if (emitFlags) - setEmitFlags(name_11, emitFlags); - return name_11; + setEmitFlags(name_8, emitFlags); + return name_8; } return getGeneratedNameForNode(node); } @@ -10374,14 +10270,18 @@ var ts; var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name); var emitFlags; if (!allowSourceMaps) - emitFlags |= 1536; + emitFlags |= 48; if (!allowComments) - emitFlags |= 49152; + emitFlags |= 1536; if (emitFlags) setEmitFlags(qualifiedName, emitFlags); return qualifiedName; } ts.getNamespaceMemberName = getNamespaceMemberName; + function convertToFunctionBody(node, multiLine) { + return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine); + } + ts.convertToFunctionBody = convertToFunctionBody; function isUseStrictPrologue(node) { return node.expression.text === "use strict"; } @@ -10408,7 +10308,7 @@ var ts; } while (statementOffset < numStatements) { var statement = source[statementOffset]; - if (getEmitFlags(statement) & 8388608) { + if (getEmitFlags(statement) & 524288) { target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); } else { @@ -10419,10 +10319,17 @@ var ts; return statementOffset; } ts.addPrologueDirectives = addPrologueDirectives; - function ensureUseStrict(node) { + function startsWithUseStrict(statements) { + var firstStatement = ts.firstOrUndefined(statements); + return firstStatement !== undefined + && ts.isPrologueDirective(firstStatement) + && isUseStrictPrologue(firstStatement); + } + ts.startsWithUseStrict = startsWithUseStrict; + function ensureUseStrict(statements) { var foundUseStrict = false; - for (var _i = 0, _a = node.statements; _i < _a.length; _i++) { - var statement = _a[_i]; + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; if (ts.isPrologueDirective(statement)) { if (isUseStrictPrologue(statement)) { foundUseStrict = true; @@ -10434,11 +10341,11 @@ var ts; } } if (!foundUseStrict) { - var statements = []; - statements.push(startOnNewLine(createStatement(createLiteral("use strict")))); - return updateSourceFileNode(node, statements.concat(node.statements)); + return createNodeArray([ + startOnNewLine(createStatement(createLiteral("use strict"))) + ].concat(statements), statements); } - return node; + return statements; } ts.ensureUseStrict = ensureUseStrict; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { @@ -10513,6 +10420,21 @@ var ts; } return 0; } + function parenthesizeForConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(193, 54); + var emittedCondition = skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { + return createParen(condition); + } + return condition; + } + ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; + function parenthesizeSubexpressionOfConditionalExpression(e) { + return e.kind === 192 && e.operatorToken.kind === 25 + ? createParen(e) + : e; + } function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { @@ -10618,7 +10540,7 @@ var ts; case 177: node = node.expression; continue; - case 293: + case 294: node = node.expression; continue; } @@ -10666,7 +10588,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 293) { + while (node.kind === 294) { node = node.expression; } return node; @@ -10688,8 +10610,8 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges; - if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges)) + var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) destEmitNode = {}; if (flags) destEmitNode.flags = flags; @@ -10699,6 +10621,10 @@ var ts; destEmitNode.sourceMapRange = sourceMapRange; if (tokenSourceMapRanges) destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -10732,6 +10658,7 @@ var ts; } return node.emitNode; } + ts.getOrCreateEmitNode = getOrCreateEmitNode; function getEmitFlags(node) { var emitNode = node.emitNode; return emitNode && emitNode.flags; @@ -10742,11 +10669,22 @@ var ts; return node; } ts.setEmitFlags = setEmitFlags; + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; function setSourceMapRange(node, range) { getOrCreateEmitNode(node).sourceMapRange = range; return node; } ts.setSourceMapRange = setSourceMapRange; + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; function setTokenSourceMapRange(node, token, range) { var emitNode = getOrCreateEmitNode(node); var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); @@ -10754,27 +10692,16 @@ var ts; return node; } ts.setTokenSourceMapRange = setTokenSourceMapRange; - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; function getCommentRange(node) { var emitNode = node.emitNode; return (emitNode && emitNode.commentRange) || node; } ts.getCommentRange = getCommentRange; - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; } - ts.getSourceMapRange = getSourceMapRange; - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; + ts.setCommentRange = setCommentRange; function getConstantValue(node) { var emitNode = node.emitNode; return emitNode && emitNode.constantValue; @@ -10786,6 +10713,103 @@ var ts; return node; } ts.setConstantValue = setConstantValue; + function getExternalHelpersModuleName(node) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = parseNode && parseNode.emitNode; + return emitNode && emitNode.externalHelpersModuleName; + } + ts.getExternalHelpersModuleName = getExternalHelpersModuleName; + function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) { + if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { + var externalHelpersModuleName = getExternalHelpersModuleName(node); + if (externalHelpersModuleName) { + return externalHelpersModuleName; + } + var helpers = getEmitHelpers(node); + if (helpers) { + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!helper.scoped) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText)); + } + } + } + } + } + ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + function compareEmitHelpers(x, y) { + if (x === y) + return 0; + if (x.priority === y.priority) + return 0; + if (x.priority === undefined) + return 1; + if (y.priority === undefined) + return -1; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; function setTextRange(node, location) { if (location) { node.pos = location.pos; @@ -10812,8 +10836,8 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_12 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_12) ? name_12 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name_9 = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } if (node.kind === 235 && node.importClause) { return getGeneratedNameForNode(node); @@ -10856,221 +10880,291 @@ var ts; function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) { return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); } - function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) { - var multiLine = false; - var singleLine = false; - var statementsLocation; - var closeBraceLocation; - var statements = []; - var body = node.body; - var statementOffset; - context.startLexicalEnvironment(); - if (ts.isBlock(body)) { - statementOffset = addPrologueDirectives(statements, body.statements, false, visitor); + function getInitializerOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + return bindingElement.initializer; } - addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis); - addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest); - addRestParameterIfNeeded(statements, node, false); - if (!multiLine && statements.length > 0) { - multiLine = true; + if (ts.isPropertyAssignment(bindingElement)) { + return ts.isAssignmentExpression(bindingElement.initializer, true) + ? bindingElement.initializer.right + : undefined; } - if (ts.isBlock(body)) { - statementsLocation = body.statements; - ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); - if (!multiLine && body.multiLine) { - multiLine = true; + if (ts.isShorthandPropertyAssignment(bindingElement)) { + return bindingElement.objectAssignmentInitializer; + } + if (ts.isAssignmentExpression(bindingElement, true)) { + return bindingElement.right; + } + if (ts.isSpreadExpression(bindingElement)) { + return getInitializerOfBindingOrAssignmentElement(bindingElement.expression); + } + } + ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement; + function getTargetOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + return bindingElement.name; + } + if (ts.isObjectLiteralElementLike(bindingElement)) { + switch (bindingElement.kind) { + case 257: + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); + case 258: + return bindingElement.name; + case 259: + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + return undefined; + } + if (ts.isAssignmentExpression(bindingElement, true)) { + return getTargetOfBindingOrAssignmentElement(bindingElement.left); + } + if (ts.isSpreadExpression(bindingElement)) { + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + return bindingElement; + } + ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; + function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 144: + case 174: + return bindingElement.dotDotDotToken; + case 196: + case 259: + return bindingElement; + } + return undefined; + } + ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; + function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 174: + if (bindingElement.propertyName) { + var propertyName = bindingElement.propertyName; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 257: + if (bindingElement.name) { + var propertyName = bindingElement.name; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 259: + return bindingElement.name; + } + var target = getTargetOfBindingOrAssignmentElement(bindingElement); + if (target && ts.isPropertyName(target)) { + return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression) + ? target.expression + : target; + } + ts.Debug.fail("Invalid property name for binding element."); + } + ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; + function getElementsOfBindingOrAssignmentPattern(name) { + switch (name.kind) { + case 172: + case 173: + case 175: + return name.elements; + case 176: + return name.properties; + } + } + ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern; + function convertToArrayAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createSpread(element.name, element), element); + } + var expression = convertToAssignmentElementTarget(element.name); + return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression; + } + ts.Debug.assertNode(element, ts.isExpression); + return element; + } + ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement; + function convertToObjectAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createSpreadAssignment(element.name, element), element); + } + if (element.propertyName) { + var expression = convertToAssignmentElementTarget(element.name); + return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element); + } + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element); + } + ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); + return element; + } + ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; + function convertToAssignmentPattern(node) { + switch (node.kind) { + case 173: + case 175: + return convertToArrayAssignmentPattern(node); + case 172: + case 176: + return convertToObjectAssignmentPattern(node); + } + } + ts.convertToAssignmentPattern = convertToAssignmentPattern; + function convertToObjectAssignmentPattern(node) { + if (ts.isObjectBindingPattern(node)) { + return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node); + } + ts.Debug.assertNode(node, ts.isObjectLiteralExpression); + return node; + } + ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; + function convertToArrayAssignmentPattern(node) { + if (ts.isArrayBindingPattern(node)) { + return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node); + } + ts.Debug.assertNode(node, ts.isArrayLiteralExpression); + return node; + } + ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern; + function convertToAssignmentElementTarget(node) { + if (ts.isBindingPattern(node)) { + return convertToAssignmentPattern(node); + } + ts.Debug.assertNode(node, ts.isExpression); + return node; + } + ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; + function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { + var externalImports = []; + var exportSpecifiers = ts.createMap(); + var exportedBindings = ts.createMap(); + var uniqueExports = ts.createMap(); + var exportedNames; + var hasExportDefault = false; + var exportEquals = undefined; + var hasExportStarsToExportValues = false; + var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions); + var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText)); + if (externalHelpersImportDeclaration) { + externalImports.push(externalHelpersImportDeclaration); + } + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 235: + externalImports.push(node); + break; + case 234: + if (node.moduleReference.kind === 245) { + externalImports.push(node); + } + break; + case 241: + if (node.moduleSpecifier) { + if (!node.exportClause) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } + else { + externalImports.push(node); + } + } + else { + for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { + var specifier = _c[_b]; + if (!uniqueExports[specifier.name.text]) { + var name_10 = specifier.propertyName || specifier.name; + ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name_10) + || resolver.getReferencedValueDeclaration(name_10); + if (decl) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + } + uniqueExports[specifier.name.text] = true; + exportedNames = ts.append(exportedNames, specifier.name); + } + } + } + break; + case 240: + if (node.isExportEquals && !exportEquals) { + exportEquals = node; + } + break; + case 205: + if (ts.hasModifier(node, 1)) { + for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { + var decl = _e[_d]; + exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames); + } + } + break; + case 225: + if (ts.hasModifier(node, 1)) { + if (ts.hasModifier(node, 512)) { + if (!hasExportDefault) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + var name_11 = node.name; + if (!uniqueExports[name_11.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11); + uniqueExports[name_11.text] = true; + exportedNames = ts.append(exportedNames, name_11); + } + } + } + break; + case 226: + if (ts.hasModifier(node, 1)) { + if (ts.hasModifier(node, 512)) { + if (!hasExportDefault) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + var name_12 = node.name; + if (!uniqueExports[name_12.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); + uniqueExports[name_12.text] = true; + exportedNames = ts.append(exportedNames, name_12); + } + } + } + break; } } - else { - ts.Debug.assert(node.kind === 185); - statementsLocation = ts.moveRangeEnd(body, -1); - var equalsGreaterThanToken = node.equalsGreaterThanToken; - if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { - if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { - singleLine = true; - } - else { - multiLine = true; + return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration }; + } + ts.collectExternalModuleInfo = collectExternalModuleInfo; + function collectExportedVariableInfo(decl, uniqueExports, exportedNames) { + if (ts.isBindingPattern(decl.name)) { + for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames); } } - var expression = ts.visitNode(body, visitor, ts.isExpression); - var returnStatement = createReturn(expression, body); - setEmitFlags(returnStatement, 12288 | 1024 | 32768); - statements.push(returnStatement); - closeBraceLocation = body; } - var lexicalEnvironment = context.endLexicalEnvironment(); - ts.addRange(statements, lexicalEnvironment); - if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { - multiLine = true; - } - var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine); - if (!multiLine && singleLine) { - setEmitFlags(block, 32); - } - if (closeBraceLocation) { - setTokenSourceMapRange(block, 17, closeBraceLocation); - } - setOriginalNode(block, node.body); - return block; - } - ts.transformFunctionBody = transformFunctionBody; - function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) { - if (node.transformFlags & 524288 && node.kind !== 185) { - captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis); - } - } - ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded; - function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) { - enableSubstitutionsForCapturedThis(); - var captureThisStatement = createVariableStatement(undefined, createVariableDeclarationList([ - createVariableDeclaration("_this", undefined, initializer) - ]), originalStatement); - setEmitFlags(captureThisStatement, 49152 | 8388608); - setSourceMapRange(captureThisStatement, node); - statements.push(captureThisStatement); - } - ts.captureThisForNode = captureThisForNode; - function shouldAddDefaultValueAssignments(node) { - return (node.transformFlags & 2097152) !== 0; - } - function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) { - if (!shouldAddDefaultValueAssignments(node)) { - return; - } - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var parameter = _a[_i]; - var name_13 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; - if (dotDotDotToken) { - continue; - } - if (ts.isBindingPattern(name_13)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_13, initializer, visitor, convertObjectRest); - } - else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_13, initializer, visitor); + else if (!ts.isGeneratedIdentifier(decl.name)) { + if (!uniqueExports[decl.name.text]) { + uniqueExports[decl.name.text] = true; + exportedNames = ts.append(exportedNames, decl.name); } } + return exportedNames; } - ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded; - function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) { - var temp = getGeneratedNameForNode(parameter); - if (name.elements.length > 0) { - statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608)); - } - else if (initializer) { - statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608)); - } - } - function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) { - initializer = ts.visitNode(initializer, visitor, ts.isExpression); - var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([ - createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536), setEmitFlags(initializer, 1536 | getEmitFlags(initializer)), parameter)) - ], parameter), 32 | 1024 | 12288), undefined, parameter); - statement.startsOnNewLine = true; - setEmitFlags(statement, 12288 | 1024 | 8388608); - statements.push(statement); - } - function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { - return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper; - } - function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { - var parameter = ts.lastOrUndefined(node.parameters); - if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { - return; - } - var declarationName = getMutableClone(parameter.name); - setEmitFlags(declarationName, 1536); - var expressionName = getSynthesizedClone(parameter.name); - var restIndex = node.parameters.length - 1; - var temp = createLoopVariable(); - statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList([ - createVariableDeclaration(declarationName, undefined, createArrayLiteral([])) - ]), parameter), 8388608)); - var forStatement = createFor(createVariableDeclarationList([ - createVariableDeclaration(temp, undefined, createLiteral(restIndex)) - ], parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"), parameter), createPostfixIncrement(temp, parameter), createBlock([ - startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)), parameter)) - ])); - setEmitFlags(forStatement, 8388608); - startOnNewLine(forStatement); - statements.push(forStatement); - } - ts.addRestParameterIfNeeded = addRestParameterIfNeeded; - function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var initializer = node.initializer; - var statements = []; - var counter = convertObjectRest ? undefined : createLoopVariable(); - var rhsReference = expression.kind === 70 - ? createUniqueName(expression.text) - : createTempVariable(undefined); - var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter); - if (ts.isVariableDeclarationList(initializer)) { - if (initializer.flags & 3) { - enableSubstitutionsForBlockScopedBindings(); - } - var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); - if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { - var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor, undefined, convertObjectRest); - var declarationList = createVariableDeclarationList(declarations, initializer); - setOriginalNode(declarationList, initializer); - var firstDeclaration = declarations[0]; - var lastDeclaration = ts.lastOrUndefined(declarations); - setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - statements.push(createVariableStatement(undefined, declarationList)); - } - else { - statements.push(createVariableStatement(undefined, setOriginalNode(createVariableDeclarationList([ - createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(undefined), undefined, createElementAccess(rhsReference, counter)) - ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1))); - } - } - else { - var assignment = createAssignment(initializer, elementAccess); - if (ts.isDestructuringAssignment(assignment)) { - statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment, false, context.hoistVariableDeclaration, visitor, convertObjectRest))); - } - else { - assignment.end = initializer.end; - statements.push(createStatement(assignment, ts.moveRangeEnd(initializer, -1))); - } - } - var bodyLocation; - var statementsLocation; - if (convertedLoopBodyStatements) { - ts.addRange(statements, convertedLoopBodyStatements); - } - else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); - if (ts.isBlock(statement)) { - ts.addRange(statements, statement.statements); - bodyLocation = statement; - statementsLocation = statement.statements; - } - else { - statements.push(statement); - } - } - setEmitFlags(expression, 1536 | getEmitFlags(expression)); - var body = createBlock(createNodeArray(statements, statementsLocation), bodyLocation); - setEmitFlags(body, 1536 | 12288); - var forStatement; - if (convertObjectRest) { - forStatement = createForOf(createVariableDeclarationList([ - createVariableDeclaration(rhsReference, undefined, undefined, node.expression) - ], node.expression), node.expression, body, node); - } - else { - forStatement = createFor(setEmitFlags(createVariableDeclarationList([ - createVariableDeclaration(counter, undefined, createLiteral(0), ts.moveRangePos(node.expression, -1)), - createVariableDeclaration(rhsReference, undefined, expression, node.expression) - ], node.expression), 16777216), createLessThan(counter, createPropertyAccess(rhsReference, "length"), node.expression), createPostfixIncrement(counter, node.expression), body, node); - } - setEmitFlags(forStatement, 8192); - return forStatement; - } - ts.convertForOf = convertForOf; })(ts || (ts = {})); var ts; (function (ts) { @@ -11468,29 +11562,31 @@ var ts; visitNode(cbNode, node.type); case 278: return visitNodes(cbNodes, node.tags); - case 280: + case 281: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 281: - return visitNode(cbNode, node.typeExpression); case 282: return visitNode(cbNode, node.typeExpression); case 283: - return visitNodes(cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 280: + return visitNode(cbNode, node.typeExpression); case 284: + return visitNodes(cbNodes, node.typeParameters); + case 285: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 286: + case 287: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 285: + case 286: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 293: + case 294: return visitNode(cbNode, node.expression); - case 287: + case 288: return visitNode(cbNode, node.literal); } } @@ -11531,7 +11627,7 @@ var ts; var Parser; (function (Parser) { var scanner = ts.createScanner(5, true); - var disallowInAndDecoratorContext = 65536 | 262144; + var disallowInAndDecoratorContext = 2048 | 8192; var NodeConstructor; var TokenConstructor; var IdentifierConstructor; @@ -11579,7 +11675,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 || scriptKind === 2 ? 2097152 : 0; + contextFlags = scriptKind === 1 || scriptKind === 2 ? 65536 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); @@ -11614,7 +11710,7 @@ var ts; return sourceFile; } function addJSDocComment(node) { - var comments = ts.getJsDocCommentsFromText(node, sourceFile.text); + var comments = ts.getJSDocCommentRanges(node, sourceFile.text); if (comments) { for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { var comment = comments_2[_i]; @@ -11622,10 +11718,10 @@ var ts; if (!jsDoc) { continue; } - if (!node.jsDocComments) { - node.jsDocComments = []; + if (!node.jsDoc) { + node.jsDoc = []; } - node.jsDocComments.push(jsDoc); + node.jsDoc.push(jsDoc); } } return node; @@ -11640,12 +11736,12 @@ var ts; var saveParent = parent; parent = n; forEachChild(n, visitNode); - if (n.jsDocComments) { - for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - jsDocComment.parent = n; - parent = jsDocComment; - forEachChild(jsDocComment, visitNode); + if (n.jsDoc) { + for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + jsDoc.parent = n; + parent = jsDoc; + forEachChild(jsDoc, visitNode); } } parent = saveParent; @@ -11674,16 +11770,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 65536); + setContextFlag(val, 2048); } function setYieldContext(val) { - setContextFlag(val, 131072); + setContextFlag(val, 4096); } function setDecoratorContext(val) { - setContextFlag(val, 262144); + setContextFlag(val, 8192); } function setAwaitContext(val) { - setContextFlag(val, 524288); + setContextFlag(val, 16384); } function doOutsideOfContext(context, func) { var contextFlagsToClear = context & contextFlags; @@ -11706,40 +11802,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(65536, func); + return doOutsideOfContext(2048, func); } function disallowInAnd(func) { - return doInsideOfContext(65536, func); + return doInsideOfContext(2048, func); } function doInYieldContext(func) { - return doInsideOfContext(131072, func); + return doInsideOfContext(4096, func); } function doInDecoratorContext(func) { - return doInsideOfContext(262144, func); + return doInsideOfContext(8192, func); } function doInAwaitContext(func) { - return doInsideOfContext(524288, func); + return doInsideOfContext(16384, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(524288, func); + return doOutsideOfContext(16384, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(131072 | 524288, func); + return doInsideOfContext(4096 | 16384, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(131072); + return inContext(4096); } function inDisallowInContext() { - return inContext(65536); + return inContext(2048); } function inDecoratorContext() { - return inContext(262144); + return inContext(8192); } function inAwaitContext() { - return inContext(524288); + return inContext(16384); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -11901,7 +11997,7 @@ var ts; } if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 1048576; + node.flags |= 32768; } return node; } @@ -12219,7 +12315,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.flags & 3080192; + var nodeContextFlags = node.flags & 96256; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -12892,6 +12988,8 @@ var ts; case 16: case 20: case 26: + case 48: + case 47: case 93: case 9: case 8: @@ -12944,6 +13042,7 @@ var ts; return parseArrayTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { var types = createNodeArray([type], type.pos); @@ -13024,7 +13123,7 @@ var ts; } } function parseType() { - return doOutsideOfContext(655360, parseTypeWorker); + return doOutsideOfContext(20480, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { @@ -14655,7 +14754,7 @@ var ts; property.type = parseTypeAnnotation(); property.initializer = ts.hasModifier(property, 32) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(131072 | 65536, parseNonParameterInitializer); + : doOutsideOfContext(4096 | 2048, parseNonParameterInitializer); parseSemicolon(); return addJSDocComment(finishNode(property)); } @@ -14822,8 +14921,8 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_14 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_14, undefined); + var name_13 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } @@ -15470,7 +15569,7 @@ var ts; return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(287); + var result = createNode(288); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -15572,7 +15671,7 @@ var ts; break; case 38: var asterisk = scanner.getTokenText(); - if (state === 1) { + if (state === 1 || state === 2) { state = 2; pushComment(asterisk); } @@ -15587,7 +15686,10 @@ var ts; break; case 5: var whitespace = scanner.getTokenText(); - if (state === 2 || margin !== undefined && indent + whitespace.length > margin) { + if (state === 2) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -15595,6 +15697,7 @@ var ts; case 1: break; default: + state = 2; pushComment(scanner.getTokenText()); break; } @@ -15650,6 +15753,9 @@ var ts; var tag; if (tagName) { switch (tagName.text) { + case "augments": + tag = parseAugmentsTag(atToken, tagName); + break; case "param": tag = parseParamTag(atToken, tagName); break; @@ -15789,7 +15895,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(280, atToken.pos); + var result = createNode(281, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -15800,20 +15906,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281; })) { + if (ts.forEach(tags, function (t) { return t.kind === 282; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(281, atToken.pos); + var result = createNode(282, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -15828,17 +15934,25 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(285, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; result.typeExpression = typeExpression; return finishNode(result); } + function parseAugmentsTag(atToken, tagName) { + var typeExpression = tryParseTypeExpression(); + var result = createNode(280, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + result.typeExpression = typeExpression; + return finishNode(result); + } function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(284, atToken.pos); + var typedefTag = createNode(285, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -15855,8 +15969,8 @@ var ts; if (typeExpression.type.kind === 272) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { - var name_15 = jsDocTypeReference.name; - if (name_15.text === "Object") { + var name_14 = jsDocTypeReference.name; + if (name_14.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -15870,7 +15984,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(286, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(287, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -15955,19 +16069,19 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); while (true) { - var name_16 = parseJSDocIdentifierName(); + var name_15 = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_16) { + if (!name_15) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143, name_16.pos); - typeParameter.name = name_16; + var typeParameter = createNode(143, name_15.pos); + typeParameter.name = name_15; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25) { @@ -15978,7 +16092,7 @@ var ts; break; } } - var result = createNode(283, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -16058,8 +16172,8 @@ var ts; ts.Debug.assert(text === newText.substring(node.pos, node.end)); } forEachChild(node, visitNode, visitArray); - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; forEachChild(jsDocComment, visitNode, visitArray); } @@ -16443,7 +16557,7 @@ var ts; } if (node.name.kind === 142) { var nameExpression = node.name.expression; - if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; } ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); @@ -16488,7 +16602,7 @@ var ts; var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 284: + case 285: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; if (parentNode && parentNode.kind === 205) { @@ -16563,7 +16677,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 284 && + var isJSDocTypedefInJSDocNamespace = node.kind === 285 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -16618,7 +16732,7 @@ var ts; activeLabels = undefined; hasExplicitReturn = false; bindChildren(node); - node.flags &= ~64896; + node.flags &= ~1408; if (!(currentFlow.flags & 1) && containerFlags & 8 && ts.nodeIsPresent(node.body)) { node.flags |= 128; if (hasExplicitReturn) @@ -16668,12 +16782,35 @@ var ts; subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags); } } + function bindEach(nodes) { + if (nodes === undefined) { + return; + } + if (skipTransformFlagAggregation) { + ts.forEach(nodes, bind); + } + else { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0; + var nodeArrayFlags = 0; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; + bind(node); + nodeArrayFlags |= node.transformFlags & ~536870912; + } + nodes.transformFlags = nodeArrayFlags | 536870912; + subtreeTransformFlags |= savedSubtreeTransformFlags; + } + } + function bindEachChild(node) { + ts.forEachChild(node, bind, bindEach); + } function bindChildrenWorker(node) { - if (ts.isInJavaScriptFile(node) && node.jsDocComments) { - ts.forEach(node.jsDocComments, bind); + if (ts.isInJavaScriptFile(node) && node.jsDoc) { + ts.forEach(node.jsDoc, bind); } if (checkUnreachable(node)) { - ts.forEachChild(node, bind); + bindEachChild(node); return; } switch (node.kind) { @@ -16738,7 +16875,7 @@ var ts; bindCallExpressionFlow(node); break; default: - ts.forEachChild(node, bind); + bindEachChild(node); break; } } @@ -17041,7 +17178,7 @@ var ts; } return undefined; } - function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { + function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { var flowLabel = node.kind === 215 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); @@ -17054,11 +17191,11 @@ var ts; var activeLabel = findActiveLabel(node.label.text); if (activeLabel) { activeLabel.referenced = true; - bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); } } else { - bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); } } function bindTryStatement(node) { @@ -17109,6 +17246,8 @@ var ts; currentFlow = finishFlowLabel(postSwitchLabel); } function bindCaseBlock(node) { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0; var clauses = node.clauses; var fallthroughFlow = unreachableFlow; for (var i = 0; i < clauses.length; i++) { @@ -17128,13 +17267,15 @@ var ts; errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); } } + clauses.transformFlags = subtreeTransformFlags | 536870912; + subtreeTransformFlags |= savedSubtreeTransformFlags; } function bindCaseClause(node) { var saveCurrentFlow = currentFlow; currentFlow = preSwitchCaseFlow; bind(node.expression); currentFlow = saveCurrentFlow; - ts.forEach(node.statements, bind); + bindEach(node.statements); } function pushActiveLabel(name, breakTarget, continueTarget) { var activeLabel = { @@ -17220,19 +17361,19 @@ var ts; var saveTrueTarget = currentTrueTarget; currentTrueTarget = currentFalseTarget; currentFalseTarget = saveTrueTarget; - ts.forEachChild(node, bind); + bindEachChild(node); currentFalseTarget = currentTrueTarget; currentTrueTarget = saveTrueTarget; } else { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.operator === 42 || node.operator === 43) { bindAssignmentTargetFlow(node.operand); } } } function bindPostfixUnaryExpressionFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.operator === 42 || node.operator === 43) { bindAssignmentTargetFlow(node.operand); } @@ -17250,7 +17391,7 @@ var ts; } } else { - ts.forEachChild(node, bind); + bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); if (operator === 57 && node.left.kind === 178) { @@ -17263,7 +17404,7 @@ var ts; } } function bindDeleteExpressionFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.expression.kind === 177) { bindAssignmentTargetFlow(node.expression); } @@ -17296,7 +17437,7 @@ var ts; } } function bindVariableDeclarationFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) { bindInitializedVariableFlow(node); } @@ -17307,12 +17448,12 @@ var ts; expr = expr.expression; } if (expr.kind === 184 || expr.kind === 185) { - ts.forEach(node.typeArguments, bind); - ts.forEach(node.arguments, bind); + bindEach(node.typeArguments); + bindEach(node.arguments); bind(node.expression); } else { - ts.forEachChild(node, bind); + bindEachChild(node); } if (node.expression.kind === 177) { var propertyAccess = node.expression; @@ -17328,7 +17469,7 @@ var ts; case 229: case 176: case 161: - case 286: + case 287: case 270: return 1; case 227: @@ -17397,7 +17538,7 @@ var ts; case 176: case 227: case 270: - case 286: + case 287: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 158: case 159: @@ -17691,8 +17832,8 @@ var ts; } function updateStrictModeStatementList(statements) { if (!inStrictMode) { - for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { - var statement = statements_1[_i]; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; if (!ts.isPrologueDirective(statement)) { return; } @@ -17712,7 +17853,7 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 284) { + while (parentNode && parentNode.kind !== 285) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); @@ -17774,15 +17915,12 @@ var ts; return bindParameter(node); case 223: case 174: - if (node.dotDotDotToken && node.parent.kind === 172) { - emitFlags |= 32768; - } return bindVariableDeclarationOrBindingElement(node); case 147: case 146: case 271: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 285: + case 286: return bindJSDocProperty(node); case 257: case 258: @@ -17803,7 +17941,6 @@ var ts; } root = root.parent; } - emitFlags |= hasRest ? 32768 : 16384; return; case 153: case 154: @@ -17826,7 +17963,7 @@ var ts; return bindFunctionOrConstructorType(node); case 161: case 170: - case 286: + case 287: case 270: return bindAnonymousDeclaration(node, 2048, "__type"); case 176: @@ -17845,7 +17982,7 @@ var ts; return bindClassLikeDeclaration(node); case 227: return bindBlockScopedDeclaration(node, 64, 792968); - case 284: + case 285: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } @@ -17919,12 +18056,12 @@ var ts; return; } else { - var parent_5 = node.parent; - if (!ts.isExternalModule(parent_5)) { + var parent_4 = node.parent; + if (!ts.isExternalModule(parent_4)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_5.isDeclarationFile) { + if (!parent_4.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -17999,14 +18136,6 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 1024; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; - } - } if (node.kind === 226) { bindBlockScopedDeclaration(node, 32, 899519); } @@ -18050,11 +18179,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (2048 | 4096); - } if (inStrictMode) { checkStrictModeEvalOrArguments(node, node.name); } @@ -18072,7 +18196,7 @@ var ts; function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + emitFlags |= 1024; } } checkStrictModeFunctionName(node); @@ -18087,7 +18211,7 @@ var ts; function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + emitFlags |= 1024; } } if (currentFlow) { @@ -18100,10 +18224,7 @@ var ts; function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; + emitFlags |= 1024; } } if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -18210,12 +18331,12 @@ var ts; if (node.typeArguments) { transformFlags |= 3; } - if (subtreeFlags & 8388608 + if (subtreeFlags & 524288 || isSuperOrSuperProperty(expression, expressionKind)) { - transformFlags |= 3072; + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~545281365; + return transformFlags & ~537396545; } function isSuperOrSuperProperty(node, kind) { switch (kind) { @@ -18234,28 +18355,28 @@ var ts; if (node.typeArguments) { transformFlags |= 3; } - if (subtreeFlags & 8388608) { - transformFlags |= 3072; + if (subtreeFlags & 524288) { + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~545281365; + return transformFlags & ~537396545; } function computeBinaryExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; if (operatorTokenKind === 57 && leftKind === 176) { - transformFlags |= 48 | 3072 | 49152; + transformFlags |= 8 | 192 | 3072; } else if (operatorTokenKind === 57 && leftKind === 175) { - transformFlags |= 3072 | 49152; + transformFlags |= 192 | 3072; } else if (operatorTokenKind === 39 || operatorTokenKind === 61) { - transformFlags |= 768; + transformFlags |= 32; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeParameter(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -18265,21 +18386,21 @@ var ts; var dotDotDotToken = node.dotDotDotToken; if (node.questionToken || node.type - || subtreeFlags & 65536 + || subtreeFlags & 4096 || ts.isThisIdentifier(name)) { transformFlags |= 3; } if (modifierFlags & 92) { - transformFlags |= 3 | 4194304; + transformFlags |= 3 | 262144; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } - if (subtreeFlags & 67108864 || initializer || dotDotDotToken) { - transformFlags |= 3072 | 2097152; + if (subtreeFlags & 8388608 || initializer || dotDotDotToken) { + transformFlags |= 192 | 131072; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~604001621; + return transformFlags & ~536872257; } function computeParenthesizedExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -18290,11 +18411,11 @@ var ts; || expressionKind === 182) { transformFlags |= 3; } - if (expressionTransformFlags & 16384) { - transformFlags |= 16384; + if (expressionTransformFlags & 1024) { + transformFlags |= 1024; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeClassDeclaration(node, subtreeFlags) { var transformFlags; @@ -18303,35 +18424,35 @@ var ts; transformFlags = 3; } else { - transformFlags = subtreeFlags | 3072; - if ((subtreeFlags & 4390912) + transformFlags = subtreeFlags | 192; + if ((subtreeFlags & 274432) || node.typeParameters) { transformFlags |= 3; } - if (subtreeFlags & 1048576) { - transformFlags |= 262144; + if (subtreeFlags & 65536) { + transformFlags |= 16384; } } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~559895893; + return transformFlags & ~539358529; } function computeClassExpression(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; - if (subtreeFlags & 4390912 + var transformFlags = subtreeFlags | 192; + if (subtreeFlags & 274432 || node.typeParameters) { transformFlags |= 3; } - if (subtreeFlags & 1048576) { - transformFlags |= 262144; + if (subtreeFlags & 65536) { + transformFlags |= 16384; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~559895893; + return transformFlags & ~539358529; } function computeHeritageClause(node, subtreeFlags) { var transformFlags = subtreeFlags; switch (node.token) { case 84: - transformFlags |= 3072; + transformFlags |= 192; break; case 107: transformFlags |= 3; @@ -18341,23 +18462,23 @@ var ts; break; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeCatchClause(node, subtreeFlags) { var transformFlags = subtreeFlags; if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) { - transformFlags |= 3072; + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~537920833; } function computeExpressionWithTypeArguments(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; + var transformFlags = subtreeFlags | 192; if (node.typeArguments) { transformFlags |= 3; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeConstructor(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -18365,11 +18486,14 @@ var ts; || !node.body) { transformFlags |= 3; } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~975983957; + return transformFlags & ~601015617; } function computeMethod(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; + var transformFlags = subtreeFlags | 192; if (node.decorators || ts.hasModifier(node, 2270) || node.typeParameters @@ -18377,14 +18501,17 @@ var ts; || !node.body) { transformFlags |= 3; } - if (ts.hasModifier(node, 256)) { - transformFlags |= 192; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - transformFlags |= 12288; + if (ts.hasModifier(node, 256)) { + transformFlags |= 16; + } + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~975983957; + return transformFlags & ~601015617; } function computeAccessor(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -18394,16 +18521,19 @@ var ts; || !node.body) { transformFlags |= 3; } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~975983957; + return transformFlags & ~601015617; } function computePropertyDeclaration(node, subtreeFlags) { var transformFlags = subtreeFlags | 3; if (node.initializer) { - transformFlags |= 131072; + transformFlags |= 8192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeFunctionDeclaration(node, subtreeFlags) { var transformFlags; @@ -18413,27 +18543,27 @@ var ts; transformFlags = 3; } else { - transformFlags = subtreeFlags | 268435456; + transformFlags = subtreeFlags | 33554432; if (modifierFlags & 2270 || node.typeParameters || node.type) { transformFlags |= 3; } if (modifierFlags & 256) { + transformFlags |= 16; + } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } + if (subtreeFlags & 163840) { transformFlags |= 192; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; - } - if (subtreeFlags & 2621440) { - transformFlags |= 3072; - } - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - transformFlags |= 12288; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + transformFlags |= 768; } } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~980243797; + return transformFlags & ~601281857; } function computeFunctionExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -18443,63 +18573,60 @@ var ts; transformFlags |= 3; } if (ts.hasModifier(node, 256)) { + transformFlags |= 16; + } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } + if (subtreeFlags & 163840) { transformFlags |= 192; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; - } - if (subtreeFlags & 2621440) { - transformFlags |= 3072; - } - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - transformFlags |= 12288; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~980243797; + return transformFlags & ~601281857; } function computeArrowFunction(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; + var transformFlags = subtreeFlags | 192; if (ts.hasModifier(node, 2270) || node.typeParameters || node.type) { transformFlags |= 3; } if (ts.hasModifier(node, 256)) { - transformFlags |= 192; + transformFlags |= 16; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } - if (subtreeFlags & 262144) { - transformFlags |= 524288; + if (subtreeFlags & 16384) { + transformFlags |= 32768; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~979719509; + return transformFlags & ~601249089; } function computePropertyAccess(node, subtreeFlags) { var transformFlags = subtreeFlags; var expression = node.expression; var expressionKind = expression.kind; if (expressionKind === 96) { - transformFlags |= 262144; + transformFlags |= 16384; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeVariableDeclaration(node, subtreeFlags) { var transformFlags = subtreeFlags; - var nameKind = node.name.kind; - if (nameKind === 172) { - transformFlags |= 48 | 3072 | 67108864; - } - else if (nameKind === 173) { - transformFlags |= 3072 | 67108864; + transformFlags |= 192 | 8388608; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } if (node.type) { transformFlags |= 3; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeVariableStatement(node, subtreeFlags) { var transformFlags; @@ -18510,21 +18637,21 @@ var ts; } else { transformFlags = subtreeFlags; - if (declarationListTransformFlags & 67108864) { - transformFlags |= 3072; + if (declarationListTransformFlags & 8388608) { + transformFlags |= 192; } } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeLabeledStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; - if (subtreeFlags & 33554432 + if (subtreeFlags & 4194304 && ts.isIterationStatement(node, true)) { - transformFlags |= 3072; + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeImportEquals(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -18532,15 +18659,15 @@ var ts; transformFlags |= 3; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeExpressionStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; - if (node.expression.transformFlags & 16384) { - transformFlags |= 3072; + if (node.expression.transformFlags & 1024) { + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeModuleDeclaration(node, subtreeFlags) { var transformFlags = 3; @@ -18549,26 +18676,26 @@ var ts; transformFlags |= subtreeFlags; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~839734613; + return transformFlags & ~574674241; } function computeVariableDeclarationList(node, subtreeFlags) { - var transformFlags = subtreeFlags | 268435456; - if (subtreeFlags & 67108864) { - transformFlags |= 3072; + var transformFlags = subtreeFlags | 33554432; + if (subtreeFlags & 8388608) { + transformFlags |= 192; } if (node.flags & 3) { - transformFlags |= 3072 | 33554432; + transformFlags |= 192 | 4194304; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~604001621; + return transformFlags & ~546309441; } function computeOther(node, kind, subtreeFlags) { var transformFlags = subtreeFlags; - var excludeFlags = 536892757; + var excludeFlags = 536872257; switch (kind) { case 119: case 189: - transformFlags |= 192; + transformFlags |= 16; break; case 113: case 111: @@ -18592,10 +18719,10 @@ var ts; case 250: case 251: case 252: - transformFlags |= 12; + transformFlags |= 4; break; case 213: - transformFlags |= 48; + transformFlags |= 8; case 12: case 13: case 14: @@ -18604,10 +18731,10 @@ var ts; case 181: case 258: case 114: - transformFlags |= 3072; + transformFlags |= 192; break; case 195: - transformFlags |= 3072 | 134217728; + transformFlags |= 192 | 16777216; break; case 118: case 132: @@ -18644,73 +18771,79 @@ var ts; excludeFlags = -3; break; case 142: - transformFlags |= 16777216; - if (subtreeFlags & 262144) { - transformFlags |= 1048576; + transformFlags |= 2097152; + if (subtreeFlags & 16384) { + transformFlags |= 65536; } break; case 196: - case 259: - transformFlags |= 8388608; + transformFlags |= 192 | 524288; + break; + case 259: + transformFlags |= 8 | 1048576; break; - case 174: - if (node.dotDotDotToken) { - transformFlags |= 8388608; - } case 96: - transformFlags |= 3072; + transformFlags |= 192; break; case 98: - transformFlags |= 262144; + transformFlags |= 16384; break; case 172: - case 173: - if (subtreeFlags & 8388608) { - transformFlags |= 48 | 67108864; + transformFlags |= 192 | 8388608; + if (subtreeFlags & 524288) { + transformFlags |= 8 | 1048576; } - else { - transformFlags |= 3072 | 67108864; + excludeFlags = 537396545; + break; + case 173: + transformFlags |= 192 | 8388608; + excludeFlags = 537396545; + break; + case 174: + transformFlags |= 192; + if (node.dotDotDotToken) { + transformFlags |= 524288; } break; case 145: - transformFlags |= 3 | 65536; + transformFlags |= 3 | 4096; break; case 176: - excludeFlags = 554784085; - if (subtreeFlags & 16777216) { - transformFlags |= 3072; + excludeFlags = 540087617; + if (subtreeFlags & 2097152) { + transformFlags |= 192; + } + if (subtreeFlags & 65536) { + transformFlags |= 16384; } if (subtreeFlags & 1048576) { - transformFlags |= 262144; - } - if (subtreeFlags & 8388608) { - transformFlags |= 48; + transformFlags |= 8; } break; case 175: case 180: - excludeFlags = 545281365; - if (subtreeFlags & 8388608) { - transformFlags |= 3072; + excludeFlags = 537396545; + if (subtreeFlags & 524288) { + transformFlags |= 192; } break; case 209: case 210: case 211: case 212: - if (subtreeFlags & 33554432) { - transformFlags |= 3072; + if (subtreeFlags & 4194304) { + transformFlags |= 192; } break; case 261: - if (subtreeFlags & 524288) { - transformFlags |= 3072; + if (subtreeFlags & 32768) { + transformFlags |= 192; } break; case 216: case 214: case 215: - transformFlags |= 268435456; + transformFlags |= 33554432; break; } node.transformFlags = transformFlags | 536870912; @@ -18724,27 +18857,27 @@ var ts; case 179: case 180: case 175: - return 545281365; + return 537396545; case 230: - return 839734613; + return 574674241; case 144: - return 604001621; + return 536872257; case 185: - return 979719509; + return 601249089; case 184: case 225: - return 980243797; + return 601281857; case 224: - return 604001621; + return 546309441; case 226: case 197: - return 559895893; + return 539358529; case 150: - return 975983957; + return 601015617; case 149: case 151: case 152: - return 975983957; + return 601015617; case 118: case 132: case 129: @@ -18762,9 +18895,14 @@ var ts; case 228: return -3; case 176: - return 554784085; + return 540087617; + case 256: + return 537920833; + case 172: + case 173: + return 537396545; default: - return 536892757; + return 536872257; } } ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions; @@ -18799,6 +18937,7 @@ var ts; function moduleHasNonRelativeName(moduleName) { return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } + ts.moduleHasNonRelativeName = moduleHasNonRelativeName; function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { @@ -19375,6 +19514,8 @@ var ts; ts.getSymbolId = getSymbolId; function createTypeChecker(host, produceDiagnostics) { var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); @@ -19437,6 +19578,7 @@ var ts; getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, isOptionalParameter: isOptionalParameter, + tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, false); } @@ -19446,6 +19588,7 @@ var ts; var intersectionTypes = ts.createMap(); var stringLiteralTypes = ts.createMap(); var numericLiteralTypes = ts.createMap(); + var indexedAccessTypes = ts.createMap(); var evolvingArrayTypes = []; var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); @@ -19465,7 +19608,6 @@ var ts; var voidType = createIntrinsicType(1024, "void"); var neverType = createIntrinsicType(8192, "never"); var silentNeverType = createIntrinsicType(8192, "never"); - var stringOrNumberType = getUnionType([stringType, numberType]); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); @@ -19681,9 +19823,7 @@ var ts; (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) { target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -20015,6 +20155,7 @@ var ts; if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && + !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } @@ -20091,6 +20232,16 @@ var ts; return undefined; } } + function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) { + if (meaning === 1920) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name); + return true; + } + } + return false; + } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { if (meaning & (107455 & ~1024)) { var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined)); @@ -20132,7 +20283,7 @@ var ts; } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { if (node.moduleReference.kind === 245) { @@ -20196,28 +20347,28 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_17 = specifier.propertyName || specifier.name; - if (name_17.text) { + var name_16 = specifier.propertyName || specifier.name; + if (name_16.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_17.text); + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_17.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text); } symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_17.text); - if (!symbolFromModule && allowSyntheticDefaultImports && name_17.text === "default") { + var symbolFromModule = getExportOfModule(targetSymbol, name_16.text); + if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_17, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_17)); + error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16)); } return symbol; } @@ -20399,9 +20550,8 @@ var ts; } if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - ts.Debug.assert(!!moduleNotFoundError); var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } else if (compilerOptions.noImplicitAny && moduleNotFoundError) { error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); @@ -20442,6 +20592,12 @@ var ts; function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function tryGetMemberInModuleExports(memberName, moduleSymbol) { + var symbolTable = getExportsOfModule(moduleSymbol); + if (symbolTable) { + return symbolTable[memberName]; + } + } function getExportsOfSymbol(symbol) { return symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; } @@ -20624,6 +20780,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { return true; @@ -20637,26 +20803,28 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + if (isAccessible(symbols[symbol.name])) { + return [symbol]; + } + return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -20957,9 +21125,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_6) { - walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false); + var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent_5) { + walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -21092,12 +21260,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -21378,7 +21546,7 @@ var ts; } ts.Debug.assert(bindingElement.kind === 174); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55); writeSpace(writer); } @@ -21521,12 +21689,12 @@ var ts; if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_8 = getDeclarationContainer(node); + var parent_7 = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 234 && parent_8.kind !== 261 && ts.isInAmbientContext(parent_8))) { - return isGlobalSourceFile(parent_8); + !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) { + return isGlobalSourceFile(parent_7); } - return isDeclarationVisible(parent_8); + return isDeclarationVisible(parent_7); case 147: case 146: case 151: @@ -21682,15 +21850,21 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); } function isComputedNonLiteralName(name) { - return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { - ts.Debug.assert(!!(source.flags & 32768), "Rest types only support object types right now."); + source = filterType(source, function (t) { return !(t.flags & 6144); }); + if (source.flags & 8192) { + return emptyObjectType; + } + if (source.flags & 65536) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_18 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_18)] = true; + var name_17 = properties_2[_i]; + names[ts.getTextOfPropertyName(name_17)] = true; } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; @@ -21721,33 +21895,33 @@ var ts; var type; if (pattern.kind === 172) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & 32768)) { + if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } var literalMembers = []; for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198 && !element.dotDotDotToken) { + if (!element.dotDotDotToken) { literalMembers.push(element.propertyName || element.name); } } type = getRestType(parentType, literalMembers, declaration.symbol); } else { - var name_19 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_19)) { + var name_18 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_18)) { return anyType; } if (declaration.initializer) { getContextualType(declaration.initializer); } - var text = ts.getTextOfPropertyName(name_19); + var text = ts.getTextOfPropertyName(name_18); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_19, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_19)); + error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18)); return unknownType; } } @@ -21781,29 +21955,9 @@ var ts; type; } function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { - var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); - if (jsDocType) { - return getTypeFromTypeNode(jsDocType); - } - } - function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) { - var typeTag = ts.getJSDocTypeTag(declaration); - if (typeTag && typeTag.typeExpression) { - return typeTag.typeExpression.type; - } - if (declaration.kind === 223 && - declaration.parent.kind === 224 && - declaration.parent.parent.kind === 205) { - var annotation = ts.getJSDocTypeTag(declaration.parent.parent); - if (annotation && annotation.typeExpression) { - return annotation.typeExpression.type; - } - } - else if (declaration.kind === 144) { - var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type; - } + var jsdocType = ts.getJSDocType(declaration); + if (jsdocType) { + return getTypeFromTypeNode(jsdocType); } return undefined; } @@ -21819,14 +21973,15 @@ var ts; return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } if (declaration.parent.parent.kind === 212) { - return stringType; + var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); + return indexType.flags & (16384 | 262144) ? indexType : stringType; } if (declaration.parent.parent.kind === 213) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; @@ -21837,7 +21992,8 @@ var ts; if (declaration.type) { return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); } - if (declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && + if ((compilerOptions.noImplicitAny || declaration.flags & 65536) && + declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -21897,13 +22053,18 @@ var ts; } function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { + if (isComputedNonLiteralName(name)) { hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, false); + return; + } var text = ts.getTextOfPropertyName(name); var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); var symbol = createSymbol(flags, text); @@ -21911,7 +22072,7 @@ var ts; symbol.bindingElement = e; members[symbol.name] = symbol; }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -21976,7 +22137,7 @@ var ts; if (declaration.kind === 240) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 2097152 && declaration.kind === 285 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 286 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { @@ -21985,10 +22146,10 @@ var ts; var type = void 0; if (declaration.kind === 192 || declaration.kind === 177 && declaration.parent.kind === 192) { - if (declaration.flags & 2097152) { - var typeTag = ts.getJSDocTypeTag(declaration.parent); - if (typeTag && typeTag.typeExpression) { - return links.type = getTypeFromTypeNode(typeTag.typeExpression.type); + if (declaration.flags & 65536) { + var jsdocType = ts.getJSDocType(declaration.parent); + if (jsdocType) { + return links.type = getTypeFromTypeNode(jsdocType); } } var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ? @@ -22000,16 +22161,7 @@ var ts; type = getWidenedTypeForVariableLikeDeclaration(declaration, true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -22039,7 +22191,7 @@ var ts; if (!links.type) { var getter = ts.getDeclarationOfKind(symbol, 151); var setter = ts.getDeclarationOfKind(symbol, 152); - if (getter && getter.flags & 2097152) { + if (getter && getter.flags & 65536) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; @@ -22121,10 +22273,27 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!pushTypeResolution(symbol, 0)) { + return unknownType; + } + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; } return links.type; } + function reportCircularityError(symbol) { + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { if (symbol.flags & 16777216) { return getTypeOfInstantiatedSymbol(symbol); @@ -22289,6 +22458,13 @@ var ts; } baseType = getReturnTypeOfSignature(constructors[0]); } + var valueDecl = type.symbol.valueDeclaration; + if (valueDecl && ts.isInJavaScriptFile(valueDecl)) { + var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration); + if (augTag) { + baseType = getTypeFromTypeNode(augTag.typeExpression.type); + } + } if (baseType === unknownType) { return; } @@ -22297,7 +22473,7 @@ var ts; return; } if (type === baseType || hasBaseType(baseType, type)) { - error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); + error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); return; } if (type.resolvedBaseTypes === emptyArray) { @@ -22399,7 +22575,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 284); + var declaration = ts.getDeclarationOfKind(symbol, 285); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -22885,36 +23061,42 @@ var ts; function resolveMappedTypeMembers(type) { var members = ts.createMap(); var stringIndexInfo; - var numberIndexInfo; + setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var isReadonly = !!type.declaration.readonlyToken; - var isOptional = !!type.declaration.questionToken; - var keyType = constraintType.flags & 16384 ? getApparentType(constraintType) : constraintType; - var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; - forEachType(iterationType, function (t) { + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 168) { + forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + if (getIndexInfoOfType(modifiersType, 0)) { + addMemberForKeyType(stringType); + } + } + else { + var keyType = constraintType.flags & 540672 ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t) { var iterationMapper = createUnaryTypeMapper(typeParameter, t); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); - if (t.flags & (32 | 64 | 256)) { + if (t.flags & 32) { var propName = t.text; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 536870912); var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; + prop.type = propType; + prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); members[propName] = prop; } else if (t.flags & 2) { - stringIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } - else if (t.flags & 4) { - numberIndexInfo = createIndexInfo(propType, isReadonly); - } - }); - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeParameterFromMappedType(type) { return type.typeParameter || @@ -22927,13 +23109,31 @@ var ts; function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 168) { + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; + } + function getErasedTemplateTypeFromMappedType(type) { + return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + } function isGenericMappedType(type) { if (getObjectFlags(type) & 32) { var constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (16384 | 262144)); + return maybeTypeOfKind(constraintType, 540672 | 262144); } return false; } @@ -23007,24 +23207,23 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } - function getApparentTypeOfTypeParameter(type) { + function getApparentTypeOfTypeVariable(type) { if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); + var constraintType = getConstraintOfTypeVariable(type); while (constraintType && constraintType.flags & 16384) { - constraintType = getConstraintOfTypeParameter(constraintType); + constraintType = getConstraintOfTypeVariable(constraintType); } type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); } return type.resolvedApparentType; } function getApparentType(type) { - var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) : type; - return t.flags & 34 ? globalStringType : + var t = type.flags & 540672 ? getApparentTypeOfTypeVariable(type) : type; + return t.flags & 262178 ? globalStringType : t.flags & 340 ? globalNumberType : t.flags & 136 ? globalBooleanType : t.flags & 512 ? getGlobalESSymbolType() : - t.flags & 262144 ? stringOrNumberType : - t; + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; @@ -23165,7 +23364,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -23193,17 +23392,20 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 2097152) { + if (node.flags & 65536) { if (node.type && node.type.kind === 273) { return true; } - var paramTag = ts.getCorrespondingJSDocParameterTag(node); - if (paramTag) { - if (paramTag.isBracketed) { - return true; - } - if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273; + var paramTags = ts.getJSDocParameterTags(node); + if (paramTags) { + for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) { + var paramTag = paramTags_1[_i]; + if (paramTag.isBracketed) { + return true; + } + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 273; + } } } } @@ -23319,7 +23521,7 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; @@ -23511,6 +23713,11 @@ var ts; } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } + function getConstraintOfTypeVariable(type) { + return type.flags & 16384 ? getConstraintOfTypeParameter(type) : + type.flags & 524288 ? type.constraint : + undefined; + } function getParentSymbolOfTypeParameter(typeParameter) { return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent); } @@ -23971,6 +24178,9 @@ var ts; typeSet.containsAny = true; } else if (!(type.flags & 8192) && (strictNullChecks || !(type.flags & 6144)) && !ts.contains(typeSet, type)) { + if (type.flags & 65536 && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } typeSet.push(type); } } @@ -23984,17 +24194,6 @@ var ts; if (types.length === 0) { return emptyObjectType; } - var _loop_2 = function (i) { - var type_1 = types[i]; - if (type_1.flags & 65536) { - return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }), false, aliasSymbol, aliasTypeArguments) }; - } - }; - for (var i = 0; i < types.length; i++) { - var state_2 = _loop_2(i); - if (typeof state_2 === "object") - return state_2.value; - } var typeSet = []; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { @@ -24003,6 +24202,11 @@ var ts; if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { @@ -24021,7 +24225,7 @@ var ts; } return links.resolvedType; } - function getIndexTypeForTypeParameter(type) { + function getIndexTypeForGenericType(type) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(262144); type.resolvedIndexType.type = type; @@ -24037,11 +24241,15 @@ var ts; return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); } function getIndexType(type) { - return type.flags & 16384 ? getIndexTypeForTypeParameter(type) : - type.flags & 1 || getIndexInfoOfType(type, 0) ? stringOrNumberType : - getIndexInfoOfType(type, 1) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) : + return maybeTypeOfKind(type, 540672) ? getIndexTypeForGenericType(type) : + getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) : + type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType : getLiteralTypeFromPropertyNames(type); } + function getIndexTypeOrString(type) { + var indexType = getIndexType(type); + return indexType !== neverType ? indexType : stringType; + } function getTypeFromTypeOperatorNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -24053,12 +24261,19 @@ var ts; var type = createType(524288); type.objectType = objectType; type.indexType = indexType; + if (type.objectType.flags & 229376) { + type.constraint = getIndexTypeOfType(type.objectType, 0); + } + else if (type.objectType.flags & 540672) { + var apparentType = getApparentTypeOfTypeVariable(type.objectType); + if (apparentType !== emptyObjectType) { + type.constraint = isTypeOfKind(type.indexType, 262178) ? + getIndexedAccessType(apparentType, type.indexType) : + getIndexTypeOfType(apparentType, 0); + } + } return type; } - function getIndexedAccessTypeForTypeParameter(objectType, indexType) { - var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []); - return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType)); - } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; var propName = indexType.flags & (32 | 64 | 256) ? @@ -24081,7 +24296,7 @@ var ts; return getTypeOfSymbol(prop); } } - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 | 340 | 512)) { + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 | 340 | 512)) { if (isTypeAny(objectType)) { return anyType; } @@ -24121,20 +24336,41 @@ var ts; } return unknownType; } - function getIndexedAccessType(objectType, indexType, accessNode) { - if (indexType.flags & 16384) { - if (accessNode && !isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - return getIndexedAccessTypeForTypeParameter(objectType, indexType); + function getIndexedAccessForMappedType(type, indexType, accessNode) { + var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { + error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); + return unknownType; } - var apparentType = getApparentType(objectType); + var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); + } + function getIndexedAccessType(objectType, indexType, accessNode) { + if (maybeTypeOfKind(indexType, 540672 | 262144) || + maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 178) || + isGenericMappedType(objectType)) { + if (objectType.flags & 1) { + return objectType; + } + if (accessNode) { + if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return unknownType; + } + } + if (isGenericMappedType(objectType)) { + return getIndexedAccessForMappedType(objectType, indexType, accessNode); + } + var id = objectType.id + "," + indexType.id; + return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + } + var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 && !(indexType.flags & 8190)) { var propTypes = []; for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) { var t = _a[_i]; - var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, false); + var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, false); if (propType === unknownType) { return unknownType; } @@ -24142,7 +24378,7 @@ var ts; } return getUnionType(propTypes); } - return getPropertyTypeForIndexType(apparentType, indexType, accessNode, true); + return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, true); } function getTypeFromIndexedAccessTypeNode(node) { var links = getNodeLinks(node); @@ -24159,6 +24395,7 @@ var ts; type.aliasSymbol = getAliasSymbolForTypeNode(node); type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); links.resolvedType = type; + getConstraintTypeFromMappedType(type); } return links.resolvedType; } @@ -24186,10 +24423,23 @@ var ts; return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } function getSpreadType(left, right, isFromObjectLiteral) { - ts.Debug.assert(!!(left.flags & (32768 | 1)) && !!(right.flags & (32768 | 1)), "Only object types may be spread."); if (left.flags & 1 || right.flags & 1) { return anyType; } + left = filterType(left, function (t) { return !(t.flags & 6144); }); + if (left.flags & 8192) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144); }); + if (right.flags & 8192) { + return left; + } + if (left.flags & 65536) { + return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + } + if (right.flags & 65536) { + return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); var stringIndexInfo; @@ -24327,18 +24577,18 @@ var ts; return nullType; case 129: return neverType; - case 288: - return nullType; case 289: - return undefinedType; + return nullType; case 290: + return undefinedType; + case 291: return neverType; case 167: case 98: return getTypeFromThisTypeNode(node); case 171: return getTypeFromLiteralTypeNode(node); - case 287: + case 288: return getTypeFromLiteralTypeNode(node.literal); case 157: case 272: @@ -24371,7 +24621,7 @@ var ts; case 158: case 159: case 161: - case 286: + case 287: case 274: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 168: @@ -24532,6 +24782,28 @@ var ts; return result; } function instantiateMappedType(type, mapper) { + var constraintType = getConstraintTypeFromMappedType(type); + if (constraintType.flags & 262144) { + var typeVariable_1 = constraintType.type; + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } + } + return instantiateMappedObjectType(type, mapper); + } + function isMappableType(type) { + return type.flags & (16384 | 32768 | 131072 | 524288); + } + function instantiateMappedObjectType(type, mapper) { var result = createObjectType(32 | 64, type.symbol); result.declaration = type.declaration; result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; @@ -24890,7 +25162,7 @@ var ts; return false; if (target.flags & 1 || source.flags & 8192) return true; - if (source.flags & 34 && target.flags & 2) + if (source.flags & 262178 && target.flags & 2) return true; if (source.flags & 340 && target.flags & 4) return true; @@ -24999,6 +25271,23 @@ var ts; reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608)) { + return false; + } + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source.flags & 96 && source.flags & 1048576) { @@ -25014,11 +25303,6 @@ var ts; } if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return -1; - if (source.flags & 262144) { - if (maybeTypeOfKind(target, 2) && maybeTypeOfKind(target, 4)) { - return -1; - } - } if (getObjectFlags(source) & 128 && source.flags & 1048576) { if (hasExcessProperties(source, target, reportErrors)) { if (reportErrors) { @@ -25026,7 +25310,7 @@ var ts; } return 0; } - if (target.flags & 196608) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -25057,11 +25341,22 @@ var ts; return result; } } - if (target.flags & 16384) { - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; + else if (target.flags & 16384) { + if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) { + if (!source.declaration.questionToken) { + var templateType = getTemplateTypeFromMappedType(source); + var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); + if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { + return result; + } + } + } + else { + var constraint = getConstraintOfTypeParameter(target); + if (constraint && constraint.flags & 262144) { + if (result = isRelatedTo(source, constraint, reportErrors)) { + return result; + } } } } @@ -25071,23 +25366,56 @@ var ts; return result; } } - var constraint = getConstraintOfTypeParameter(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + if (target.type.flags & 540672) { + var constraint = getConstraintOfTypeVariable(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } + } + } + else if (target.flags & 524288) { + if (source.flags & 524288 && source.indexType === target.indexType) { + if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { + return result; + } + } + if (target.constraint) { + if (result = isRelatedTo(source, target.constraint, reportErrors)) { + errorInfo = saveErrorInfo; return result; } } } if (source.flags & 16384) { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1) { - constraint = emptyObjectType; + if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) { + var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } - constraint = getTypeWithThisArgument(constraint, source); - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; - return result; + else { + var constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + constraint = getTypeWithThisArgument(constraint, source); + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + else if (source.flags & 524288) { + if (source.constraint) { + if (result = isRelatedTo(source.constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } else { @@ -25096,22 +25424,12 @@ var ts; return result; } } - if (isGenericMappedType(target)) { - if (isGenericMappedType(source)) { - if ((result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) && - (result = isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors))) { - return result; - } - } - } - else { - var apparentSource = getApparentType(source); - if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) { - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190); - if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { - errorInfo = saveErrorInfo; - return result; - } + var apparentSource = getApparentType(source); + if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + errorInfo = saveErrorInfo; + return result; } } } @@ -25318,6 +25636,9 @@ var ts; if (expandingFlags === 3) { result = 1; } + else if (isGenericMappedType(source) || isGenericMappedType(target)) { + result = mappedTypeRelatedTo(source, target, reportErrors); + } else { result = propertiesRelatedTo(source, target, reportErrors); if (result) { @@ -25345,6 +25666,33 @@ var ts; } return result; } + function mappedTypeRelatedTo(source, target, reportErrors) { + if (isGenericMappedType(target)) { + if (isGenericMappedType(source)) { + var result_2; + if (relation === identityRelation) { + var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; + var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; + if (readonlyMatches && optionalMatches) { + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); + } + } + } + else { + if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + } + } + } + } + } + else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { + return -1; + } + return 0; + } function propertiesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { return propertiesIdenticalTo(source, target); @@ -25820,7 +26168,7 @@ var ts; return type; } var types = [type]; - if (flags & 34) + if (flags & 262178) types.push(emptyStringType); if (flags & 340) types.push(zeroType); @@ -26024,25 +26372,69 @@ var ts; isFixed: false, }; } - function couldContainTypeParameters(type) { + function couldContainTypeVariables(type) { var objectFlags = getObjectFlags(type); - return !!(type.flags & 16384 || - objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeParameters) || + return !!(type.flags & 540672 || + objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeVariables) || objectFlags & 16 && type.symbol && type.symbol.flags & (8192 | 2048 | 32) || objectFlags & 32 || - type.flags & 196608 && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & 196608 && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || type.flags & 196608 && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); } - function inferTypes(context, originalSource, originalTarget) { - var typeParameters = context.signature.typeParameters; + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 536870912; + var members = createSymbolTable(properties); + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var prop = properties_4[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 | 67108864 | prop.flags & optionalMask, prop.name); + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); + members[prop.name] = inferredProp; + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; @@ -26058,7 +26450,7 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -26097,13 +26489,13 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384) { + if (target.flags & 540672) { if (source.flags & 8388608) { return; } - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : @@ -26111,7 +26503,7 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & 16384 && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -26129,21 +26521,21 @@ var ts; } else if (target.flags & 196608) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; + var typeVariableCount = 0; + var typeVariable = void 0; for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { var t = targetTypes_2[_d]; - if (t.flags & 16384 && ts.contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + if (t.flags & 540672 && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -26155,19 +26547,6 @@ var ts; } } else { - if (getObjectFlags(target) & 32) { - var constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & 32) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); - return; - } - if (constraintType.flags & 16384) { - inferFromTypes(getIndexType(source), constraintType); - inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); - return; - } - } source = getApparentType(source); if (source.flags & 32768) { if (isInProcess(source, target)) { @@ -26188,18 +26567,41 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; depth++; - inferFromProperties(source, target); - inferFromSignatures(source, target, 0); - inferFromSignatures(source, target, 1); - inferFromIndexTypes(source, target); + inferFromObjectTypes(source, target); depth--; } } } + function inferFromObjectTypes(source, target) { + if (getObjectFlags(target) & 32) { + var constraintType = getConstraintTypeFromMappedType(target); + if (constraintType.flags & 262144) { + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } + return; + } + if (constraintType.flags & 16384) { + inferFromTypes(getIndexType(source), constraintType); + inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); + return; + } + } + inferFromProperties(source, target); + inferFromSignatures(source, target, 0); + inferFromSignatures(source, target, 1); + inferFromIndexTypes(source, target); + } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var targetProp = properties_5[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -26530,7 +26932,7 @@ var ts; } function getTypeWithDefault(type, defaultExpression) { if (defaultExpression) { - var defaultType = checkExpression(defaultExpression); + var defaultType = getTypeOfExpression(defaultExpression); return getUnionType([getTypeWithFacts(type, 131072), defaultType]); } return type; @@ -26553,7 +26955,7 @@ var ts; function getAssignedTypeOfBinaryExpression(node) { return node.parent.kind === 175 || node.parent.kind === 257 ? getTypeWithDefault(getAssignedType(node), node.right) : - checkExpression(node.right); + getTypeOfExpression(node.right); } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); @@ -26601,7 +27003,7 @@ var ts; } function getTypeOfInitializer(node) { var links = getNodeLinks(node); - return links.resolvedType || checkExpression(node); + return links.resolvedType || getTypeOfExpression(node); } function getInitialTypeOfVariableDeclaration(node) { if (node.initializer) { @@ -26654,7 +27056,7 @@ var ts; } function getTypeOfSwitchClause(clause) { if (clause.kind === 253) { - var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression)); + var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } return neverType; @@ -26734,7 +27136,7 @@ var ts; return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType)); } function addEvolvingArrayElementType(evolvingArrayType, node) { - var elementType = getBaseTypeOfLiteralType(checkExpression(node)); + var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { @@ -26782,7 +27184,7 @@ var ts; parent.parent.operatorToken.kind === 57 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && - isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 | 2048); + isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 | 2048); return isLengthPushOrUnshift || isElementAssignment; } function maybeTypePredicateCall(node) { @@ -26920,7 +27322,7 @@ var ts; } } else { - var indexType = checkExpression(node.left.argumentExpression); + var indexType = getTypeOfExpression(node.left.argumentExpression); if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 | 2048)) { evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right); } @@ -27101,7 +27503,7 @@ var ts; if (operator === 32 || operator === 34) { assumeTrue = !assumeTrue; } - var valueType = checkExpression(value); + var valueType = getTypeOfExpression(value); if (valueType.flags & 6144) { if (!strictNullChecks) { return type; @@ -27173,7 +27575,7 @@ var ts; } return type; } - var rightType = checkExpression(expr.right); + var rightType = getTypeOfExpression(expr.right); if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } @@ -27201,16 +27603,16 @@ var ts; } } if (targetType) { - return getNarrowedType(type, targetType, assumeTrue); + return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf); } return type; } - function getNarrowedType(type, candidate, assumeTrue) { + function getNarrowedType(type, candidate, assumeTrue, isRelated) { if (!assumeTrue) { - return filterType(type, function (t) { return !isTypeInstanceOf(t, candidate); }); + return filterType(type, function (t) { return !isRelated(t, candidate); }); } if (type.flags & 65536) { - var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); }); + var assignableType = filterType(type, function (t) { return isRelated(t, candidate); }); if (!(assignableType.flags & 8192)) { return assignableType; } @@ -27237,7 +27639,7 @@ var ts; var predicateArgument = callExpression.arguments[predicate.parameterIndex]; if (predicateArgument) { if (isMatchingReference(reference, predicateArgument)) { - return getNarrowedType(type, predicate.type, assumeTrue); + return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } if (containsMatchingReference(reference, predicateArgument)) { return declaredType; @@ -27250,7 +27652,7 @@ var ts; var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { - return getNarrowedType(type, predicate.type, assumeTrue); + return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } if (containsMatchingReference(reference, possibleReference)) { return declaredType; @@ -27286,7 +27688,7 @@ var ts; location = location.parent; } if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) { - var type = checkExpression(location); + var type = getTypeOfExpression(location); if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { return type; } @@ -27358,7 +27760,7 @@ var ts; error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } - if (node.flags & 524288) { + if (node.flags & 16384) { getNodeLinks(container).flags |= 8192; } return getTypeOfSymbol(symbol); @@ -27369,8 +27771,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (languageVersion === 2 - && declaration_1.kind === 226 + if (declaration_1.kind === 226 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -27544,18 +27945,21 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + if (!superCall || superCall.end > node.pos) { + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; if (container.kind === 150) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - if (!superCall || superCall.end > node.pos) { - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } if (container.kind === 185) { container = ts.getThisContainer(container, false); @@ -27622,9 +28026,9 @@ var ts; return anyType; } function getTypeForThisExpressionFromJSDoc(node) { - var typeTag = ts.getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 274) { - var jsDocFunctionType = typeTag.typeExpression.type; + var jsdocType = ts.getJSDocType(node); + if (jsdocType && jsdocType.kind === 274) { + var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } @@ -27669,6 +28073,9 @@ var ts; } return unknownType; } + if (!isCallExpression && container.kind === 150) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } if ((ts.getModifierFlags(container) & 32) || isCallExpression) { nodeCheckFlag = 512; } @@ -27809,11 +28216,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_20 = declaration.propertyName || declaration.name; + var name_19 = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_20)) { - var text = ts.getTextOfPropertyName(name_20); + !ts.isBindingPattern(name_19)) { + var text = ts.getTextOfPropertyName(name_19); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -27892,13 +28299,13 @@ var ts; return undefined; } if (node === binaryExpression.right) { - return checkExpression(binaryExpression.left); + return getTypeOfExpression(binaryExpression.left); } } else if (operator === 53) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { - type = checkExpression(binaryExpression.left); + type = getTypeOfExpression(binaryExpression.left); } return type; } @@ -28124,7 +28531,7 @@ var ts; return mapper && mapper.context; } function checkSpreadExpression(node, contextualMapper) { - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); + var arrayOrIterableType = checkExpression(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { @@ -28204,7 +28611,7 @@ var ts; var links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 34 | 512)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 262178 | 512)) { error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { @@ -28213,10 +28620,10 @@ var ts; } return links.resolvedType; } - function getObjectLiteralIndexInfo(node, properties, kind) { + function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) { var propTypes = []; for (var i = 0; i < properties.length; i++) { - if (kind === 0 || isNumericName(node.properties[i].name)) { + if (kind === 0 || isNumericName(propertyNodes[i + offset].name)) { propTypes.push(getTypeOfSymbol(properties[i])); } } @@ -28237,8 +28644,9 @@ var ts; var patternWithComputedProperties = false; var hasComputedStringProperty = false; var hasComputedNumberProperty = false; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var memberDecl = _a[_i]; + var offset = 0; + for (var i = 0; i < node.properties.length; i++) { + var memberDecl = node.properties[i]; var member = memberDecl.symbol; if (memberDecl.kind === 257 || memberDecl.kind === 258 || @@ -28271,7 +28679,7 @@ var ts; if (impliedProp) { prop.flags |= impliedProp.flags & 536870912; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -28285,6 +28693,9 @@ var ts; member = prop; } else if (memberDecl.kind === 259) { + if (languageVersion < 5) { + checkExternalEmitHelpers(memberDecl, 2); + } if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), true); propertiesArray = []; @@ -28294,11 +28705,12 @@ var ts; typeFlags = 0; } var type = checkExpression(memberDecl.expression); - if (!(type.flags & (32768 | 1))) { + if (!isValidSpreadType(type)) { error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } spread = getSpreadType(spread, type, false); + offset = i + 1; continue; } else { @@ -28319,8 +28731,8 @@ var ts; propertiesArray.push(member); } if (contextualTypeHasPattern) { - for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { - var prop = _c[_b]; + for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { + var prop = _a[_i]; if (!propertiesTable[prop.name]) { if (!(prop.flags & 536870912)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); @@ -28334,14 +28746,16 @@ var ts; if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), true); } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; + if (spread.flags & 32768) { + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; + } return spread; } return createObjectLiteralType(); function createObjectLiteralType() { - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1) : undefined; + var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined; + var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined; var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); @@ -28358,6 +28772,11 @@ var ts; return result; } } + function isValidSpreadType(type) { + return !!(type.flags & (1 | 4096 | 2048) || + type.flags & 32768 && !isGenericMappedType(type) || + type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); + } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; @@ -28432,6 +28851,9 @@ var ts; return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { + if (compilerOptions.jsx === 2) { + checkExternalEmitHelpers(node, 2); + } var type = checkExpression(node.expression); var props = getPropertiesOfType(type); for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { @@ -28883,7 +29305,7 @@ var ts; if (node.kind === 212 && child === node.statement && getForInVariableSymbol(node) === symbol && - hasNumericPropertyNames(checkExpression(node.expression))) { + hasNumericPropertyNames(getTypeOfExpression(node.expression))) { return true; } child = node; @@ -28976,19 +29398,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_9 = signature.declaration && signature.declaration.parent; + var parent_8 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_9 === lastParent) { + if (lastParent && parent_8 === lastParent) { index++; } else { - lastParent = parent_9; + lastParent = parent_8; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_9; + lastParent = parent_8; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -29077,7 +29499,7 @@ var ts; function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { var context = createInferenceContext(signature, true); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -29096,7 +29518,7 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { @@ -29108,7 +29530,7 @@ var ts; var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } if (excludeArgument) { @@ -29116,7 +29538,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -29610,12 +30032,13 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; if (modifiers & 16 && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } if (modifiers & 8) { @@ -29806,7 +30229,7 @@ var ts; for (var i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -29859,7 +30282,7 @@ var ts; assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -29956,7 +30379,7 @@ var ts; if (!node.possiblyExhaustive) { return false; } - var type = checkExpression(node.expression); + var type = getTypeOfExpression(node.expression); if (!isLiteralType(type)) { return false; } @@ -29964,7 +30387,7 @@ var ts; if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { if (!(func.flags & 128)) { @@ -30178,7 +30601,7 @@ var ts; } function checkAwaitExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 524288)) { + if (!(node.flags & 16384)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -30292,32 +30715,32 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 | 340 | 512)) { + if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var p = properties_5[_i]; - checkObjectLiteralDestructuringPropertyAssignment(sourceType, p); + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var p = properties_6[_i]; + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } - function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) { + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { if (property.kind === 257 || property.kind === 258) { - var name_21 = property.name; - if (name_21.kind === 142) { - checkComputedPropertyName(name_21); + var name_20 = property.name; + if (name_20.kind === 142) { + checkComputedPropertyName(name_20); } - if (isComputedNonLiteralName(name_21)) { + if (isComputedNonLiteralName(name_20)) { return undefined; } - var text = ts.getTextOfPropertyName(name_21); + var text = ts.getTextOfPropertyName(name_20); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || @@ -30332,13 +30755,21 @@ var ts; } } else { - error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_21)); + error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); } } else if (property.kind === 259) { - if (property.expression.kind !== 70) { - error(property.expression, ts.Diagnostics.An_object_rest_element_must_be_an_identifier); + if (languageVersion < 5) { + checkExternalEmitHelpers(property, 4); } + var nonRestNames = []; + if (allProperties) { + for (var i = 0; i < allProperties.length - 1; i++) { + nonRestNames.push(allProperties[i].name); + } + } + var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); + return checkDestructuringAssignment(property.expression, type); } else { error(property, ts.Diagnostics.Property_assignment_expected); @@ -30423,7 +30854,10 @@ var ts; } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) { + var error = target.parent.kind === 259 ? + ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : + ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; + if (checkReferenceExpression(target, error)) { checkTypeAssignableTo(sourceType, targetType, target, undefined); } return sourceType; @@ -30560,7 +30994,7 @@ var ts; resultType = numberType; } else { - if (isTypeOfKind(leftType, 34) || isTypeOfKind(rightType, 34)) { + if (isTypeOfKind(leftType, 262178) || isTypeOfKind(rightType, 262178)) { resultType = stringType; } else if (isTypeAny(leftType) || isTypeAny(rightType)) { @@ -30583,6 +31017,8 @@ var ts; case 29: case 30: if (checkForDisallowedESSymbolOperand(operator)) { + leftType = getBaseTypeOfLiteralType(leftType); + rightType = getBaseTypeOfLiteralType(rightType); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -30676,7 +31112,7 @@ var ts; } function checkYieldExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 131072) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -30756,19 +31192,19 @@ var ts; function checkDeclarationInitializer(declaration) { var type = checkExpressionCached(declaration.initializer); return ts.getCombinedNodeFlags(declaration) & 2 || - ts.getCombinedModifierFlags(declaration) & 64 || + ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } function isLiteralContextualType(contextualType) { if (contextualType) { - if (contextualType.flags & 16384) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); + if (contextualType.flags & 540672) { + var apparentType = getApparentTypeOfTypeVariable(contextualType); if (apparentType.flags & (2 | 4 | 8 | 16)) { return true; } contextualType = apparentType; } - return maybeTypeOfKind(contextualType, 480); + return maybeTypeOfKind(contextualType, (480 | 262144)); } return false; } @@ -30805,6 +31241,16 @@ var ts; } return type; } + function getTypeOfExpression(node) { + if (node.kind === 179 && node.expression.kind !== 96) { + var funcType = checkNonNullExpression(node.expression); + var signature = getSingleCallSignature(funcType); + if (signature && !signature.typeParameters) { + return getReturnTypeOfSignature(signature); + } + } + return checkExpression(node); + } function checkExpression(node, contextualMapper) { var type; if (node.kind === 141) { @@ -30985,9 +31431,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_22 = _a[_i].name; - if (ts.isBindingPattern(name_22) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, parameterName, typePredicate.parameterName)) { + var name_21 = _a[_i].name; + if (ts.isBindingPattern(name_21) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -31007,9 +31453,9 @@ var ts; case 158: case 149: case 148: - var parent_10 = node.parent; - if (node === parent_10.type) { - return parent_10; + var parent_9 = node.parent; + if (node === parent_9.type) { + return parent_9; } } } @@ -31019,15 +31465,15 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_23 = element.name; - if (name_23.kind === 70 && - name_23.text === predicateVariableName) { + var name_22 = element.name; + if (name_22.kind === 70 && + name_22.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_23.kind === 173 || - name_23.kind === 172) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, predicateVariableNode, predicateVariableName)) { + else if (name_22.kind === 173 || + name_22.kind === 172) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) { return true; } } @@ -31042,6 +31488,12 @@ var ts; node.kind === 154) { checkGrammarFunctionLikeDeclaration(node); } + if (ts.isAsyncFunctionLike(node) && languageVersion < 4) { + checkExternalEmitHelpers(node, 64); + if (languageVersion < 2) { + checkExternalEmitHelpers(node, 128); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -31258,8 +31710,8 @@ var ts; if (superCallShouldBeFirst) { var statements = node.body.statements; var superCallStatement = void 0; - for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { - var statement = statements_2[_i]; + for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { + var statement = statements_3[_i]; if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; @@ -31401,8 +31853,8 @@ var ts; checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint); + var keyType = constraintType.flags & 540672 ? getApparentTypeOfTypeVariable(constraintType) : constraintType; + checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node); @@ -31646,10 +32098,10 @@ var ts; case 229: return 2097152 | 1048576; case 234: - var result_2 = 0; + var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); }); - return result_2; + ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); + return result_3; default: return 1048576; } @@ -31690,7 +32142,7 @@ var ts; if (thenSignatures.length === 0) { return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288); if (isTypeAny(onfulfilledParameterType)) { return undefined; } @@ -31826,6 +32278,9 @@ var ts; markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } function checkDecorators(node) { if (!node.decorators) { return; @@ -31836,14 +32291,20 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8); + if (node.kind === 144) { + checkExternalEmitHelpers(firstDecorator, 32); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { case 226: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; @@ -31852,11 +32313,13 @@ var ts; case 152: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; case 147: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; case 144: markTypeNodeAsReferenced(node.type); break; @@ -31965,7 +32428,7 @@ var ts; } function checkUnusedLocalsAndParameters(node) { if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_3 = function (key) { + var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) { @@ -31983,10 +32446,17 @@ var ts; } }; for (var key in node.locals) { - _loop_3(key); + _loop_2(key); } } } + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); @@ -31996,7 +32466,9 @@ var ts; return; } } - error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); @@ -32153,14 +32625,14 @@ var ts; } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192) { + if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -32188,8 +32660,8 @@ var ts; container.kind === 230 || container.kind === 261); if (!namesShareScope) { - var name_24 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_24, name_24); + var name_23 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23); } } } @@ -32257,16 +32729,19 @@ var ts; } } if (node.kind === 174) { + if (node.parent.kind === 172 && languageVersion < 5) { + checkExternalEmitHelpers(node, 4); + } if (node.propertyName && node.propertyName.kind === 142) { checkComputedPropertyName(node.propertyName); } - var parent_11 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_11); - var name_25 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_25)); + var parent_10 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_10); + var name_24 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); markPropertyAsReferenced(property); - if (parent_11.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + if (parent_10.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { @@ -32427,6 +32902,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); + var rightType = checkNonNullExpression(node.expression); if (node.initializer.kind === 224) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { @@ -32440,15 +32916,14 @@ var ts; if (varExpr.kind === 175 || varExpr.kind === 176) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } - else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34)) { + else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - var rightType = checkNonNullExpression(node.expression); - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -32573,12 +33048,12 @@ var ts; var arrayType = arrayOrStringType; if (arrayOrStringType.flags & 65536) { var arrayTypes = arrayOrStringType.types; - var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 34); }); + var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); }); if (filteredTypes !== arrayTypes) { arrayType = getUnionType(filteredTypes, true); } } - else if (arrayOrStringType.flags & 34) { + else if (arrayOrStringType.flags & 262178) { arrayType = neverType; } var hasStringConstituent = arrayOrStringType !== arrayType; @@ -32603,7 +33078,7 @@ var ts; } var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; if (hasStringConstituent) { - if (arrayElementType.flags & 34) { + if (arrayElementType.flags & 262178) { return stringType; } return getUnionType([arrayElementType, stringType], true); @@ -32666,7 +33141,7 @@ var ts; } function checkWithStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 524288) { + if (node.flags & 16384) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -32912,6 +33387,9 @@ var ts; checkClassForDuplicateDeclarations(node); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2 && !ts.isInAmbientContext(node)) { + checkExternalEmitHelpers(baseTypeNode.parent, 1); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; @@ -33087,8 +33565,8 @@ var ts; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var prop = properties_6[_a]; + for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { + var prop = properties_7[_a]; var existing = seen[prop.name]; if (!existing) { seen[prop.name] = { prop: prop, containingType: base }; @@ -33287,7 +33765,7 @@ var ts; return undefined; } } - enumType_1 = checkExpression(expression); + enumType_1 = getTypeOfExpression(expression); if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) { return undefined; } @@ -33482,9 +33960,9 @@ var ts; break; case 174: case 223: - var name_26 = node.name; - if (ts.isBindingPattern(name_26)) { - for (var _b = 0, _c = name_26.elements; _b < _c.length; _b++) { + var name_25 = node.name; + if (ts.isBindingPattern(name_25)) { + for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } @@ -34222,7 +34700,7 @@ var ts; } } case 96: - var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); + var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; case 167: return getTypeFromTypeNode(node).symbol; @@ -34244,7 +34722,7 @@ var ts; } case 8: if (node.parent.kind === 178 && node.parent.argumentExpression === node) { - var objectType = checkExpression(node.parent.expression); + var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; var apparentType = getApparentType(objectType); @@ -34275,7 +34753,7 @@ var ts; return getTypeFromTypeNode(node); } if (ts.isPartOfExpression(node)) { - return getTypeOfExpression(node); + return getRegularTypeOfExpression(node); } if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; @@ -34313,7 +34791,7 @@ var ts; return checkDestructuringAssignment(expr, iteratedType || unknownType); } if (expr.parent.kind === 192) { - var iteratedType = checkExpression(expr.parent.right); + var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } if (expr.parent.kind === 257) { @@ -34329,11 +34807,11 @@ var ts; var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); } - function getTypeOfExpression(expr) { + function getRegularTypeOfExpression(expr) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } - return getRegularTypeOfLiteralType(checkExpression(expr)); + return getRegularTypeOfLiteralType(getTypeOfExpression(expr)); } function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); @@ -34356,9 +34834,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols_3 = []; - var name_27 = symbol.name; + var name_26 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_27); + var symbol = getPropertyOfType(t, name_26); if (symbol) { symbols_3.push(symbol); } @@ -34411,7 +34889,7 @@ var ts; } function isNameOfModuleOrEnumDeclaration(node) { var parent = node.parent; - return ts.isModuleOrEnumDeclaration(parent) && node === parent.name; + return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name; } function getReferencedExportContainer(node, prefixLocals) { node = ts.getParseTreeNode(node, ts.isIdentifier); @@ -34619,7 +35097,7 @@ var ts; else if (isTypeOfKind(type, 340)) { return ts.TypeReferenceSerializationKind.NumberLikeType; } - else if (isTypeOfKind(type, 34)) { + else if (isTypeOfKind(type, 262178)) { return ts.TypeReferenceSerializationKind.StringLikeType; } else if (isTupleType(type)) { @@ -34650,7 +35128,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getWidenedType(getTypeOfExpression(expr)); + var type = getWidenedType(getRegularTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { @@ -34669,9 +35147,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_12 = reference.parent; - if (ts.isDeclaration(parent_12) && reference === parent_12.name) { - location = getDeclarationContainer(parent_12); + var parent_11 = reference.parent; + if (ts.isDeclaration(parent_11) && reference === parent_11.name) { + location = getDeclarationContainer(parent_11); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -34784,9 +35262,9 @@ var ts; } var current = symbol; while (true) { - var parent_13 = getParentOfSymbol(current); - if (parent_13) { - current = parent_13; + var parent_12 = getParentOfSymbol(current); + if (parent_12) { + current = parent_12; } else { break; @@ -34819,8 +35297,6 @@ var ts; ts.bindSourceFile(file, compilerOptions); } var augmentations; - var requestedExternalEmitHelpers = 0; - var firstFileRequestingExternalHelpers; for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { @@ -34840,15 +35316,6 @@ var ts; } } } - if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) { - var fileRequestedExternalEmitHelpers = file.flags & 64512; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; - } - } - } } if (augmentations) { for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) { @@ -34903,44 +35370,46 @@ var ts; var symbol = getGlobalSymbol("ReadonlyArray", 793064, undefined); globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - var helpersModule = resolveExternalModule(firstFileRequestingExternalHelpers, ts.externalHelpersModuleNameText, ts.Diagnostics.Cannot_find_module_0, undefined); - if (helpersModule) { - var exports = helpersModule.exports; - if (requestedExternalEmitHelpers & 1024 && languageVersion < 2) { - verifyHelperSymbol(exports, "__extends", 107455); - } - if (requestedExternalEmitHelpers & 16384 && - (languageVersion < 5 || compilerOptions.jsx === 2)) { - verifyHelperSymbol(exports, "__assign", 107455); - } - if (languageVersion < 5 && requestedExternalEmitHelpers & 32768) { - verifyHelperSymbol(exports, "__rest", 107455); - } - if (requestedExternalEmitHelpers & 2048) { - verifyHelperSymbol(exports, "__decorate", 107455); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports, "__metadata", 107455); - } - } - if (requestedExternalEmitHelpers & 4096) { - verifyHelperSymbol(exports, "__param", 107455); - } - if (requestedExternalEmitHelpers & 8192) { - verifyHelperSymbol(exports, "__awaiter", 107455); - if (languageVersion < 2) { - verifyHelperSymbol(exports, "__generator", 107455); + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1; helper <= 128; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name_27 = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_27), 107455); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_27); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols, name, meaning) { - var symbol = getSymbol(symbols, ts.escapeIdentifier(name), meaning); - if (!symbol) { - error(undefined, ts.Diagnostics.Module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + function getHelperName(helper) { + switch (helper) { + case 1: return "__extends"; + case 2: return "__assign"; + case 4: return "__rest"; + case 8: return "__decorate"; + case 16: return "__metadata"; + case 32: return "__param"; + case 64: return "__awaiter"; + case 128: return "__generator"; } } + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; + } + return externalHelpersModule; + } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); if (promiseLikeType !== emptyGenericType) { @@ -35590,6 +36059,9 @@ var ts; else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } @@ -35985,10 +36457,15 @@ var ts; function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } - function reduceEachChild(node, f, initial) { + function reduceNodeArray(nodes, f, initial) { + return nodes ? f(initial, nodes) : initial; + } + function reduceEachChild(node, initial, cbNode, cbNodeArray) { if (node === undefined) { return initial; } + var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; + var cbNodes = cbNodeArray || cbNode; var kind = node.kind; if ((kind > 0 && kind <= 140)) { return initial; @@ -36002,108 +36479,108 @@ var ts; case 206: case 198: case 222: - case 292: + case 293: break; case 142: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 144: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 145: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 147: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 149: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 150: - result = ts.reduceLeft(node.modifiers, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); break; case 151: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 152: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); break; case 172: case 173: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 174: - result = reduceNode(node.propertyName, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 175: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 176: - result = ts.reduceLeft(node.properties, f, result); + result = reduceNodes(node.properties, cbNodes, result); break; case 177: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.name, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 178: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.argumentExpression, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.argumentExpression, cbNode, result); break; case 179: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); - result = ts.reduceLeft(node.arguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); break; case 180: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); - result = ts.reduceLeft(node.arguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); break; case 181: - result = reduceNode(node.tag, f, result); - result = reduceNode(node.template, f, result); + result = reduceNode(node.tag, cbNode, result); + result = reduceNode(node.template, cbNode, result); break; case 184: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 185: - result = ts.reduceLeft(node.modifiers, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 183: case 186: @@ -36113,205 +36590,205 @@ var ts; case 195: case 196: case 201: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 190: case 191: - result = reduceNode(node.operand, f, result); + result = reduceNode(node.operand, cbNode, result); break; case 192: - result = reduceNode(node.left, f, result); - result = reduceNode(node.right, f, result); + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); break; case 193: - result = reduceNode(node.condition, f, result); - result = reduceNode(node.whenTrue, f, result); - result = reduceNode(node.whenFalse, f, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.whenTrue, cbNode, result); + result = reduceNode(node.whenFalse, cbNode, result); break; case 194: - result = reduceNode(node.head, f, result); - result = ts.reduceLeft(node.templateSpans, f, result); + result = reduceNode(node.head, cbNode, result); + result = reduceNodes(node.templateSpans, cbNodes, result); break; case 197: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.heritageClauses, f, result); - result = ts.reduceLeft(node.members, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); break; case 199: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); break; case 202: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.literal, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); break; case 204: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 205: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.declarationList, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.declarationList, cbNode, result); break; case 207: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 208: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.thenStatement, f, result); - result = reduceNode(node.elseStatement, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.thenStatement, cbNode, result); + result = reduceNode(node.elseStatement, cbNode, result); break; case 209: - result = reduceNode(node.statement, f, result); - result = reduceNode(node.expression, f, result); + result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 210: case 217: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 211: - result = reduceNode(node.initializer, f, result); - result = reduceNode(node.condition, f, result); - result = reduceNode(node.incrementor, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.incrementor, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 212: case 213: - result = reduceNode(node.initializer, f, result); - result = reduceNode(node.expression, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 216: case 220: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 218: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.caseBlock, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.caseBlock, cbNode, result); break; case 219: - result = reduceNode(node.label, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.label, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 221: - result = reduceNode(node.tryBlock, f, result); - result = reduceNode(node.catchClause, f, result); - result = reduceNode(node.finallyBlock, f, result); + result = reduceNode(node.tryBlock, cbNode, result); + result = reduceNode(node.catchClause, cbNode, result); + result = reduceNode(node.finallyBlock, cbNode, result); break; case 223: - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 224: - result = ts.reduceLeft(node.declarations, f, result); + result = reduceNodes(node.declarations, cbNodes, result); break; case 225: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 226: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.heritageClauses, f, result); - result = ts.reduceLeft(node.members, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); break; case 232: - result = ts.reduceLeft(node.clauses, f, result); + result = reduceNodes(node.clauses, cbNodes, result); break; case 235: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.importClause, f, result); - result = reduceNode(node.moduleSpecifier, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.importClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); break; case 236: - result = reduceNode(node.name, f, result); - result = reduceNode(node.namedBindings, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); break; case 237: - result = reduceNode(node.name, f, result); + result = reduceNode(node.name, cbNode, result); break; case 238: case 242: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 239: case 243: - result = reduceNode(node.propertyName, f, result); - result = reduceNode(node.name, f, result); + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 240: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.expression, f, result); + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 241: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.exportClause, f, result); - result = reduceNode(node.moduleSpecifier, f, result); + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.exportClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); break; case 246: - result = reduceNode(node.openingElement, f, result); - result = ts.reduceLeft(node.children, f, result); - result = reduceNode(node.closingElement, f, result); + result = reduceNode(node.openingElement, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingElement, cbNode, result); break; case 247: case 248: - result = reduceNode(node.tagName, f, result); - result = ts.reduceLeft(node.attributes, f, result); + result = reduceNode(node.tagName, cbNode, result); + result = reduceNodes(node.attributes, cbNodes, result); break; case 249: - result = reduceNode(node.tagName, f, result); + result = reduceNode(node.tagName, cbNode, result); break; case 250: - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 251: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 252: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 253: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); case 254: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 255: - result = ts.reduceLeft(node.types, f, result); + result = reduceNodes(node.types, cbNodes, result); break; case 256: - result = reduceNode(node.variableDeclaration, f, result); - result = reduceNode(node.block, f, result); + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); break; case 257: - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 258: - result = reduceNode(node.name, f, result); - result = reduceNode(node.objectAssignmentInitializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; case 259: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 261: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; - case 293: - result = reduceNode(node.expression, f, result); + case 294: + result = reduceNode(node.expression, cbNode, result); break; default: var edgeTraversalPath = nodeEdgeTraversalMap[kind]; @@ -36321,8 +36798,8 @@ var ts; var value = node[edge.name]; if (value !== undefined) { result = ts.isArray(value) - ? ts.reduceLeft(value, f, result) - : f(result, value); + ? reduceNodes(value, cbNodes, result) + : cbNode(result, value); } } } @@ -36332,8 +36809,8 @@ var ts; } ts.reduceEachChild = reduceEachChild; function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { - if (node === undefined) { - return undefined; + if (node === undefined || visitor === undefined) { + return node; } aggregateTransformFlags(node); var visited = visitor(node); @@ -36410,6 +36887,35 @@ var ts; return updated || nodes; } ts.visitNodes = visitNodes; + function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) { + context.startLexicalEnvironment(); + statements = visitNodes(statements, visitor, ts.isStatement, start); + if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { + statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements); + } + var declarations = context.endLexicalEnvironment(); + return ts.createNodeArray(ts.concatenate(statements, declarations), statements); + } + ts.visitLexicalEnvironment = visitLexicalEnvironment; + function visitParameterList(nodes, visitor, context) { + context.startLexicalEnvironment(); + var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration); + context.suspendLexicalEnvironment(); + return updated; + } + ts.visitParameterList = visitParameterList; + function visitFunctionBody(node, visitor, context) { + context.resumeLexicalEnvironment(); + var updated = visitNode(node, visitor, ts.isConciseBody); + var declarations = context.endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(updated); + var statements = mergeLexicalEnvironment(block.statements, declarations); + return ts.updateBlock(block, statements); + } + return updated; + } + ts.visitFunctionBody = visitFunctionBody; function visitEachChild(node, visitor, context) { if (node === undefined) { return undefined; @@ -36430,23 +36936,23 @@ var ts; case 142: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); case 144: - return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 147: return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 149: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 150: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 151: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 152: - return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 172: return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 173: return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); case 174: - return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); case 175: return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); case 176: @@ -36464,9 +36970,9 @@ var ts; case 183: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 184: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 185: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, true), context.endLexicalEnvironment())); + return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 186: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 187: @@ -36534,7 +37040,7 @@ var ts; case 224: return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 225: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 226: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); case 232: @@ -36586,9 +37092,8 @@ var ts; case 259: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); case 261: - context.startLexicalEnvironment(); - return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements)); - case 293: + return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); + case 294: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; @@ -36616,6 +37121,15 @@ var ts; } } ts.visitEachChild = visitEachChild; + function mergeLexicalEnvironment(statements, declarations) { + if (!ts.some(declarations)) { + return statements; + } + return ts.isNodeArray(statements) + ? ts.createNodeArray(ts.concatenate(statements, declarations), statements) + : ts.addRange(statements, declarations); + } + ts.mergeLexicalEnvironment = mergeLexicalEnvironment; function mergeFunctionBodyLexicalEnvironment(body, declarations) { if (body && declarations !== undefined && declarations.length > 0) { if (ts.isBlock(body)) { @@ -36646,22 +37160,37 @@ var ts; if (node === undefined) { return 0; } - else if (node.transformFlags & 536870912) { + if (node.transformFlags & 536870912) { return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind); } - else { - var subtreeFlags = aggregateTransformFlagsForSubtree(node); - return ts.computeTransformFlagsForNode(node, subtreeFlags); + var subtreeFlags = aggregateTransformFlagsForSubtree(node); + return ts.computeTransformFlagsForNode(node, subtreeFlags); + } + function aggregateTransformFlagsForNodeArray(nodes) { + if (nodes === undefined) { + return 0; } + var subtreeFlags = 0; + var nodeArrayFlags = 0; + for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { + var node = nodes_3[_i]; + subtreeFlags |= aggregateTransformFlagsForNode(node); + nodeArrayFlags |= node.transformFlags & ~536870912; + } + nodes.transformFlags = nodeArrayFlags | 536870912; + return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) { return 0; } - return reduceEachChild(node, aggregateTransformFlagsForChildNode, 0); + return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); } - function aggregateTransformFlagsForChildNode(transformFlags, child) { - return transformFlags | aggregateTransformFlagsForNode(child); + function aggregateTransformFlagsForChildNode(transformFlags, node) { + return transformFlags | aggregateTransformFlagsForNode(node); + } + function aggregateTransformFlagsForChildNodes(transformFlags, nodes) { + return transformFlags | aggregateTransformFlagsForNodeArray(nodes); } var Debug; (function (Debug) { @@ -36671,9 +37200,21 @@ var ts; Debug.failBadSyntaxKind = Debug.shouldAssert(1) ? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); } : ts.noop; + Debug.assertEachNode = Debug.shouldAssert(1) + ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }); } + : ts.noop; Debug.assertNode = Debug.shouldAssert(1) ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); } : ts.noop; + Debug.assertOptionalNode = Debug.shouldAssert(1) + ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); } + : ts.noop; + Debug.assertOptionalToken = Debug.shouldAssert(1) + ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }); } + : ts.noop; + Debug.assertMissingNode = Debug.shouldAssert(1) + ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }); } + : ts.noop; function getFunctionName(func) { if (typeof func !== "function") { return ""; @@ -36692,440 +37233,316 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) { - if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { - var right = node.right; - if (ts.isDestructuringAssignment(right)) { - return flattenDestructuringAssignment(context, right, needsValue, recordTempVariable, visitor); - } - else { - return node.right; - } - } + function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) { var location = node; - var value = node.right; - var expressions = []; - if (needsValue) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment, visitor); + var value; + if (ts.isDestructuringAssignment(node)) { + value = node.right; + while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { + if (ts.isDestructuringAssignment(value)) { + location = node = value; + value = node.right; + } + else { + return value; + } + } } - else if (ts.nodeIsSynthesized(node)) { - location = value; + var expressions; + var flattenContext = { + context: context, + level: level, + hoistTempVariables: true, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern, + createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern, + createArrayBindingOrAssignmentElement: makeAssignmentElement, + visitor: visitor + }; + if (value) { + value = ts.visitNode(value, visitor, ts.isExpression); + if (needsValue) { + value = ensureIdentifier(flattenContext, value, true, location); + } + else if (ts.nodeIsSynthesized(node)) { + location = value; + } } - flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor); - if (needsValue) { + flattenBindingOrAssignmentElement(flattenContext, node, value, location, ts.isDestructuringAssignment(node)); + if (value && needsValue) { + if (!ts.some(expressions)) { + return value; + } expressions.push(value); } - var expression = ts.inlineExpressions(expressions); - ts.aggregateTransformFlags(expression); - return expression; - function emitAssignment(name, value, location) { - var expression = ts.createAssignment(name, value, location); - ts.setEmitFlags(expression, 2048); + return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression(); + function emitExpression(expression) { + ts.setEmitFlags(expression, 64); ts.aggregateTransformFlags(expression); - expressions.push(expression); + expressions = ts.append(expressions, expression); } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - emitAssignment(name, value, location); - return name; - } - function emitRestAssignment(elements, value, location) { - emitAssignment(ts.createObjectLiteral(elements), value, location); + function emitBindingOrAssignment(target, value, location, original) { + ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); + var expression = createAssignmentCallback + ? createAssignmentCallback(target, value, location) + : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location); + expression.original = original; + emitExpression(expression); } } ts.flattenDestructuringAssignment = flattenDestructuringAssignment; - function flattenParameterDestructuring(node, value, visitor, transformRest) { + function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) { + var pendingExpressions; + var pendingDeclarations = []; var declarations = []; - flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor); + var flattenContext = { + context: context, + level: level, + hoistTempVariables: hoistTempVariables, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayBindingPattern, + createObjectBindingOrAssignmentPattern: makeObjectBindingPattern, + createArrayBindingOrAssignmentElement: makeBindingElement, + visitor: visitor + }; + flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer); + if (pendingExpressions) { + var temp = ts.createTempVariable(undefined); + if (hoistTempVariables) { + var value = ts.inlineExpressions(pendingExpressions); + pendingExpressions = undefined; + emitBindingOrAssignment(temp, value, undefined, undefined); + } + else { + context.hoistVariableDeclaration(temp); + var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations); + pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value)); + ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions); + pendingDeclaration.value = temp; + } + } + for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_30 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name_30, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + variable.original = original; + if (ts.isIdentifier(name_30)) { + ts.setEmitFlags(variable, 64); + } + ts.aggregateTransformFlags(variable); + declarations.push(variable); + } return declarations; - function emitAssignment(name, value, location) { - var declaration = ts.createVariableDeclaration(name, undefined, value, location); - ts.setEmitFlags(declaration, 2048); - ts.aggregateTransformFlags(declaration); - declarations.push(declaration); + function emitExpression(value) { + pendingExpressions = ts.append(pendingExpressions, value); } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(undefined); - emitAssignment(name, value, location); - return name; - } - function emitRestAssignment(elements, value, location) { - emitAssignment(ts.createObjectBindingPattern(elements), value, location); + function emitBindingOrAssignment(target, value, location, original) { + ts.Debug.assertNode(target, ts.isBindingName); + if (pendingExpressions) { + value = ts.inlineExpressions(ts.append(pendingExpressions, value)); + pendingExpressions = undefined; + } + pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original }); } } - ts.flattenParameterDestructuring = flattenParameterDestructuring; - function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) { - var declarations = []; - var pendingAssignments; - flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor); - return declarations; - function emitAssignment(name, value, location, original) { - if (pendingAssignments) { - pendingAssignments.push(value); - value = ts.inlineExpressions(pendingAssignments); - pendingAssignments = undefined; - } - var declaration = ts.createVariableDeclaration(name, undefined, value, location); - declaration.original = original; - ts.setEmitFlags(declaration, 2048); - declarations.push(declaration); - ts.aggregateTransformFlags(declaration); - } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - if (recordTempVariable) { - var assignment = ts.createAssignment(name, value, location); - if (pendingAssignments) { - pendingAssignments.push(assignment); - } - else { - pendingAssignments = [assignment]; - } - } - else { - emitAssignment(name, value, location, undefined); - } - return name; - } - function emitRestAssignment(elements, value, location, original) { - emitAssignment(ts.createObjectBindingPattern(elements), value, location, original); - } - } - ts.flattenVariableDestructuring = flattenVariableDestructuring; - function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) { - var pendingAssignments = []; - flattenDestructuring(node, undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, false, visitor); - var expression = ts.inlineExpressions(pendingAssignments); - ts.aggregateTransformFlags(expression); - return expression; - function emitAssignment(name, value, location, original) { - var expression = createAssignmentCallback - ? createAssignmentCallback(name.kind === 70 ? name : emitTempVariableAssignment(name, location), value, location) - : ts.createAssignment(name, value, location); - emitPendingAssignment(expression, original); - } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - emitPendingAssignment(ts.createAssignment(name, value, location), undefined); - return name; - } - function emitRestAssignment(elements, value, location, original) { - emitAssignment(ts.createObjectLiteral(elements), value, location, original); - } - function emitPendingAssignment(expression, original) { - expression.original = original; - ts.setEmitFlags(expression, 2048); - pendingAssignments.push(expression); - } - } - ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression; - function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) { - if (value && visitor) { - value = ts.visitNode(value, visitor, ts.isExpression); - } - if (ts.isBinaryExpression(root)) { - emitDestructuringAssignment(root.left, value, location); - } - else { - emitBindingElement(root, value); - } - function emitDestructuringAssignment(bindingTarget, value, location) { - var target; - if (ts.isShorthandPropertyAssignment(bindingTarget)) { - var initializer = visitor - ? ts.visitNode(bindingTarget.objectAssignmentInitializer, visitor, ts.isExpression) - : bindingTarget.objectAssignmentInitializer; - if (initializer) { - value = createDefaultValueCheck(value, initializer, location); - } - target = bindingTarget.name; - } - else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57) { - var initializer = visitor - ? ts.visitNode(bindingTarget.right, visitor, ts.isExpression) - : bindingTarget.right; - value = createDefaultValueCheck(value, initializer, location); - target = bindingTarget.left; - } - else { - target = bindingTarget; - } - if (target.kind === 176) { - emitObjectLiteralAssignment(target, value, location); - } - else if (target.kind === 175) { - emitArrayLiteralAssignment(target, value, location); - } - else { - var name_30 = ts.getMutableClone(target); - ts.setSourceMapRange(name_30, target); - ts.setCommentRange(name_30, target); - emitAssignment(name_30, value, location, undefined); - } - } - function emitObjectLiteralAssignment(target, value, location) { - var properties = target.properties; - if (properties.length !== 1) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - } - var bindingElements = []; - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; - if (p.kind === 257 || p.kind === 258) { - if (!transformRest || - p.transformFlags & 8388608 || - (p.kind === 257 && p.initializer.transformFlags & 8388608)) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - var propName = p.name; - var bindingTarget = p.kind === 258 ? p : p.initializer || propName; - emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p); - } - else { - bindingElements.push(p); - } - } - else if (i === properties.length - 1 && - p.kind === 259 && - p.expression.kind === 70) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - var propName = p.expression; - var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target); - emitDestructuringAssignment(propName, restCall, p); - } - } - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - } - function emitArrayLiteralAssignment(target, value, location) { - if (transformRest) { - emitESNextArrayLiteralAssignment(target, value, location); - } - else { - emitES2015ArrayLiteralAssignment(target, value, location); - } - } - function emitESNextArrayLiteralAssignment(target, value, location) { - var elements = target.elements; - var numElements = elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - } - var expressions = []; - var spreadContainingExpressions = []; - for (var i = 0; i < numElements; i++) { - var e = elements[i]; - if (e.kind === 198) { - continue; - } - if (e.transformFlags & 8388608 && i < numElements - 1) { - var tmp = ts.createTempVariable(recordTempVariable); - spreadContainingExpressions.push([e, tmp]); - expressions.push(tmp); - } - else { - expressions.push(e); - } - } - emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined); - for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) { - var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1]; - emitDestructuringAssignment(e, tmp, e); - } - } - function emitES2015ArrayLiteralAssignment(target, value, location) { - var elements = target.elements; - var numElements = elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - } - for (var i = 0; i < numElements; i++) { - var e = elements[i]; - if (e.kind !== 198) { - if (e.kind !== 196) { - emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e); - } - else if (i === numElements - 1) { - emitDestructuringAssignment(e.expression, ts.createArraySlice(value, i), e); - } - } - } - } - function createRestCall(value, elements, getPropertyName, location) { - var propertyNames = []; - for (var i = 0; i < elements.length - 1; i++) { - if (ts.isOmittedExpression(elements[i])) { - continue; - } - var str = ts.createSynthesizedNode(9); - str.pos = location.pos; - str.end = location.end; - str.text = ts.getTextOfPropertyName(getPropertyName(elements[i])); - propertyNames.push(str); - } - var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]); - return ts.createCall(ts.createIdentifier("__rest"), undefined, args); - } - function emitBindingElement(target, value) { - var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer; - if (transformRest) { - value = value || initializer; - } - else if (initializer) { - value = value ? createDefaultValueCheck(value, initializer, target) : initializer; + ts.flattenDestructuringBinding = flattenDestructuringBinding; + function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) { + if (!skipInitializer) { + var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression); + if (initializer) { + value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer; } else if (!value) { value = ts.createVoidZero(); } - var name = target.name; - if (!ts.isBindingPattern(name)) { - emitAssignment(name, value, target, target); - } - else { - var numElements = name.elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, numElements !== 0, target, emitTempVariableAssignment); - } - if (name.kind === 173) { - emitArrayBindingElement(name, value); + } + var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element); + if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) { + flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) { + flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else { + flattenContext.emitBindingOrAssignment(bindingTarget, value, location, element); + } + } + function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1) { + var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var computedTempVariables; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element); + if (flattenContext.level >= 1 + && !(element.transformFlags & (524288 | 1048576)) + && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 | 1048576)) + && !ts.isComputedPropertyName(propertyName)) { + bindingElements = ts.append(bindingElements, element); } else { - emitObjectBindingElement(target, value); - } - } - } - function emitArrayBindingElement(name, value) { - if (transformRest) { - emitESNextArrayBindingElement(name, value); - } - else { - emitES2015ArrayBindingElement(name, value); - } - } - function emitES2015ArrayBindingElement(name, value) { - var elements = name.elements; - var numElements = elements.length; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (!element.dotDotDotToken) { - emitBindingElement(element, ts.createElementAccess(value, i)); - } - else if (i === numElements - 1) { - emitBindingElement(element, ts.createArraySlice(value, i)); - } - } - } - function emitESNextArrayBindingElement(name, value) { - var elements = name.elements; - var numElements = elements.length; - var bindingElements = []; - var spreadContainingElements = []; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (element.transformFlags & 8388608 && i < numElements - 1) { - spreadContainingElements.push(element); - bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value)); - } - else { - bindingElements.push(element); - } - } - emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined); - for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) { - var element = spreadContainingElements_1[_i]; - emitBindingElement(element, ts.getGeneratedNameForNode(element)); - } - } - function emitObjectBindingElement(target, value) { - var name = target.name; - var elements = name.elements; - var numElements = elements.length; - var bindingElements = []; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (i === numElements - 1 && element.dotDotDotToken) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; } - var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name); - emitBindingElement(element, restCall); - } - else if (transformRest && !(element.transformFlags & 8388608)) { - bindingElements.push(element); - } - else { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName); + if (ts.isComputedPropertyName(propertyName)) { + computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression); } - var propName = element.propertyName || element.name; - emitBindingElement(element, createDestructuringPropertyAccess(value, propName)); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); } } - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + else if (i === numElements - 1) { + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; + } + var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); } } - function createDefaultValueCheck(value, defaultValue, location) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54), defaultValue, ts.createToken(55), value); + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); } - function createDestructuringPropertyAccess(expression, propertyName) { - if (ts.isComputedPropertyName(propertyName)) { - return ts.createElementAccess(expression, ensureIdentifier(propertyName.expression, false, propertyName, emitTempVariableAssignment)); - } - else if (ts.isLiteralExpression(propertyName)) { - var clone_2 = ts.getSynthesizedClone(propertyName); - clone_2.text = ts.unescapeIdentifier(clone_2.text); - return ts.createElementAccess(expression, clone_2); - } - else { - if (ts.isGeneratedIdentifier(propertyName)) { - var clone_3 = ts.getSynthesizedClone(propertyName); - clone_3.text = ts.unescapeIdentifier(clone_3.text); - return ts.createPropertyAccess(expression, clone_3); + } + function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) { + var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var restContainingElements; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (flattenContext.level >= 1) { + if (element.transformFlags & 1048576) { + var temp = ts.createTempVariable(undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + } + restContainingElements = ts.append(restContainingElements, [temp, element]); + bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp)); } else { - return ts.createPropertyAccess(expression, ts.createIdentifier(ts.unescapeIdentifier(propertyName.text))); + bindingElements = ts.append(bindingElements, element); } } + else if (ts.isOmittedExpression(element)) { + continue; + } + else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var rhsValue = ts.createElementAccess(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); + } + else if (i === numElements - 1) { + var rhsValue = ts.createArraySlice(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); + } + } + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern); + } + if (restContainingElements) { + for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) { + var _a = restContainingElements_1[_i], id = _a[0], element = _a[1]; + flattenBindingOrAssignmentElement(flattenContext, element, id, element); + } } } - function ensureIdentifier(value, reuseIdentifierExpressions, location, emitTempVariableAssignment, visitor) { + function createDefaultValueCheck(flattenContext, value, defaultValue, location) { + value = ensureIdentifier(flattenContext, value, true, location); + return ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value); + } + function createDestructuringPropertyAccess(flattenContext, value, propertyName) { + if (ts.isComputedPropertyName(propertyName)) { + var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, false, propertyName); + return ts.createElementAccess(value, argumentExpression); + } + else if (ts.isStringOrNumericLiteral(propertyName)) { + var argumentExpression = ts.getSynthesizedClone(propertyName); + argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text); + return ts.createElementAccess(value, argumentExpression); + } + else { + var name_31 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name_31); + } + } + function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { if (ts.isIdentifier(value) && reuseIdentifierExpressions) { return value; } else { - if (visitor) { - value = ts.visitNode(value, visitor, ts.isExpression); + var temp = ts.createTempVariable(undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + flattenContext.emitExpression(ts.createAssignment(temp, value, location)); } - return emitTempVariableAssignment(value, location); + else { + flattenContext.emitBindingOrAssignment(temp, value, location, undefined); + } + return temp; } } + function makeArrayBindingPattern(elements) { + ts.Debug.assertEachNode(elements, ts.isArrayBindingElement); + return ts.createArrayBindingPattern(elements); + } + function makeArrayAssignmentPattern(elements) { + return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement)); + } + function makeObjectBindingPattern(elements) { + ts.Debug.assertEachNode(elements, ts.isBindingElement); + return ts.createObjectBindingPattern(elements); + } + function makeObjectAssignmentPattern(elements) { + return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement)); + } + function makeBindingElement(name) { + return ts.createBindingElement(undefined, undefined, name); + } + function makeAssignmentElement(name) { + return name; + } + var restHelper = { + name: "typescript:rest", + scoped: false, + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + }; + function createRestCall(context, value, elements, computedTempVariables, location) { + context.requestEmitHelper(restHelper); + var propertyNames = []; + var computedTempVariableOffset = 0; + for (var i = 0; i < elements.length - 1; i++) { + var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]); + if (propertyName) { + if (ts.isComputedPropertyName(propertyName)) { + var temp = computedTempVariables[computedTempVariableOffset]; + computedTempVariableOffset++; + propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral("")))); + } + else { + propertyNames.push(ts.createLiteral(propertyName)); + } + } + } + return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + } })(ts || (ts = {})); var ts; (function (ts) { var USE_NEW_TYPE_METADATA_FORMAT = false; function transformTypeScript(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); @@ -37141,7 +37558,6 @@ var ts; var currentNamespaceContainerName; var currentScope; var currentScopeFirstDeclarationsOfName; - var currentExternalHelpersModuleName; var enabledSubstitutions; var classAliases; var applicableSubstitutions; @@ -37150,7 +37566,11 @@ var ts; if (ts.isDeclarationFile(node)) { return node; } - return ts.visitNode(node, visitor, ts.isSourceFile); + currentSourceFile = node; + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function saveStateAndInvoke(node, f) { var savedCurrentScope = currentScope; @@ -37163,14 +37583,29 @@ var ts; currentScope = savedCurrentScope; return visited; } + function onBeforeVisitNode(node) { + switch (node.kind) { + case 261: + case 232: + case 231: + case 204: + currentScope = node; + currentScopeFirstDeclarationsOfName = undefined; + break; + case 226: + case 225: + if (ts.hasModifier(node, 2)) { + break; + } + recordEmittedDeclarationInScope(node); + break; + } + } function visitor(node) { return saveStateAndInvoke(node, visitorWorker); } function visitorWorker(node) { - if (node.kind === 261) { - return visitSourceFile(node); - } - else if (node.transformFlags & 1) { + if (node.transformFlags & 1) { return visitTypeScript(node); } else if (node.transformFlags & 2) { @@ -37286,6 +37721,7 @@ var ts; case 145: case 228: case 147: + return undefined; case 150: return visitConstructor(node); case 227: @@ -37338,53 +37774,9 @@ var ts; return ts.visitEachChild(node, visitor, context); } } - function onBeforeVisitNode(node) { - switch (node.kind) { - case 261: - case 232: - case 231: - case 204: - currentScope = node; - currentScopeFirstDeclarationsOfName = undefined; - break; - case 226: - case 225: - if (ts.hasModifier(node, 2)) { - break; - } - recordEmittedDeclarationInScope(node); - break; - } - } function visitSourceFile(node) { - currentSourceFile = node; - if (compilerOptions.alwaysStrict && - !(ts.isExternalModule(node) && (compilerOptions.target >= 2 || compilerOptions.module === ts.ModuleKind.ES2015))) { - node = ts.ensureUseStrict(node); - } - if (node.flags & 64512 - && compilerOptions.importHelpers - && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); - var externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText); - var externalHelpersModuleImport = ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); - externalHelpersModuleImport.parent = node; - externalHelpersModuleImport.flags &= ~8; - statements.push(externalHelpersModuleImport); - currentExternalHelpersModuleName = externalHelpersModuleName; - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); - currentExternalHelpersModuleName = undefined; - node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); - node.externalHelpersModuleName = externalHelpersModuleName; - } - else { - node = ts.visitEachChild(node, sourceElementVisitor, context); - } - ts.setEmitFlags(node, 1 | ts.getEmitFlags(node)); - return node; + var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); + return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict)); } function shouldEmitDecorateCallForClass(node) { if (node.decorators && node.decorators.length > 0) { @@ -37430,7 +37822,7 @@ var ts; } if (statements.length > 1) { statements.push(ts.createEndOfDeclarationMarker(node)); - ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432); + ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152); } return ts.singleOrMany(statements); } @@ -37438,7 +37830,7 @@ var ts; var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node); var emitFlags = ts.getEmitFlags(node); if (hasStaticProperties) { - emitFlags |= 1024; + emitFlags |= 32; } ts.setOriginalNode(classDeclaration, node); ts.setEmitFlags(classDeclaration, emitFlags); @@ -37469,7 +37861,7 @@ var ts; enableSubstitutionForClassAliases(); classAliases[ts.getOriginalNodeId(node)] = ts.getSynthesizedClone(temp); } - ts.setEmitFlags(classExpression, 524288 | ts.getEmitFlags(classExpression)); + ts.setEmitFlags(classExpression, 32768 | ts.getEmitFlags(classExpression)); expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression))); ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp)); expressions.push(ts.startOnNewLine(temp)); @@ -37488,7 +37880,7 @@ var ts; } function transformConstructor(node, hasExtendsClause) { var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty); - var hasParameterPropertyAssignments = node.transformFlags & 4194304; + var hasParameterPropertyAssignments = node.transformFlags & 262144; var constructor = ts.getFirstConstructorWithBody(node); if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) { return ts.visitEachChild(constructor, visitor, context); @@ -37498,14 +37890,13 @@ var ts; return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor)); } function transformConstructorParameters(constructor) { - return constructor - ? ts.visitNodes(constructor.parameters, visitor, ts.isParameter) - : []; + return ts.visitParameterList(constructor && constructor.parameters, visitor, context) + || []; } function transformConstructorBody(node, constructor, hasExtendsClause) { var statements = []; var indexOfFirstStatement = 0; - startLexicalEnvironment(); + resumeLexicalEnvironment(); if (constructor) { indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements); var propertyAssignments = getParametersWithPropertyAssignments(constructor); @@ -37520,7 +37911,7 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement)); } ts.addRange(statements, endLexicalEnvironment()); - return ts.setMultiLine(ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined), true); + return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true); } function addPrologueDirectivesAndInitialSuperCall(ctor, result) { if (ctor.body) { @@ -37549,9 +37940,9 @@ var ts; ts.Debug.assert(ts.isIdentifier(node.name)); var name = node.name; var propertyName = ts.getMutableClone(name); - ts.setEmitFlags(propertyName, 49152 | 1536); + ts.setEmitFlags(propertyName, 1536 | 48); var localName = ts.getMutableClone(name); - ts.setEmitFlags(localName, 49152); + ts.setEmitFlags(localName, 1536); return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1))); } function getInitializedProperties(node, isStatic) { @@ -37569,8 +37960,8 @@ var ts; && member.initializer !== undefined; } function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { - var property = properties_7[_i]; + for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { + var property = properties_8[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -37579,8 +37970,8 @@ var ts; } function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { - var property = properties_8[_i]; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -37653,10 +38044,11 @@ var ts; return undefined; } var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; - if (accessor !== firstAccessor) { + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + var decorators = firstAccessorWithDecorators.decorators; var parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -37681,14 +38073,14 @@ var ts; } return { decorators: decorators }; } - function transformAllDecoratorsOfDeclaration(node, allDecorators) { + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (!allDecorators) { return undefined; } var decoratorExpressions = []; ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } function addClassElementDecorationStatements(statements, node, isStatic) { @@ -37713,7 +38105,7 @@ var ts; } function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -37724,8 +38116,8 @@ var ts; ? ts.createVoidZero() : ts.createNull() : undefined; - var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); - ts.setEmitFlags(helper, 49152); + var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); + ts.setEmitFlags(helper, 1536); return helper; } function addConstructorDecorationStatement(statements, node) { @@ -37736,15 +38128,15 @@ var ts; } function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)]; var localName = ts.getLocalName(node, false, true); - var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName); + var decorate = createDecorateHelper(context, decoratorExpressions, localName); var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate); - ts.setEmitFlags(expression, 49152); + ts.setEmitFlags(expression, 1536); ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node)); return expression; } @@ -37757,48 +38149,48 @@ var ts; expressions = []; for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) { var decorator = decorators_1[_i]; - var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset, decorator.expression); - ts.setEmitFlags(helper, 49152); + var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, decorator.expression); + ts.setEmitFlags(helper, 1536); expressions.push(helper); } } return expressions; } - function addTypeMetadata(node, decoratorExpressions) { + function addTypeMetadata(node, container, decoratorExpressions) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node, decoratorExpressions) { + function addOldTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } } } - function addNewTypeMetadata(node, decoratorExpressions) { + function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node)))); } if (properties) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true))); + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true))); } } } @@ -37813,12 +38205,16 @@ var ts; return node.kind === 149; } function shouldAddParamTypesMetadata(node) { - var kind = node.kind; - return kind === 226 - || kind === 197 - || kind === 149 - || kind === 151 - || kind === 152; + switch (node.kind) { + case 226: + case 197: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 149: + case 151: + case 152: + return true; + } + return false; } function serializeTypeOfNode(node) { switch (node.kind) { @@ -37836,18 +38232,7 @@ var ts; return ts.createVoidZero(); } } - function getRestParameterElementType(node) { - if (node && node.kind === 162) { - return node.elementType; - } - else if (node && node.kind === 157) { - return ts.singleOrUndefined(node.typeArguments); - } - else { - return undefined; - } - } - function serializeParameterTypesOfNode(node) { + function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) @@ -37855,7 +38240,7 @@ var ts; : undefined; var expressions = []; if (valueDeclaration) { - var parameters = valueDeclaration.parameters; + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; @@ -37863,7 +38248,7 @@ var ts; continue; } if (parameter.dotDotDotToken) { - expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type))); + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); } else { expressions.push(serializeTypeOfNode(parameter)); @@ -37872,6 +38257,15 @@ var ts; } return ts.createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 151) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } function serializeReturnTypeOfNode(node) { if (ts.isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); @@ -37967,7 +38361,7 @@ var ts; case ts.TypeReferenceSerializationKind.Unknown: var serialized = serializeEntityNameAsExpression(node.typeName, true); var temp = ts.createTempVariable(hoistVariableDeclaration); - return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictEquality(ts.createTypeOf(ts.createAssignment(temp, serialized)), ts.createLiteral("function")), temp), ts.createIdentifier("Object")); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object")); case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: return serializeEntityNameAsExpression(node.typeName, false); case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType: @@ -37996,14 +38390,14 @@ var ts; function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 70: - var name_31 = ts.getMutableClone(node); - name_31.flags &= ~8; - name_31.original = undefined; - name_31.parent = currentScope; + var name_32 = ts.getMutableClone(node); + name_32.flags &= ~8; + name_32.original = undefined; + name_32.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_31), ts.createLiteral("undefined")), name_31); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_32), ts.createLiteral("undefined")), name_32); } - return name_31; + return name_32; case 141: return serializeQualifiedNameAsExpression(node, useFallback); } @@ -38023,7 +38417,7 @@ var ts; return ts.createPropertyAccess(left, node.right); } function getGlobalSymbolNameWithFallback() { - return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54), ts.createIdentifier("Symbol"), ts.createToken(55), ts.createIdentifier("Object")); + return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object")); } function getExpressionForPropertyName(member, generateNameForComputedPropertyName) { var name = member.name; @@ -38033,7 +38427,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeIdentifier(name.text)); } else { return ts.getSynthesizedClone(name); @@ -38078,11 +38472,12 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setCommentRange(method, node); - ts.setSourceMapRange(method, ts.moveRangePastDecorators(node)); - ts.setOriginalNode(method, node); - return method; + var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + if (updated !== node) { + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } function shouldEmitAccessorDeclaration(node) { return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128)); @@ -38091,86 +38486,46 @@ var ts; if (!shouldEmitAccessorDeclaration(node)) { return undefined; } - var accessor = ts.createGetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node); - ts.setOriginalNode(accessor, node); - ts.setCommentRange(accessor, node); - ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node)); - return accessor; + var updated = ts.updateGetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + if (updated !== node) { + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } function visitSetAccessor(node) { if (!shouldEmitAccessorDeclaration(node)) { return undefined; } - var accessor = ts.createSetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node); - ts.setOriginalNode(accessor, node); - ts.setCommentRange(accessor, node); - ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node)); - return accessor; + var updated = ts.updateSetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + if (updated !== node) { + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } function visitFunctionDeclaration(node) { if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createNotEmittedStatement(node); } - var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); + var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isNamespaceExport(node)) { - var statements = [func]; + var statements = [updated]; addExportMemberAssignment(statements, node); return statements; } - return func; + return updated; } function visitFunctionExpression(node) { if (ts.nodeIsMissing(node.body)) { return ts.createOmittedExpression(); } - var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); - return func; + var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + return updated; } function visitArrowFunction(node) { - var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node); - ts.setOriginalNode(func, node); - return func; - } - function transformFunctionBody(node) { - return transformFunctionBodyWorker(node.body); - } - function transformFunctionBodyWorker(body, start) { - if (start === void 0) { start = 0; } - var savedCurrentScope = currentScope; - var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; - currentScope = body; - currentScopeFirstDeclarationsOfName = ts.createMap(); - startLexicalEnvironment(); - var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start); - var visited = ts.updateBlock(body, statements); - var declarations = endLexicalEnvironment(); - currentScope = savedCurrentScope; - currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - } - function transformConciseBody(node) { - return transformConciseBodyWorker(node.body, false); - } - function transformConciseBodyWorker(body, forceBlockFunctionBody) { - if (ts.isBlock(body)) { - return transformFunctionBodyWorker(body); - } - else { - startLexicalEnvironment(); - var visited = ts.visitNode(body, visitor, ts.isConciseBody); - var declarations = endLexicalEnvironment(); - var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - if (forceBlockFunctionBody && !ts.isBlock(merged)) { - return ts.createBlock([ - ts.createReturn(merged) - ]); - } - else { - return merged; - } - } + var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + return updated; } function visitParameter(node) { if (ts.parameterIsThisKeyword(node)) { @@ -38180,7 +38535,7 @@ var ts; ts.setOriginalNode(parameter, node); ts.setCommentRange(parameter, node); ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); - ts.setEmitFlags(parameter.name, 1024); + ts.setEmitFlags(parameter.name, 32); return parameter; } function visitVariableStatement(node) { @@ -38198,7 +38553,7 @@ var ts; function transformInitializedVariable(node) { var name = node.name; if (ts.isBindingPattern(name)) { - return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor); + return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression); } else { return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node); @@ -38239,10 +38594,10 @@ var ts; return undefined; } var statements = []; - var emitFlags = 64; + var emitFlags = 2; if (addVarForEnumOrModuleDeclaration(statements, node)) { if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= 16384; + emitFlags |= 512; } } var parameterName = getNamespaceParameterName(node); @@ -38313,9 +38668,9 @@ var ts; } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_32 = node.symbol && node.symbol.name; - if (name_32) { - return currentScopeFirstDeclarationsOfName[name_32] === node; + var name_33 = node.symbol && node.symbol.name; + if (name_33) { + return currentScopeFirstDeclarationsOfName[name_33] === node; } } return false; @@ -38334,13 +38689,13 @@ var ts; ts.setSourceMapRange(statement, node); } ts.setCommentRange(statement, node); - ts.setEmitFlags(statement, 32768 | 33554432); + ts.setEmitFlags(statement, 1024 | 2097152); statements.push(statement); return true; } else { var mergeMarker = ts.createMergeDeclarationMarker(statement); - ts.setEmitFlags(mergeMarker, 49152 | 33554432); + ts.setEmitFlags(mergeMarker, 1536 | 2097152); statements.push(mergeMarker); return false; } @@ -38352,10 +38707,10 @@ var ts; ts.Debug.assert(ts.isIdentifier(node.name), "TypeScript module should have an Identifier name."); enableSubstitutionForNamespaceExports(); var statements = []; - var emitFlags = 64; + var emitFlags = 2; if (addVarForEnumOrModuleDeclaration(statements, node)) { if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= 16384; + emitFlags |= 512; } } var parameterName = getNamespaceParameterName(node); @@ -38411,7 +38766,7 @@ var ts; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); if (body.kind !== 231) { - ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152); + ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } @@ -38486,7 +38841,7 @@ var ts; return undefined; } var moduleReference = ts.createExpressionFromEntityName(node.moduleReference); - ts.setEmitFlags(moduleReference, 49152 | 65536); + ts.setEmitFlags(moduleReference, 1536 | 2048); if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node) @@ -38604,14 +38959,14 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2) { - var name_33 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_33); + var name_34 = node.name; + var exportedName = trySubstituteNamespaceExportedName(name_34); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_33, initializer, node); + return ts.createPropertyAssignment(name_34, initializer, node); } - return ts.createPropertyAssignment(name_33, exportedName, node); + return ts.createPropertyAssignment(name_34, exportedName, node); } } return node; @@ -38639,10 +38994,10 @@ var ts; if (declaration) { var classAlias = classAliases[declaration.id]; if (classAlias) { - var clone_4 = ts.getSynthesizedClone(classAlias); - ts.setSourceMapRange(clone_4, node); - ts.setCommentRange(clone_4, node); - return clone_4; + var clone_2 = ts.getSynthesizedClone(classAlias); + ts.setSourceMapRange(clone_2, node); + ts.setCommentRange(clone_2, node); + return clone_2; } } } @@ -38650,7 +39005,7 @@ var ts; return undefined; } function trySubstituteNamespaceExportedName(node) { - if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) { + if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); if (container && container.kind !== 261) { var substitute = (applicableSubstitutions & 2 && container.kind === 230) || @@ -38695,10 +39050,278 @@ var ts; } } ts.transformTypeScript = transformTypeScript; + var paramHelper = { + name: "typescript:param", + scoped: false, + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + }; + function createParamHelper(context, expression, parameterOffset, location) { + context.requestEmitHelper(paramHelper); + return ts.createCall(ts.getHelperName("__param"), undefined, [ + ts.createLiteral(parameterOffset), + expression + ], location); + } + var metadataHelper = { + name: "typescript:metadata", + scoped: false, + priority: 3, + text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" + }; + function createMetadataHelper(context, metadataKey, metadataValue) { + context.requestEmitHelper(metadataHelper); + return ts.createCall(ts.getHelperName("__metadata"), undefined, [ + ts.createLiteral(metadataKey), + metadataValue + ]); + } + var decorateHelper = { + name: "typescript:decorate", + scoped: false, + priority: 2, + text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" + }; + function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { + context.requestEmitHelper(decorateHelper); + var argumentsArray = []; + argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + return ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray, location); + } +})(ts || (ts = {})); +var ts; +(function (ts) { + function transformESNext(context) { + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + function visitor(node) { + return visitorWorker(node, false); + } + function visitorNoDestructuringValue(node) { + return visitorWorker(node, true); + } + function visitorWorker(node, noDestructuringValue) { + if ((node.transformFlags & 8) === 0) { + return node; + } + switch (node.kind) { + case 176: + return visitObjectLiteralExpression(node); + case 192: + return visitBinaryExpression(node, noDestructuringValue); + case 223: + return visitVariableDeclaration(node); + case 213: + return visitForOfStatement(node); + case 211: + return visitForStatement(node); + case 188: + return visitVoidExpression(node); + case 150: + return visitConstructorDeclaration(node); + case 149: + return visitMethodDeclaration(node); + case 151: + return visitGetAccessorDeclaration(node); + case 152: + return visitSetAccessorDeclaration(node); + case 225: + return visitFunctionDeclaration(node); + case 184: + return visitFunctionExpression(node); + case 185: + return visitArrowFunction(node); + case 144: + return visitParameter(node); + case 207: + return visitExpressionStatement(node); + case 183: + return visitParenthesizedExpression(node, noDestructuringValue); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function chunkObjectLiteralElements(elements) { + var chunkObject; + var objects = []; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var e = elements_3[_i]; + if (e.kind === 259) { + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + chunkObject = undefined; + } + var target = e.expression; + objects.push(ts.visitNode(target, visitor, ts.isExpression)); + } + else { + if (!chunkObject) { + chunkObject = []; + } + if (e.kind === 257) { + var p = e; + chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); + } + else { + chunkObject.push(e); + } + } + } + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + } + return objects; + } + function visitObjectLiteralExpression(node) { + if (node.transformFlags & 1048576) { + var objects = chunkObjectLiteralElements(node.properties); + if (objects.length && objects[0].kind !== 176) { + objects.unshift(ts.createObjectLiteral()); + } + return createAssignHelper(context, objects); + } + return ts.visitEachChild(node, visitor, context); + } + function visitExpressionStatement(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + function visitParenthesizedExpression(node, noDestructuringValue) { + return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context); + } + function visitBinaryExpression(node, noDestructuringValue) { + if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) { + return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue); + } + else if (node.operatorToken.kind === 25) { + return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + function visitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576) { + return ts.flattenDestructuringBinding(node, visitor, context, 1); + } + return ts.visitEachChild(node, visitor, context); + } + function visitForStatement(node) { + return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement)); + } + function visitVoidExpression(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + function visitForOfStatement(node) { + var leadingStatements; + var temp; + var initializer = ts.skipParentheses(node.initializer); + if (initializer.transformFlags & 1048576) { + if (ts.isVariableDeclarationList(initializer)) { + temp = ts.createTempVariable(undefined); + var firstDeclaration = ts.firstOrUndefined(initializer.declarations); + var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer); + leadingStatements = ts.append(leadingStatements, statement); + } + } + else if (ts.isAssignmentPattern(initializer)) { + temp = ts.createTempVariable(undefined); + var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1); + leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer)); + } + } + if (temp) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var block = ts.isBlock(statement) + ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements)) + : ts.createBlock(ts.append(leadingStatements, statement), statement, true); + return ts.updateForOf(node, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(temp, undefined, undefined, node.initializer) + ], node.initializer, 1), expression, block); + } + return ts.visitEachChild(node, visitor, context); + } + function visitParameter(node) { + if (node.transformFlags & 1048576) { + return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + function visitConstructorDeclaration(node) { + return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + } + function visitGetAccessorDeclaration(node) { + return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitSetAccessorDeclaration(node) { + return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + } + function visitMethodDeclaration(node) { + return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitFunctionDeclaration(node) { + return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitArrowFunction(node) { + return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitFunctionExpression(node) { + return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function transformFunctionBody(node) { + resumeLexicalEnvironment(); + var leadingStatements; + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (parameter.transformFlags & 1048576) { + var temp = ts.getGeneratedNameForNode(parameter); + var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations)); + ts.setEmitFlags(statement, 524288); + leadingStatements = ts.append(leadingStatements, statement); + } + } + } + var body = ts.visitNode(node.body, visitor, ts.isConciseBody); + var trailingStatements = endLexicalEnvironment(); + if (ts.some(leadingStatements) || ts.some(trailingStatements)) { + var block = ts.convertToFunctionBody(body, true); + return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements)); + } + return body; + } + } + ts.transformESNext = transformESNext; + var assignHelper = { + name: "typescript:assign", + scoped: false, + priority: 1, + text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" + }; + function createAssignHelper(context, attributesSegments) { + context.requestEmitHelper(assignHelper); + return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments); + } + ts.createAssignHelper = createAssignHelper; })(ts || (ts = {})); var ts; (function (ts) { - var entities = createEntitiesMap(); function transformJsx(context) { var compilerOptions = context.getCompilerOptions(); var currentSourceFile; @@ -38708,17 +39331,15 @@ var ts; return node; } currentSourceFile = node; - node = ts.visitEachChild(node, visitor, context); + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; - return node; + return visited; } function visitor(node) { if (node.transformFlags & 4) { return visitorWorker(node); } - else if (node.transformFlags & 8) { - return ts.visitEachChild(node, visitor, context); - } else { return node; } @@ -38732,8 +39353,7 @@ var ts; case 252: return visitJsxExpression(node); default: - ts.Debug.failBadSyntaxKind(node); - return undefined; + return ts.visitEachChild(node, visitor, context); } } function transformJsxChildToExpression(node) { @@ -38771,8 +39391,10 @@ var ts; if (ts.isJsxSpreadAttribute(attrs[0])) { segments.unshift(ts.createObjectLiteral()); } - objectProperties = ts.singleOrUndefined(segments) - || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments); + objectProperties = ts.singleOrUndefined(segments); + if (!objectProperties) { + objectProperties = ts.createAssignHelper(context, segments); + } } var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location); if (isChild) { @@ -38865,12 +39487,12 @@ var ts; return getTagName(node.openingElement); } else { - var name_34 = node.tagName; - if (ts.isIdentifier(name_34) && ts.isIntrinsicJsxName(name_34.text)) { - return ts.createLiteral(name_34.text); + var name_35 = node.tagName; + if (ts.isIdentifier(name_35) && ts.isIntrinsicJsxName(name_35.text)) { + return ts.createLiteral(name_35.text); } else { - return ts.createExpressionFromEntityName(name_34); + return ts.createExpressionFromEntityName(name_35); } } } @@ -38888,455 +39510,291 @@ var ts; } } ts.transformJsx = transformJsx; - function createEntitiesMap() { - return ts.createMap({ - "quot": 0x0022, - "amp": 0x0026, - "apos": 0x0027, - "lt": 0x003C, - "gt": 0x003E, - "nbsp": 0x00A0, - "iexcl": 0x00A1, - "cent": 0x00A2, - "pound": 0x00A3, - "curren": 0x00A4, - "yen": 0x00A5, - "brvbar": 0x00A6, - "sect": 0x00A7, - "uml": 0x00A8, - "copy": 0x00A9, - "ordf": 0x00AA, - "laquo": 0x00AB, - "not": 0x00AC, - "shy": 0x00AD, - "reg": 0x00AE, - "macr": 0x00AF, - "deg": 0x00B0, - "plusmn": 0x00B1, - "sup2": 0x00B2, - "sup3": 0x00B3, - "acute": 0x00B4, - "micro": 0x00B5, - "para": 0x00B6, - "middot": 0x00B7, - "cedil": 0x00B8, - "sup1": 0x00B9, - "ordm": 0x00BA, - "raquo": 0x00BB, - "frac14": 0x00BC, - "frac12": 0x00BD, - "frac34": 0x00BE, - "iquest": 0x00BF, - "Agrave": 0x00C0, - "Aacute": 0x00C1, - "Acirc": 0x00C2, - "Atilde": 0x00C3, - "Auml": 0x00C4, - "Aring": 0x00C5, - "AElig": 0x00C6, - "Ccedil": 0x00C7, - "Egrave": 0x00C8, - "Eacute": 0x00C9, - "Ecirc": 0x00CA, - "Euml": 0x00CB, - "Igrave": 0x00CC, - "Iacute": 0x00CD, - "Icirc": 0x00CE, - "Iuml": 0x00CF, - "ETH": 0x00D0, - "Ntilde": 0x00D1, - "Ograve": 0x00D2, - "Oacute": 0x00D3, - "Ocirc": 0x00D4, - "Otilde": 0x00D5, - "Ouml": 0x00D6, - "times": 0x00D7, - "Oslash": 0x00D8, - "Ugrave": 0x00D9, - "Uacute": 0x00DA, - "Ucirc": 0x00DB, - "Uuml": 0x00DC, - "Yacute": 0x00DD, - "THORN": 0x00DE, - "szlig": 0x00DF, - "agrave": 0x00E0, - "aacute": 0x00E1, - "acirc": 0x00E2, - "atilde": 0x00E3, - "auml": 0x00E4, - "aring": 0x00E5, - "aelig": 0x00E6, - "ccedil": 0x00E7, - "egrave": 0x00E8, - "eacute": 0x00E9, - "ecirc": 0x00EA, - "euml": 0x00EB, - "igrave": 0x00EC, - "iacute": 0x00ED, - "icirc": 0x00EE, - "iuml": 0x00EF, - "eth": 0x00F0, - "ntilde": 0x00F1, - "ograve": 0x00F2, - "oacute": 0x00F3, - "ocirc": 0x00F4, - "otilde": 0x00F5, - "ouml": 0x00F6, - "divide": 0x00F7, - "oslash": 0x00F8, - "ugrave": 0x00F9, - "uacute": 0x00FA, - "ucirc": 0x00FB, - "uuml": 0x00FC, - "yacute": 0x00FD, - "thorn": 0x00FE, - "yuml": 0x00FF, - "OElig": 0x0152, - "oelig": 0x0153, - "Scaron": 0x0160, - "scaron": 0x0161, - "Yuml": 0x0178, - "fnof": 0x0192, - "circ": 0x02C6, - "tilde": 0x02DC, - "Alpha": 0x0391, - "Beta": 0x0392, - "Gamma": 0x0393, - "Delta": 0x0394, - "Epsilon": 0x0395, - "Zeta": 0x0396, - "Eta": 0x0397, - "Theta": 0x0398, - "Iota": 0x0399, - "Kappa": 0x039A, - "Lambda": 0x039B, - "Mu": 0x039C, - "Nu": 0x039D, - "Xi": 0x039E, - "Omicron": 0x039F, - "Pi": 0x03A0, - "Rho": 0x03A1, - "Sigma": 0x03A3, - "Tau": 0x03A4, - "Upsilon": 0x03A5, - "Phi": 0x03A6, - "Chi": 0x03A7, - "Psi": 0x03A8, - "Omega": 0x03A9, - "alpha": 0x03B1, - "beta": 0x03B2, - "gamma": 0x03B3, - "delta": 0x03B4, - "epsilon": 0x03B5, - "zeta": 0x03B6, - "eta": 0x03B7, - "theta": 0x03B8, - "iota": 0x03B9, - "kappa": 0x03BA, - "lambda": 0x03BB, - "mu": 0x03BC, - "nu": 0x03BD, - "xi": 0x03BE, - "omicron": 0x03BF, - "pi": 0x03C0, - "rho": 0x03C1, - "sigmaf": 0x03C2, - "sigma": 0x03C3, - "tau": 0x03C4, - "upsilon": 0x03C5, - "phi": 0x03C6, - "chi": 0x03C7, - "psi": 0x03C8, - "omega": 0x03C9, - "thetasym": 0x03D1, - "upsih": 0x03D2, - "piv": 0x03D6, - "ensp": 0x2002, - "emsp": 0x2003, - "thinsp": 0x2009, - "zwnj": 0x200C, - "zwj": 0x200D, - "lrm": 0x200E, - "rlm": 0x200F, - "ndash": 0x2013, - "mdash": 0x2014, - "lsquo": 0x2018, - "rsquo": 0x2019, - "sbquo": 0x201A, - "ldquo": 0x201C, - "rdquo": 0x201D, - "bdquo": 0x201E, - "dagger": 0x2020, - "Dagger": 0x2021, - "bull": 0x2022, - "hellip": 0x2026, - "permil": 0x2030, - "prime": 0x2032, - "Prime": 0x2033, - "lsaquo": 0x2039, - "rsaquo": 0x203A, - "oline": 0x203E, - "frasl": 0x2044, - "euro": 0x20AC, - "image": 0x2111, - "weierp": 0x2118, - "real": 0x211C, - "trade": 0x2122, - "alefsym": 0x2135, - "larr": 0x2190, - "uarr": 0x2191, - "rarr": 0x2192, - "darr": 0x2193, - "harr": 0x2194, - "crarr": 0x21B5, - "lArr": 0x21D0, - "uArr": 0x21D1, - "rArr": 0x21D2, - "dArr": 0x21D3, - "hArr": 0x21D4, - "forall": 0x2200, - "part": 0x2202, - "exist": 0x2203, - "empty": 0x2205, - "nabla": 0x2207, - "isin": 0x2208, - "notin": 0x2209, - "ni": 0x220B, - "prod": 0x220F, - "sum": 0x2211, - "minus": 0x2212, - "lowast": 0x2217, - "radic": 0x221A, - "prop": 0x221D, - "infin": 0x221E, - "ang": 0x2220, - "and": 0x2227, - "or": 0x2228, - "cap": 0x2229, - "cup": 0x222A, - "int": 0x222B, - "there4": 0x2234, - "sim": 0x223C, - "cong": 0x2245, - "asymp": 0x2248, - "ne": 0x2260, - "equiv": 0x2261, - "le": 0x2264, - "ge": 0x2265, - "sub": 0x2282, - "sup": 0x2283, - "nsub": 0x2284, - "sube": 0x2286, - "supe": 0x2287, - "oplus": 0x2295, - "otimes": 0x2297, - "perp": 0x22A5, - "sdot": 0x22C5, - "lceil": 0x2308, - "rceil": 0x2309, - "lfloor": 0x230A, - "rfloor": 0x230B, - "lang": 0x2329, - "rang": 0x232A, - "loz": 0x25CA, - "spades": 0x2660, - "clubs": 0x2663, - "hearts": 0x2665, - "diams": 0x2666 - }); - } -})(ts || (ts = {})); -var ts; -(function (ts) { - function transformESNext(context) { - var hoistVariableDeclaration = context.hoistVariableDeclaration; - var currentSourceFile; - return transformSourceFile; - function transformSourceFile(node) { - currentSourceFile = node; - return ts.visitEachChild(node, visitor, context); - } - function visitor(node) { - if (node.transformFlags & 16) { - return visitorWorker(node); - } - else if (node.transformFlags & 32) { - return ts.visitEachChild(node, visitor, context); - } - else { - return node; - } - } - function visitorWorker(node) { - switch (node.kind) { - case 176: - return visitObjectLiteralExpression(node); - case 192: - return visitBinaryExpression(node); - case 223: - return visitVariableDeclaration(node); - case 213: - return visitForOfStatement(node); - case 172: - case 173: - return node; - case 225: - return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); - case 185: - return visitArrowFunction(node); - case 144: - return visitParameter(node); - default: - ts.Debug.failBadSyntaxKind(node); - return ts.visitEachChild(node, visitor, context); - } - } - function chunkObjectLiteralElements(elements) { - var chunkObject; - var objects = []; - for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { - var e = elements_3[_i]; - if (e.kind === 259) { - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - chunkObject = undefined; - } - var target = e.expression; - objects.push(ts.visitNode(target, visitor, ts.isExpression)); - } - else { - if (!chunkObject) { - chunkObject = []; - } - if (e.kind === 257) { - var p = e; - chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); - } - else { - chunkObject.push(e); - } - } - } - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - } - return objects; - } - function visitObjectLiteralExpression(node) { - var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176) { - objects.unshift(ts.createObjectLiteral()); - } - return ts.createCall(ts.createIdentifier("__assign"), undefined, objects); - } - function visitBinaryExpression(node) { - if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48) { - return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, visitor, true); - } - return ts.visitEachChild(node, visitor, context); - } - function visitVariableDeclaration(node) { - if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48) { - var result = ts.flattenVariableDestructuring(node, undefined, visitor, undefined, true); - return result; - } - return ts.visitEachChild(node, visitor, context); - } - function visitForOfStatement(node) { - var initializer = node.initializer; - if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) { - return ts.visitEachChild(node, visitor, context); - } - return ts.convertForOf(node, undefined, visitor, ts.noop, context, true); - } - function isRestBindingPattern(initializer) { - if (ts.isVariableDeclarationList(initializer)) { - var declaration = ts.firstOrUndefined(initializer.declarations); - return declaration && declaration.name && - declaration.name.kind === 172 && - !!(declaration.name.transformFlags & 8388608); - } - return false; - } - function isRestAssignment(initializer) { - return initializer.kind === 176 && - initializer.transformFlags & 8388608; - } - function visitParameter(node) { - if (isObjectRestParameter(node)) { - return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, node.initializer, node), node); - } - else { - return node; - } - } - function isObjectRestParameter(node) { - return node.name && - node.name.kind === 172 && - !!(node.name.transformFlags & 8388608); - } - function visitFunctionDeclaration(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) : - ts.visitEachChild(node.body, visitor, context); - return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node); - } - function visitArrowFunction(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) : - ts.visitEachChild(node.body, visitor, context); - var func = ts.setOriginalNode(ts.createArrowFunction(undefined, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, body, node), node); - ts.setEmitFlags(func, 256); - return func; - } - function visitFunctionExpression(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) : - ts.visitEachChild(node.body, visitor, context); - return ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node); - } - } - ts.transformESNext = transformESNext; + var entities = ts.createMap({ + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + }); })(ts || (ts = {})); var ts; (function (ts) { function transformES2017(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var resolver = context.getEmitResolver(); var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); - var currentSourceFileExternalHelpersModuleName; + var currentSourceFile; var enabledSubstitutions; - var applicableSubstitutions; var currentSuperContainer; var previousOnEmitNode = context.onEmitNode; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - var currentScope; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } - currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName; - return ts.visitEachChild(node, visitor, context); + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function visitor(node) { - if (node.transformFlags & 64) { - return visitorWorker(node); + if ((node.transformFlags & 16) === 0) { + return node; } - else if (node.transformFlags & 128) { - return ts.visitEachChild(node, visitor, context); - } - return node; - } - function visitorWorker(node) { switch (node.kind) { case 119: return undefined; @@ -39351,68 +39809,37 @@ var ts; case 185: return visitArrowFunction(node); default: - ts.Debug.failBadSyntaxKind(node); - return node; + return ts.visitEachChild(node, visitor, context); } } function visitAwaitExpression(node) { return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node); } function visitMethodDeclaration(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setCommentRange(method, node); - ts.setSourceMapRange(method, ts.moveRangePastDecorators(node)); - ts.setOriginalNode(method, node); - return method; + return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitFunctionDeclaration(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); - return func; + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitFunctionExpression(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } if (ts.nodeIsMissing(node.body)) { return ts.createOmittedExpression(); } - var func = ts.createFunctionExpression(undefined, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); - return func; + return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitArrowFunction(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node); - ts.setOriginalNode(func, node); - return func; - } - function transformFunctionBody(node) { - return transformAsyncFunctionBody(node); - } - function transformConciseBody(node) { - return transformAsyncFunctionBody(node); - } - function transformFunctionBodyWorker(body, start) { - if (start === void 0) { start = 0; } - var savedCurrentScope = currentScope; - currentScope = body; - startLexicalEnvironment(); - var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start); - var visited = ts.updateBlock(body, statements); - var declarations = endLexicalEnvironment(); - currentScope = savedCurrentScope; - return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; @@ -39421,52 +39848,49 @@ var ts; if (!isArrowFunction) { var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor); - statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(statements, node.body, true); if (languageVersion >= 2) { if (resolver.getNodeCheckFlags(node) & 4096) { enableSubstitutionForAsyncMethodsWithSuper(); - ts.setEmitFlags(block, 8); + ts.addEmitHelper(block, advancedAsyncSuperHelper); } else if (resolver.getNodeCheckFlags(node) & 2048) { enableSubstitutionForAsyncMethodsWithSuper(); - ts.setEmitFlags(block, 4); + ts.addEmitHelper(block, asyncSuperHelper); } } return block; } else { - return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, true)); + var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(expression); + return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements)); + } + return expression; } } - function transformConciseBodyWorker(body, forceBlockFunctionBody) { + function transformFunctionBodyWorker(body, start) { if (ts.isBlock(body)) { - return transformFunctionBodyWorker(body); + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); } else { startLexicalEnvironment(); - var visited = ts.visitNode(body, visitor, ts.isConciseBody); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); var declarations = endLexicalEnvironment(); - var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - if (forceBlockFunctionBody && !ts.isBlock(merged)) { - return ts.createBlock([ - ts.createReturn(merged) - ]); - } - else { - return merged; - } + return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); } } function getPromiseConstructor(type) { - if (type) { - var typeName = ts.getEntityNameFromTypeNode(type); - if (typeName && ts.isEntityName(typeName)) { - var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); - if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue - || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { - return typeName; - } + var typeName = type && ts.getEntityNameFromTypeNode(type); + if (typeName && ts.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { + return typeName; } } return undefined; @@ -39540,14 +39964,15 @@ var ts; || kind === 152; } function onEmitNode(emitContext, node, emitCallback) { - var savedApplicableSubstitutions = applicableSubstitutions; - var savedCurrentSuperContainer = currentSuperContainer; if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var savedCurrentSuperContainer = currentSuperContainer; currentSuperContainer = node; + previousOnEmitNode(emitContext, node, emitCallback); + currentSuperContainer = savedCurrentSuperContainer; + } + else { + previousOnEmitNode(emitContext, node, emitCallback); } - previousOnEmitNode(emitContext, node, emitCallback); - applicableSubstitutions = savedApplicableSubstitutions; - currentSuperContainer = savedCurrentSuperContainer; } function onSubstituteNode(emitContext, node) { node = previousOnSubstituteNode(emitContext, node); @@ -39570,6 +39995,33 @@ var ts; } } ts.transformES2017 = transformES2017; + function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(awaiterHelper); + var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; + return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ + ts.createThis(), + hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), + promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), + generatorFunc + ]); + } + var awaiterHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };" + }; + var asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: "\n const _super = name => super[name];" + }; + var advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" + }; })(ts || (ts = {})); var ts; (function (ts) { @@ -39583,55 +40035,52 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitor(node) { - if (node.transformFlags & 256) { - return visitorWorker(node); - } - else if (node.transformFlags & 512) { - return ts.visitEachChild(node, visitor, context); - } - else { + if ((node.transformFlags & 32) === 0) { return node; } - } - function visitorWorker(node) { switch (node.kind) { case 192: return visitBinaryExpression(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitBinaryExpression(node) { + switch (node.operatorToken.kind) { + case 61: + return visitExponentiationAssignmentExpression(node); + case 39: + return visitExponentiationExpression(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function visitExponentiationAssignmentExpression(node) { + var target; + var value; var left = ts.visitNode(node.left, visitor, ts.isExpression); var right = ts.visitNode(node.right, visitor, ts.isExpression); - if (node.operatorToken.kind === 61) { - var target = void 0; - var value = void 0; - if (ts.isElementAccessExpression(left)) { - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left); - value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left); - } - else if (ts.isPropertyAccessExpression(left)) { - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left); - value = ts.createPropertyAccess(expressionTemp, left.name, left); - } - else { - target = left; - value = left; - } - return ts.createAssignment(target, ts.createMathPow(value, right, node), node); + if (ts.isElementAccessExpression(left)) { + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left); + value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left); } - else if (node.operatorToken.kind === 39) { - return ts.createMathPow(left, right, node); + else if (ts.isPropertyAccessExpression(left)) { + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left); + value = ts.createPropertyAccess(expressionTemp, left.name, left); } else { - ts.Debug.failBadSyntaxKind(node); - return ts.visitEachChild(node, visitor, context); + target = left; + value = left; } + return ts.createAssignment(target, ts.createMathPow(value, right, node), node); + } + function visitExponentiationExpression(node) { + var left = ts.visitNode(node.left, visitor, ts.isExpression); + var right = ts.visitNode(node.right, visitor, ts.isExpression); + return ts.createMathPow(left, right, node); } } ts.transformES2016 = transformES2016; @@ -39639,7 +40088,7 @@ var ts; var ts; (function (ts) { function transformES2015(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -39665,7 +40114,11 @@ var ts; } currentSourceFile = node; currentText = node.text; - return ts.visitNode(node, visitor, ts.isSourceFile); + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + currentText = undefined; + return visited; } function visitor(node) { return saveStateAndInvoke(node, dispatcher); @@ -39704,6 +40157,38 @@ var ts; currentNode = savedCurrentNode; return visited; } + function onBeforeVisitNode(node) { + if (currentNode) { + if (ts.isBlockScope(currentNode, currentParent)) { + enclosingBlockScopeContainer = currentNode; + enclosingBlockScopeContainerParent = currentParent; + } + if (ts.isFunctionLike(currentNode)) { + enclosingFunction = currentNode; + if (currentNode.kind !== 185) { + enclosingNonArrowFunction = currentNode; + if (!(ts.getEmitFlags(currentNode) & 131072)) { + enclosingNonAsyncFunctionBody = currentNode; + } + } + } + switch (currentNode.kind) { + case 205: + enclosingVariableStatement = currentNode; + break; + case 224: + case 223: + case 174: + case 172: + case 173: + break; + default: + enclosingVariableStatement = undefined; + } + } + currentParent = currentNode; + currentNode = node; + } function returnCapturedThis(node) { return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } @@ -39711,7 +40196,7 @@ var ts; return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression; } function shouldCheckNode(node) { - return (node.transformFlags & 1024) !== 0 || + return (node.transformFlags & 64) !== 0 || node.kind === 219 || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); } @@ -39722,7 +40207,7 @@ var ts; else if (shouldCheckNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 2048 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { + else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { return ts.visitEachChild(node, visitor, context); } else { @@ -39822,14 +40307,14 @@ var ts; return visitTemplateExpression(node); case 195: return visitYieldExpression(node); + case 196: + return visitSpreadElement(node); case 96: return visitSuperKeyword(); case 195: return ts.visitEachChild(node, visitor, context); case 149: return visitMethodDeclaration(node); - case 261: - return visitSourceFileNode(node); case 205: return visitVariableStatement(node); default: @@ -39837,37 +40322,14 @@ var ts; return ts.visitEachChild(node, visitor, context); } } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 2097152)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - switch (currentNode.kind) { - case 205: - enclosingVariableStatement = currentNode; - break; - case 224: - case 223: - case 174: - case 172: - case 173: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; + function visitSourceFile(node) { + var statements = []; + startLexicalEnvironment(); + var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); + addCaptureThisForNodeIfNeeded(statements, node); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + ts.addRange(statements, endLexicalEnvironment()); + return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); } function visitSwitchStatement(node) { ts.Debug.assert(convertedLoopState !== undefined); @@ -39969,9 +40431,9 @@ var ts; statements.push(exportStatement); } var emitFlags = ts.getEmitFlags(node); - if ((emitFlags & 33554432) === 0) { + if ((emitFlags & 2097152) === 0) { statements.push(ts.createEndOfDeclarationMarker(node)); - ts.setEmitFlags(statement, emitFlags | 33554432); + ts.setEmitFlags(statement, emitFlags | 2097152); } return ts.singleOrMany(statements); } @@ -39984,15 +40446,15 @@ var ts; } var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node); var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, "_super")] : [], undefined, transformClassBody(node, extendsClauseElement)); - if (ts.getEmitFlags(node) & 524288) { - ts.setEmitFlags(classFunction, 524288); + if (ts.getEmitFlags(node) & 32768) { + ts.setEmitFlags(classFunction, 32768); } var inner = ts.createPartiallyEmittedExpression(classFunction); inner.end = node.end; - ts.setEmitFlags(inner, 49152); + ts.setEmitFlags(inner, 1536); var outer = ts.createPartiallyEmittedExpression(inner); outer.end = ts.skipTrivia(currentText, node.pos); - ts.setEmitFlags(outer, 49152); + ts.setEmitFlags(outer, 1536); return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)] : [])); @@ -40007,19 +40469,19 @@ var ts; var localName = ts.getLocalName(node); var outer = ts.createPartiallyEmittedExpression(localName); outer.end = closingBraceLocation.end; - ts.setEmitFlags(outer, 49152); + ts.setEmitFlags(outer, 1536); var statement = ts.createReturn(outer); statement.pos = closingBraceLocation.pos; - ts.setEmitFlags(statement, 49152 | 12288); + ts.setEmitFlags(statement, 1536 | 384); statements.push(statement); ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true); - ts.setEmitFlags(block, 49152); + ts.setEmitFlags(block, 1536); return block; } function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { - statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)), extendsClauseElement)); + statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement)); } } function addConstructor(statements, node, extendsClauseElement) { @@ -40027,29 +40489,27 @@ var ts; var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node); if (extendsClauseElement) { - ts.setEmitFlags(constructorFunction, 256); + ts.setEmitFlags(constructorFunction, 8); } statements.push(constructorFunction); } function transformConstructorParameters(constructor, hasSynthesizedSuper) { - if (constructor && !hasSynthesizedSuper) { - return ts.visitNodes(constructor.parameters, visitor, ts.isParameter); - } - return []; + return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) + || []; } function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { var statements = []; - startLexicalEnvironment(); + resumeLexicalEnvironment(); var statementOffset = -1; if (hasSynthesizedSuper) { - statementOffset = 1; + statementOffset = 0; } else if (constructor) { statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor); } if (constructor) { - ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, false); - ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + addDefaultValueAssignmentsIfNeeded(statements, constructor); + addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); @@ -40071,7 +40531,7 @@ var ts; ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true); if (!constructor) { - ts.setEmitFlags(block, 49152); + ts.setEmitFlags(block, 1536); } return block; } @@ -40097,7 +40557,7 @@ var ts; function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { if (!hasExtendsClause) { if (ctor) { - ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis); + addCaptureThisForNodeIfNeeded(statements, ctor); } return 0; } @@ -40106,7 +40566,7 @@ var ts; return 2; } if (hasSynthesizedSuper) { - ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); + captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); enableSubstitutionsForCapturedThis(); return 1; } @@ -40120,11 +40580,19 @@ var ts; superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); } } - if (superCallExpression && statementOffset === ctorStatements.length - 1) { - statements.push(ts.createReturn(superCallExpression)); + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 | 32768))) { + var returnStatement = ts.createReturn(superCallExpression); + if (superCallExpression.kind !== 192 + || superCallExpression.left.kind !== 179) { + ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); + } + ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); + statements.push(returnStatement); return 2; } - ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement); + captureThisForNode(statements, ctor, superCallExpression, firstStatement); if (superCallExpression) { return 1; } @@ -40132,7 +40600,7 @@ var ts; } function createDefaultSuperCallOrThis() { var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 128); + ts.setEmitFlags(actualThis, 4); var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); return ts.createLogicalOr(superCall, actualThis); } @@ -40150,6 +40618,86 @@ var ts; return node; } } + function shouldAddDefaultValueAssignments(node) { + return (node.transformFlags & 131072) !== 0; + } + function addDefaultValueAssignmentsIfNeeded(statements, node) { + if (!shouldAddDefaultValueAssignments(node)) { + return; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + var name_36 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + if (dotDotDotToken) { + continue; + } + if (ts.isBindingPattern(name_36)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name_36, initializer); + } + else if (initializer) { + addDefaultValueAssignmentForInitializer(statements, parameter, name_36, initializer); + } + } + } + function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) { + var temp = ts.getGeneratedNameForNode(parameter); + if (name.elements.length > 0) { + statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, temp))), 524288)); + } + else if (initializer) { + statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288)); + } + } + function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { + initializer = ts.visitNode(initializer, visitor, ts.isExpression); + var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter)) + ], parameter), 1 | 32 | 384), undefined, parameter); + statement.startsOnNewLine = true; + ts.setEmitFlags(statement, 384 | 32 | 524288); + statements.push(statement); + } + function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { + return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper; + } + function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { + var parameter = ts.lastOrUndefined(node.parameters); + if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { + return; + } + var declarationName = ts.getMutableClone(parameter.name); + ts.setEmitFlags(declarationName, 48); + var expressionName = ts.getSynthesizedClone(parameter.name); + var restIndex = node.parameters.length - 1; + var temp = ts.createLoopVariable(); + statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([])) + ]), parameter), 524288)); + var forStatement = ts.createFor(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex)) + ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([ + ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 + ? temp + : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter)) + ])); + ts.setEmitFlags(forStatement, 524288); + ts.startOnNewLine(forStatement); + statements.push(forStatement); + } + function addCaptureThisForNodeIfNeeded(statements, node) { + if (node.transformFlags & 32768 && node.kind !== 185) { + captureThisForNode(statements, node, ts.createThis()); + } + } + function captureThisForNode(statements, node, initializer, originalStatement) { + enableSubstitutionsForCapturedThis(); + var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_this", undefined, initializer) + ]), originalStatement); + ts.setEmitFlags(captureThisStatement, 1536 | 524288); + ts.setSourceMapRange(captureThisStatement, node); + statements.push(captureThisStatement); + } function addClassMembers(statements, node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; @@ -40181,33 +40729,34 @@ var ts; function transformClassMethodDeclarationToStatement(receiver, member) { var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); - var func = transformFunctionLikeToExpression(member, member, undefined); - ts.setEmitFlags(func, 49152); - ts.setSourceMapRange(func, sourceMapRange); - var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name), func), member); + var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name); + var memberFunction = transformFunctionLikeToExpression(member, member, undefined); + ts.setEmitFlags(memberFunction, 1536); + ts.setSourceMapRange(memberFunction, sourceMapRange); + var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); - ts.setEmitFlags(statement, 1536); + ts.setEmitFlags(statement, 48); return statement; } function transformAccessorsToStatement(receiver, accessors) { var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor)); - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); return statement; } function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; var target = ts.getMutableClone(receiver); - ts.setEmitFlags(target, 49152 | 1024); + ts.setEmitFlags(target, 1536 | 32); ts.setSourceMapRange(target, firstAccessor.name); var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName)); - ts.setEmitFlags(propertyName, 49152 | 512); + ts.setEmitFlags(propertyName, 1536 | 16); ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); - ts.setEmitFlags(getterFunction, 16384); + ts.setEmitFlags(getterFunction, 512); var getter = ts.createPropertyAssignment("get", getterFunction); ts.setCommentRange(getter, ts.getCommentRange(getAccessor)); properties.push(getter); @@ -40215,7 +40764,7 @@ var ts; if (setAccessor) { var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); - ts.setEmitFlags(setterFunction, 16384); + ts.setEmitFlags(setterFunction, 512); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); properties.push(setter); @@ -40232,28 +40781,91 @@ var ts; return call; } function visitArrowFunction(node) { - if (node.transformFlags & 262144) { + if (node.transformFlags & 16384) { enableSubstitutionsForCapturedThis(); } - var func = transformFunctionLikeToExpression(node, node, undefined); - ts.setEmitFlags(func, 256); + var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node); + ts.setOriginalNode(func, node); + ts.setEmitFlags(func, 8); return func; } function visitFunctionExpression(node) { - return transformFunctionLikeToExpression(node, node, node.name); + return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + ? transformFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitFunctionDeclaration(node) { - return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis), node), node); + return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + ? transformFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function transformFunctionLikeToExpression(node, location, name) { var savedContainingNonArrowFunction = enclosingNonArrowFunction; if (node.kind !== 185) { enclosingNonArrowFunction = node; } - var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location), node); + var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node); enclosingNonArrowFunction = savedContainingNonArrowFunction; return expression; } + function transformFunctionBody(node) { + var multiLine = false; + var singleLine = false; + var statementsLocation; + var closeBraceLocation; + var statements = []; + var body = node.body; + var statementOffset; + resumeLexicalEnvironment(); + if (ts.isBlock(body)) { + statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); + } + addCaptureThisForNodeIfNeeded(statements, node); + addDefaultValueAssignmentsIfNeeded(statements, node); + addRestParameterIfNeeded(statements, node, false); + if (!multiLine && statements.length > 0) { + multiLine = true; + } + if (ts.isBlock(body)) { + statementsLocation = body.statements; + ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); + if (!multiLine && body.multiLine) { + multiLine = true; + } + } + else { + ts.Debug.assert(node.kind === 185); + statementsLocation = ts.moveRangeEnd(body, -1); + var equalsGreaterThanToken = node.equalsGreaterThanToken; + if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { + if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { + singleLine = true; + } + else { + multiLine = true; + } + } + var expression = ts.visitNode(body, visitor, ts.isExpression); + var returnStatement = ts.createReturn(expression, body); + ts.setEmitFlags(returnStatement, 384 | 32 | 1024); + statements.push(returnStatement); + closeBraceLocation = body; + } + var lexicalEnvironment = context.endLexicalEnvironment(); + ts.addRange(statements, lexicalEnvironment); + if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { + multiLine = true; + } + var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine); + if (!multiLine && singleLine) { + ts.setEmitFlags(block, 1); + } + if (closeBraceLocation) { + ts.setTokenSourceMapRange(block, 17, closeBraceLocation); + } + ts.setOriginalNode(block, node.body); + return block; + } function visitExpressionStatement(node) { switch (node.expression.kind) { case 183: @@ -40264,19 +40876,20 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitParenthesizedExpression(node, needsDestructuringValue) { - if (needsDestructuringValue) { + if (!needsDestructuringValue) { switch (node.expression.kind) { case 183: - return ts.createParen(visitParenthesizedExpression(node.expression, true), node); + return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); case 192: - return ts.createParen(visitBinaryExpression(node.expression, true), node); + return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } return ts.visitEachChild(node, visitor, context); } function visitBinaryExpression(node, needsDestructuringValue) { - ts.Debug.assert(ts.isDestructuringAssignment(node)); - return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor); + if (ts.isDestructuringAssignment(node)) { + return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue); + } } function visitVariableStatement(node) { if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) { @@ -40287,7 +40900,7 @@ var ts; if (decl.initializer) { var assignment = void 0; if (ts.isBindingPattern(decl.name)) { - assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, undefined, visitor); + assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0); } else { assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression)); @@ -40314,7 +40927,7 @@ var ts; var declarationList = ts.createVariableDeclarationList(declarations, node); ts.setOriginalNode(declarationList, node); ts.setCommentRange(declarationList, node); - if (node.transformFlags & 67108864 + if (node.transformFlags & 8388608 && (ts.isBindingPattern(node.declarations[0].name) || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { var firstDeclaration = ts.firstOrUndefined(declarations); @@ -40347,17 +40960,17 @@ var ts; return visitVariableDeclaration(node); } if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) { - var clone_5 = ts.getMutableClone(node); - clone_5.initializer = ts.createVoidZero(); - return clone_5; + var clone_3 = ts.getMutableClone(node); + clone_3.initializer = ts.createVoidZero(); + return clone_3; } return ts.visitEachChild(node, visitor, context); } function visitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - var recordTempVariablesInLine = !enclosingVariableStatement - || !ts.hasModifier(enclosingVariableStatement, 1); - return ts.flattenVariableDestructuring(node, undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration); + var hoistTempVariables = enclosingVariableStatement + && ts.hasModifier(enclosingVariableStatement, 1); + return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables); } return ts.visitEachChild(node, visitor, context); } @@ -40396,7 +41009,69 @@ var ts; return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); } function convertForOfToFor(node, convertedLoopBodyStatements) { - return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, false); + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var initializer = node.initializer; + var statements = []; + var counter = ts.createLoopVariable(); + var rhsReference = expression.kind === 70 + ? ts.createUniqueName(expression.text) + : ts.createTempVariable(undefined); + var elementAccess = ts.createElementAccess(rhsReference, counter); + if (ts.isVariableDeclarationList(initializer)) { + if (initializer.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); + if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { + var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess); + var declarationList = ts.createVariableDeclarationList(declarations, initializer); + ts.setOriginalNode(declarationList, initializer); + var firstDeclaration = declarations[0]; + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + statements.push(ts.createVariableStatement(undefined, declarationList)); + } + else { + statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter)) + ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1))); + } + } + else { + var assignment = ts.createAssignment(initializer, elementAccess); + if (ts.isDestructuringAssignment(assignment)) { + statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0))); + } + else { + assignment.end = initializer.end; + statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1))); + } + } + var bodyLocation; + var statementsLocation; + if (convertedLoopBodyStatements) { + ts.addRange(statements, convertedLoopBodyStatements); + } + else { + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + if (ts.isBlock(statement)) { + ts.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; + } + else { + statements.push(statement); + } + } + ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression)); + var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation); + ts.setEmitFlags(body, 48 | 384); + var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)), + ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression) + ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node); + ts.setEmitFlags(forStatement, 256); + return forStatement; } function visitObjectLiteralExpression(node) { var properties = node.properties; @@ -40404,7 +41079,7 @@ var ts; var numInitialProperties = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 134217728 + if (property.transformFlags & 16777216 || property.name.kind === 142) { numInitialProperties = i; break; @@ -40413,7 +41088,7 @@ var ts; ts.Debug.assert(numInitialProperties !== numProperties); var temp = ts.createTempVariable(hoistVariableDeclaration); var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 524288)); + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); if (node.multiLine) { assignment.startsOnNewLine = true; } @@ -40490,30 +41165,35 @@ var ts; convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; } } + startLexicalEnvironment(); var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { - var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, 1, statements_3); - loopBody = ts.createBlock(statements_3, undefined, true); + if (loopOutParameters.length || lexicalEnvironment) { + var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, undefined, true); } if (!ts.isBlock(loopBody)) { loopBody = ts.createBlock([loopBody], undefined, true); } var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152) !== 0 - && (node.statement.transformFlags & 134217728) !== 0; + && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0 + && (node.statement.transformFlags & 16777216) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { - loopBodyFlags |= 256; + loopBodyFlags |= 8; } if (isAsyncBlockContainingAwait) { - loopBodyFlags |= 2097152; + loopBodyFlags |= 131072; } var convertedLoopVariable = ts.createVariableStatement(undefined, ts.setEmitFlags(ts.createVariableDeclarationList([ ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(undefined, isAsyncBlockContainingAwait ? ts.createToken(38) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags)) - ]), 16777216)); + ]), 1048576)); var statements = [convertedLoopVariable]; var extraVariableDeclarations; if (currentState.argumentsName) { @@ -40730,7 +41410,7 @@ var ts; ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); var temp = ts.createTempVariable(undefined); var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenVariableDestructuring(node.variableDeclaration, temp, visitor); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); var destructure = ts.createVariableStatement(undefined, list); return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); @@ -40742,7 +41422,7 @@ var ts; function visitMethodDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined); - ts.setEmitFlags(functionExpression, 16384 | ts.getEmitFlags(functionExpression)); + ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression)); return ts.createPropertyAssignment(node.name, functionExpression, node); } function visitShorthandPropertyAssignment(node) { @@ -40763,10 +41443,10 @@ var ts; function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) { var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; if (node.expression.kind === 96) { - ts.setEmitFlags(thisArg, 128); + ts.setEmitFlags(thisArg, 4); } var resultingCall; - if (node.transformFlags & 8388608) { + if (node.transformFlags & 524288) { resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); } else { @@ -40774,7 +41454,7 @@ var ts; } if (node.expression.kind === 96) { var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 128); + ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); return assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) @@ -40783,7 +41463,7 @@ var ts; return resultingCall; } function visitNewExpression(node) { - ts.Debug.assert((node.transformFlags & 8388608) !== 0); + ts.Debug.assert((node.transformFlags & 524288) !== 0); var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); } @@ -40811,6 +41491,9 @@ var ts; function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine); } + function visitSpreadElement(node) { + return ts.visitNode(node.expression, visitor, ts.isExpression); + } function visitExpressionOfSpread(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); } @@ -40888,18 +41571,6 @@ var ts; ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } - function visitSourceFileNode(node) { - var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1]; - var statements = []; - startLexicalEnvironment(); - ts.addRange(statements, prologue); - ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis); - ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement)); - ts.addRange(statements, endLexicalEnvironment()); - var clone = ts.getMutableClone(node); - clone.statements = ts.createNodeArray(statements, node.statements); - return clone; - } function onEmitNode(emitContext, node, emitCallback) { var savedEnclosingFunction = enclosingFunction; if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) { @@ -40979,7 +41650,7 @@ var ts; function substituteThisKeyword(node) { if (enabledSubstitutions & 1 && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 256) { + && ts.getEmitFlags(enclosingFunction) & 8) { return ts.createIdentifier("_this", node); } return node; @@ -40992,8 +41663,7 @@ var ts; if (!constructor || !hasExtendsClause) { return false; } - var parameter = ts.singleOrUndefined(constructor.parameters); - if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) { + if (ts.some(constructor.parameters)) { return false; } var statement = ts.firstOrUndefined(constructor.body.statements); @@ -41013,10 +41683,23 @@ var ts; return false; } var expression = callArgument.expression; - return ts.isIdentifier(expression) && expression === parameter.name; + return ts.isIdentifier(expression) && expression.text === "arguments"; } } ts.transformES2015 = transformES2015; + function createExtendsHelper(context, name) { + context.requestEmitHelper(extendsHelper); + return ts.createCall(ts.getHelperName("__extends"), undefined, [ + name, + ts.createIdentifier("_super") + ]); + } + var extendsHelper = { + name: "typescript:extends", + scoped: false, + priority: 0, + text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + }; })(ts || (ts = {})); var ts; (function (ts) { @@ -41028,7 +41711,7 @@ var ts; _a[7] = "endfinally", _a)); function transformGenerators(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var resolver = context.getEmitResolver(); @@ -41062,15 +41745,15 @@ var ts; var withBlockStack; return transformSourceFile; function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { + if (ts.isDeclarationFile(node) + || (node.transformFlags & 512) === 0) { return node; } - if (node.transformFlags & 8192) { - currentSourceFile = node; - node = ts.visitEachChild(node, visitor, context); - currentSourceFile = undefined; - } - return node; + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function visitor(node) { var transformFlags = node.transformFlags; @@ -41080,10 +41763,10 @@ var ts; else if (inGeneratorFunctionBody) { return visitJavaScriptInGeneratorFunctionBody(node); } - else if (transformFlags & 4096) { + else if (transformFlags & 256) { return visitGenerator(node); } - else if (transformFlags & 8192) { + else if (transformFlags & 512) { return ts.visitEachChild(node, visitor, context); } else { @@ -41126,10 +41809,10 @@ var ts; case 216: return visitReturnStatement(node); default: - if (node.transformFlags & 134217728) { + if (node.transformFlags & 16777216) { return visitJavaScriptContainingYield(node); } - else if (node.transformFlags & (8192 | 268435456)) { + else if (node.transformFlags & (512 | 33554432)) { return ts.visitEachChild(node, visitor, context); } else { @@ -41171,8 +41854,8 @@ var ts; } } function visitFunctionDeclaration(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -41192,8 +41875,8 @@ var ts; } } function visitFunctionExpression(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -41244,7 +41927,7 @@ var ts; operationArguments = undefined; operationLocations = undefined; state = ts.createTempVariable(undefined); - startLexicalEnvironment(); + resumeLexicalEnvironment(); var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); @@ -41266,12 +41949,12 @@ var ts; return ts.createBlock(statements, body, body.multiLine); } function visitVariableStatement(node) { - if (node.transformFlags & 134217728) { + if (node.transformFlags & 16777216) { transformAndEmitVariableDeclarationList(node.declarationList); return undefined; } else { - if (ts.getEmitFlags(node) & 8388608) { + if (ts.getEmitFlags(node) & 524288) { return node; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { @@ -41348,10 +42031,10 @@ var ts; else if (node.operatorToken.kind === 25) { return visitCommaExpression(node); } - var clone_6 = ts.getMutableClone(node); - clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_6; + var clone_4 = ts.getMutableClone(node); + clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_4; } return ts.visitEachChild(node, visitor, context); } @@ -41416,26 +42099,30 @@ var ts; return createGeneratorResume(); } function visitArrayLiteralExpression(node) { - return visitElements(node.elements, node.multiLine); + return visitElements(node.elements, undefined, undefined, node.multiLine); } - function visitElements(elements, _multiLine) { + function visitElements(elements, leadingElement, location, multiLine) { var numInitialElements = countInitialNodesWithoutYield(elements); var temp = declareLocal(); var hasAssignedTemp = false; if (numInitialElements > 0) { - emitAssignment(temp, ts.createArrayLiteral(ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements))); + var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); + emitAssignment(temp, ts.createArrayLiteral(leadingElement + ? [leadingElement].concat(initialElements) : initialElements)); + leadingElement = undefined; hasAssignedTemp = true; } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); return hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)]) - : ts.createArrayLiteral(expressions); + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine); function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { emitAssignment(temp, hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)]) - : ts.createArrayLiteral(expressions)); + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine)); hasAssignedTemp = true; + leadingElement = undefined; expressions = []; } expressions.push(ts.visitNode(element, visitor, ts.isExpression)); @@ -41469,10 +42156,10 @@ var ts; } function visitElementAccessExpression(node) { if (containsYield(node.argumentExpression)) { - var clone_7 = ts.getMutableClone(node); - clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_7; + var clone_5 = ts.getMutableClone(node); + clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -41486,7 +42173,7 @@ var ts; function visitNewExpression(node) { if (ts.forEach(node.arguments, containsYield)) { var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)), undefined, [], node), node); + return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node); } return ts.visitEachChild(node, visitor, context); } @@ -41928,7 +42615,7 @@ var ts; } } function containsYield(node) { - return node && (node.transformFlags & 134217728) !== 0; + return node && (node.transformFlags & 16777216) !== 0; } function countInitialNodesWithoutYield(nodes) { var numNodes = nodes.length; @@ -41958,12 +42645,12 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_35 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_35) { - var clone_8 = ts.getMutableClone(name_35); - ts.setSourceMapRange(clone_8, node); - ts.setCommentRange(clone_8, node); - return clone_8; + var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_37) { + var clone_6 = ts.getMutableClone(name_37); + ts.setSourceMapRange(clone_6, node); + ts.setCommentRange(clone_6, node); + return clone_6; } } } @@ -42354,10 +43041,7 @@ var ts; currentExceptionBlock = undefined; withBlockStack = undefined; var buildResult = buildStatements(); - return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), undefined, [ - ts.createThis(), - ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 4194304) - ]); + return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144)); } function buildStatements() { if (operations) { @@ -42620,6 +43304,16 @@ var ts; } } ts.transformGenerators = transformGenerators; + function createGeneratorHelper(context, body) { + context.requestEmitHelper(generatorHelper); + return ts.createCall(ts.getHelperName("__generator"), undefined, [ts.createThis(), body]); + } + var generatorHelper = { + name: "typescript:generator", + scoped: false, + priority: 6, + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + }; var _a; })(ts || (ts = {})); var ts; @@ -42671,13 +43365,30 @@ var ts; (function (ts) { function transformES2015Module(context) { var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.enableEmitNotification(261); + context.enableSubstitution(70); + var currentSourceFile; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - return ts.visitEachChild(node, visitor, context); + var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); + if (externalHelpersModuleName) { + var statements = []; + var statementOffset = ts.addPrologueDirectives(statements, node.statements); + ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + } + else { + return ts.visitEachChild(node, visitor, context); + } } return node; } @@ -42693,6 +43404,32 @@ var ts; function visitExportAssignment(node) { return node.isExportEquals ? undefined : node; } + function onEmitNode(emitContext, node, emitCallback) { + if (ts.isSourceFile(node)) { + currentSourceFile = node; + previousOnEmitNode(emitContext, node, emitCallback); + currentSourceFile = undefined; + } + else { + previousOnEmitNode(emitContext, node, emitCallback); + } + } + function onSubstituteNode(emitContext, node) { + node = previousOnSubstituteNode(emitContext, node); + if (ts.isIdentifier(node) && emitContext === 1) { + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + } + return node; + } } ts.transformES2015Module = transformES2015Module; })(ts || (ts = {})); @@ -42733,22 +43470,25 @@ var ts; var id = ts.getOriginalNodeId(node); currentSourceFile = node; enclosingBlockScopedContainer = node; - moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver); + moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); contextObject = ts.createUniqueName("context"); var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); + var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ ts.createParameter(undefined, undefined, undefined, exportFunction), ts.createParameter(undefined, undefined, undefined, contextObject) - ], undefined, createSystemModuleBody(node, dependencyGroups)); + ], undefined, moduleBodyBlock); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray([ + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.createNodeArray([ ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), undefined, moduleName ? [moduleName, dependencies, moduleBodyFunction] : [dependencies, moduleBodyFunction])) - ], node.statements)); - ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1); + ], node.statements)), 1024); + if (!(compilerOptions.outFile || compilerOptions.out)) { + ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); + } if (noSubstitution) { noSubstitutionMap[id] = noSubstitution; noSubstitution = undefined; @@ -42789,6 +43529,7 @@ var ts; statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) ]))); + ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true); var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); ts.addRange(statements, hoistedStatements); ts.addRange(statements, endLexicalEnvironment()); @@ -42797,9 +43538,7 @@ var ts; ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true))) ]), true))); - var body = ts.createBlock(statements, undefined, true); - ts.setEmitFlags(body, 1); - return body; + return ts.createBlock(statements, undefined, true); } function addExportStarIfNeeded(statements) { if (!moduleInfo.hasExportStarsToExportValues) { @@ -42859,7 +43598,7 @@ var ts; var exports = ts.createIdentifier("exports"); var condition = ts.createStrictInequality(n, ts.createLiteral("default")); if (localNames) { - condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n))); + condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), undefined, [n]))); } return ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(undefined, undefined, undefined, m)], undefined, ts.createBlock([ ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ @@ -42868,7 +43607,7 @@ var ts; ts.createForIn(ts.createVariableDeclarationList([ ts.createVariableDeclaration(n, undefined) ]), m, ts.createBlock([ - ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32) + ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1) ])), ts.createStatement(ts.createCall(exportFunction, undefined, [exports])) ], undefined, true)); @@ -43040,14 +43779,14 @@ var ts; } } function shouldHoistVariableDeclarationList(node) { - return (ts.getEmitFlags(node) & 16777216) === 0 + return (ts.getEmitFlags(node) & 1048576) === 0 && (enclosingBlockScopedContainer.kind === 261 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; return ts.isBindingPattern(node.name) - ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor) + ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, false, createAssignment) : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); } function createExportedVariableAssignment(name, value, location) { @@ -43071,7 +43810,7 @@ var ts; return node; } function hasAssociatedEndOfDeclarationMarker(node) { - return (ts.getEmitFlags(node) & 33554432) !== 0; + return (ts.getEmitFlags(node) & 2097152) !== 0; } function visitEndOfDeclarationMarker(node) { var id = ts.getOriginalNodeId(node); @@ -43188,7 +43927,7 @@ var ts; var statement = ts.createStatement(createExportExpression(name, value)); ts.startOnNewLine(statement); if (!allowComments) { - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); } return statement; } @@ -43232,9 +43971,9 @@ var ts; return visitCatchClause(node); case 204: return visitBlock(node); - case 294: - return visitMergeDeclarationMarker(node); case 295: + return visitMergeDeclarationMarker(node); + case 296: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -43324,11 +44063,11 @@ var ts; return node; } function destructuringVisitor(node) { - if (node.transformFlags & 16384 + if (node.transformFlags & 1024 && node.kind === 192) { return visitDestructuringAssignment(node); } - else if (node.transformFlags & 32768) { + else if (node.transformFlags & 2048) { return ts.visitEachChild(node, destructuringVisitor, context); } else { @@ -43337,7 +44076,7 @@ var ts; } function visitDestructuringAssignment(node) { if (hasExportedReferenceInDestructuringTarget(node.left)) { - return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, destructuringVisitor); + return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, true); } return ts.visitEachChild(node, destructuringVisitor, context); } @@ -43419,6 +44158,13 @@ var ts; return node; } function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + return node; + } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { @@ -43511,7 +44257,7 @@ var ts; _a[ts.ModuleKind.AMD] = transformAMDModule, _a[ts.ModuleKind.UMD] = transformUMDModule, _a)); - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var host = context.getEmitHost(); @@ -43540,7 +44286,7 @@ var ts; return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver); + currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; var updated = transformModule(node); currentSourceFile = undefined; @@ -43551,12 +44297,13 @@ var ts; startLexicalEnvironment(); var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, false); var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); if (currentModuleInfo.hasExportStarsToExportValues) { - ts.setEmitFlags(updated, 2 | ts.getEmitFlags(node)); + ts.addEmitHelper(updated, exportStarHelper); } return updated; } @@ -43566,8 +44313,7 @@ var ts; return transformAsynchronousModule(node, define, moduleName, true); } function transformUMDModule(node) { - var define = ts.createIdentifier("define"); - ts.setEmitFlags(define, 16); + var define = ts.createRawExpression(umdHelper); return transformAsynchronousModule(node, define, undefined, false); } function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { @@ -43604,7 +44350,7 @@ var ts; var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); if (includeNonAmdDependencies && importAliasName) { - ts.setEmitFlags(importAliasName, 128); + ts.setEmitFlags(importAliasName, 4); aliasedModuleNames.push(externalModuleName); importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName)); } @@ -43618,12 +44364,13 @@ var ts; startLexicalEnvironment(); var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, true); var body = ts.createBlock(statements, undefined, true); if (currentModuleInfo.hasExportStarsToExportValues) { - ts.setEmitFlags(body, 2); + ts.addEmitHelper(body, exportStarHelper); } return body; } @@ -43631,12 +44378,12 @@ var ts; if (currentModuleInfo.exportEquals) { if (emitAsReturn) { var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 12288 | 49152); + ts.setEmitFlags(statement, 384 | 1536); statements.push(statement); } else { var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); statements.push(statement); } } @@ -43657,9 +44404,9 @@ var ts; return visitFunctionDeclaration(node); case 226: return visitClassDeclaration(node); - case 294: - return visitMergeDeclarationMarker(node); case 295: + return visitMergeDeclarationMarker(node); + case 296: return visitEndOfDeclarationMarker(node); default: return node; @@ -43850,7 +44597,7 @@ var ts; } function transformInitializedVariable(node) { if (ts.isBindingPattern(node.name)) { - return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression); + return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression); } else { return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, node.name), node.initializer); @@ -43864,7 +44611,7 @@ var ts; return node; } function hasAssociatedEndOfDeclarationMarker(node) { - return (ts.getEmitFlags(node) & 33554432) !== 0; + return (ts.getEmitFlags(node) & 2097152) !== 0; } function visitEndOfDeclarationMarker(node) { var id = ts.getOriginalNodeId(node); @@ -43984,7 +44731,7 @@ var ts; var statement = ts.createStatement(createExportExpression(name, value), location); ts.startOnNewLine(statement); if (!allowComments) { - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); } return statement; } @@ -44051,6 +44798,13 @@ var ts; return node; } function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + return node; + } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); if (exportContainer && exportContainer.kind === 261) { @@ -44062,8 +44816,8 @@ var ts; return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_36 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_36), node); + var name_38 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), node); } } } @@ -44122,6 +44876,12 @@ var ts; var _a; } ts.transformModule = transformModule; + var exportStarHelper = { + name: "typescript:export-star", + scoped: true, + text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" + }; + var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); var ts; (function (ts) { @@ -44163,21 +44923,27 @@ var ts; } ts.getTransformers = getTransformers; function transformFiles(resolver, host, sourceFiles, transformers) { + var enabledSyntaxKindFeatures = new Array(298); + var lexicalEnvironmentDisabled = false; + var lexicalEnvironmentVariableDeclarations; + var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; var lexicalEnvironmentFunctionDeclarationsStack = []; - var enabledSyntaxKindFeatures = new Array(296); var lexicalEnvironmentStackOffset = 0; - var hoistedVariableDeclarations; - var hoistedFunctionDeclarations; - var lexicalEnvironmentDisabled; + var lexicalEnvironmentSuspended = false; + var emitHelpers; var context = { getCompilerOptions: function () { return host.getCompilerOptions(); }, getEmitResolver: function () { return resolver; }, getEmitHost: function () { return host; }, + startLexicalEnvironment: startLexicalEnvironment, + suspendLexicalEnvironment: suspendLexicalEnvironment, + resumeLexicalEnvironment: resumeLexicalEnvironment, + endLexicalEnvironment: endLexicalEnvironment, hoistVariableDeclaration: hoistVariableDeclaration, hoistFunctionDeclaration: hoistFunctionDeclaration, - startLexicalEnvironment: startLexicalEnvironment, - endLexicalEnvironment: endLexicalEnvironment, + requestEmitHelper: requestEmitHelper, + readEmitHelpers: readEmitHelpers, onSubstituteNode: function (_emitContext, node) { return node; }, enableSubstitution: enableSubstitution, isSubstitutionEnabled: isSubstitutionEnabled, @@ -44204,7 +44970,7 @@ var ts; } function isSubstitutionEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0 - && (ts.getEmitFlags(node) & 128) === 0; + && (ts.getEmitFlags(node) & 4) === 0; } function emitNodeWithSubstitution(emitContext, node, emitCallback) { if (node) { @@ -44223,7 +44989,7 @@ var ts; } function isEmitNotificationEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0 - || (ts.getEmitFlags(node) & 64) !== 0; + || (ts.getEmitFlags(node) & 2) !== 0; } function emitNodeWithNotification(emitContext, node, emitCallback) { if (node) { @@ -44238,39 +45004,51 @@ var ts; function hoistVariableDeclaration(name) { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); var decl = ts.createVariableDeclaration(name); - if (!hoistedVariableDeclarations) { - hoistedVariableDeclarations = [decl]; + if (!lexicalEnvironmentVariableDeclarations) { + lexicalEnvironmentVariableDeclarations = [decl]; } else { - hoistedVariableDeclarations.push(decl); + lexicalEnvironmentVariableDeclarations.push(decl); } } function hoistFunctionDeclaration(func) { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = [func]; + if (!lexicalEnvironmentFunctionDeclarations) { + lexicalEnvironmentFunctionDeclarations = [func]; } else { - hoistedFunctionDeclarations.push(func); + lexicalEnvironmentFunctionDeclarations.push(func); } } function startLexicalEnvironment() { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); - lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedVariableDeclarations; - lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedFunctionDeclarations; + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); + lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations; + lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations; lexicalEnvironmentStackOffset++; - hoistedVariableDeclarations = undefined; - hoistedFunctionDeclarations = undefined; + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + } + function suspendLexicalEnvironment() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); + lexicalEnvironmentSuspended = true; + } + function resumeLexicalEnvironment() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); + lexicalEnvironmentSuspended = false; } function endLexicalEnvironment() { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; - if (hoistedVariableDeclarations || hoistedFunctionDeclarations) { - if (hoistedFunctionDeclarations) { - statements = hoistedFunctionDeclarations.slice(); + if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { + if (lexicalEnvironmentFunctionDeclarations) { + statements = lexicalEnvironmentFunctionDeclarations.slice(); } - if (hoistedVariableDeclarations) { - var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(hoistedVariableDeclarations)); + if (lexicalEnvironmentVariableDeclarations) { + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations)); if (!statements) { statements = [statement]; } @@ -44280,10 +45058,25 @@ var ts; } } lexicalEnvironmentStackOffset--; - hoistedVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; - hoistedFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + if (lexicalEnvironmentStackOffset === 0) { + lexicalEnvironmentVariableDeclarationsStack = []; + lexicalEnvironmentFunctionDeclarationsStack = []; + } return statements; } + function requestEmitHelper(helper) { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); + emitHelpers = ts.append(emitHelpers, helper); + } + function readEmitHelpers() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + var helpers = emitHelpers; + emitHelpers = undefined; + return helpers; + } } ts.transformFiles = transformFiles; var _a; @@ -44452,12 +45245,12 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 292 - && (emitFlags & 512) === 0 + if (node.kind !== 293 + && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); } - if (emitFlags & 2048) { + if (emitFlags & 64) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -44465,8 +45258,8 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 292 - && (emitFlags & 1024) === 0 + if (node.kind !== 293 + && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); } @@ -44480,13 +45273,13 @@ var ts; var emitFlags = emitNode && emitNode.flags; var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos); - if ((emitFlags & 4096) === 0 && tokenPos >= 0) { + if ((emitFlags & 128) === 0 && tokenPos >= 0) { emitPos(tokenPos); } tokenPos = emitCallback(token, tokenPos); if (range) tokenPos = range.end; - if ((emitFlags & 8192) === 0 && tokenPos >= 0) { + if ((emitFlags & 256) === 0 && tokenPos >= 0) { emitPos(tokenPos); } return tokenPos; @@ -44514,7 +45307,7 @@ var ts; return; } encodeLastRecordedSourceMapSpan(); - return ts.stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, @@ -44596,7 +45389,7 @@ var ts; var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end; var emitFlags = ts.getEmitFlags(node); if ((pos < 0 && end < 0) || (pos === end)) { - if (emitFlags & 65536) { + if (emitFlags & 2048) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -44609,9 +45402,9 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 292; - var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0; - var skipTrailingComments = end < 0 || (emitFlags & 32768) !== 0; + var isEmittedNode = node.kind !== 293; + var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; + var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { emitLeadingComments(pos, isEmittedNode); } @@ -44630,7 +45423,7 @@ var ts; if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & 65536) { + if (emitFlags & 2048) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -44659,15 +45452,15 @@ var ts; } var pos = detachedRange.pos, end = detachedRange.end; var emitFlags = ts.getEmitFlags(node); - var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0; - var skipTrailingComments = disabled || end < 0 || (emitFlags & 32768) !== 0; + var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; + var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { emitDetachedCommentsAndUpdateCommentsInfo(detachedRange); } if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments"); } - if (emitFlags & 65536 && !disabled) { + if (emitFlags & 2048 && !disabled) { disabled = true; emitCallback(node); disabled = false; @@ -44680,6 +45473,9 @@ var ts; } if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); @@ -44951,6 +45747,7 @@ var ts; writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -45071,15 +45868,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { - var node = nodes_2[_i]; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { - var node = nodes_3[_i]; + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -45094,7 +45891,7 @@ var ts; } function writeJsDocComments(declaration) { if (declaration) { - var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText); + var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText); ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); ts.emitComments(currentText, currentLineMap, writer, jsDocComments, false, true, newLine, ts.writeCommentRange); } @@ -45281,9 +46078,9 @@ var ts; var count = 0; while (true) { count++; - var name_37 = baseName + "_" + count; - if (!(name_37 in currentIdentifiers)) { - return name_37; + var name_39 = baseName + "_" + count; + if (!(name_39 in currentIdentifiers)) { + return name_39; } } } @@ -45677,6 +46474,9 @@ var ts; case 225: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; + case 228: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; + break; default: ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); } @@ -45770,7 +46570,10 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false); + var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); + if (interfaceExtendsTypes && interfaceExtendsTypes.length) { + emitHeritageClause(interfaceExtendsTypes, false); + } write(" {"); writeLine(); increaseIndent(); @@ -46166,6 +46969,10 @@ var ts; return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 155: + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; case 149: case 148: if (ts.hasModifier(node.parent, 32)) { @@ -46331,18 +47138,6 @@ var ts; function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { var delimiters = createDelimiterMap(); var brackets = createBracketsMap(); - var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; - var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; - var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};"; - var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; - var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};"; - var generatorHelper = "\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};"; - var exportStarHelper = "\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}"; - var umdHelper = "\n(function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n})"; - var superHelper = "\nconst _super = name => super[name];"; - var advancedSuperHelper = "\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"; var compilerOptions = host.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); @@ -46364,12 +47159,7 @@ var ts; var currentSourceFile; var currentText; var currentFileIdentifiers; - var extendsEmitted; - var assignEmitted; - var restEmitted; - var decorateEmitted; - var paramEmitted; - var awaiterEmitted; + var bundledHelpers; var isOwnFileEmit; var emitSkipped = false; var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); @@ -46418,11 +47208,12 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNameSet = ts.createMap(); + bundledHelpers = isBundledEmit ? ts.createMap() : undefined; isOwnFileEmit = !isBundledEmit; if (isBundledEmit && moduleKind) { for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { var sourceFile = sourceFiles_5[_a]; - emitEmitHelpers(sourceFile); + emitHelpers(sourceFile, true); } } ts.forEach(sourceFiles, printSourceFile); @@ -46432,23 +47223,18 @@ var ts; write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); } if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false); + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); } if (sourceMapDataList) { sourceMapDataList.push(sourceMap.getSourceMapData()); } - ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM); + ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); sourceMap.reset(); comments.reset(); writer.reset(); tempFlags = 0; currentSourceFile = undefined; currentText = undefined; - extendsEmitted = false; - assignEmitted = false; - decorateEmitted = false; - paramEmitted = false; - awaiterEmitted = false; isOwnFileEmit = false; } function printSourceFile(node) { @@ -46816,8 +47602,10 @@ var ts; return emitJsxElement(node); case 247: return emitJsxSelfClosingElement(node); - case 293: + case 294: return emitPartiallyEmittedExpression(node); + case 297: + return writeLines(node.text); } } function emitNumericLiteral(node) { @@ -46837,12 +47625,7 @@ var ts; } } function emitIdentifier(node) { - if (ts.getEmitFlags(node) & 16) { - writeLines(umdHelper); - } - else { - write(getTextOfNode(node, false)); - } + write(getTextOfNode(node, false)); } function emitQualifiedName(node) { emitEntityName(node.left); @@ -47085,7 +47868,7 @@ var ts; write("{}"); } else { - var indentedFlag = ts.getEmitFlags(node) & 524288; + var indentedFlag = ts.getEmitFlags(node) & 32768; if (indentedFlag) { increaseIndent(); } @@ -47100,7 +47883,7 @@ var ts; function emitPropertyAccessExpression(node) { var indentBeforeDot = false; var indentAfterDot = false; - if (!(ts.getEmitFlags(node) & 1048576)) { + if (!(ts.getEmitFlags(node) & 65536)) { var dotRangeStart = node.expression.end; var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1; var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd }; @@ -47284,7 +48067,7 @@ var ts; } } function emitBlockStatements(node) { - if (ts.getEmitFlags(node) & 32) { + if (ts.getEmitFlags(node) & 1) { emitList(node, node.statements, 384); } else { @@ -47460,11 +48243,11 @@ var ts; var body = node.body; if (body) { if (ts.isBlock(body)) { - var indentedFlag = ts.getEmitFlags(node) & 524288; + var indentedFlag = ts.getEmitFlags(node) & 32768; if (indentedFlag) { increaseIndent(); } - if (ts.getEmitFlags(node) & 4194304) { + if (ts.getEmitFlags(node) & 262144) { emitSignatureHead(node); emitBlockFunctionBody(body); } @@ -47496,7 +48279,7 @@ var ts; emitWithPrefix(": ", node.type); } function shouldEmitBlockFunctionBodyOnSingleLine(body) { - if (ts.getEmitFlags(body) & 32) { + if (ts.getEmitFlags(body) & 1) { return true; } if (body.multiLine) { @@ -47551,7 +48334,7 @@ var ts; emitModifiers(node, node.modifiers); write("class"); emitNodeWithPrefix(" ", node.name, emitIdentifierName); - var indentedFlag = ts.getEmitFlags(node) & 524288; + var indentedFlag = ts.getEmitFlags(node) & 32768; if (indentedFlag) { increaseIndent(); } @@ -47810,7 +48593,7 @@ var ts; emit(node.name); write(": "); var initializer = node.initializer; - if ((ts.getEmitFlags(initializer) & 16384) === 0) { + if ((ts.getEmitFlags(initializer) & 512) === 0) { var commentRange = ts.getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos); } @@ -47864,71 +48647,31 @@ var ts; } return statements.length; } - function emitHelpers(node) { - var emitFlags = ts.getEmitFlags(node); + function emitHelpers(node, isBundle) { + var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile; + var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); + var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit; var helpersEmitted = false; - if (emitFlags & 1) { - helpersEmitted = emitEmitHelpers(currentSourceFile); - } - if (emitFlags & 2) { - writeLines(exportStarHelper); - helpersEmitted = true; - } - if (emitFlags & 4) { - writeLines(superHelper); - helpersEmitted = true; - } - if (emitFlags & 8) { - writeLines(advancedSuperHelper); - helpersEmitted = true; - } - return helpersEmitted; - } - function emitEmitHelpers(node) { - if (compilerOptions.noEmitHelpers) { - return false; - } - if (compilerOptions.importHelpers - && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { - return false; - } - var helpersEmitted = false; - if ((languageVersion < 2) && (!extendsEmitted && node.flags & 1024)) { - writeLines(extendsHelper); - extendsEmitted = true; - helpersEmitted = true; - } - if ((languageVersion < 5 || currentSourceFile.scriptKind === 2 || currentSourceFile.scriptKind === 4) && - compilerOptions.jsx !== 1 && - !assignEmitted && - node.flags & 16384) { - writeLines(assignHelper); - assignEmitted = true; - } - if (languageVersion < 5 && !restEmitted && node.flags & 32768) { - writeLines(restHelper); - restEmitted = true; - } - if (!decorateEmitted && node.flags & 2048) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); + var helpers = ts.getEmitHelpers(node); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + if (shouldSkip) + continue; + if (shouldBundle) { + if (bundledHelpers[helper.name]) { + continue; + } + bundledHelpers[helper.name] = true; + } + } + else if (isBundle) { + continue; + } + writeLines(helper.text); + helpersEmitted = true; } - decorateEmitted = true; - helpersEmitted = true; - } - if (!paramEmitted && node.flags & 4096) { - writeLines(paramHelper); - paramEmitted = true; - helpersEmitted = true; - } - if ((languageVersion < 4) && (!awaiterEmitted && node.flags & 8192)) { - writeLines(awaiterHelper); - if (languageVersion < 2) { - writeLines(generatorHelper); - } - awaiterEmitted = true; - helpersEmitted = true; } if (helpersEmitted) { writeLine(); @@ -47936,9 +48679,10 @@ var ts; return helpersEmitted; } function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); for (var i = 0; i < lines.length; i++) { - var line = lines[i]; + var line = indentation ? lines[i].slice(indentation) : lines[i]; if (line.length) { if (i > 0) { writeLine(); @@ -47947,6 +48691,21 @@ var ts; } } } + function guessIndentation(lines) { + var indentation; + for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { + var line = lines_1[_a]; + for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { + if (!ts.isWhiteSpace(line.charCodeAt(i))) { + if (indentation === undefined || i < indentation) { + indentation = i; + break; + } + } + } + } + return indentation; + } function emitShebang() { var shebang = ts.getShebang(currentText); if (shebang) { @@ -48288,21 +49047,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_38 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_38)) { + var name_40 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_40)) { tempFlags |= flags; - return name_38; + return name_40; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_39 = count < 26 + var name_41 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_39)) { - return name_39; + if (isUniqueName(name_41)) { + return name_41; } } } @@ -48423,7 +49182,6 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.2.0"; var emptyArray = []; function findConfigFile(searchPath, fileExists, configName) { if (configName === void 0) { configName = "tsconfig.json"; } @@ -48639,10 +49397,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_40 = names_1[_i]; - var result = name_40 in cache - ? cache[name_40] - : cache[name_40] = loader(name_40, containingFile); + var name_42 = names_1[_i]; + var result = name_42 in cache + ? cache[name_42] + : cache[name_42] = loader(name_42, containingFile); resolutions.push(result); } return resolutions; @@ -48696,7 +49454,8 @@ var ts; ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host); if (typeReferences.length) { - var containingFilename = ts.combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts"); + var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); + var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts"); var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename); for (var i = 0; i < typeReferences.length; i++) { processTypeReferenceDirective(typeReferences[i], resolutions[i]); @@ -49176,8 +49935,8 @@ var ts; } break; } - for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) { - var node = nodes_4[_b]; + for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { + var node = nodes_6[_b]; walk(node); } } @@ -50016,7 +50775,7 @@ var ts; "es2017": 4, "esnext": 5, }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, paramType: ts.Diagnostics.VERSION, }, { @@ -50197,11 +50956,15 @@ var ts; description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file } ]; - ts.typingOptionDeclarations = [ + ts.typeAcquisitionDeclarations = [ { name: "enableAutoDiscovery", type: "boolean", }, + { + name: "enable", + type: "boolean", + }, { name: "include", type: "list", @@ -50226,6 +50989,18 @@ var ts; sourceMap: false, }; var optionNameMapCache; + function convertEnableAutoDiscoveryToEnable(typeAcquisition) { + if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { + var result = { + enable: typeAcquisition.enableAutoDiscovery, + include: typeAcquisition.include || [], + exclude: typeAcquisition.exclude || [] + }; + return result; + } + return typeAcquisition; + } + ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; function getOptionNameMap() { if (optionNameMapCache) { return optionNameMapCache; @@ -50248,14 +51023,7 @@ var ts; } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; function parseListTypeOption(opt, value, errors) { @@ -50439,9 +51207,9 @@ var ts; function serializeCompilerOptions(options) { var result = ts.createMap(); var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_41 in options) { - if (ts.hasProperty(options, name_41)) { - switch (name_41) { + for (var name_43 in options) { + if (ts.hasProperty(options, name_43)) { + switch (name_43) { case "init": case "watch": case "version": @@ -50449,12 +51217,12 @@ var ts; case "project": break; default: - var value = options[name_41]; - var optionDefinition = optionsNameMap[name_41.toLowerCase()]; + var value = options[name_43]; + var optionDefinition = optionsNameMap[name_43.toLowerCase()]; if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { - result[name_41] = value; + result[name_43] = value; } else { if (optionDefinition.type === "list") { @@ -50463,10 +51231,10 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_41] = convertedValue; + result[name_43] = convertedValue; } else { - result[name_41] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name_43] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -50495,9 +51263,10 @@ var ts; } return output; } - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); @@ -50505,14 +51274,15 @@ var ts; return { options: {}, fileNames: [], - typingOptions: {}, + typeAcquisition: {}, raw: json, errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))], wildcardDirectories: {} }; } var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + var jsonOptions = json["typeAcquisition"] || json["typingOptions"]; + var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); if (json["extends"]) { var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3]; if (typeof json["extends"] === "string") { @@ -50539,7 +51309,7 @@ var ts; return { options: options, fileNames: fileNames, - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, raw: json, errors: errors, wildcardDirectories: wildcardDirectories, @@ -50547,7 +51317,7 @@ var ts; }; function tryExtendsName(extendedConfig) { if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted)); + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); return; } var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName); @@ -50610,7 +51380,7 @@ var ts; errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); } else { - excludeSpecs = ["node_modules", "bower_components", "jspm_packages"]; + excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"]; var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; if (outDir) { excludeSpecs.push(outDir); @@ -50619,7 +51389,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -50645,12 +51415,12 @@ var ts; return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; - function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { var errors = []; - var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } - ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } @@ -50658,9 +51428,10 @@ var ts; convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); return options; } - function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; - convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); + convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors); return options; } function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { @@ -50722,7 +51493,7 @@ var ts; var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; var literalFileMap = ts.createMap(); @@ -50734,7 +51505,7 @@ var ts; exclude = validateSpecs(exclude, errors, true); } var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); if (fileNames) { for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; @@ -50890,47 +51661,6 @@ var ts; ts.sys.write("TSFILE: " + filepath + ts.sys.newLine); } } - function validateLocaleAndSetLanguage(locale, errors) { - var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); - if (!matchResult) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); - return false; - } - var language = matchResult[1]; - var territory = matchResult[3]; - if (!trySetLanguageAndTerritory(language, territory, errors)) { - trySetLanguageAndTerritory(language, undefined, errors); - } - return true; - } - function trySetLanguageAndTerritory(language, territory, errors) { - var compilerFilePath = ts.normalizePath(ts.sys.getExecutingFilePath()); - var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath); - var filePath = ts.combinePaths(containingDirectoryPath, language); - if (territory) { - filePath = filePath + "-" + territory; - } - filePath = ts.sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")); - if (!ts.sys.fileExists(filePath)) { - return false; - } - var fileContents = ""; - try { - fileContents = ts.sys.readFile(filePath); - } - catch (e) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)); - return false; - } - try { - ts.localizedDiagnosticMessages = JSON.parse(fileContents); - } - catch (e) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)); - return false; - } - return true; - } function countLines(program) { var count = 0; ts.forEach(program.getSourceFiles(), function (file) { @@ -51059,7 +51789,7 @@ var ts; reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"), undefined); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } - validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); + ts.validateLocaleAndSetLanguage(commandLine.options.locale, ts.sys, commandLine.errors); } if (commandLine.errors.length > 0) { reportDiagnostics(commandLine.errors, compilerHost); @@ -51354,17 +52084,17 @@ var ts; var nameSize = 0; var valueSize = 0; for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) { - var _a = statistics_1[_i], name_42 = _a.name, value = _a.value; - if (name_42.length > nameSize) { - nameSize = name_42.length; + var _a = statistics_1[_i], name_44 = _a.name, value = _a.value; + if (name_44.length > nameSize) { + nameSize = name_44.length; } if (value.length > valueSize) { valueSize = value.length; } } for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) { - var _c = statistics_2[_b], name_43 = _c.name, value = _c.value; - ts.sys.write(padRight(name_43 + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine); + var _c = statistics_2[_b], name_45 = _c.name, value = _c.value; + ts.sys.write(padRight(name_45 + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine); } } function reportStatisticalValue(name, value) { diff --git a/lib/tsserver.js b/lib/tsserver.js index c308492a668..9c17684ed0a 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -136,6 +136,9 @@ var ts; })(performance = ts.performance || (ts.performance = {})); })(ts || (ts = {})); var ts; +(function (ts) { + ts.version = "2.2.0"; +})(ts || (ts = {})); (function (ts) { var createObject = Object.create; ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; @@ -606,7 +609,7 @@ var ts; if (value === undefined) return to; if (to === undefined) - to = []; + return [value]; to.push(value); return to; } @@ -621,6 +624,14 @@ var ts; return to; } ts.addRange = addRange; + function stableSort(array, comparer) { + if (comparer === void 0) { comparer = compareValues; } + return array + .map(function (_, i) { return i; }) + .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); }) + .map(function (i) { return array[i]; }); + } + ts.stableSort = stableSort; function rangeEquals(array1, array2, pos, end) { while (pos < end) { if (array1[pos] !== array2[pos]) { @@ -775,6 +786,15 @@ var ts; } } ts.copyProperties = copyProperties; + function appendProperty(map, key, value) { + if (key === undefined || value === undefined) + return map; + if (map === undefined) + map = createMap(); + map[key] = value; + return map; + } + ts.appendProperty = appendProperty; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -798,15 +818,6 @@ var ts; return result; } ts.reduceProperties = reduceProperties; - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -1227,6 +1238,14 @@ var ts; getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS; } ts.getEmitModuleKind = getEmitModuleKind; + function getEmitModuleResolutionKind(compilerOptions) { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + } + return moduleResolution; + } + ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind; function hasZeroOrOneAsteriskCharacter(str) { var seenAsterisk = false; for (var i = 0; i < str.length; i++) { @@ -1645,8 +1664,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (needAllExtensions || extInfo.scriptKind === 3) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -1657,11 +1687,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -1777,6 +1807,16 @@ var ts; } Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); + function orderedRemoveItem(array, item) { + for (var i = 0; i < array.length; i++) { + if (array[i] === item) { + orderedRemoveItemAt(array, i); + return true; + } + } + return false; + } + ts.orderedRemoveItem = orderedRemoveItem; function orderedRemoveItemAt(array, index) { for (var i = index; i < array.length - 1; i++) { array[i] = array[i + 1]; @@ -2591,6 +2631,7 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2634,6 +2675,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -2644,6 +2686,7 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, @@ -2811,7 +2854,7 @@ var ts; Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." }, - Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." }, + Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." }, Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." }, Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." }, Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." }, @@ -2876,7 +2919,8 @@ var ts; An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, - An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." }, + The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, + _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2947,7 +2991,10 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, @@ -2989,7 +3036,7 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -3150,6 +3197,7 @@ var ts; type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, + Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", message: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, @@ -3160,9 +3208,10 @@ var ts; A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, - Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." }, + Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, - The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." }, + A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, @@ -3174,6 +3223,9 @@ var ts; Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, }; })(ts || (ts = {})); var ts; @@ -4994,7 +5046,7 @@ var ts; "es2017": 4, "esnext": 5, }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, paramType: ts.Diagnostics.VERSION, }, { @@ -5175,11 +5227,15 @@ var ts; description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file } ]; - ts.typingOptionDeclarations = [ + ts.typeAcquisitionDeclarations = [ { name: "enableAutoDiscovery", type: "boolean", }, + { + name: "enable", + type: "boolean", + }, { name: "include", type: "list", @@ -5204,6 +5260,18 @@ var ts; sourceMap: false, }; var optionNameMapCache; + function convertEnableAutoDiscoveryToEnable(typeAcquisition) { + if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { + var result = { + enable: typeAcquisition.enableAutoDiscovery, + include: typeAcquisition.include || [], + exclude: typeAcquisition.exclude || [] + }; + return result; + } + return typeAcquisition; + } + ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; function getOptionNameMap() { if (optionNameMapCache) { return optionNameMapCache; @@ -5226,14 +5294,7 @@ var ts; } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; function parseListTypeOption(opt, value, errors) { @@ -5473,9 +5534,10 @@ var ts; } return output; } - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); @@ -5483,14 +5545,15 @@ var ts; return { options: {}, fileNames: [], - typingOptions: {}, + typeAcquisition: {}, raw: json, errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))], wildcardDirectories: {} }; } var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + var jsonOptions = json["typeAcquisition"] || json["typingOptions"]; + var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); if (json["extends"]) { var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3]; if (typeof json["extends"] === "string") { @@ -5517,7 +5580,7 @@ var ts; return { options: options, fileNames: fileNames, - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, raw: json, errors: errors, wildcardDirectories: wildcardDirectories, @@ -5525,7 +5588,7 @@ var ts; }; function tryExtendsName(extendedConfig) { if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted)); + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); return; } var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName); @@ -5588,7 +5651,7 @@ var ts; errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); } else { - excludeSpecs = ["node_modules", "bower_components", "jspm_packages"]; + excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"]; var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; if (outDir) { excludeSpecs.push(outDir); @@ -5597,7 +5660,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -5623,12 +5686,12 @@ var ts; return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; - function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { var errors = []; - var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } - ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } @@ -5636,9 +5699,10 @@ var ts; convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); return options; } - function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; - convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); + convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors); return options; } function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { @@ -5700,7 +5764,7 @@ var ts; var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; var literalFileMap = ts.createMap(); @@ -5712,7 +5776,7 @@ var ts; exclude = validateSpecs(exclude, errors, true); } var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); if (fileNames) { for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; @@ -5857,9 +5921,9 @@ var ts; "constants", "process", "v8", "timers", "console" ]; var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); - function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) { + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { var inferredTypings = ts.createMap(); - if (!typingOptions || !typingOptions.enableAutoDiscovery) { + if (!typeAcquisition || !typeAcquisition.enable) { return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; } fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { @@ -5873,8 +5937,8 @@ var ts; var filesToWatch = []; var searchDirs = []; var exclude = []; - mergeTypings(typingOptions.include); - exclude = typingOptions.exclude || []; + mergeTypings(typeAcquisition.include); + exclude = typeAcquisition.exclude || []; var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); if (projectRootPath) { possibleSearchDirs.push(projectRootPath); @@ -6007,7 +6071,8 @@ var ts; (function (server) { server.ActionSet = "action::set"; server.ActionInvalidate = "action::invalidate"; - server.EventInstall = "event::install"; + server.EventBeginInstallTypes = "event::beginInstallTypes"; + server.EventEndInstallTypes = "event::endInstallTypes"; var Arguments; (function (Arguments) { Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation"; @@ -6056,12 +6121,12 @@ var ts; return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName; } } - function createInstallTypingsRequest(project, typingOptions, unresolvedImports, cachePath) { + function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { return { projectName: project.getProjectName(), fileNames: project.getFileNames(true), compilerOptions: project.getCompilerOptions(), - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, unresolvedImports: unresolvedImports, projectRootPath: getProjectRootPath(project), cachePath: cachePath, @@ -6160,59 +6225,6 @@ var ts; }; } server.createNormalizedPathMap = createNormalizedPathMap; - function throwLanguageServiceIsDisabledError() { - throw new Error("LanguageService is disabled"); - } - server.nullLanguageService = { - cleanupSemanticCache: throwLanguageServiceIsDisabledError, - getSyntacticDiagnostics: throwLanguageServiceIsDisabledError, - getSemanticDiagnostics: throwLanguageServiceIsDisabledError, - getCompilerOptionsDiagnostics: throwLanguageServiceIsDisabledError, - getSyntacticClassifications: throwLanguageServiceIsDisabledError, - getEncodedSyntacticClassifications: throwLanguageServiceIsDisabledError, - getSemanticClassifications: throwLanguageServiceIsDisabledError, - getEncodedSemanticClassifications: throwLanguageServiceIsDisabledError, - getCompletionsAtPosition: throwLanguageServiceIsDisabledError, - findReferences: throwLanguageServiceIsDisabledError, - getCompletionEntryDetails: throwLanguageServiceIsDisabledError, - getQuickInfoAtPosition: throwLanguageServiceIsDisabledError, - findRenameLocations: throwLanguageServiceIsDisabledError, - getNameOrDottedNameSpan: throwLanguageServiceIsDisabledError, - getBreakpointStatementAtPosition: throwLanguageServiceIsDisabledError, - getBraceMatchingAtPosition: throwLanguageServiceIsDisabledError, - getSignatureHelpItems: throwLanguageServiceIsDisabledError, - getDefinitionAtPosition: throwLanguageServiceIsDisabledError, - getRenameInfo: throwLanguageServiceIsDisabledError, - getTypeDefinitionAtPosition: throwLanguageServiceIsDisabledError, - getReferencesAtPosition: throwLanguageServiceIsDisabledError, - getDocumentHighlights: throwLanguageServiceIsDisabledError, - getOccurrencesAtPosition: throwLanguageServiceIsDisabledError, - getNavigateToItems: throwLanguageServiceIsDisabledError, - getNavigationBarItems: throwLanguageServiceIsDisabledError, - getNavigationTree: throwLanguageServiceIsDisabledError, - getOutliningSpans: throwLanguageServiceIsDisabledError, - getTodoComments: throwLanguageServiceIsDisabledError, - getIndentationAtPosition: throwLanguageServiceIsDisabledError, - getFormattingEditsForRange: throwLanguageServiceIsDisabledError, - getFormattingEditsForDocument: throwLanguageServiceIsDisabledError, - getFormattingEditsAfterKeystroke: throwLanguageServiceIsDisabledError, - getDocCommentTemplateAtPosition: throwLanguageServiceIsDisabledError, - isValidBraceCompletionAtPosition: throwLanguageServiceIsDisabledError, - getEmitOutput: throwLanguageServiceIsDisabledError, - getProgram: throwLanguageServiceIsDisabledError, - getNonBoundSourceFile: throwLanguageServiceIsDisabledError, - dispose: throwLanguageServiceIsDisabledError, - getCompletionEntrySymbol: throwLanguageServiceIsDisabledError, - getImplementationAtPosition: throwLanguageServiceIsDisabledError, - getSourceFile: throwLanguageServiceIsDisabledError, - getCodeFixesAtPosition: throwLanguageServiceIsDisabledError - }; - server.nullLanguageServiceHost = { - setCompilationSettings: function () { return undefined; }, - notifyFileRemoved: function () { return undefined; }, - startRecordingFilesWithChangedResolutions: function () { return undefined; }, - finishRecordingFilesWithChangedResolutions: function () { return undefined; } - }; function isInferredProjectName(name) { return /dev\/null\/inferredProject\d+\*/.test(name); } @@ -6301,6 +6313,7 @@ var ts; function moduleHasNonRelativeName(moduleName) { return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } + ts.moduleHasNonRelativeName = moduleHasNonRelativeName; function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { @@ -6881,6 +6894,7 @@ var ts; writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, writeLine: function () { return str_1 += " "; }, increaseIndent: ts.noop, @@ -6953,17 +6967,17 @@ var ts; ts.hasChangesInResolutions = hasChangesInResolutions; function containsParseError(node) { aggregateChildData(node); - return (node.flags & 4194304) !== 0; + return (node.flags & 131072) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.flags & 8388608)) { - var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576) !== 0) || + if (!(node.flags & 262144)) { + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { - node.flags |= 4194304; + node.flags |= 131072; } - node.flags |= 8388608; + node.flags |= 262144; } } function getSourceFileOfNode(node) { @@ -7034,28 +7048,28 @@ var ts; return !nodeIsMissing(node); } ts.nodeIsPresent = nodeIsPresent; - function getTokenPosOfNode(node, sourceFile, includeJsDocComment) { + function getTokenPosOfNode(node, sourceFile, includeJsDoc) { if (nodeIsMissing(node)) { return node.pos; } if (isJSDocNode(node)) { return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true); } - if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) { - return getTokenPosOfNode(node.jsDocComments[0]); + if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { + return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 291 && node._children.length > 0) { - return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment); + if (node.kind === 292 && node._children.length > 0) { + return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 && node.kind <= 287; + return node.kind >= 262 && node.kind <= 288; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 && node.kind <= 290; + return node.kind >= 278 && node.kind <= 291; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -7187,6 +7201,10 @@ var ts; return false; } ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { case 261: @@ -7232,7 +7250,7 @@ var ts; case 8: return name.text; case 142: - if (isStringOrNumericLiteral(name.expression.kind)) { + if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } } @@ -7354,7 +7372,8 @@ var ts; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 && node.expression.kind === 9; + return node.kind === 207 + && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -7365,25 +7384,20 @@ var ts; return ts.getLeadingCommentRanges(text, node.pos); } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; - function getJsDocComments(node, sourceFileOfNode) { - return getJsDocCommentsFromText(node, sourceFileOfNode.text); - } - ts.getJsDocComments = getJsDocComments; - function getJsDocCommentsFromText(node, text) { + function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 144 || node.kind === 143 || node.kind === 184 || node.kind === 185) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); - return ts.filter(commentRanges, isJsDocComment); - function isJsDocComment(comment) { + return ts.filter(commentRanges, function (comment) { return text.charCodeAt(comment.pos + 1) === 42 && text.charCodeAt(comment.pos + 2) === 42 && text.charCodeAt(comment.pos + 3) !== 47; - } + }); } - ts.getJsDocCommentsFromText = getJsDocCommentsFromText; + ts.getJSDocCommentRanges = getJSDocCommentRanges; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; @@ -7515,6 +7529,18 @@ var ts; } } ts.forEachYieldExpression = forEachYieldExpression; + function getRestParameterElementType(node) { + if (node && node.kind === 162) { + return node.elementType; + } + else if (node && node.kind === 157) { + return ts.singleOrUndefined(node.typeArguments); + } + else { + return undefined; + } + } + ts.getRestParameterElementType = getRestParameterElementType; function isVariableLike(node) { if (node) { switch (node.kind) { @@ -7909,6 +7935,7 @@ var ts; case 145: case 252: case 251: + case 259: return true; case 199: return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); @@ -7945,7 +7972,7 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.flags & 2097152); + return node && !!(node.flags & 65536); } ts.isInJavaScriptFile = isInJavaScriptFile; function isRequireCall(expression, checkArgumentIsStringLiteral) { @@ -8063,152 +8090,118 @@ var ts; node.parameters[0].type.kind === 276; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getJSDocTag(node, kind, checkParentVariableStatement) { - if (!node) { - return undefined; - } - var jsDocTags = getJSDocTags(node, checkParentVariableStatement); - if (!jsDocTags) { - return undefined; - } - for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) { - var tag = jsDocTags_1[_i]; - if (tag.kind === kind) { - return tag; - } - } + function getCommentsFromJSDoc(node) { + return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); } - function append(previous, additional) { - if (additional) { - if (!previous) { - previous = []; - } - for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) { - var x = additional_1[_i]; - previous.push(x); - } - } - return previous; - } - function getJSDocComments(node, checkParentVariableStatement) { - return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); }); - } - ts.getJSDocComments = getJSDocComments; - function getJSDocTags(node, checkParentVariableStatement) { - return getJSDocs(node, checkParentVariableStatement, function (docs) { + ts.getCommentsFromJSDoc = getCommentsFromJSDoc; + function getJSDocTags(node, kind) { + var docs = getJSDocs(node); + if (docs) { var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.tags) { - result.push.apply(result, doc.tags); + if (doc.kind === 281) { + if (doc.kind === kind) { + result.push(doc); + } + } + else { + result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; })); } } return result; - }, function (tags) { return tags; }); + } } - function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) { - var result = undefined; - if (checkParentVariableStatement) { - var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) && - (node.parent).initializer === node && - node.parent.parent.parent.kind === 205; + function getFirstJSDocTag(node, kind) { + return node && ts.firstOrUndefined(getJSDocTags(node, kind)); + } + function getJSDocs(node) { + var cache = node.jsDocCache; + if (!cache) { + getJSDocsWorker(node); + node.jsDocCache = cache; + } + return cache; + function getJSDocsWorker(node) { + var parent = node.parent; + var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && + parent.initializer === node && + parent.parent.parent.kind === 205; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - node.parent.parent.kind === 205; - var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : - isVariableOfVariableDeclarationStatement ? node.parent.parent : + parent.parent.kind === 205; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : + isVariableOfVariableDeclarationStatement ? parent.parent : undefined; if (variableStatementNode) { - result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags)); + getJSDocsWorker(variableStatementNode); } - if (node.kind === 230 && - node.parent && node.parent.kind === 230) { - result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags)); - } - var parent_4 = node.parent; - var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent && - parent_4.kind === 192 && - parent_4.operatorToken.kind === 57 && - parent_4.parent.kind === 207; + var isSourceOfAssignmentExpressionStatement = parent && parent.parent && + parent.kind === 192 && + parent.operatorToken.kind === 57 && + parent.parent.kind === 207; if (isSourceOfAssignmentExpressionStatement) { - result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags)); + getJSDocsWorker(parent.parent); } - var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 257; - if (isPropertyAssignmentExpression) { - result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags)); + var isModuleDeclaration = node.kind === 230 && + parent && parent.kind === 230; + var isPropertyAssignmentExpression = parent && parent.kind === 257; + if (isModuleDeclaration || isPropertyAssignmentExpression) { + getJSDocsWorker(parent); } if (node.kind === 144) { - var paramTags = getJSDocParameterTag(node, checkParentVariableStatement); - if (paramTags) { - result = append(result, getTags(paramTags)); - } + cache = ts.concatenate(cache, getJSDocParameterTags(node)); } - } - if (isVariableLike(node) && node.initializer) { - result = append(result, getJSDocs(node.initializer, false, getDocs, getTags)); - } - if (node.jsDocComments) { - if (result) { - result = append(result, getDocs(node.jsDocComments)); - } - else { - return getDocs(node.jsDocComments); + if (isVariableLike(node) && node.initializer) { + cache = ts.concatenate(cache, node.initializer.jsDoc); } + cache = ts.concatenate(cache, node.jsDoc); } - return result; } - function getJSDocParameterTag(param, checkParentVariableStatement) { + function getJSDocParameterTags(param) { + if (!isParameter(param)) { + return undefined; + } var func = param.parent; - var tags = getJSDocTags(func, checkParentVariableStatement); + var tags = getJSDocTags(func, 281); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { var name_8 = param.name.text; - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 && tag.parameterName.text === name_8; }); - if (paramTags) { - return paramTags; - } + return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_8; }); } else { return undefined; } } - function getJSDocTypeTag(node) { - return getJSDocTag(node, 282, false); + ts.getJSDocParameterTags = getJSDocParameterTags; + function getJSDocType(node) { + var tag = getFirstJSDocTag(node, 283); + if (!tag && node.kind === 144) { + var paramTags = getJSDocParameterTags(node); + if (paramTags) { + tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); + } + } + return tag && tag.typeExpression && tag.typeExpression.type; } - ts.getJSDocTypeTag = getJSDocTypeTag; + ts.getJSDocType = getJSDocType; + function getJSDocAugmentsTag(node) { + return getFirstJSDocTag(node, 280); + } + ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 281, true); + return getFirstJSDocTag(node, 282); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 283, false); + return getFirstJSDocTag(node, 284); } ts.getJSDocTemplateTag = getJSDocTemplateTag; - function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 70) { - var parameterName = parameter.name.text; - var jsDocTags = getJSDocTags(parameter.parent, true); - if (!jsDocTags) { - return undefined; - } - for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) { - var tag = jsDocTags_2[_i]; - if (tag.kind === 280) { - var parameterTag = tag; - if (parameterTag.parameterName.text === parameterName) { - return parameterTag; - } - } - } - } - return undefined; - } - ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; function hasRestParameter(s) { return isRestParameter(ts.lastOrUndefined(s.parameters)); } @@ -8218,14 +8211,11 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 2097152)) { - if (node.type && node.type.kind === 275) { + if (node && (node.flags & 65536)) { + if (node.type && node.type.kind === 275 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) { return true; } - var paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 275; - } } return isDeclaredRestParam(node); } @@ -8448,8 +8438,10 @@ var ts; return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; - function isStringOrNumericLiteral(kind) { - return kind === 9 || kind === 8; + function isStringOrNumericLiteral(node) { + var kind = node.kind; + return kind === 9 + || kind === 8; } ts.isStringOrNumericLiteral = isStringOrNumericLiteral; function hasDynamicName(declaration) { @@ -8458,7 +8450,7 @@ var ts; ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { return name.kind === 142 && - !isStringOrNumericLiteral(name.expression.kind) && + !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } ts.isDynamicName = isDynamicName; @@ -8664,6 +8656,7 @@ var ts; case 194: case 183: case 198: + case 297: return 19; case 181: case 177: @@ -9425,19 +9418,19 @@ var ts; } } ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments; - function isAssignmentExpression(node) { + function isAssignmentExpression(node, excludeCompoundAssignment) { return isBinaryExpression(node) - && isAssignmentOperator(node.operatorToken.kind) + && (excludeCompoundAssignment + ? node.operatorToken.kind === 57 + : isAssignmentOperator(node.operatorToken.kind)) && isLeftHandSideExpression(node.left); } ts.isAssignmentExpression = isAssignmentExpression; function isDestructuringAssignment(node) { - if (isBinaryExpression(node)) { - if (node.operatorToken.kind === 57) { - var kind = node.left.kind; - return kind === 176 - || kind === 175; - } + if (isAssignmentExpression(node, true)) { + var kind = node.left.kind; + return kind === 176 + || kind === 175; } return false; } @@ -9519,39 +9512,6 @@ var ts; } return output; } - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - function stringifyFallback(value) { - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; - } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; - } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; - } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); - } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function convertToBase64(input) { var result = ""; @@ -9748,122 +9708,6 @@ var ts; return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos); } ts.getStartPositionOfRange = getStartPositionOfRange; - function collectExternalModuleInfo(sourceFile, resolver) { - var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); - var uniqueExports = ts.createMap(); - var hasExportDefault = false; - var exportEquals = undefined; - var hasExportStarsToExportValues = false; - for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { - var node = _a[_i]; - switch (node.kind) { - case 235: - externalImports.push(node); - break; - case 234: - if (node.moduleReference.kind === 245) { - externalImports.push(node); - } - break; - case 241: - if (node.moduleSpecifier) { - if (!node.exportClause) { - externalImports.push(node); - hasExportStarsToExportValues = true; - } - else { - externalImports.push(node); - } - } - else { - for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { - var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_10 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_10) - || resolver.getReferencedValueDeclaration(name_10); - if (decl) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name); - } - uniqueExports[specifier.name.text] = specifier.name; - } - } - } - break; - case 240: - if (node.isExportEquals && !exportEquals) { - exportEquals = node; - } - break; - case 205: - if (hasModifier(node, 1)) { - for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { - var decl = _e[_d]; - collectExportedVariableInfo(decl, uniqueExports); - } - } - break; - case 225: - if (hasModifier(node, 1)) { - if (hasModifier(node, 512)) { - if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); - hasExportDefault = true; - } - } - else { - var name_11 = node.name; - if (!uniqueExports[name_11.text]) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_11); - uniqueExports[name_11.text] = name_11; - } - } - } - break; - case 226: - if (hasModifier(node, 1)) { - if (hasModifier(node, 512)) { - if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); - hasExportDefault = true; - } - } - else { - var name_12 = node.name; - if (!uniqueExports[name_12.text]) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_12); - uniqueExports[name_12.text] = name_12; - } - } - } - break; - } - } - var exportedNames; - for (var key in uniqueExports) { - exportedNames = ts.append(exportedNames, uniqueExports[key]); - } - return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames }; - } - ts.collectExternalModuleInfo = collectExternalModuleInfo; - function collectExportedVariableInfo(decl, uniqueExports) { - if (isBindingPattern(decl.name)) { - for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (!isOmittedExpression(element)) { - collectExportedVariableInfo(element, uniqueExports); - } - } - } - else if (!isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = decl.name; - } - } - } function isDeclarationNameOfEnumOrNamespace(node) { var parseNode = getParseTreeNode(node); if (parseNode) { @@ -10034,6 +9878,14 @@ var ts; return isTypeNodeKind(node.kind); } ts.isTypeNode = isTypeNode; + function isArrayBindingPattern(node) { + return node.kind === 173; + } + ts.isArrayBindingPattern = isArrayBindingPattern; + function isObjectBindingPattern(node) { + return node.kind === 172; + } + ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; @@ -10043,6 +9895,12 @@ var ts; return false; } ts.isBindingPattern = isBindingPattern; + function isAssignmentPattern(node) { + var kind = node.kind; + return kind === 175 + || kind === 176; + } + ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { return node.kind === 174; } @@ -10053,6 +9911,39 @@ var ts; || kind === 198; } ts.isArrayBindingElement = isArrayBindingElement; + function isDeclarationBindingElement(bindingElement) { + switch (bindingElement.kind) { + case 223: + case 144: + case 174: + return true; + } + return false; + } + ts.isDeclarationBindingElement = isDeclarationBindingElement; + function isBindingOrAssignmentPattern(node) { + return isObjectBindingOrAssignmentPattern(node) + || isArrayBindingOrAssignmentPattern(node); + } + ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; + function isObjectBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 172: + case 176: + return true; + } + return false; + } + ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; + function isArrayBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 173: + case 175: + return true; + } + return false; + } + ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; function isArrayLiteralExpression(node) { return node.kind === 175; } @@ -10119,7 +10010,8 @@ var ts; || kind === 98 || kind === 100 || kind === 96 - || kind === 201; + || kind === 201 + || kind === 297; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); @@ -10147,6 +10039,7 @@ var ts; || kind === 196 || kind === 200 || kind === 198 + || kind === 297 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10160,11 +10053,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 293; + return node.kind === 294; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 292; + return node.kind === 293; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10276,7 +10169,7 @@ var ts; || kind === 228 || kind === 143 || kind === 223 - || kind === 284; + || kind === 285; } function isDeclarationStatementKind(kind) { return kind === 225 @@ -10311,9 +10204,9 @@ var ts; || kind === 205 || kind === 210 || kind === 217 - || kind === 292 - || kind === 295 - || kind === 294; + || kind === 293 + || kind === 296 + || kind === 295; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10601,6 +10494,53 @@ var ts; return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; + function validateLocaleAndSetLanguage(locale, sys, errors) { + var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); + if (!matchResult) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); + } + return; + } + var language = matchResult[1]; + var territory = matchResult[3]; + if (!trySetLanguageAndTerritory(language, territory, errors)) { + trySetLanguageAndTerritory(language, undefined, errors); + } + function trySetLanguageAndTerritory(language, territory, errors) { + var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath()); + var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath); + var filePath = ts.combinePaths(containingDirectoryPath, language); + if (territory) { + filePath = filePath + "-" + territory; + } + filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")); + if (!sys.fileExists(filePath)) { + return false; + } + var fileContents = ""; + try { + fileContents = sys.readFile(filePath); + } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)); + } + return false; + } + try { + ts.localizedDiagnosticMessages = JSON.parse(fileContents); + } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)); + } + return false; + } + return true; + } + } + ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; })(ts || (ts = {})); var ts; (function (ts) { @@ -10801,9 +10741,9 @@ var ts; return node; } ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node); + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) { + return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node); } return node; } @@ -10936,9 +10876,9 @@ var ts; return node; } ts.createBindingElement = createBindingElement; - function updateBindingElement(node, propertyName, name, initializer) { - if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) { - return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node); + function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { + if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) { + return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node); } return node; } @@ -10978,7 +10918,7 @@ var ts; function createPropertyAccess(expression, name, location, flags) { var node = createNode(177, location, flags); node.expression = parenthesizeForAccess(expression); - (node.emitNode || (node.emitNode = {})).flags |= 1048576; + (node.emitNode || (node.emitNode = {})).flags |= 65536; node.name = typeof name === "string" ? createIdentifier(name) : name; return node; } @@ -11199,13 +11139,21 @@ var ts; return node; } ts.updateBinary = updateBinary; - function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) { - var node = createNode(193, location); - node.condition = condition; - node.questionToken = questionToken; - node.whenTrue = whenTrue; - node.colonToken = colonToken; - node.whenFalse = whenFalse; + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { + var node = createNode(193, whenFalse ? location : colonTokenOrLocation); + node.condition = parenthesizeForConditionalHead(condition); + if (whenFalse) { + node.questionToken = questionTokenOrWhenTrue; + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); + node.colonToken = colonTokenOrLocation; + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); + } + else { + node.questionToken = createToken(54); + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); + node.colonToken = createToken(55); + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); + } return node; } ts.createConditional = createConditional; @@ -12015,35 +11963,33 @@ var ts; updated.imports = node.imports; if (node.moduleAugmentations !== undefined) updated.moduleAugmentations = node.moduleAugmentations; - if (node.externalHelpersModuleName !== undefined) - updated.externalHelpersModuleName = node.externalHelpersModuleName; return updateNode(updated, node); } return node; } ts.updateSourceFileNode = updateSourceFileNode; function createNotEmittedStatement(original) { - var node = createNode(292, original); + var node = createNode(293, original); node.original = original; return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(295); + var node = createNode(296); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(294); + var node = createNode(295); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(293, location || original); + var node = createNode(294, location || original); node.expression = expression; node.original = original; return node; @@ -12056,6 +12002,12 @@ var ts; return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; + function createRawExpression(text) { + var node = createNode(297); + node.text = text; + return node; + } + ts.createRawExpression = createRawExpression; function createComma(left, right) { return createBinary(left, 25, right); } @@ -12104,13 +12056,19 @@ var ts; return createVoid(createLiteral(0)); } ts.createVoidZero = createVoidZero; + function createTypeCheck(value, tag) { + return tag === "undefined" + ? createStrictEquality(value, createVoidZero()) + : createStrictEquality(createTypeOf(value), createLiteral(tag)); + } + ts.createTypeCheck = createTypeCheck; function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) { return createElementAccess(target, memberName.expression, location); } else { var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - (expression.emitNode || (expression.emitNode = {})).flags |= 2048; + (expression.emitNode || (expression.emitNode = {})).flags |= 64; return expression; } } @@ -12152,7 +12110,10 @@ var ts; } function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { - return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536)); + var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); + var right = createSynthesizedNode(70); + right.text = jsxFactory.right.text; + return createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); @@ -12206,114 +12167,10 @@ var ts; return createVariableDeclarationList(declarations, location, 2); } ts.createConstDeclarationList = createConstDeclarationList; - function createHelperName(externalHelpersModuleName, name) { - return externalHelpersModuleName - ? createPropertyAccess(externalHelpersModuleName, name) - : createIdentifier(name); + function getHelperName(name) { + return setEmitFlags(createIdentifier(name), 4096 | 2); } - ts.createHelperName = createHelperName; - function createExtendsHelper(externalHelpersModuleName, name) { - return createCall(createHelperName(externalHelpersModuleName, "__extends"), undefined, [ - name, - createIdentifier("_super") - ]); - } - ts.createExtendsHelper = createExtendsHelper; - function createAssignHelper(externalHelpersModuleName, attributesSegments) { - return createCall(createHelperName(externalHelpersModuleName, "__assign"), undefined, attributesSegments); - } - ts.createAssignHelper = createAssignHelper; - function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) { - return createCall(createHelperName(externalHelpersModuleName, "__param"), undefined, [ - createLiteral(parameterOffset), - expression - ], location); - } - ts.createParamHelper = createParamHelper; - function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) { - return createCall(createHelperName(externalHelpersModuleName, "__metadata"), undefined, [ - createLiteral(metadataKey), - metadataValue - ]); - } - ts.createMetadataHelper = createMetadataHelper; - function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) { - var argumentsArray = []; - argumentsArray.push(createArrayLiteral(decoratorExpressions, undefined, true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); - } - } - return createCall(createHelperName(externalHelpersModuleName, "__decorate"), undefined, argumentsArray, location); - } - ts.createDecorateHelper = createDecorateHelper; - function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) { - var generatorFunc = createFunctionExpression(undefined, createToken(38), undefined, undefined, [], undefined, body); - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152; - return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), undefined, [ - createThis(), - hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(), - promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(), - generatorFunc - ]); - } - ts.createAwaiterHelper = createAwaiterHelper; - function createHasOwnProperty(target, propertyName) { - return createCall(createPropertyAccess(target, "hasOwnProperty"), undefined, [propertyName]); - } - ts.createHasOwnProperty = createHasOwnProperty; - function createObjectCreate(prototype) { - return createCall(createPropertyAccess(createIdentifier("Object"), "create"), undefined, [prototype]); - } - function createGeti(target) { - return createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createElementAccess(target, createIdentifier("name"))); - } - function createSeti(target) { - return createArrowFunction(undefined, undefined, [ - createParameter(undefined, undefined, undefined, "name"), - createParameter(undefined, undefined, undefined, "value") - ], undefined, createToken(35), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value"))); - } - function createAdvancedAsyncSuperHelper() { - var createCache = createVariableStatement(undefined, createConstDeclarationList([ - createVariableDeclaration("cache", undefined, createObjectCreate(createNull())) - ])); - var getter = createGetAccessor(undefined, undefined, "value", [], undefined, createBlock([ - createReturn(createCall(createIdentifier("geti"), undefined, [createIdentifier("name")])) - ])); - var setter = createSetAccessor(undefined, undefined, "value", [createParameter(undefined, undefined, undefined, "v")], createBlock([ - createStatement(createCall(createIdentifier("seti"), undefined, [ - createIdentifier("name"), - createIdentifier("v") - ])) - ])); - var getOrCreateAccessorsForName = createReturn(createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([ - getter, - setter - ])))))); - return createVariableStatement(undefined, createConstDeclarationList([ - createVariableDeclaration("_super", undefined, createCall(createParen(createFunctionExpression(undefined, undefined, undefined, undefined, [ - createParameter(undefined, undefined, undefined, "geti"), - createParameter(undefined, undefined, undefined, "seti") - ], undefined, createBlock([ - createCache, - getOrCreateAccessorsForName - ]))), undefined, [ - createGeti(createSuper()), - createSeti(createSuper()) - ])) - ])); - } - ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper; - function createSimpleAsyncSuperHelper() { - return createVariableStatement(undefined, createConstDeclarationList([ - createVariableDeclaration("_super", undefined, createGeti(createSuper())) - ])); - } - ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper; + ts.getHelperName = getHelperName; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12459,19 +12316,19 @@ var ts; return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method)); } function getLocalName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 262144); + return getName(node, allowComments, allowSourceMaps, 16384); } ts.getLocalName = getLocalName; function isLocalName(node) { - return (getEmitFlags(node) & 262144) !== 0; + return (getEmitFlags(node) & 16384) !== 0; } ts.isLocalName = isLocalName; function getExportName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 131072); + return getName(node, allowComments, allowSourceMaps, 8192); } ts.getExportName = getExportName; function isExportName(node) { - return (getEmitFlags(node) & 131072) !== 0; + return (getEmitFlags(node) & 8192) !== 0; } ts.isExportName = isExportName; function getDeclarationName(node, allowComments, allowSourceMaps) { @@ -12480,15 +12337,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_13 = getMutableClone(node.name); + var name_10 = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) - emitFlags |= 1536; + emitFlags |= 48; if (!allowComments) - emitFlags |= 49152; + emitFlags |= 1536; if (emitFlags) - setEmitFlags(name_13, emitFlags); - return name_13; + setEmitFlags(name_10, emitFlags); + return name_10; } return getGeneratedNameForNode(node); } @@ -12503,14 +12360,18 @@ var ts; var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name); var emitFlags; if (!allowSourceMaps) - emitFlags |= 1536; + emitFlags |= 48; if (!allowComments) - emitFlags |= 49152; + emitFlags |= 1536; if (emitFlags) setEmitFlags(qualifiedName, emitFlags); return qualifiedName; } ts.getNamespaceMemberName = getNamespaceMemberName; + function convertToFunctionBody(node, multiLine) { + return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine); + } + ts.convertToFunctionBody = convertToFunctionBody; function isUseStrictPrologue(node) { return node.expression.text === "use strict"; } @@ -12537,7 +12398,7 @@ var ts; } while (statementOffset < numStatements) { var statement = source[statementOffset]; - if (getEmitFlags(statement) & 8388608) { + if (getEmitFlags(statement) & 524288) { target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); } else { @@ -12548,10 +12409,17 @@ var ts; return statementOffset; } ts.addPrologueDirectives = addPrologueDirectives; - function ensureUseStrict(node) { + function startsWithUseStrict(statements) { + var firstStatement = ts.firstOrUndefined(statements); + return firstStatement !== undefined + && ts.isPrologueDirective(firstStatement) + && isUseStrictPrologue(firstStatement); + } + ts.startsWithUseStrict = startsWithUseStrict; + function ensureUseStrict(statements) { var foundUseStrict = false; - for (var _i = 0, _a = node.statements; _i < _a.length; _i++) { - var statement = _a[_i]; + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; if (ts.isPrologueDirective(statement)) { if (isUseStrictPrologue(statement)) { foundUseStrict = true; @@ -12563,11 +12431,11 @@ var ts; } } if (!foundUseStrict) { - var statements = []; - statements.push(startOnNewLine(createStatement(createLiteral("use strict")))); - return updateSourceFileNode(node, statements.concat(node.statements)); + return createNodeArray([ + startOnNewLine(createStatement(createLiteral("use strict"))) + ].concat(statements), statements); } - return node; + return statements; } ts.ensureUseStrict = ensureUseStrict; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { @@ -12642,6 +12510,21 @@ var ts; } return 0; } + function parenthesizeForConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(193, 54); + var emittedCondition = skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { + return createParen(condition); + } + return condition; + } + ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; + function parenthesizeSubexpressionOfConditionalExpression(e) { + return e.kind === 192 && e.operatorToken.kind === 25 + ? createParen(e) + : e; + } function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { @@ -12747,7 +12630,7 @@ var ts; case 177: node = node.expression; continue; - case 293: + case 294: node = node.expression; continue; } @@ -12795,7 +12678,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 293) { + while (node.kind === 294) { node = node.expression; } return node; @@ -12817,8 +12700,8 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges; - if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges)) + var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) destEmitNode = {}; if (flags) destEmitNode.flags = flags; @@ -12828,6 +12711,10 @@ var ts; destEmitNode.sourceMapRange = sourceMapRange; if (tokenSourceMapRanges) destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -12861,6 +12748,7 @@ var ts; } return node.emitNode; } + ts.getOrCreateEmitNode = getOrCreateEmitNode; function getEmitFlags(node) { var emitNode = node.emitNode; return emitNode && emitNode.flags; @@ -12871,11 +12759,22 @@ var ts; return node; } ts.setEmitFlags = setEmitFlags; + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; function setSourceMapRange(node, range) { getOrCreateEmitNode(node).sourceMapRange = range; return node; } ts.setSourceMapRange = setSourceMapRange; + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; function setTokenSourceMapRange(node, token, range) { var emitNode = getOrCreateEmitNode(node); var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); @@ -12883,27 +12782,16 @@ var ts; return node; } ts.setTokenSourceMapRange = setTokenSourceMapRange; - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; function getCommentRange(node) { var emitNode = node.emitNode; return (emitNode && emitNode.commentRange) || node; } ts.getCommentRange = getCommentRange; - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; } - ts.getSourceMapRange = getSourceMapRange; - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; + ts.setCommentRange = setCommentRange; function getConstantValue(node) { var emitNode = node.emitNode; return emitNode && emitNode.constantValue; @@ -12915,6 +12803,103 @@ var ts; return node; } ts.setConstantValue = setConstantValue; + function getExternalHelpersModuleName(node) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = parseNode && parseNode.emitNode; + return emitNode && emitNode.externalHelpersModuleName; + } + ts.getExternalHelpersModuleName = getExternalHelpersModuleName; + function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) { + if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { + var externalHelpersModuleName = getExternalHelpersModuleName(node); + if (externalHelpersModuleName) { + return externalHelpersModuleName; + } + var helpers = getEmitHelpers(node); + if (helpers) { + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!helper.scoped) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText)); + } + } + } + } + } + ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + function compareEmitHelpers(x, y) { + if (x === y) + return 0; + if (x.priority === y.priority) + return 0; + if (x.priority === undefined) + return 1; + if (y.priority === undefined) + return -1; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; function setTextRange(node, location) { if (location) { node.pos = location.pos; @@ -12941,8 +12926,8 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_14 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_14) ? name_14 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name_11 = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } if (node.kind === 235 && node.importClause) { return getGeneratedNameForNode(node); @@ -12985,221 +12970,291 @@ var ts; function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) { return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); } - function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) { - var multiLine = false; - var singleLine = false; - var statementsLocation; - var closeBraceLocation; - var statements = []; - var body = node.body; - var statementOffset; - context.startLexicalEnvironment(); - if (ts.isBlock(body)) { - statementOffset = addPrologueDirectives(statements, body.statements, false, visitor); + function getInitializerOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + return bindingElement.initializer; } - addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis); - addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest); - addRestParameterIfNeeded(statements, node, false); - if (!multiLine && statements.length > 0) { - multiLine = true; + if (ts.isPropertyAssignment(bindingElement)) { + return ts.isAssignmentExpression(bindingElement.initializer, true) + ? bindingElement.initializer.right + : undefined; } - if (ts.isBlock(body)) { - statementsLocation = body.statements; - ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); - if (!multiLine && body.multiLine) { - multiLine = true; + if (ts.isShorthandPropertyAssignment(bindingElement)) { + return bindingElement.objectAssignmentInitializer; + } + if (ts.isAssignmentExpression(bindingElement, true)) { + return bindingElement.right; + } + if (ts.isSpreadExpression(bindingElement)) { + return getInitializerOfBindingOrAssignmentElement(bindingElement.expression); + } + } + ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement; + function getTargetOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + return bindingElement.name; + } + if (ts.isObjectLiteralElementLike(bindingElement)) { + switch (bindingElement.kind) { + case 257: + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); + case 258: + return bindingElement.name; + case 259: + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + return undefined; + } + if (ts.isAssignmentExpression(bindingElement, true)) { + return getTargetOfBindingOrAssignmentElement(bindingElement.left); + } + if (ts.isSpreadExpression(bindingElement)) { + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + return bindingElement; + } + ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; + function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 144: + case 174: + return bindingElement.dotDotDotToken; + case 196: + case 259: + return bindingElement; + } + return undefined; + } + ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; + function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 174: + if (bindingElement.propertyName) { + var propertyName = bindingElement.propertyName; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 257: + if (bindingElement.name) { + var propertyName = bindingElement.name; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 259: + return bindingElement.name; + } + var target = getTargetOfBindingOrAssignmentElement(bindingElement); + if (target && ts.isPropertyName(target)) { + return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression) + ? target.expression + : target; + } + ts.Debug.fail("Invalid property name for binding element."); + } + ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; + function getElementsOfBindingOrAssignmentPattern(name) { + switch (name.kind) { + case 172: + case 173: + case 175: + return name.elements; + case 176: + return name.properties; + } + } + ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern; + function convertToArrayAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createSpread(element.name, element), element); + } + var expression = convertToAssignmentElementTarget(element.name); + return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression; + } + ts.Debug.assertNode(element, ts.isExpression); + return element; + } + ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement; + function convertToObjectAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createSpreadAssignment(element.name, element), element); + } + if (element.propertyName) { + var expression = convertToAssignmentElementTarget(element.name); + return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element); + } + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element); + } + ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); + return element; + } + ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; + function convertToAssignmentPattern(node) { + switch (node.kind) { + case 173: + case 175: + return convertToArrayAssignmentPattern(node); + case 172: + case 176: + return convertToObjectAssignmentPattern(node); + } + } + ts.convertToAssignmentPattern = convertToAssignmentPattern; + function convertToObjectAssignmentPattern(node) { + if (ts.isObjectBindingPattern(node)) { + return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node); + } + ts.Debug.assertNode(node, ts.isObjectLiteralExpression); + return node; + } + ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; + function convertToArrayAssignmentPattern(node) { + if (ts.isArrayBindingPattern(node)) { + return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node); + } + ts.Debug.assertNode(node, ts.isArrayLiteralExpression); + return node; + } + ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern; + function convertToAssignmentElementTarget(node) { + if (ts.isBindingPattern(node)) { + return convertToAssignmentPattern(node); + } + ts.Debug.assertNode(node, ts.isExpression); + return node; + } + ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; + function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { + var externalImports = []; + var exportSpecifiers = ts.createMap(); + var exportedBindings = ts.createMap(); + var uniqueExports = ts.createMap(); + var exportedNames; + var hasExportDefault = false; + var exportEquals = undefined; + var hasExportStarsToExportValues = false; + var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions); + var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText)); + if (externalHelpersImportDeclaration) { + externalImports.push(externalHelpersImportDeclaration); + } + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 235: + externalImports.push(node); + break; + case 234: + if (node.moduleReference.kind === 245) { + externalImports.push(node); + } + break; + case 241: + if (node.moduleSpecifier) { + if (!node.exportClause) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } + else { + externalImports.push(node); + } + } + else { + for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { + var specifier = _c[_b]; + if (!uniqueExports[specifier.name.text]) { + var name_12 = specifier.propertyName || specifier.name; + ts.multiMapAdd(exportSpecifiers, name_12.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name_12) + || resolver.getReferencedValueDeclaration(name_12); + if (decl) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + } + uniqueExports[specifier.name.text] = true; + exportedNames = ts.append(exportedNames, specifier.name); + } + } + } + break; + case 240: + if (node.isExportEquals && !exportEquals) { + exportEquals = node; + } + break; + case 205: + if (ts.hasModifier(node, 1)) { + for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { + var decl = _e[_d]; + exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames); + } + } + break; + case 225: + if (ts.hasModifier(node, 1)) { + if (ts.hasModifier(node, 512)) { + if (!hasExportDefault) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + var name_13 = node.name; + if (!uniqueExports[name_13.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13); + uniqueExports[name_13.text] = true; + exportedNames = ts.append(exportedNames, name_13); + } + } + } + break; + case 226: + if (ts.hasModifier(node, 1)) { + if (ts.hasModifier(node, 512)) { + if (!hasExportDefault) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + var name_14 = node.name; + if (!uniqueExports[name_14.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_14); + uniqueExports[name_14.text] = true; + exportedNames = ts.append(exportedNames, name_14); + } + } + } + break; } } - else { - ts.Debug.assert(node.kind === 185); - statementsLocation = ts.moveRangeEnd(body, -1); - var equalsGreaterThanToken = node.equalsGreaterThanToken; - if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { - if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { - singleLine = true; - } - else { - multiLine = true; + return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration }; + } + ts.collectExternalModuleInfo = collectExternalModuleInfo; + function collectExportedVariableInfo(decl, uniqueExports, exportedNames) { + if (ts.isBindingPattern(decl.name)) { + for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames); } } - var expression = ts.visitNode(body, visitor, ts.isExpression); - var returnStatement = createReturn(expression, body); - setEmitFlags(returnStatement, 12288 | 1024 | 32768); - statements.push(returnStatement); - closeBraceLocation = body; } - var lexicalEnvironment = context.endLexicalEnvironment(); - ts.addRange(statements, lexicalEnvironment); - if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { - multiLine = true; - } - var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine); - if (!multiLine && singleLine) { - setEmitFlags(block, 32); - } - if (closeBraceLocation) { - setTokenSourceMapRange(block, 17, closeBraceLocation); - } - setOriginalNode(block, node.body); - return block; - } - ts.transformFunctionBody = transformFunctionBody; - function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) { - if (node.transformFlags & 524288 && node.kind !== 185) { - captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis); - } - } - ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded; - function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) { - enableSubstitutionsForCapturedThis(); - var captureThisStatement = createVariableStatement(undefined, createVariableDeclarationList([ - createVariableDeclaration("_this", undefined, initializer) - ]), originalStatement); - setEmitFlags(captureThisStatement, 49152 | 8388608); - setSourceMapRange(captureThisStatement, node); - statements.push(captureThisStatement); - } - ts.captureThisForNode = captureThisForNode; - function shouldAddDefaultValueAssignments(node) { - return (node.transformFlags & 2097152) !== 0; - } - function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) { - if (!shouldAddDefaultValueAssignments(node)) { - return; - } - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var parameter = _a[_i]; - var name_15 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; - if (dotDotDotToken) { - continue; - } - if (ts.isBindingPattern(name_15)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_15, initializer, visitor, convertObjectRest); - } - else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_15, initializer, visitor); + else if (!ts.isGeneratedIdentifier(decl.name)) { + if (!uniqueExports[decl.name.text]) { + uniqueExports[decl.name.text] = true; + exportedNames = ts.append(exportedNames, decl.name); } } + return exportedNames; } - ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded; - function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) { - var temp = getGeneratedNameForNode(parameter); - if (name.elements.length > 0) { - statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608)); - } - else if (initializer) { - statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608)); - } - } - function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) { - initializer = ts.visitNode(initializer, visitor, ts.isExpression); - var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([ - createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536), setEmitFlags(initializer, 1536 | getEmitFlags(initializer)), parameter)) - ], parameter), 32 | 1024 | 12288), undefined, parameter); - statement.startsOnNewLine = true; - setEmitFlags(statement, 12288 | 1024 | 8388608); - statements.push(statement); - } - function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { - return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper; - } - function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { - var parameter = ts.lastOrUndefined(node.parameters); - if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { - return; - } - var declarationName = getMutableClone(parameter.name); - setEmitFlags(declarationName, 1536); - var expressionName = getSynthesizedClone(parameter.name); - var restIndex = node.parameters.length - 1; - var temp = createLoopVariable(); - statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList([ - createVariableDeclaration(declarationName, undefined, createArrayLiteral([])) - ]), parameter), 8388608)); - var forStatement = createFor(createVariableDeclarationList([ - createVariableDeclaration(temp, undefined, createLiteral(restIndex)) - ], parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"), parameter), createPostfixIncrement(temp, parameter), createBlock([ - startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)), parameter)) - ])); - setEmitFlags(forStatement, 8388608); - startOnNewLine(forStatement); - statements.push(forStatement); - } - ts.addRestParameterIfNeeded = addRestParameterIfNeeded; - function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var initializer = node.initializer; - var statements = []; - var counter = convertObjectRest ? undefined : createLoopVariable(); - var rhsReference = expression.kind === 70 - ? createUniqueName(expression.text) - : createTempVariable(undefined); - var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter); - if (ts.isVariableDeclarationList(initializer)) { - if (initializer.flags & 3) { - enableSubstitutionsForBlockScopedBindings(); - } - var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); - if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { - var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor, undefined, convertObjectRest); - var declarationList = createVariableDeclarationList(declarations, initializer); - setOriginalNode(declarationList, initializer); - var firstDeclaration = declarations[0]; - var lastDeclaration = ts.lastOrUndefined(declarations); - setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - statements.push(createVariableStatement(undefined, declarationList)); - } - else { - statements.push(createVariableStatement(undefined, setOriginalNode(createVariableDeclarationList([ - createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(undefined), undefined, createElementAccess(rhsReference, counter)) - ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1))); - } - } - else { - var assignment = createAssignment(initializer, elementAccess); - if (ts.isDestructuringAssignment(assignment)) { - statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment, false, context.hoistVariableDeclaration, visitor, convertObjectRest))); - } - else { - assignment.end = initializer.end; - statements.push(createStatement(assignment, ts.moveRangeEnd(initializer, -1))); - } - } - var bodyLocation; - var statementsLocation; - if (convertedLoopBodyStatements) { - ts.addRange(statements, convertedLoopBodyStatements); - } - else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); - if (ts.isBlock(statement)) { - ts.addRange(statements, statement.statements); - bodyLocation = statement; - statementsLocation = statement.statements; - } - else { - statements.push(statement); - } - } - setEmitFlags(expression, 1536 | getEmitFlags(expression)); - var body = createBlock(createNodeArray(statements, statementsLocation), bodyLocation); - setEmitFlags(body, 1536 | 12288); - var forStatement; - if (convertObjectRest) { - forStatement = createForOf(createVariableDeclarationList([ - createVariableDeclaration(rhsReference, undefined, undefined, node.expression) - ], node.expression), node.expression, body, node); - } - else { - forStatement = createFor(setEmitFlags(createVariableDeclarationList([ - createVariableDeclaration(counter, undefined, createLiteral(0), ts.moveRangePos(node.expression, -1)), - createVariableDeclaration(rhsReference, undefined, expression, node.expression) - ], node.expression), 16777216), createLessThan(counter, createPropertyAccess(rhsReference, "length"), node.expression), createPostfixIncrement(counter, node.expression), body, node); - } - setEmitFlags(forStatement, 8192); - return forStatement; - } - ts.convertForOf = convertForOf; })(ts || (ts = {})); var ts; (function (ts) { @@ -13597,29 +13652,31 @@ var ts; visitNode(cbNode, node.type); case 278: return visitNodes(cbNodes, node.tags); - case 280: + case 281: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 281: - return visitNode(cbNode, node.typeExpression); case 282: return visitNode(cbNode, node.typeExpression); case 283: - return visitNodes(cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 280: + return visitNode(cbNode, node.typeExpression); case 284: + return visitNodes(cbNodes, node.typeParameters); + case 285: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 286: + case 287: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 285: + case 286: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 293: + case 294: return visitNode(cbNode, node.expression); - case 287: + case 288: return visitNode(cbNode, node.literal); } } @@ -13660,7 +13717,7 @@ var ts; var Parser; (function (Parser) { var scanner = ts.createScanner(5, true); - var disallowInAndDecoratorContext = 65536 | 262144; + var disallowInAndDecoratorContext = 2048 | 8192; var NodeConstructor; var TokenConstructor; var IdentifierConstructor; @@ -13708,7 +13765,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 || scriptKind === 2 ? 2097152 : 0; + contextFlags = scriptKind === 1 || scriptKind === 2 ? 65536 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); @@ -13743,7 +13800,7 @@ var ts; return sourceFile; } function addJSDocComment(node) { - var comments = ts.getJsDocCommentsFromText(node, sourceFile.text); + var comments = ts.getJSDocCommentRanges(node, sourceFile.text); if (comments) { for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { var comment = comments_2[_i]; @@ -13751,10 +13808,10 @@ var ts; if (!jsDoc) { continue; } - if (!node.jsDocComments) { - node.jsDocComments = []; + if (!node.jsDoc) { + node.jsDoc = []; } - node.jsDocComments.push(jsDoc); + node.jsDoc.push(jsDoc); } } return node; @@ -13769,12 +13826,12 @@ var ts; var saveParent = parent; parent = n; forEachChild(n, visitNode); - if (n.jsDocComments) { - for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - jsDocComment.parent = n; - parent = jsDocComment; - forEachChild(jsDocComment, visitNode); + if (n.jsDoc) { + for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + jsDoc.parent = n; + parent = jsDoc; + forEachChild(jsDoc, visitNode); } } parent = saveParent; @@ -13803,16 +13860,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 65536); + setContextFlag(val, 2048); } function setYieldContext(val) { - setContextFlag(val, 131072); + setContextFlag(val, 4096); } function setDecoratorContext(val) { - setContextFlag(val, 262144); + setContextFlag(val, 8192); } function setAwaitContext(val) { - setContextFlag(val, 524288); + setContextFlag(val, 16384); } function doOutsideOfContext(context, func) { var contextFlagsToClear = context & contextFlags; @@ -13835,40 +13892,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(65536, func); + return doOutsideOfContext(2048, func); } function disallowInAnd(func) { - return doInsideOfContext(65536, func); + return doInsideOfContext(2048, func); } function doInYieldContext(func) { - return doInsideOfContext(131072, func); + return doInsideOfContext(4096, func); } function doInDecoratorContext(func) { - return doInsideOfContext(262144, func); + return doInsideOfContext(8192, func); } function doInAwaitContext(func) { - return doInsideOfContext(524288, func); + return doInsideOfContext(16384, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(524288, func); + return doOutsideOfContext(16384, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(131072 | 524288, func); + return doInsideOfContext(4096 | 16384, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(131072); + return inContext(4096); } function inDisallowInContext() { - return inContext(65536); + return inContext(2048); } function inDecoratorContext() { - return inContext(262144); + return inContext(8192); } function inAwaitContext() { - return inContext(524288); + return inContext(16384); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -14030,7 +14087,7 @@ var ts; } if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 1048576; + node.flags |= 32768; } return node; } @@ -14348,7 +14405,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.flags & 3080192; + var nodeContextFlags = node.flags & 96256; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -15021,6 +15078,8 @@ var ts; case 16: case 20: case 26: + case 48: + case 47: case 93: case 9: case 8: @@ -15073,6 +15132,7 @@ var ts; return parseArrayTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { var types = createNodeArray([type], type.pos); @@ -15153,7 +15213,7 @@ var ts; } } function parseType() { - return doOutsideOfContext(655360, parseTypeWorker); + return doOutsideOfContext(20480, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { @@ -16784,7 +16844,7 @@ var ts; property.type = parseTypeAnnotation(); property.initializer = ts.hasModifier(property, 32) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(131072 | 65536, parseNonParameterInitializer); + : doOutsideOfContext(4096 | 2048, parseNonParameterInitializer); parseSemicolon(); return addJSDocComment(finishNode(property)); } @@ -16951,8 +17011,8 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_16 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_16, undefined); + var name_15 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_15, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } @@ -17599,7 +17659,7 @@ var ts; return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(287); + var result = createNode(288); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -17701,7 +17761,7 @@ var ts; break; case 38: var asterisk = scanner.getTokenText(); - if (state === 1) { + if (state === 1 || state === 2) { state = 2; pushComment(asterisk); } @@ -17716,7 +17776,10 @@ var ts; break; case 5: var whitespace = scanner.getTokenText(); - if (state === 2 || margin !== undefined && indent + whitespace.length > margin) { + if (state === 2) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -17724,6 +17787,7 @@ var ts; case 1: break; default: + state = 2; pushComment(scanner.getTokenText()); break; } @@ -17779,6 +17843,9 @@ var ts; var tag; if (tagName) { switch (tagName.text) { + case "augments": + tag = parseAugmentsTag(atToken, tagName); + break; case "param": tag = parseParamTag(atToken, tagName); break; @@ -17918,7 +17985,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(280, atToken.pos); + var result = createNode(281, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -17929,20 +17996,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281; })) { + if (ts.forEach(tags, function (t) { return t.kind === 282; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(281, atToken.pos); + var result = createNode(282, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -17957,17 +18024,25 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(285, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; result.typeExpression = typeExpression; return finishNode(result); } + function parseAugmentsTag(atToken, tagName) { + var typeExpression = tryParseTypeExpression(); + var result = createNode(280, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + result.typeExpression = typeExpression; + return finishNode(result); + } function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(284, atToken.pos); + var typedefTag = createNode(285, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -17984,8 +18059,8 @@ var ts; if (typeExpression.type.kind === 272) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { - var name_17 = jsDocTypeReference.name; - if (name_17.text === "Object") { + var name_16 = jsDocTypeReference.name; + if (name_16.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -17999,7 +18074,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(286, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(287, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -18084,19 +18159,19 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); while (true) { - var name_18 = parseJSDocIdentifierName(); + var name_17 = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_18) { + if (!name_17) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143, name_18.pos); - typeParameter.name = name_18; + var typeParameter = createNode(143, name_17.pos); + typeParameter.name = name_17; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25) { @@ -18107,7 +18182,7 @@ var ts; break; } } - var result = createNode(283, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -18187,8 +18262,8 @@ var ts; ts.Debug.assert(text === newText.substring(node.pos, node.end)); } forEachChild(node, visitNode, visitArray); - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; forEachChild(jsDocComment, visitNode, visitArray); } @@ -18572,7 +18647,7 @@ var ts; } if (node.name.kind === 142) { var nameExpression = node.name.expression; - if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; } ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); @@ -18617,7 +18692,7 @@ var ts; var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 284: + case 285: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; if (parentNode && parentNode.kind === 205) { @@ -18692,7 +18767,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 284 && + var isJSDocTypedefInJSDocNamespace = node.kind === 285 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -18747,7 +18822,7 @@ var ts; activeLabels = undefined; hasExplicitReturn = false; bindChildren(node); - node.flags &= ~64896; + node.flags &= ~1408; if (!(currentFlow.flags & 1) && containerFlags & 8 && ts.nodeIsPresent(node.body)) { node.flags |= 128; if (hasExplicitReturn) @@ -18797,12 +18872,35 @@ var ts; subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags); } } + function bindEach(nodes) { + if (nodes === undefined) { + return; + } + if (skipTransformFlagAggregation) { + ts.forEach(nodes, bind); + } + else { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0; + var nodeArrayFlags = 0; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; + bind(node); + nodeArrayFlags |= node.transformFlags & ~536870912; + } + nodes.transformFlags = nodeArrayFlags | 536870912; + subtreeTransformFlags |= savedSubtreeTransformFlags; + } + } + function bindEachChild(node) { + ts.forEachChild(node, bind, bindEach); + } function bindChildrenWorker(node) { - if (ts.isInJavaScriptFile(node) && node.jsDocComments) { - ts.forEach(node.jsDocComments, bind); + if (ts.isInJavaScriptFile(node) && node.jsDoc) { + ts.forEach(node.jsDoc, bind); } if (checkUnreachable(node)) { - ts.forEachChild(node, bind); + bindEachChild(node); return; } switch (node.kind) { @@ -18867,7 +18965,7 @@ var ts; bindCallExpressionFlow(node); break; default: - ts.forEachChild(node, bind); + bindEachChild(node); break; } } @@ -19170,7 +19268,7 @@ var ts; } return undefined; } - function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { + function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { var flowLabel = node.kind === 215 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); @@ -19183,11 +19281,11 @@ var ts; var activeLabel = findActiveLabel(node.label.text); if (activeLabel) { activeLabel.referenced = true; - bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); } } else { - bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); } } function bindTryStatement(node) { @@ -19238,6 +19336,8 @@ var ts; currentFlow = finishFlowLabel(postSwitchLabel); } function bindCaseBlock(node) { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0; var clauses = node.clauses; var fallthroughFlow = unreachableFlow; for (var i = 0; i < clauses.length; i++) { @@ -19257,13 +19357,15 @@ var ts; errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); } } + clauses.transformFlags = subtreeTransformFlags | 536870912; + subtreeTransformFlags |= savedSubtreeTransformFlags; } function bindCaseClause(node) { var saveCurrentFlow = currentFlow; currentFlow = preSwitchCaseFlow; bind(node.expression); currentFlow = saveCurrentFlow; - ts.forEach(node.statements, bind); + bindEach(node.statements); } function pushActiveLabel(name, breakTarget, continueTarget) { var activeLabel = { @@ -19349,19 +19451,19 @@ var ts; var saveTrueTarget = currentTrueTarget; currentTrueTarget = currentFalseTarget; currentFalseTarget = saveTrueTarget; - ts.forEachChild(node, bind); + bindEachChild(node); currentFalseTarget = currentTrueTarget; currentTrueTarget = saveTrueTarget; } else { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.operator === 42 || node.operator === 43) { bindAssignmentTargetFlow(node.operand); } } } function bindPostfixUnaryExpressionFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.operator === 42 || node.operator === 43) { bindAssignmentTargetFlow(node.operand); } @@ -19379,7 +19481,7 @@ var ts; } } else { - ts.forEachChild(node, bind); + bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); if (operator === 57 && node.left.kind === 178) { @@ -19392,7 +19494,7 @@ var ts; } } function bindDeleteExpressionFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.expression.kind === 177) { bindAssignmentTargetFlow(node.expression); } @@ -19425,7 +19527,7 @@ var ts; } } function bindVariableDeclarationFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) { bindInitializedVariableFlow(node); } @@ -19436,12 +19538,12 @@ var ts; expr = expr.expression; } if (expr.kind === 184 || expr.kind === 185) { - ts.forEach(node.typeArguments, bind); - ts.forEach(node.arguments, bind); + bindEach(node.typeArguments); + bindEach(node.arguments); bind(node.expression); } else { - ts.forEachChild(node, bind); + bindEachChild(node); } if (node.expression.kind === 177) { var propertyAccess = node.expression; @@ -19457,7 +19559,7 @@ var ts; case 229: case 176: case 161: - case 286: + case 287: case 270: return 1; case 227: @@ -19526,7 +19628,7 @@ var ts; case 176: case 227: case 270: - case 286: + case 287: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 158: case 159: @@ -19820,8 +19922,8 @@ var ts; } function updateStrictModeStatementList(statements) { if (!inStrictMode) { - for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { - var statement = statements_1[_i]; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; if (!ts.isPrologueDirective(statement)) { return; } @@ -19841,7 +19943,7 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 284) { + while (parentNode && parentNode.kind !== 285) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); @@ -19903,15 +20005,12 @@ var ts; return bindParameter(node); case 223: case 174: - if (node.dotDotDotToken && node.parent.kind === 172) { - emitFlags |= 32768; - } return bindVariableDeclarationOrBindingElement(node); case 147: case 146: case 271: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 285: + case 286: return bindJSDocProperty(node); case 257: case 258: @@ -19932,7 +20031,6 @@ var ts; } root = root.parent; } - emitFlags |= hasRest ? 32768 : 16384; return; case 153: case 154: @@ -19955,7 +20053,7 @@ var ts; return bindFunctionOrConstructorType(node); case 161: case 170: - case 286: + case 287: case 270: return bindAnonymousDeclaration(node, 2048, "__type"); case 176: @@ -19974,7 +20072,7 @@ var ts; return bindClassLikeDeclaration(node); case 227: return bindBlockScopedDeclaration(node, 64, 792968); - case 284: + case 285: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } @@ -20048,12 +20146,12 @@ var ts; return; } else { - var parent_5 = node.parent; - if (!ts.isExternalModule(parent_5)) { + var parent_4 = node.parent; + if (!ts.isExternalModule(parent_4)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_5.isDeclarationFile) { + if (!parent_4.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -20128,14 +20226,6 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 1024; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; - } - } if (node.kind === 226) { bindBlockScopedDeclaration(node, 32, 899519); } @@ -20179,11 +20269,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (2048 | 4096); - } if (inStrictMode) { checkStrictModeEvalOrArguments(node, node.name); } @@ -20201,7 +20286,7 @@ var ts; function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + emitFlags |= 1024; } } checkStrictModeFunctionName(node); @@ -20216,7 +20301,7 @@ var ts; function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + emitFlags |= 1024; } } if (currentFlow) { @@ -20229,10 +20314,7 @@ var ts; function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; + emitFlags |= 1024; } } if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -20339,12 +20421,12 @@ var ts; if (node.typeArguments) { transformFlags |= 3; } - if (subtreeFlags & 8388608 + if (subtreeFlags & 524288 || isSuperOrSuperProperty(expression, expressionKind)) { - transformFlags |= 3072; + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~545281365; + return transformFlags & ~537396545; } function isSuperOrSuperProperty(node, kind) { switch (kind) { @@ -20363,28 +20445,28 @@ var ts; if (node.typeArguments) { transformFlags |= 3; } - if (subtreeFlags & 8388608) { - transformFlags |= 3072; + if (subtreeFlags & 524288) { + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~545281365; + return transformFlags & ~537396545; } function computeBinaryExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; if (operatorTokenKind === 57 && leftKind === 176) { - transformFlags |= 48 | 3072 | 49152; + transformFlags |= 8 | 192 | 3072; } else if (operatorTokenKind === 57 && leftKind === 175) { - transformFlags |= 3072 | 49152; + transformFlags |= 192 | 3072; } else if (operatorTokenKind === 39 || operatorTokenKind === 61) { - transformFlags |= 768; + transformFlags |= 32; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeParameter(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20394,21 +20476,21 @@ var ts; var dotDotDotToken = node.dotDotDotToken; if (node.questionToken || node.type - || subtreeFlags & 65536 + || subtreeFlags & 4096 || ts.isThisIdentifier(name)) { transformFlags |= 3; } if (modifierFlags & 92) { - transformFlags |= 3 | 4194304; + transformFlags |= 3 | 262144; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } - if (subtreeFlags & 67108864 || initializer || dotDotDotToken) { - transformFlags |= 3072 | 2097152; + if (subtreeFlags & 8388608 || initializer || dotDotDotToken) { + transformFlags |= 192 | 131072; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~604001621; + return transformFlags & ~536872257; } function computeParenthesizedExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20419,11 +20501,11 @@ var ts; || expressionKind === 182) { transformFlags |= 3; } - if (expressionTransformFlags & 16384) { - transformFlags |= 16384; + if (expressionTransformFlags & 1024) { + transformFlags |= 1024; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeClassDeclaration(node, subtreeFlags) { var transformFlags; @@ -20432,35 +20514,35 @@ var ts; transformFlags = 3; } else { - transformFlags = subtreeFlags | 3072; - if ((subtreeFlags & 4390912) + transformFlags = subtreeFlags | 192; + if ((subtreeFlags & 274432) || node.typeParameters) { transformFlags |= 3; } - if (subtreeFlags & 1048576) { - transformFlags |= 262144; + if (subtreeFlags & 65536) { + transformFlags |= 16384; } } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~559895893; + return transformFlags & ~539358529; } function computeClassExpression(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; - if (subtreeFlags & 4390912 + var transformFlags = subtreeFlags | 192; + if (subtreeFlags & 274432 || node.typeParameters) { transformFlags |= 3; } - if (subtreeFlags & 1048576) { - transformFlags |= 262144; + if (subtreeFlags & 65536) { + transformFlags |= 16384; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~559895893; + return transformFlags & ~539358529; } function computeHeritageClause(node, subtreeFlags) { var transformFlags = subtreeFlags; switch (node.token) { case 84: - transformFlags |= 3072; + transformFlags |= 192; break; case 107: transformFlags |= 3; @@ -20470,23 +20552,23 @@ var ts; break; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeCatchClause(node, subtreeFlags) { var transformFlags = subtreeFlags; if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) { - transformFlags |= 3072; + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~537920833; } function computeExpressionWithTypeArguments(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; + var transformFlags = subtreeFlags | 192; if (node.typeArguments) { transformFlags |= 3; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeConstructor(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20494,11 +20576,14 @@ var ts; || !node.body) { transformFlags |= 3; } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~975983957; + return transformFlags & ~601015617; } function computeMethod(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; + var transformFlags = subtreeFlags | 192; if (node.decorators || ts.hasModifier(node, 2270) || node.typeParameters @@ -20506,14 +20591,17 @@ var ts; || !node.body) { transformFlags |= 3; } - if (ts.hasModifier(node, 256)) { - transformFlags |= 192; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - transformFlags |= 12288; + if (ts.hasModifier(node, 256)) { + transformFlags |= 16; + } + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~975983957; + return transformFlags & ~601015617; } function computeAccessor(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20523,16 +20611,19 @@ var ts; || !node.body) { transformFlags |= 3; } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~975983957; + return transformFlags & ~601015617; } function computePropertyDeclaration(node, subtreeFlags) { var transformFlags = subtreeFlags | 3; if (node.initializer) { - transformFlags |= 131072; + transformFlags |= 8192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeFunctionDeclaration(node, subtreeFlags) { var transformFlags; @@ -20542,27 +20633,27 @@ var ts; transformFlags = 3; } else { - transformFlags = subtreeFlags | 268435456; + transformFlags = subtreeFlags | 33554432; if (modifierFlags & 2270 || node.typeParameters || node.type) { transformFlags |= 3; } if (modifierFlags & 256) { + transformFlags |= 16; + } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } + if (subtreeFlags & 163840) { transformFlags |= 192; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; - } - if (subtreeFlags & 2621440) { - transformFlags |= 3072; - } - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - transformFlags |= 12288; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + transformFlags |= 768; } } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~980243797; + return transformFlags & ~601281857; } function computeFunctionExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20572,63 +20663,60 @@ var ts; transformFlags |= 3; } if (ts.hasModifier(node, 256)) { + transformFlags |= 16; + } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } + if (subtreeFlags & 163840) { transformFlags |= 192; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; - } - if (subtreeFlags & 2621440) { - transformFlags |= 3072; - } - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - transformFlags |= 12288; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~980243797; + return transformFlags & ~601281857; } function computeArrowFunction(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; + var transformFlags = subtreeFlags | 192; if (ts.hasModifier(node, 2270) || node.typeParameters || node.type) { transformFlags |= 3; } if (ts.hasModifier(node, 256)) { - transformFlags |= 192; + transformFlags |= 16; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } - if (subtreeFlags & 262144) { - transformFlags |= 524288; + if (subtreeFlags & 16384) { + transformFlags |= 32768; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~979719509; + return transformFlags & ~601249089; } function computePropertyAccess(node, subtreeFlags) { var transformFlags = subtreeFlags; var expression = node.expression; var expressionKind = expression.kind; if (expressionKind === 96) { - transformFlags |= 262144; + transformFlags |= 16384; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeVariableDeclaration(node, subtreeFlags) { var transformFlags = subtreeFlags; - var nameKind = node.name.kind; - if (nameKind === 172) { - transformFlags |= 48 | 3072 | 67108864; - } - else if (nameKind === 173) { - transformFlags |= 3072 | 67108864; + transformFlags |= 192 | 8388608; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } if (node.type) { transformFlags |= 3; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeVariableStatement(node, subtreeFlags) { var transformFlags; @@ -20639,21 +20727,21 @@ var ts; } else { transformFlags = subtreeFlags; - if (declarationListTransformFlags & 67108864) { - transformFlags |= 3072; + if (declarationListTransformFlags & 8388608) { + transformFlags |= 192; } } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeLabeledStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; - if (subtreeFlags & 33554432 + if (subtreeFlags & 4194304 && ts.isIterationStatement(node, true)) { - transformFlags |= 3072; + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeImportEquals(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20661,15 +20749,15 @@ var ts; transformFlags |= 3; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeExpressionStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; - if (node.expression.transformFlags & 16384) { - transformFlags |= 3072; + if (node.expression.transformFlags & 1024) { + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeModuleDeclaration(node, subtreeFlags) { var transformFlags = 3; @@ -20678,26 +20766,26 @@ var ts; transformFlags |= subtreeFlags; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~839734613; + return transformFlags & ~574674241; } function computeVariableDeclarationList(node, subtreeFlags) { - var transformFlags = subtreeFlags | 268435456; - if (subtreeFlags & 67108864) { - transformFlags |= 3072; + var transformFlags = subtreeFlags | 33554432; + if (subtreeFlags & 8388608) { + transformFlags |= 192; } if (node.flags & 3) { - transformFlags |= 3072 | 33554432; + transformFlags |= 192 | 4194304; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~604001621; + return transformFlags & ~546309441; } function computeOther(node, kind, subtreeFlags) { var transformFlags = subtreeFlags; - var excludeFlags = 536892757; + var excludeFlags = 536872257; switch (kind) { case 119: case 189: - transformFlags |= 192; + transformFlags |= 16; break; case 113: case 111: @@ -20721,10 +20809,10 @@ var ts; case 250: case 251: case 252: - transformFlags |= 12; + transformFlags |= 4; break; case 213: - transformFlags |= 48; + transformFlags |= 8; case 12: case 13: case 14: @@ -20733,10 +20821,10 @@ var ts; case 181: case 258: case 114: - transformFlags |= 3072; + transformFlags |= 192; break; case 195: - transformFlags |= 3072 | 134217728; + transformFlags |= 192 | 16777216; break; case 118: case 132: @@ -20773,73 +20861,79 @@ var ts; excludeFlags = -3; break; case 142: - transformFlags |= 16777216; - if (subtreeFlags & 262144) { - transformFlags |= 1048576; + transformFlags |= 2097152; + if (subtreeFlags & 16384) { + transformFlags |= 65536; } break; case 196: - case 259: - transformFlags |= 8388608; + transformFlags |= 192 | 524288; + break; + case 259: + transformFlags |= 8 | 1048576; break; - case 174: - if (node.dotDotDotToken) { - transformFlags |= 8388608; - } case 96: - transformFlags |= 3072; + transformFlags |= 192; break; case 98: - transformFlags |= 262144; + transformFlags |= 16384; break; case 172: - case 173: - if (subtreeFlags & 8388608) { - transformFlags |= 48 | 67108864; + transformFlags |= 192 | 8388608; + if (subtreeFlags & 524288) { + transformFlags |= 8 | 1048576; } - else { - transformFlags |= 3072 | 67108864; + excludeFlags = 537396545; + break; + case 173: + transformFlags |= 192 | 8388608; + excludeFlags = 537396545; + break; + case 174: + transformFlags |= 192; + if (node.dotDotDotToken) { + transformFlags |= 524288; } break; case 145: - transformFlags |= 3 | 65536; + transformFlags |= 3 | 4096; break; case 176: - excludeFlags = 554784085; - if (subtreeFlags & 16777216) { - transformFlags |= 3072; + excludeFlags = 540087617; + if (subtreeFlags & 2097152) { + transformFlags |= 192; + } + if (subtreeFlags & 65536) { + transformFlags |= 16384; } if (subtreeFlags & 1048576) { - transformFlags |= 262144; - } - if (subtreeFlags & 8388608) { - transformFlags |= 48; + transformFlags |= 8; } break; case 175: case 180: - excludeFlags = 545281365; - if (subtreeFlags & 8388608) { - transformFlags |= 3072; + excludeFlags = 537396545; + if (subtreeFlags & 524288) { + transformFlags |= 192; } break; case 209: case 210: case 211: case 212: - if (subtreeFlags & 33554432) { - transformFlags |= 3072; + if (subtreeFlags & 4194304) { + transformFlags |= 192; } break; case 261: - if (subtreeFlags & 524288) { - transformFlags |= 3072; + if (subtreeFlags & 32768) { + transformFlags |= 192; } break; case 216: case 214: case 215: - transformFlags |= 268435456; + transformFlags |= 33554432; break; } node.transformFlags = transformFlags | 536870912; @@ -20853,27 +20947,27 @@ var ts; case 179: case 180: case 175: - return 545281365; + return 537396545; case 230: - return 839734613; + return 574674241; case 144: - return 604001621; + return 536872257; case 185: - return 979719509; + return 601249089; case 184: case 225: - return 980243797; + return 601281857; case 224: - return 604001621; + return 546309441; case 226: case 197: - return 559895893; + return 539358529; case 150: - return 975983957; + return 601015617; case 149: case 151: case 152: - return 975983957; + return 601015617; case 118: case 132: case 129: @@ -20891,9 +20985,14 @@ var ts; case 228: return -3; case 176: - return 554784085; + return 540087617; + case 256: + return 537920833; + case 172: + case 173: + return 537396545; default: - return 536892757; + return 536872257; } } ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions; @@ -20923,6 +21022,8 @@ var ts; ts.getSymbolId = getSymbolId; function createTypeChecker(host, produceDiagnostics) { var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); @@ -20985,6 +21086,7 @@ var ts; getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, isOptionalParameter: isOptionalParameter, + tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, false); } @@ -20994,6 +21096,7 @@ var ts; var intersectionTypes = ts.createMap(); var stringLiteralTypes = ts.createMap(); var numericLiteralTypes = ts.createMap(); + var indexedAccessTypes = ts.createMap(); var evolvingArrayTypes = []; var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); @@ -21013,7 +21116,6 @@ var ts; var voidType = createIntrinsicType(1024, "void"); var neverType = createIntrinsicType(8192, "never"); var silentNeverType = createIntrinsicType(8192, "never"); - var stringOrNumberType = getUnionType([stringType, numberType]); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); @@ -21229,9 +21331,7 @@ var ts; (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) { target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -21563,6 +21663,7 @@ var ts; if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && + !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } @@ -21639,6 +21740,16 @@ var ts; return undefined; } } + function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) { + if (meaning === 1920) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name); + return true; + } + } + return false; + } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { if (meaning & (107455 & ~1024)) { var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined)); @@ -21680,7 +21791,7 @@ var ts; } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { if (node.moduleReference.kind === 245) { @@ -21744,28 +21855,28 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_19 = specifier.propertyName || specifier.name; - if (name_19.text) { + var name_18 = specifier.propertyName || specifier.name; + if (name_18.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_19.text); + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_18.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_19.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_18.text); } symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_19.text); - if (!symbolFromModule && allowSyntheticDefaultImports && name_19.text === "default") { + var symbolFromModule = getExportOfModule(targetSymbol, name_18.text); + if (!symbolFromModule && allowSyntheticDefaultImports && name_18.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_19, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_19)); + error(name_18, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_18)); } return symbol; } @@ -21947,9 +22058,8 @@ var ts; } if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - ts.Debug.assert(!!moduleNotFoundError); var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } else if (compilerOptions.noImplicitAny && moduleNotFoundError) { error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); @@ -21990,6 +22100,12 @@ var ts; function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function tryGetMemberInModuleExports(memberName, moduleSymbol) { + var symbolTable = getExportsOfModule(moduleSymbol); + if (symbolTable) { + return symbolTable[memberName]; + } + } function getExportsOfSymbol(symbol) { return symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; } @@ -22172,6 +22288,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { return true; @@ -22185,26 +22311,28 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + if (isAccessible(symbols[symbol.name])) { + return [symbol]; + } + return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -22505,9 +22633,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_6) { - walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false); + var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent_5) { + walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -22640,12 +22768,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -22926,7 +23054,7 @@ var ts; } ts.Debug.assert(bindingElement.kind === 174); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55); writeSpace(writer); } @@ -23069,12 +23197,12 @@ var ts; if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_8 = getDeclarationContainer(node); + var parent_7 = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 234 && parent_8.kind !== 261 && ts.isInAmbientContext(parent_8))) { - return isGlobalSourceFile(parent_8); + !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) { + return isGlobalSourceFile(parent_7); } - return isDeclarationVisible(parent_8); + return isDeclarationVisible(parent_7); case 147: case 146: case 151: @@ -23230,15 +23358,21 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); } function isComputedNonLiteralName(name) { - return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { - ts.Debug.assert(!!(source.flags & 32768), "Rest types only support object types right now."); + source = filterType(source, function (t) { return !(t.flags & 6144); }); + if (source.flags & 8192) { + return emptyObjectType; + } + if (source.flags & 65536) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_20 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_20)] = true; + var name_19 = properties_2[_i]; + names[ts.getTextOfPropertyName(name_19)] = true; } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; @@ -23269,33 +23403,33 @@ var ts; var type; if (pattern.kind === 172) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & 32768)) { + if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } var literalMembers = []; for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198 && !element.dotDotDotToken) { + if (!element.dotDotDotToken) { literalMembers.push(element.propertyName || element.name); } } type = getRestType(parentType, literalMembers, declaration.symbol); } else { - var name_21 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_21)) { + var name_20 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_20)) { return anyType; } if (declaration.initializer) { getContextualType(declaration.initializer); } - var text = ts.getTextOfPropertyName(name_21); + var text = ts.getTextOfPropertyName(name_20); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_21)); + error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_20)); return unknownType; } } @@ -23329,29 +23463,9 @@ var ts; type; } function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { - var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); - if (jsDocType) { - return getTypeFromTypeNode(jsDocType); - } - } - function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) { - var typeTag = ts.getJSDocTypeTag(declaration); - if (typeTag && typeTag.typeExpression) { - return typeTag.typeExpression.type; - } - if (declaration.kind === 223 && - declaration.parent.kind === 224 && - declaration.parent.parent.kind === 205) { - var annotation = ts.getJSDocTypeTag(declaration.parent.parent); - if (annotation && annotation.typeExpression) { - return annotation.typeExpression.type; - } - } - else if (declaration.kind === 144) { - var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type; - } + var jsdocType = ts.getJSDocType(declaration); + if (jsdocType) { + return getTypeFromTypeNode(jsdocType); } return undefined; } @@ -23367,14 +23481,15 @@ var ts; return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } if (declaration.parent.parent.kind === 212) { - return stringType; + var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); + return indexType.flags & (16384 | 262144) ? indexType : stringType; } if (declaration.parent.parent.kind === 213) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; @@ -23385,7 +23500,8 @@ var ts; if (declaration.type) { return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); } - if (declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && + if ((compilerOptions.noImplicitAny || declaration.flags & 65536) && + declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -23445,13 +23561,18 @@ var ts; } function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { + if (isComputedNonLiteralName(name)) { hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, false); + return; + } var text = ts.getTextOfPropertyName(name); var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); var symbol = createSymbol(flags, text); @@ -23459,7 +23580,7 @@ var ts; symbol.bindingElement = e; members[symbol.name] = symbol; }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -23524,7 +23645,7 @@ var ts; if (declaration.kind === 240) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 2097152 && declaration.kind === 285 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 286 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { @@ -23533,10 +23654,10 @@ var ts; var type = void 0; if (declaration.kind === 192 || declaration.kind === 177 && declaration.parent.kind === 192) { - if (declaration.flags & 2097152) { - var typeTag = ts.getJSDocTypeTag(declaration.parent); - if (typeTag && typeTag.typeExpression) { - return links.type = getTypeFromTypeNode(typeTag.typeExpression.type); + if (declaration.flags & 65536) { + var jsdocType = ts.getJSDocType(declaration.parent); + if (jsdocType) { + return links.type = getTypeFromTypeNode(jsdocType); } } var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ? @@ -23548,16 +23669,7 @@ var ts; type = getWidenedTypeForVariableLikeDeclaration(declaration, true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -23587,7 +23699,7 @@ var ts; if (!links.type) { var getter = ts.getDeclarationOfKind(symbol, 151); var setter = ts.getDeclarationOfKind(symbol, 152); - if (getter && getter.flags & 2097152) { + if (getter && getter.flags & 65536) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; @@ -23669,10 +23781,27 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!pushTypeResolution(symbol, 0)) { + return unknownType; + } + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; } return links.type; } + function reportCircularityError(symbol) { + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { if (symbol.flags & 16777216) { return getTypeOfInstantiatedSymbol(symbol); @@ -23837,6 +23966,13 @@ var ts; } baseType = getReturnTypeOfSignature(constructors[0]); } + var valueDecl = type.symbol.valueDeclaration; + if (valueDecl && ts.isInJavaScriptFile(valueDecl)) { + var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration); + if (augTag) { + baseType = getTypeFromTypeNode(augTag.typeExpression.type); + } + } if (baseType === unknownType) { return; } @@ -23845,7 +23981,7 @@ var ts; return; } if (type === baseType || hasBaseType(baseType, type)) { - error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); + error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); return; } if (type.resolvedBaseTypes === emptyArray) { @@ -23947,7 +24083,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 284); + var declaration = ts.getDeclarationOfKind(symbol, 285); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -24433,36 +24569,42 @@ var ts; function resolveMappedTypeMembers(type) { var members = ts.createMap(); var stringIndexInfo; - var numberIndexInfo; + setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var isReadonly = !!type.declaration.readonlyToken; - var isOptional = !!type.declaration.questionToken; - var keyType = constraintType.flags & 16384 ? getApparentType(constraintType) : constraintType; - var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; - forEachType(iterationType, function (t) { + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 168) { + forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + if (getIndexInfoOfType(modifiersType, 0)) { + addMemberForKeyType(stringType); + } + } + else { + var keyType = constraintType.flags & 540672 ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t) { var iterationMapper = createUnaryTypeMapper(typeParameter, t); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); - if (t.flags & (32 | 64 | 256)) { + if (t.flags & 32) { var propName = t.text; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 536870912); var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; + prop.type = propType; + prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); members[propName] = prop; } else if (t.flags & 2) { - stringIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } - else if (t.flags & 4) { - numberIndexInfo = createIndexInfo(propType, isReadonly); - } - }); - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeParameterFromMappedType(type) { return type.typeParameter || @@ -24475,13 +24617,31 @@ var ts; function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 168) { + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; + } + function getErasedTemplateTypeFromMappedType(type) { + return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + } function isGenericMappedType(type) { if (getObjectFlags(type) & 32) { var constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (16384 | 262144)); + return maybeTypeOfKind(constraintType, 540672 | 262144); } return false; } @@ -24555,24 +24715,23 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } - function getApparentTypeOfTypeParameter(type) { + function getApparentTypeOfTypeVariable(type) { if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); + var constraintType = getConstraintOfTypeVariable(type); while (constraintType && constraintType.flags & 16384) { - constraintType = getConstraintOfTypeParameter(constraintType); + constraintType = getConstraintOfTypeVariable(constraintType); } type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); } return type.resolvedApparentType; } function getApparentType(type) { - var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) : type; - return t.flags & 34 ? globalStringType : + var t = type.flags & 540672 ? getApparentTypeOfTypeVariable(type) : type; + return t.flags & 262178 ? globalStringType : t.flags & 340 ? globalNumberType : t.flags & 136 ? globalBooleanType : t.flags & 512 ? getGlobalESSymbolType() : - t.flags & 262144 ? stringOrNumberType : - t; + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; @@ -24713,7 +24872,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -24741,17 +24900,20 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 2097152) { + if (node.flags & 65536) { if (node.type && node.type.kind === 273) { return true; } - var paramTag = ts.getCorrespondingJSDocParameterTag(node); - if (paramTag) { - if (paramTag.isBracketed) { - return true; - } - if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273; + var paramTags = ts.getJSDocParameterTags(node); + if (paramTags) { + for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) { + var paramTag = paramTags_1[_i]; + if (paramTag.isBracketed) { + return true; + } + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 273; + } } } } @@ -24867,7 +25029,7 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; @@ -25059,6 +25221,11 @@ var ts; } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } + function getConstraintOfTypeVariable(type) { + return type.flags & 16384 ? getConstraintOfTypeParameter(type) : + type.flags & 524288 ? type.constraint : + undefined; + } function getParentSymbolOfTypeParameter(typeParameter) { return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent); } @@ -25519,6 +25686,9 @@ var ts; typeSet.containsAny = true; } else if (!(type.flags & 8192) && (strictNullChecks || !(type.flags & 6144)) && !ts.contains(typeSet, type)) { + if (type.flags & 65536 && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } typeSet.push(type); } } @@ -25532,17 +25702,6 @@ var ts; if (types.length === 0) { return emptyObjectType; } - var _loop_2 = function (i) { - var type_1 = types[i]; - if (type_1.flags & 65536) { - return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }), false, aliasSymbol, aliasTypeArguments) }; - } - }; - for (var i = 0; i < types.length; i++) { - var state_2 = _loop_2(i); - if (typeof state_2 === "object") - return state_2.value; - } var typeSet = []; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { @@ -25551,6 +25710,11 @@ var ts; if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { @@ -25569,7 +25733,7 @@ var ts; } return links.resolvedType; } - function getIndexTypeForTypeParameter(type) { + function getIndexTypeForGenericType(type) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(262144); type.resolvedIndexType.type = type; @@ -25585,11 +25749,15 @@ var ts; return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); } function getIndexType(type) { - return type.flags & 16384 ? getIndexTypeForTypeParameter(type) : - type.flags & 1 || getIndexInfoOfType(type, 0) ? stringOrNumberType : - getIndexInfoOfType(type, 1) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) : + return maybeTypeOfKind(type, 540672) ? getIndexTypeForGenericType(type) : + getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) : + type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType : getLiteralTypeFromPropertyNames(type); } + function getIndexTypeOrString(type) { + var indexType = getIndexType(type); + return indexType !== neverType ? indexType : stringType; + } function getTypeFromTypeOperatorNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -25601,12 +25769,19 @@ var ts; var type = createType(524288); type.objectType = objectType; type.indexType = indexType; + if (type.objectType.flags & 229376) { + type.constraint = getIndexTypeOfType(type.objectType, 0); + } + else if (type.objectType.flags & 540672) { + var apparentType = getApparentTypeOfTypeVariable(type.objectType); + if (apparentType !== emptyObjectType) { + type.constraint = isTypeOfKind(type.indexType, 262178) ? + getIndexedAccessType(apparentType, type.indexType) : + getIndexTypeOfType(apparentType, 0); + } + } return type; } - function getIndexedAccessTypeForTypeParameter(objectType, indexType) { - var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []); - return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType)); - } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; var propName = indexType.flags & (32 | 64 | 256) ? @@ -25629,7 +25804,7 @@ var ts; return getTypeOfSymbol(prop); } } - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 | 340 | 512)) { + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 | 340 | 512)) { if (isTypeAny(objectType)) { return anyType; } @@ -25669,20 +25844,41 @@ var ts; } return unknownType; } - function getIndexedAccessType(objectType, indexType, accessNode) { - if (indexType.flags & 16384) { - if (accessNode && !isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - return getIndexedAccessTypeForTypeParameter(objectType, indexType); + function getIndexedAccessForMappedType(type, indexType, accessNode) { + var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { + error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); + return unknownType; } - var apparentType = getApparentType(objectType); + var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); + } + function getIndexedAccessType(objectType, indexType, accessNode) { + if (maybeTypeOfKind(indexType, 540672 | 262144) || + maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 178) || + isGenericMappedType(objectType)) { + if (objectType.flags & 1) { + return objectType; + } + if (accessNode) { + if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return unknownType; + } + } + if (isGenericMappedType(objectType)) { + return getIndexedAccessForMappedType(objectType, indexType, accessNode); + } + var id = objectType.id + "," + indexType.id; + return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + } + var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 && !(indexType.flags & 8190)) { var propTypes = []; for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) { var t = _a[_i]; - var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, false); + var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, false); if (propType === unknownType) { return unknownType; } @@ -25690,7 +25886,7 @@ var ts; } return getUnionType(propTypes); } - return getPropertyTypeForIndexType(apparentType, indexType, accessNode, true); + return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, true); } function getTypeFromIndexedAccessTypeNode(node) { var links = getNodeLinks(node); @@ -25707,6 +25903,7 @@ var ts; type.aliasSymbol = getAliasSymbolForTypeNode(node); type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); links.resolvedType = type; + getConstraintTypeFromMappedType(type); } return links.resolvedType; } @@ -25734,10 +25931,23 @@ var ts; return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } function getSpreadType(left, right, isFromObjectLiteral) { - ts.Debug.assert(!!(left.flags & (32768 | 1)) && !!(right.flags & (32768 | 1)), "Only object types may be spread."); if (left.flags & 1 || right.flags & 1) { return anyType; } + left = filterType(left, function (t) { return !(t.flags & 6144); }); + if (left.flags & 8192) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144); }); + if (right.flags & 8192) { + return left; + } + if (left.flags & 65536) { + return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + } + if (right.flags & 65536) { + return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); var stringIndexInfo; @@ -25875,18 +26085,18 @@ var ts; return nullType; case 129: return neverType; - case 288: - return nullType; case 289: - return undefinedType; + return nullType; case 290: + return undefinedType; + case 291: return neverType; case 167: case 98: return getTypeFromThisTypeNode(node); case 171: return getTypeFromLiteralTypeNode(node); - case 287: + case 288: return getTypeFromLiteralTypeNode(node.literal); case 157: case 272: @@ -25919,7 +26129,7 @@ var ts; case 158: case 159: case 161: - case 286: + case 287: case 274: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 168: @@ -26080,6 +26290,28 @@ var ts; return result; } function instantiateMappedType(type, mapper) { + var constraintType = getConstraintTypeFromMappedType(type); + if (constraintType.flags & 262144) { + var typeVariable_1 = constraintType.type; + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } + } + return instantiateMappedObjectType(type, mapper); + } + function isMappableType(type) { + return type.flags & (16384 | 32768 | 131072 | 524288); + } + function instantiateMappedObjectType(type, mapper) { var result = createObjectType(32 | 64, type.symbol); result.declaration = type.declaration; result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; @@ -26438,7 +26670,7 @@ var ts; return false; if (target.flags & 1 || source.flags & 8192) return true; - if (source.flags & 34 && target.flags & 2) + if (source.flags & 262178 && target.flags & 2) return true; if (source.flags & 340 && target.flags & 4) return true; @@ -26547,6 +26779,23 @@ var ts; reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608)) { + return false; + } + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source.flags & 96 && source.flags & 1048576) { @@ -26562,11 +26811,6 @@ var ts; } if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return -1; - if (source.flags & 262144) { - if (maybeTypeOfKind(target, 2) && maybeTypeOfKind(target, 4)) { - return -1; - } - } if (getObjectFlags(source) & 128 && source.flags & 1048576) { if (hasExcessProperties(source, target, reportErrors)) { if (reportErrors) { @@ -26574,7 +26818,7 @@ var ts; } return 0; } - if (target.flags & 196608) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -26605,11 +26849,22 @@ var ts; return result; } } - if (target.flags & 16384) { - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; + else if (target.flags & 16384) { + if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) { + if (!source.declaration.questionToken) { + var templateType = getTemplateTypeFromMappedType(source); + var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); + if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { + return result; + } + } + } + else { + var constraint = getConstraintOfTypeParameter(target); + if (constraint && constraint.flags & 262144) { + if (result = isRelatedTo(source, constraint, reportErrors)) { + return result; + } } } } @@ -26619,23 +26874,56 @@ var ts; return result; } } - var constraint = getConstraintOfTypeParameter(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + if (target.type.flags & 540672) { + var constraint = getConstraintOfTypeVariable(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } + } + } + else if (target.flags & 524288) { + if (source.flags & 524288 && source.indexType === target.indexType) { + if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { + return result; + } + } + if (target.constraint) { + if (result = isRelatedTo(source, target.constraint, reportErrors)) { + errorInfo = saveErrorInfo; return result; } } } if (source.flags & 16384) { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1) { - constraint = emptyObjectType; + if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) { + var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } - constraint = getTypeWithThisArgument(constraint, source); - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; - return result; + else { + var constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + constraint = getTypeWithThisArgument(constraint, source); + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + else if (source.flags & 524288) { + if (source.constraint) { + if (result = isRelatedTo(source.constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } else { @@ -26644,22 +26932,12 @@ var ts; return result; } } - if (isGenericMappedType(target)) { - if (isGenericMappedType(source)) { - if ((result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) && - (result = isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors))) { - return result; - } - } - } - else { - var apparentSource = getApparentType(source); - if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) { - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190); - if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { - errorInfo = saveErrorInfo; - return result; - } + var apparentSource = getApparentType(source); + if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + errorInfo = saveErrorInfo; + return result; } } } @@ -26866,6 +27144,9 @@ var ts; if (expandingFlags === 3) { result = 1; } + else if (isGenericMappedType(source) || isGenericMappedType(target)) { + result = mappedTypeRelatedTo(source, target, reportErrors); + } else { result = propertiesRelatedTo(source, target, reportErrors); if (result) { @@ -26893,6 +27174,33 @@ var ts; } return result; } + function mappedTypeRelatedTo(source, target, reportErrors) { + if (isGenericMappedType(target)) { + if (isGenericMappedType(source)) { + var result_2; + if (relation === identityRelation) { + var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; + var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; + if (readonlyMatches && optionalMatches) { + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); + } + } + } + else { + if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + } + } + } + } + } + else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { + return -1; + } + return 0; + } function propertiesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { return propertiesIdenticalTo(source, target); @@ -27368,7 +27676,7 @@ var ts; return type; } var types = [type]; - if (flags & 34) + if (flags & 262178) types.push(emptyStringType); if (flags & 340) types.push(zeroType); @@ -27572,25 +27880,69 @@ var ts; isFixed: false, }; } - function couldContainTypeParameters(type) { + function couldContainTypeVariables(type) { var objectFlags = getObjectFlags(type); - return !!(type.flags & 16384 || - objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeParameters) || + return !!(type.flags & 540672 || + objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeVariables) || objectFlags & 16 && type.symbol && type.symbol.flags & (8192 | 2048 | 32) || objectFlags & 32 || - type.flags & 196608 && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & 196608 && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || type.flags & 196608 && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); } - function inferTypes(context, originalSource, originalTarget) { - var typeParameters = context.signature.typeParameters; + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 536870912; + var members = createSymbolTable(properties); + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var prop = properties_4[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 | 67108864 | prop.flags & optionalMask, prop.name); + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); + members[prop.name] = inferredProp; + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; @@ -27606,7 +27958,7 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -27645,13 +27997,13 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384) { + if (target.flags & 540672) { if (source.flags & 8388608) { return; } - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : @@ -27659,7 +28011,7 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & 16384 && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -27677,21 +28029,21 @@ var ts; } else if (target.flags & 196608) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; + var typeVariableCount = 0; + var typeVariable = void 0; for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { var t = targetTypes_2[_d]; - if (t.flags & 16384 && ts.contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + if (t.flags & 540672 && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -27703,19 +28055,6 @@ var ts; } } else { - if (getObjectFlags(target) & 32) { - var constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & 32) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); - return; - } - if (constraintType.flags & 16384) { - inferFromTypes(getIndexType(source), constraintType); - inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); - return; - } - } source = getApparentType(source); if (source.flags & 32768) { if (isInProcess(source, target)) { @@ -27736,18 +28075,41 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; depth++; - inferFromProperties(source, target); - inferFromSignatures(source, target, 0); - inferFromSignatures(source, target, 1); - inferFromIndexTypes(source, target); + inferFromObjectTypes(source, target); depth--; } } } + function inferFromObjectTypes(source, target) { + if (getObjectFlags(target) & 32) { + var constraintType = getConstraintTypeFromMappedType(target); + if (constraintType.flags & 262144) { + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } + return; + } + if (constraintType.flags & 16384) { + inferFromTypes(getIndexType(source), constraintType); + inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); + return; + } + } + inferFromProperties(source, target); + inferFromSignatures(source, target, 0); + inferFromSignatures(source, target, 1); + inferFromIndexTypes(source, target); + } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var targetProp = properties_5[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -28078,7 +28440,7 @@ var ts; } function getTypeWithDefault(type, defaultExpression) { if (defaultExpression) { - var defaultType = checkExpression(defaultExpression); + var defaultType = getTypeOfExpression(defaultExpression); return getUnionType([getTypeWithFacts(type, 131072), defaultType]); } return type; @@ -28101,7 +28463,7 @@ var ts; function getAssignedTypeOfBinaryExpression(node) { return node.parent.kind === 175 || node.parent.kind === 257 ? getTypeWithDefault(getAssignedType(node), node.right) : - checkExpression(node.right); + getTypeOfExpression(node.right); } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); @@ -28149,7 +28511,7 @@ var ts; } function getTypeOfInitializer(node) { var links = getNodeLinks(node); - return links.resolvedType || checkExpression(node); + return links.resolvedType || getTypeOfExpression(node); } function getInitialTypeOfVariableDeclaration(node) { if (node.initializer) { @@ -28202,7 +28564,7 @@ var ts; } function getTypeOfSwitchClause(clause) { if (clause.kind === 253) { - var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression)); + var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } return neverType; @@ -28282,7 +28644,7 @@ var ts; return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType)); } function addEvolvingArrayElementType(evolvingArrayType, node) { - var elementType = getBaseTypeOfLiteralType(checkExpression(node)); + var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { @@ -28330,7 +28692,7 @@ var ts; parent.parent.operatorToken.kind === 57 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && - isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 | 2048); + isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 | 2048); return isLengthPushOrUnshift || isElementAssignment; } function maybeTypePredicateCall(node) { @@ -28468,7 +28830,7 @@ var ts; } } else { - var indexType = checkExpression(node.left.argumentExpression); + var indexType = getTypeOfExpression(node.left.argumentExpression); if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 | 2048)) { evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right); } @@ -28649,7 +29011,7 @@ var ts; if (operator === 32 || operator === 34) { assumeTrue = !assumeTrue; } - var valueType = checkExpression(value); + var valueType = getTypeOfExpression(value); if (valueType.flags & 6144) { if (!strictNullChecks) { return type; @@ -28721,7 +29083,7 @@ var ts; } return type; } - var rightType = checkExpression(expr.right); + var rightType = getTypeOfExpression(expr.right); if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } @@ -28749,16 +29111,16 @@ var ts; } } if (targetType) { - return getNarrowedType(type, targetType, assumeTrue); + return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf); } return type; } - function getNarrowedType(type, candidate, assumeTrue) { + function getNarrowedType(type, candidate, assumeTrue, isRelated) { if (!assumeTrue) { - return filterType(type, function (t) { return !isTypeInstanceOf(t, candidate); }); + return filterType(type, function (t) { return !isRelated(t, candidate); }); } if (type.flags & 65536) { - var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); }); + var assignableType = filterType(type, function (t) { return isRelated(t, candidate); }); if (!(assignableType.flags & 8192)) { return assignableType; } @@ -28785,7 +29147,7 @@ var ts; var predicateArgument = callExpression.arguments[predicate.parameterIndex]; if (predicateArgument) { if (isMatchingReference(reference, predicateArgument)) { - return getNarrowedType(type, predicate.type, assumeTrue); + return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } if (containsMatchingReference(reference, predicateArgument)) { return declaredType; @@ -28798,7 +29160,7 @@ var ts; var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { - return getNarrowedType(type, predicate.type, assumeTrue); + return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } if (containsMatchingReference(reference, possibleReference)) { return declaredType; @@ -28834,7 +29196,7 @@ var ts; location = location.parent; } if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) { - var type = checkExpression(location); + var type = getTypeOfExpression(location); if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { return type; } @@ -28906,7 +29268,7 @@ var ts; error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } - if (node.flags & 524288) { + if (node.flags & 16384) { getNodeLinks(container).flags |= 8192; } return getTypeOfSymbol(symbol); @@ -28917,8 +29279,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (languageVersion === 2 - && declaration_1.kind === 226 + if (declaration_1.kind === 226 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -29092,18 +29453,21 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + if (!superCall || superCall.end > node.pos) { + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; if (container.kind === 150) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - if (!superCall || superCall.end > node.pos) { - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } if (container.kind === 185) { container = ts.getThisContainer(container, false); @@ -29170,9 +29534,9 @@ var ts; return anyType; } function getTypeForThisExpressionFromJSDoc(node) { - var typeTag = ts.getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 274) { - var jsDocFunctionType = typeTag.typeExpression.type; + var jsdocType = ts.getJSDocType(node); + if (jsdocType && jsdocType.kind === 274) { + var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } @@ -29217,6 +29581,9 @@ var ts; } return unknownType; } + if (!isCallExpression && container.kind === 150) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } if ((ts.getModifierFlags(container) & 32) || isCallExpression) { nodeCheckFlag = 512; } @@ -29357,11 +29724,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_22 = declaration.propertyName || declaration.name; + var name_21 = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_22)) { - var text = ts.getTextOfPropertyName(name_22); + !ts.isBindingPattern(name_21)) { + var text = ts.getTextOfPropertyName(name_21); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -29440,13 +29807,13 @@ var ts; return undefined; } if (node === binaryExpression.right) { - return checkExpression(binaryExpression.left); + return getTypeOfExpression(binaryExpression.left); } } else if (operator === 53) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { - type = checkExpression(binaryExpression.left); + type = getTypeOfExpression(binaryExpression.left); } return type; } @@ -29672,7 +30039,7 @@ var ts; return mapper && mapper.context; } function checkSpreadExpression(node, contextualMapper) { - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); + var arrayOrIterableType = checkExpression(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { @@ -29752,7 +30119,7 @@ var ts; var links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 34 | 512)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 262178 | 512)) { error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { @@ -29761,10 +30128,10 @@ var ts; } return links.resolvedType; } - function getObjectLiteralIndexInfo(node, properties, kind) { + function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) { var propTypes = []; for (var i = 0; i < properties.length; i++) { - if (kind === 0 || isNumericName(node.properties[i].name)) { + if (kind === 0 || isNumericName(propertyNodes[i + offset].name)) { propTypes.push(getTypeOfSymbol(properties[i])); } } @@ -29785,8 +30152,9 @@ var ts; var patternWithComputedProperties = false; var hasComputedStringProperty = false; var hasComputedNumberProperty = false; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var memberDecl = _a[_i]; + var offset = 0; + for (var i = 0; i < node.properties.length; i++) { + var memberDecl = node.properties[i]; var member = memberDecl.symbol; if (memberDecl.kind === 257 || memberDecl.kind === 258 || @@ -29819,7 +30187,7 @@ var ts; if (impliedProp) { prop.flags |= impliedProp.flags & 536870912; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -29833,6 +30201,9 @@ var ts; member = prop; } else if (memberDecl.kind === 259) { + if (languageVersion < 5) { + checkExternalEmitHelpers(memberDecl, 2); + } if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), true); propertiesArray = []; @@ -29842,11 +30213,12 @@ var ts; typeFlags = 0; } var type = checkExpression(memberDecl.expression); - if (!(type.flags & (32768 | 1))) { + if (!isValidSpreadType(type)) { error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } spread = getSpreadType(spread, type, false); + offset = i + 1; continue; } else { @@ -29867,8 +30239,8 @@ var ts; propertiesArray.push(member); } if (contextualTypeHasPattern) { - for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { - var prop = _c[_b]; + for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { + var prop = _a[_i]; if (!propertiesTable[prop.name]) { if (!(prop.flags & 536870912)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); @@ -29882,14 +30254,16 @@ var ts; if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), true); } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; + if (spread.flags & 32768) { + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; + } return spread; } return createObjectLiteralType(); function createObjectLiteralType() { - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1) : undefined; + var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined; + var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined; var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); @@ -29906,6 +30280,11 @@ var ts; return result; } } + function isValidSpreadType(type) { + return !!(type.flags & (1 | 4096 | 2048) || + type.flags & 32768 && !isGenericMappedType(type) || + type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); + } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; @@ -29980,6 +30359,9 @@ var ts; return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { + if (compilerOptions.jsx === 2) { + checkExternalEmitHelpers(node, 2); + } var type = checkExpression(node.expression); var props = getPropertiesOfType(type); for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { @@ -30431,7 +30813,7 @@ var ts; if (node.kind === 212 && child === node.statement && getForInVariableSymbol(node) === symbol && - hasNumericPropertyNames(checkExpression(node.expression))) { + hasNumericPropertyNames(getTypeOfExpression(node.expression))) { return true; } child = node; @@ -30524,19 +30906,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_9 = signature.declaration && signature.declaration.parent; + var parent_8 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_9 === lastParent) { + if (lastParent && parent_8 === lastParent) { index++; } else { - lastParent = parent_9; + lastParent = parent_8; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_9; + lastParent = parent_8; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -30625,7 +31007,7 @@ var ts; function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { var context = createInferenceContext(signature, true); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -30644,7 +31026,7 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { @@ -30656,7 +31038,7 @@ var ts; var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } if (excludeArgument) { @@ -30664,7 +31046,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -31158,12 +31540,13 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; if (modifiers & 16 && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } if (modifiers & 8) { @@ -31354,7 +31737,7 @@ var ts; for (var i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -31407,7 +31790,7 @@ var ts; assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -31504,7 +31887,7 @@ var ts; if (!node.possiblyExhaustive) { return false; } - var type = checkExpression(node.expression); + var type = getTypeOfExpression(node.expression); if (!isLiteralType(type)) { return false; } @@ -31512,7 +31895,7 @@ var ts; if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { if (!(func.flags & 128)) { @@ -31726,7 +32109,7 @@ var ts; } function checkAwaitExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 524288)) { + if (!(node.flags & 16384)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -31840,32 +32223,32 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 | 340 | 512)) { + if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var p = properties_5[_i]; - checkObjectLiteralDestructuringPropertyAssignment(sourceType, p); + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var p = properties_6[_i]; + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } - function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) { + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { if (property.kind === 257 || property.kind === 258) { - var name_23 = property.name; - if (name_23.kind === 142) { - checkComputedPropertyName(name_23); + var name_22 = property.name; + if (name_22.kind === 142) { + checkComputedPropertyName(name_22); } - if (isComputedNonLiteralName(name_23)) { + if (isComputedNonLiteralName(name_22)) { return undefined; } - var text = ts.getTextOfPropertyName(name_23); + var text = ts.getTextOfPropertyName(name_22); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || @@ -31880,13 +32263,21 @@ var ts; } } else { - error(name_23, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_23)); + error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22)); } } else if (property.kind === 259) { - if (property.expression.kind !== 70) { - error(property.expression, ts.Diagnostics.An_object_rest_element_must_be_an_identifier); + if (languageVersion < 5) { + checkExternalEmitHelpers(property, 4); } + var nonRestNames = []; + if (allProperties) { + for (var i = 0; i < allProperties.length - 1; i++) { + nonRestNames.push(allProperties[i].name); + } + } + var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); + return checkDestructuringAssignment(property.expression, type); } else { error(property, ts.Diagnostics.Property_assignment_expected); @@ -31971,7 +32362,10 @@ var ts; } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) { + var error = target.parent.kind === 259 ? + ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : + ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; + if (checkReferenceExpression(target, error)) { checkTypeAssignableTo(sourceType, targetType, target, undefined); } return sourceType; @@ -32108,7 +32502,7 @@ var ts; resultType = numberType; } else { - if (isTypeOfKind(leftType, 34) || isTypeOfKind(rightType, 34)) { + if (isTypeOfKind(leftType, 262178) || isTypeOfKind(rightType, 262178)) { resultType = stringType; } else if (isTypeAny(leftType) || isTypeAny(rightType)) { @@ -32131,6 +32525,8 @@ var ts; case 29: case 30: if (checkForDisallowedESSymbolOperand(operator)) { + leftType = getBaseTypeOfLiteralType(leftType); + rightType = getBaseTypeOfLiteralType(rightType); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -32224,7 +32620,7 @@ var ts; } function checkYieldExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 131072) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -32304,19 +32700,19 @@ var ts; function checkDeclarationInitializer(declaration) { var type = checkExpressionCached(declaration.initializer); return ts.getCombinedNodeFlags(declaration) & 2 || - ts.getCombinedModifierFlags(declaration) & 64 || + ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } function isLiteralContextualType(contextualType) { if (contextualType) { - if (contextualType.flags & 16384) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); + if (contextualType.flags & 540672) { + var apparentType = getApparentTypeOfTypeVariable(contextualType); if (apparentType.flags & (2 | 4 | 8 | 16)) { return true; } contextualType = apparentType; } - return maybeTypeOfKind(contextualType, 480); + return maybeTypeOfKind(contextualType, (480 | 262144)); } return false; } @@ -32353,6 +32749,16 @@ var ts; } return type; } + function getTypeOfExpression(node) { + if (node.kind === 179 && node.expression.kind !== 96) { + var funcType = checkNonNullExpression(node.expression); + var signature = getSingleCallSignature(funcType); + if (signature && !signature.typeParameters) { + return getReturnTypeOfSignature(signature); + } + } + return checkExpression(node); + } function checkExpression(node, contextualMapper) { var type; if (node.kind === 141) { @@ -32533,9 +32939,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_24 = _a[_i].name; - if (ts.isBindingPattern(name_24) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, parameterName, typePredicate.parameterName)) { + var name_23 = _a[_i].name; + if (ts.isBindingPattern(name_23) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -32555,9 +32961,9 @@ var ts; case 158: case 149: case 148: - var parent_10 = node.parent; - if (node === parent_10.type) { - return parent_10; + var parent_9 = node.parent; + if (node === parent_9.type) { + return parent_9; } } } @@ -32567,15 +32973,15 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_25 = element.name; - if (name_25.kind === 70 && - name_25.text === predicateVariableName) { + var name_24 = element.name; + if (name_24.kind === 70 && + name_24.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_25.kind === 173 || - name_25.kind === 172) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_25, predicateVariableNode, predicateVariableName)) { + else if (name_24.kind === 173 || + name_24.kind === 172) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, predicateVariableNode, predicateVariableName)) { return true; } } @@ -32590,6 +32996,12 @@ var ts; node.kind === 154) { checkGrammarFunctionLikeDeclaration(node); } + if (ts.isAsyncFunctionLike(node) && languageVersion < 4) { + checkExternalEmitHelpers(node, 64); + if (languageVersion < 2) { + checkExternalEmitHelpers(node, 128); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -32806,8 +33218,8 @@ var ts; if (superCallShouldBeFirst) { var statements = node.body.statements; var superCallStatement = void 0; - for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { - var statement = statements_2[_i]; + for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { + var statement = statements_3[_i]; if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; @@ -32949,8 +33361,8 @@ var ts; checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint); + var keyType = constraintType.flags & 540672 ? getApparentTypeOfTypeVariable(constraintType) : constraintType; + checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node); @@ -33194,10 +33606,10 @@ var ts; case 229: return 2097152 | 1048576; case 234: - var result_2 = 0; + var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); }); - return result_2; + ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); + return result_3; default: return 1048576; } @@ -33238,7 +33650,7 @@ var ts; if (thenSignatures.length === 0) { return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288); if (isTypeAny(onfulfilledParameterType)) { return undefined; } @@ -33374,6 +33786,9 @@ var ts; markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } function checkDecorators(node) { if (!node.decorators) { return; @@ -33384,14 +33799,20 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8); + if (node.kind === 144) { + checkExternalEmitHelpers(firstDecorator, 32); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { case 226: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; @@ -33400,11 +33821,13 @@ var ts; case 152: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; case 147: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; case 144: markTypeNodeAsReferenced(node.type); break; @@ -33513,7 +33936,7 @@ var ts; } function checkUnusedLocalsAndParameters(node) { if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_3 = function (key) { + var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) { @@ -33531,10 +33954,17 @@ var ts; } }; for (var key in node.locals) { - _loop_3(key); + _loop_2(key); } } } + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); @@ -33544,7 +33974,9 @@ var ts; return; } } - error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); @@ -33701,14 +34133,14 @@ var ts; } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192) { + if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -33736,8 +34168,8 @@ var ts; container.kind === 230 || container.kind === 261); if (!namesShareScope) { - var name_26 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_26, name_26); + var name_25 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25); } } } @@ -33805,16 +34237,19 @@ var ts; } } if (node.kind === 174) { + if (node.parent.kind === 172 && languageVersion < 5) { + checkExternalEmitHelpers(node, 4); + } if (node.propertyName && node.propertyName.kind === 142) { checkComputedPropertyName(node.propertyName); } - var parent_11 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_11); - var name_27 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_27)); + var parent_10 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_10); + var name_26 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26)); markPropertyAsReferenced(property); - if (parent_11.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + if (parent_10.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { @@ -33975,6 +34410,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); + var rightType = checkNonNullExpression(node.expression); if (node.initializer.kind === 224) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { @@ -33988,15 +34424,14 @@ var ts; if (varExpr.kind === 175 || varExpr.kind === 176) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } - else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34)) { + else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - var rightType = checkNonNullExpression(node.expression); - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -34121,12 +34556,12 @@ var ts; var arrayType = arrayOrStringType; if (arrayOrStringType.flags & 65536) { var arrayTypes = arrayOrStringType.types; - var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 34); }); + var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); }); if (filteredTypes !== arrayTypes) { arrayType = getUnionType(filteredTypes, true); } } - else if (arrayOrStringType.flags & 34) { + else if (arrayOrStringType.flags & 262178) { arrayType = neverType; } var hasStringConstituent = arrayOrStringType !== arrayType; @@ -34151,7 +34586,7 @@ var ts; } var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; if (hasStringConstituent) { - if (arrayElementType.flags & 34) { + if (arrayElementType.flags & 262178) { return stringType; } return getUnionType([arrayElementType, stringType], true); @@ -34214,7 +34649,7 @@ var ts; } function checkWithStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 524288) { + if (node.flags & 16384) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -34460,6 +34895,9 @@ var ts; checkClassForDuplicateDeclarations(node); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2 && !ts.isInAmbientContext(node)) { + checkExternalEmitHelpers(baseTypeNode.parent, 1); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; @@ -34635,8 +35073,8 @@ var ts; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var prop = properties_6[_a]; + for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { + var prop = properties_7[_a]; var existing = seen[prop.name]; if (!existing) { seen[prop.name] = { prop: prop, containingType: base }; @@ -34835,7 +35273,7 @@ var ts; return undefined; } } - enumType_1 = checkExpression(expression); + enumType_1 = getTypeOfExpression(expression); if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) { return undefined; } @@ -35030,9 +35468,9 @@ var ts; break; case 174: case 223: - var name_28 = node.name; - if (ts.isBindingPattern(name_28)) { - for (var _b = 0, _c = name_28.elements; _b < _c.length; _b++) { + var name_27 = node.name; + if (ts.isBindingPattern(name_27)) { + for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } @@ -35770,7 +36208,7 @@ var ts; } } case 96: - var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); + var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; case 167: return getTypeFromTypeNode(node).symbol; @@ -35792,7 +36230,7 @@ var ts; } case 8: if (node.parent.kind === 178 && node.parent.argumentExpression === node) { - var objectType = checkExpression(node.parent.expression); + var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; var apparentType = getApparentType(objectType); @@ -35823,7 +36261,7 @@ var ts; return getTypeFromTypeNode(node); } if (ts.isPartOfExpression(node)) { - return getTypeOfExpression(node); + return getRegularTypeOfExpression(node); } if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; @@ -35861,7 +36299,7 @@ var ts; return checkDestructuringAssignment(expr, iteratedType || unknownType); } if (expr.parent.kind === 192) { - var iteratedType = checkExpression(expr.parent.right); + var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } if (expr.parent.kind === 257) { @@ -35877,11 +36315,11 @@ var ts; var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); } - function getTypeOfExpression(expr) { + function getRegularTypeOfExpression(expr) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } - return getRegularTypeOfLiteralType(checkExpression(expr)); + return getRegularTypeOfLiteralType(getTypeOfExpression(expr)); } function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); @@ -35904,9 +36342,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols_3 = []; - var name_29 = symbol.name; + var name_28 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_29); + var symbol = getPropertyOfType(t, name_28); if (symbol) { symbols_3.push(symbol); } @@ -35959,7 +36397,7 @@ var ts; } function isNameOfModuleOrEnumDeclaration(node) { var parent = node.parent; - return ts.isModuleOrEnumDeclaration(parent) && node === parent.name; + return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name; } function getReferencedExportContainer(node, prefixLocals) { node = ts.getParseTreeNode(node, ts.isIdentifier); @@ -36167,7 +36605,7 @@ var ts; else if (isTypeOfKind(type, 340)) { return ts.TypeReferenceSerializationKind.NumberLikeType; } - else if (isTypeOfKind(type, 34)) { + else if (isTypeOfKind(type, 262178)) { return ts.TypeReferenceSerializationKind.StringLikeType; } else if (isTupleType(type)) { @@ -36198,7 +36636,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getWidenedType(getTypeOfExpression(expr)); + var type = getWidenedType(getRegularTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { @@ -36217,9 +36655,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_12 = reference.parent; - if (ts.isDeclaration(parent_12) && reference === parent_12.name) { - location = getDeclarationContainer(parent_12); + var parent_11 = reference.parent; + if (ts.isDeclaration(parent_11) && reference === parent_11.name) { + location = getDeclarationContainer(parent_11); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -36332,9 +36770,9 @@ var ts; } var current = symbol; while (true) { - var parent_13 = getParentOfSymbol(current); - if (parent_13) { - current = parent_13; + var parent_12 = getParentOfSymbol(current); + if (parent_12) { + current = parent_12; } else { break; @@ -36367,8 +36805,6 @@ var ts; ts.bindSourceFile(file, compilerOptions); } var augmentations; - var requestedExternalEmitHelpers = 0; - var firstFileRequestingExternalHelpers; for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { @@ -36388,15 +36824,6 @@ var ts; } } } - if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) { - var fileRequestedExternalEmitHelpers = file.flags & 64512; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; - } - } - } } if (augmentations) { for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) { @@ -36451,44 +36878,46 @@ var ts; var symbol = getGlobalSymbol("ReadonlyArray", 793064, undefined); globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - var helpersModule = resolveExternalModule(firstFileRequestingExternalHelpers, ts.externalHelpersModuleNameText, ts.Diagnostics.Cannot_find_module_0, undefined); - if (helpersModule) { - var exports_2 = helpersModule.exports; - if (requestedExternalEmitHelpers & 1024 && languageVersion < 2) { - verifyHelperSymbol(exports_2, "__extends", 107455); - } - if (requestedExternalEmitHelpers & 16384 && - (languageVersion < 5 || compilerOptions.jsx === 2)) { - verifyHelperSymbol(exports_2, "__assign", 107455); - } - if (languageVersion < 5 && requestedExternalEmitHelpers & 32768) { - verifyHelperSymbol(exports_2, "__rest", 107455); - } - if (requestedExternalEmitHelpers & 2048) { - verifyHelperSymbol(exports_2, "__decorate", 107455); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports_2, "__metadata", 107455); - } - } - if (requestedExternalEmitHelpers & 4096) { - verifyHelperSymbol(exports_2, "__param", 107455); - } - if (requestedExternalEmitHelpers & 8192) { - verifyHelperSymbol(exports_2, "__awaiter", 107455); - if (languageVersion < 2) { - verifyHelperSymbol(exports_2, "__generator", 107455); + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1; helper <= 128; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name_29 = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_29), 107455); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_29); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols, name, meaning) { - var symbol = getSymbol(symbols, ts.escapeIdentifier(name), meaning); - if (!symbol) { - error(undefined, ts.Diagnostics.Module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + function getHelperName(helper) { + switch (helper) { + case 1: return "__extends"; + case 2: return "__assign"; + case 4: return "__rest"; + case 8: return "__decorate"; + case 16: return "__metadata"; + case 32: return "__param"; + case 64: return "__awaiter"; + case 128: return "__generator"; } } + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; + } + return externalHelpersModule; + } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); if (promiseLikeType !== emptyGenericType) { @@ -37138,6 +37567,9 @@ var ts; else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } @@ -37533,10 +37965,15 @@ var ts; function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } - function reduceEachChild(node, f, initial) { + function reduceNodeArray(nodes, f, initial) { + return nodes ? f(initial, nodes) : initial; + } + function reduceEachChild(node, initial, cbNode, cbNodeArray) { if (node === undefined) { return initial; } + var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; + var cbNodes = cbNodeArray || cbNode; var kind = node.kind; if ((kind > 0 && kind <= 140)) { return initial; @@ -37550,108 +37987,108 @@ var ts; case 206: case 198: case 222: - case 292: + case 293: break; case 142: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 144: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 145: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 147: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 149: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 150: - result = ts.reduceLeft(node.modifiers, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); break; case 151: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 152: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); break; case 172: case 173: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 174: - result = reduceNode(node.propertyName, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 175: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 176: - result = ts.reduceLeft(node.properties, f, result); + result = reduceNodes(node.properties, cbNodes, result); break; case 177: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.name, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 178: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.argumentExpression, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.argumentExpression, cbNode, result); break; case 179: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); - result = ts.reduceLeft(node.arguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); break; case 180: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); - result = ts.reduceLeft(node.arguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); break; case 181: - result = reduceNode(node.tag, f, result); - result = reduceNode(node.template, f, result); + result = reduceNode(node.tag, cbNode, result); + result = reduceNode(node.template, cbNode, result); break; case 184: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 185: - result = ts.reduceLeft(node.modifiers, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 183: case 186: @@ -37661,205 +38098,205 @@ var ts; case 195: case 196: case 201: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 190: case 191: - result = reduceNode(node.operand, f, result); + result = reduceNode(node.operand, cbNode, result); break; case 192: - result = reduceNode(node.left, f, result); - result = reduceNode(node.right, f, result); + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); break; case 193: - result = reduceNode(node.condition, f, result); - result = reduceNode(node.whenTrue, f, result); - result = reduceNode(node.whenFalse, f, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.whenTrue, cbNode, result); + result = reduceNode(node.whenFalse, cbNode, result); break; case 194: - result = reduceNode(node.head, f, result); - result = ts.reduceLeft(node.templateSpans, f, result); + result = reduceNode(node.head, cbNode, result); + result = reduceNodes(node.templateSpans, cbNodes, result); break; case 197: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.heritageClauses, f, result); - result = ts.reduceLeft(node.members, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); break; case 199: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); break; case 202: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.literal, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); break; case 204: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 205: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.declarationList, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.declarationList, cbNode, result); break; case 207: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 208: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.thenStatement, f, result); - result = reduceNode(node.elseStatement, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.thenStatement, cbNode, result); + result = reduceNode(node.elseStatement, cbNode, result); break; case 209: - result = reduceNode(node.statement, f, result); - result = reduceNode(node.expression, f, result); + result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 210: case 217: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 211: - result = reduceNode(node.initializer, f, result); - result = reduceNode(node.condition, f, result); - result = reduceNode(node.incrementor, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.incrementor, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 212: case 213: - result = reduceNode(node.initializer, f, result); - result = reduceNode(node.expression, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 216: case 220: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 218: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.caseBlock, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.caseBlock, cbNode, result); break; case 219: - result = reduceNode(node.label, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.label, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 221: - result = reduceNode(node.tryBlock, f, result); - result = reduceNode(node.catchClause, f, result); - result = reduceNode(node.finallyBlock, f, result); + result = reduceNode(node.tryBlock, cbNode, result); + result = reduceNode(node.catchClause, cbNode, result); + result = reduceNode(node.finallyBlock, cbNode, result); break; case 223: - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 224: - result = ts.reduceLeft(node.declarations, f, result); + result = reduceNodes(node.declarations, cbNodes, result); break; case 225: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 226: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.heritageClauses, f, result); - result = ts.reduceLeft(node.members, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); break; case 232: - result = ts.reduceLeft(node.clauses, f, result); + result = reduceNodes(node.clauses, cbNodes, result); break; case 235: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.importClause, f, result); - result = reduceNode(node.moduleSpecifier, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.importClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); break; case 236: - result = reduceNode(node.name, f, result); - result = reduceNode(node.namedBindings, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); break; case 237: - result = reduceNode(node.name, f, result); + result = reduceNode(node.name, cbNode, result); break; case 238: case 242: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 239: case 243: - result = reduceNode(node.propertyName, f, result); - result = reduceNode(node.name, f, result); + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 240: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.expression, f, result); + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 241: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.exportClause, f, result); - result = reduceNode(node.moduleSpecifier, f, result); + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.exportClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); break; case 246: - result = reduceNode(node.openingElement, f, result); - result = ts.reduceLeft(node.children, f, result); - result = reduceNode(node.closingElement, f, result); + result = reduceNode(node.openingElement, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingElement, cbNode, result); break; case 247: case 248: - result = reduceNode(node.tagName, f, result); - result = ts.reduceLeft(node.attributes, f, result); + result = reduceNode(node.tagName, cbNode, result); + result = reduceNodes(node.attributes, cbNodes, result); break; case 249: - result = reduceNode(node.tagName, f, result); + result = reduceNode(node.tagName, cbNode, result); break; case 250: - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 251: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 252: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 253: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); case 254: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 255: - result = ts.reduceLeft(node.types, f, result); + result = reduceNodes(node.types, cbNodes, result); break; case 256: - result = reduceNode(node.variableDeclaration, f, result); - result = reduceNode(node.block, f, result); + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); break; case 257: - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 258: - result = reduceNode(node.name, f, result); - result = reduceNode(node.objectAssignmentInitializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; case 259: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 261: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; - case 293: - result = reduceNode(node.expression, f, result); + case 294: + result = reduceNode(node.expression, cbNode, result); break; default: var edgeTraversalPath = nodeEdgeTraversalMap[kind]; @@ -37869,8 +38306,8 @@ var ts; var value = node[edge.name]; if (value !== undefined) { result = ts.isArray(value) - ? ts.reduceLeft(value, f, result) - : f(result, value); + ? reduceNodes(value, cbNodes, result) + : cbNode(result, value); } } } @@ -37880,8 +38317,8 @@ var ts; } ts.reduceEachChild = reduceEachChild; function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { - if (node === undefined) { - return undefined; + if (node === undefined || visitor === undefined) { + return node; } aggregateTransformFlags(node); var visited = visitor(node); @@ -37958,6 +38395,35 @@ var ts; return updated || nodes; } ts.visitNodes = visitNodes; + function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) { + context.startLexicalEnvironment(); + statements = visitNodes(statements, visitor, ts.isStatement, start); + if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { + statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements); + } + var declarations = context.endLexicalEnvironment(); + return ts.createNodeArray(ts.concatenate(statements, declarations), statements); + } + ts.visitLexicalEnvironment = visitLexicalEnvironment; + function visitParameterList(nodes, visitor, context) { + context.startLexicalEnvironment(); + var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration); + context.suspendLexicalEnvironment(); + return updated; + } + ts.visitParameterList = visitParameterList; + function visitFunctionBody(node, visitor, context) { + context.resumeLexicalEnvironment(); + var updated = visitNode(node, visitor, ts.isConciseBody); + var declarations = context.endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(updated); + var statements = mergeLexicalEnvironment(block.statements, declarations); + return ts.updateBlock(block, statements); + } + return updated; + } + ts.visitFunctionBody = visitFunctionBody; function visitEachChild(node, visitor, context) { if (node === undefined) { return undefined; @@ -37978,23 +38444,23 @@ var ts; case 142: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); case 144: - return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 147: return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 149: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 150: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 151: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 152: - return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 172: return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 173: return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); case 174: - return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); case 175: return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); case 176: @@ -38012,9 +38478,9 @@ var ts; case 183: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 184: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 185: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, true), context.endLexicalEnvironment())); + return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 186: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 187: @@ -38082,7 +38548,7 @@ var ts; case 224: return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 225: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 226: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); case 232: @@ -38134,9 +38600,8 @@ var ts; case 259: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); case 261: - context.startLexicalEnvironment(); - return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements)); - case 293: + return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); + case 294: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; @@ -38164,6 +38629,15 @@ var ts; } } ts.visitEachChild = visitEachChild; + function mergeLexicalEnvironment(statements, declarations) { + if (!ts.some(declarations)) { + return statements; + } + return ts.isNodeArray(statements) + ? ts.createNodeArray(ts.concatenate(statements, declarations), statements) + : ts.addRange(statements, declarations); + } + ts.mergeLexicalEnvironment = mergeLexicalEnvironment; function mergeFunctionBodyLexicalEnvironment(body, declarations) { if (body && declarations !== undefined && declarations.length > 0) { if (ts.isBlock(body)) { @@ -38194,22 +38668,37 @@ var ts; if (node === undefined) { return 0; } - else if (node.transformFlags & 536870912) { + if (node.transformFlags & 536870912) { return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind); } - else { - var subtreeFlags = aggregateTransformFlagsForSubtree(node); - return ts.computeTransformFlagsForNode(node, subtreeFlags); + var subtreeFlags = aggregateTransformFlagsForSubtree(node); + return ts.computeTransformFlagsForNode(node, subtreeFlags); + } + function aggregateTransformFlagsForNodeArray(nodes) { + if (nodes === undefined) { + return 0; } + var subtreeFlags = 0; + var nodeArrayFlags = 0; + for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { + var node = nodes_3[_i]; + subtreeFlags |= aggregateTransformFlagsForNode(node); + nodeArrayFlags |= node.transformFlags & ~536870912; + } + nodes.transformFlags = nodeArrayFlags | 536870912; + return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) { return 0; } - return reduceEachChild(node, aggregateTransformFlagsForChildNode, 0); + return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); } - function aggregateTransformFlagsForChildNode(transformFlags, child) { - return transformFlags | aggregateTransformFlagsForNode(child); + function aggregateTransformFlagsForChildNode(transformFlags, node) { + return transformFlags | aggregateTransformFlagsForNode(node); + } + function aggregateTransformFlagsForChildNodes(transformFlags, nodes) { + return transformFlags | aggregateTransformFlagsForNodeArray(nodes); } var Debug; (function (Debug) { @@ -38219,9 +38708,21 @@ var ts; Debug.failBadSyntaxKind = Debug.shouldAssert(1) ? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); } : ts.noop; + Debug.assertEachNode = Debug.shouldAssert(1) + ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }); } + : ts.noop; Debug.assertNode = Debug.shouldAssert(1) ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); } : ts.noop; + Debug.assertOptionalNode = Debug.shouldAssert(1) + ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); } + : ts.noop; + Debug.assertOptionalToken = Debug.shouldAssert(1) + ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }); } + : ts.noop; + Debug.assertMissingNode = Debug.shouldAssert(1) + ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }); } + : ts.noop; function getFunctionName(func) { if (typeof func !== "function") { return ""; @@ -38240,440 +38741,316 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) { - if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { - var right = node.right; - if (ts.isDestructuringAssignment(right)) { - return flattenDestructuringAssignment(context, right, needsValue, recordTempVariable, visitor); - } - else { - return node.right; - } - } + function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) { var location = node; - var value = node.right; - var expressions = []; - if (needsValue) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment, visitor); + var value; + if (ts.isDestructuringAssignment(node)) { + value = node.right; + while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { + if (ts.isDestructuringAssignment(value)) { + location = node = value; + value = node.right; + } + else { + return value; + } + } } - else if (ts.nodeIsSynthesized(node)) { - location = value; + var expressions; + var flattenContext = { + context: context, + level: level, + hoistTempVariables: true, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern, + createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern, + createArrayBindingOrAssignmentElement: makeAssignmentElement, + visitor: visitor + }; + if (value) { + value = ts.visitNode(value, visitor, ts.isExpression); + if (needsValue) { + value = ensureIdentifier(flattenContext, value, true, location); + } + else if (ts.nodeIsSynthesized(node)) { + location = value; + } } - flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor); - if (needsValue) { + flattenBindingOrAssignmentElement(flattenContext, node, value, location, ts.isDestructuringAssignment(node)); + if (value && needsValue) { + if (!ts.some(expressions)) { + return value; + } expressions.push(value); } - var expression = ts.inlineExpressions(expressions); - ts.aggregateTransformFlags(expression); - return expression; - function emitAssignment(name, value, location) { - var expression = ts.createAssignment(name, value, location); - ts.setEmitFlags(expression, 2048); + return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression(); + function emitExpression(expression) { + ts.setEmitFlags(expression, 64); ts.aggregateTransformFlags(expression); - expressions.push(expression); + expressions = ts.append(expressions, expression); } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - emitAssignment(name, value, location); - return name; - } - function emitRestAssignment(elements, value, location) { - emitAssignment(ts.createObjectLiteral(elements), value, location); + function emitBindingOrAssignment(target, value, location, original) { + ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); + var expression = createAssignmentCallback + ? createAssignmentCallback(target, value, location) + : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location); + expression.original = original; + emitExpression(expression); } } ts.flattenDestructuringAssignment = flattenDestructuringAssignment; - function flattenParameterDestructuring(node, value, visitor, transformRest) { + function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) { + var pendingExpressions; + var pendingDeclarations = []; var declarations = []; - flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor); + var flattenContext = { + context: context, + level: level, + hoistTempVariables: hoistTempVariables, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayBindingPattern, + createObjectBindingOrAssignmentPattern: makeObjectBindingPattern, + createArrayBindingOrAssignmentElement: makeBindingElement, + visitor: visitor + }; + flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer); + if (pendingExpressions) { + var temp = ts.createTempVariable(undefined); + if (hoistTempVariables) { + var value = ts.inlineExpressions(pendingExpressions); + pendingExpressions = undefined; + emitBindingOrAssignment(temp, value, undefined, undefined); + } + else { + context.hoistVariableDeclaration(temp); + var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations); + pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value)); + ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions); + pendingDeclaration.value = temp; + } + } + for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_32 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name_32, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + variable.original = original; + if (ts.isIdentifier(name_32)) { + ts.setEmitFlags(variable, 64); + } + ts.aggregateTransformFlags(variable); + declarations.push(variable); + } return declarations; - function emitAssignment(name, value, location) { - var declaration = ts.createVariableDeclaration(name, undefined, value, location); - ts.setEmitFlags(declaration, 2048); - ts.aggregateTransformFlags(declaration); - declarations.push(declaration); + function emitExpression(value) { + pendingExpressions = ts.append(pendingExpressions, value); } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(undefined); - emitAssignment(name, value, location); - return name; - } - function emitRestAssignment(elements, value, location) { - emitAssignment(ts.createObjectBindingPattern(elements), value, location); + function emitBindingOrAssignment(target, value, location, original) { + ts.Debug.assertNode(target, ts.isBindingName); + if (pendingExpressions) { + value = ts.inlineExpressions(ts.append(pendingExpressions, value)); + pendingExpressions = undefined; + } + pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original }); } } - ts.flattenParameterDestructuring = flattenParameterDestructuring; - function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) { - var declarations = []; - var pendingAssignments; - flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor); - return declarations; - function emitAssignment(name, value, location, original) { - if (pendingAssignments) { - pendingAssignments.push(value); - value = ts.inlineExpressions(pendingAssignments); - pendingAssignments = undefined; - } - var declaration = ts.createVariableDeclaration(name, undefined, value, location); - declaration.original = original; - ts.setEmitFlags(declaration, 2048); - declarations.push(declaration); - ts.aggregateTransformFlags(declaration); - } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - if (recordTempVariable) { - var assignment = ts.createAssignment(name, value, location); - if (pendingAssignments) { - pendingAssignments.push(assignment); - } - else { - pendingAssignments = [assignment]; - } - } - else { - emitAssignment(name, value, location, undefined); - } - return name; - } - function emitRestAssignment(elements, value, location, original) { - emitAssignment(ts.createObjectBindingPattern(elements), value, location, original); - } - } - ts.flattenVariableDestructuring = flattenVariableDestructuring; - function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) { - var pendingAssignments = []; - flattenDestructuring(node, undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, false, visitor); - var expression = ts.inlineExpressions(pendingAssignments); - ts.aggregateTransformFlags(expression); - return expression; - function emitAssignment(name, value, location, original) { - var expression = createAssignmentCallback - ? createAssignmentCallback(name.kind === 70 ? name : emitTempVariableAssignment(name, location), value, location) - : ts.createAssignment(name, value, location); - emitPendingAssignment(expression, original); - } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - emitPendingAssignment(ts.createAssignment(name, value, location), undefined); - return name; - } - function emitRestAssignment(elements, value, location, original) { - emitAssignment(ts.createObjectLiteral(elements), value, location, original); - } - function emitPendingAssignment(expression, original) { - expression.original = original; - ts.setEmitFlags(expression, 2048); - pendingAssignments.push(expression); - } - } - ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression; - function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) { - if (value && visitor) { - value = ts.visitNode(value, visitor, ts.isExpression); - } - if (ts.isBinaryExpression(root)) { - emitDestructuringAssignment(root.left, value, location); - } - else { - emitBindingElement(root, value); - } - function emitDestructuringAssignment(bindingTarget, value, location) { - var target; - if (ts.isShorthandPropertyAssignment(bindingTarget)) { - var initializer = visitor - ? ts.visitNode(bindingTarget.objectAssignmentInitializer, visitor, ts.isExpression) - : bindingTarget.objectAssignmentInitializer; - if (initializer) { - value = createDefaultValueCheck(value, initializer, location); - } - target = bindingTarget.name; - } - else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57) { - var initializer = visitor - ? ts.visitNode(bindingTarget.right, visitor, ts.isExpression) - : bindingTarget.right; - value = createDefaultValueCheck(value, initializer, location); - target = bindingTarget.left; - } - else { - target = bindingTarget; - } - if (target.kind === 176) { - emitObjectLiteralAssignment(target, value, location); - } - else if (target.kind === 175) { - emitArrayLiteralAssignment(target, value, location); - } - else { - var name_32 = ts.getMutableClone(target); - ts.setSourceMapRange(name_32, target); - ts.setCommentRange(name_32, target); - emitAssignment(name_32, value, location, undefined); - } - } - function emitObjectLiteralAssignment(target, value, location) { - var properties = target.properties; - if (properties.length !== 1) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - } - var bindingElements = []; - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; - if (p.kind === 257 || p.kind === 258) { - if (!transformRest || - p.transformFlags & 8388608 || - (p.kind === 257 && p.initializer.transformFlags & 8388608)) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - var propName = p.name; - var bindingTarget = p.kind === 258 ? p : p.initializer || propName; - emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p); - } - else { - bindingElements.push(p); - } - } - else if (i === properties.length - 1 && - p.kind === 259 && - p.expression.kind === 70) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - var propName = p.expression; - var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target); - emitDestructuringAssignment(propName, restCall, p); - } - } - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - } - function emitArrayLiteralAssignment(target, value, location) { - if (transformRest) { - emitESNextArrayLiteralAssignment(target, value, location); - } - else { - emitES2015ArrayLiteralAssignment(target, value, location); - } - } - function emitESNextArrayLiteralAssignment(target, value, location) { - var elements = target.elements; - var numElements = elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - } - var expressions = []; - var spreadContainingExpressions = []; - for (var i = 0; i < numElements; i++) { - var e = elements[i]; - if (e.kind === 198) { - continue; - } - if (e.transformFlags & 8388608 && i < numElements - 1) { - var tmp = ts.createTempVariable(recordTempVariable); - spreadContainingExpressions.push([e, tmp]); - expressions.push(tmp); - } - else { - expressions.push(e); - } - } - emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined); - for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) { - var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1]; - emitDestructuringAssignment(e, tmp, e); - } - } - function emitES2015ArrayLiteralAssignment(target, value, location) { - var elements = target.elements; - var numElements = elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - } - for (var i = 0; i < numElements; i++) { - var e = elements[i]; - if (e.kind !== 198) { - if (e.kind !== 196) { - emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e); - } - else if (i === numElements - 1) { - emitDestructuringAssignment(e.expression, ts.createArraySlice(value, i), e); - } - } - } - } - function createRestCall(value, elements, getPropertyName, location) { - var propertyNames = []; - for (var i = 0; i < elements.length - 1; i++) { - if (ts.isOmittedExpression(elements[i])) { - continue; - } - var str = ts.createSynthesizedNode(9); - str.pos = location.pos; - str.end = location.end; - str.text = ts.getTextOfPropertyName(getPropertyName(elements[i])); - propertyNames.push(str); - } - var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]); - return ts.createCall(ts.createIdentifier("__rest"), undefined, args); - } - function emitBindingElement(target, value) { - var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer; - if (transformRest) { - value = value || initializer; - } - else if (initializer) { - value = value ? createDefaultValueCheck(value, initializer, target) : initializer; + ts.flattenDestructuringBinding = flattenDestructuringBinding; + function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) { + if (!skipInitializer) { + var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression); + if (initializer) { + value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer; } else if (!value) { value = ts.createVoidZero(); } - var name = target.name; - if (!ts.isBindingPattern(name)) { - emitAssignment(name, value, target, target); - } - else { - var numElements = name.elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, numElements !== 0, target, emitTempVariableAssignment); - } - if (name.kind === 173) { - emitArrayBindingElement(name, value); + } + var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element); + if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) { + flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) { + flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else { + flattenContext.emitBindingOrAssignment(bindingTarget, value, location, element); + } + } + function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1) { + var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var computedTempVariables; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element); + if (flattenContext.level >= 1 + && !(element.transformFlags & (524288 | 1048576)) + && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 | 1048576)) + && !ts.isComputedPropertyName(propertyName)) { + bindingElements = ts.append(bindingElements, element); } else { - emitObjectBindingElement(target, value); - } - } - } - function emitArrayBindingElement(name, value) { - if (transformRest) { - emitESNextArrayBindingElement(name, value); - } - else { - emitES2015ArrayBindingElement(name, value); - } - } - function emitES2015ArrayBindingElement(name, value) { - var elements = name.elements; - var numElements = elements.length; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (!element.dotDotDotToken) { - emitBindingElement(element, ts.createElementAccess(value, i)); - } - else if (i === numElements - 1) { - emitBindingElement(element, ts.createArraySlice(value, i)); - } - } - } - function emitESNextArrayBindingElement(name, value) { - var elements = name.elements; - var numElements = elements.length; - var bindingElements = []; - var spreadContainingElements = []; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (element.transformFlags & 8388608 && i < numElements - 1) { - spreadContainingElements.push(element); - bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value)); - } - else { - bindingElements.push(element); - } - } - emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined); - for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) { - var element = spreadContainingElements_1[_i]; - emitBindingElement(element, ts.getGeneratedNameForNode(element)); - } - } - function emitObjectBindingElement(target, value) { - var name = target.name; - var elements = name.elements; - var numElements = elements.length; - var bindingElements = []; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (i === numElements - 1 && element.dotDotDotToken) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; } - var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name); - emitBindingElement(element, restCall); - } - else if (transformRest && !(element.transformFlags & 8388608)) { - bindingElements.push(element); - } - else { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName); + if (ts.isComputedPropertyName(propertyName)) { + computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression); } - var propName = element.propertyName || element.name; - emitBindingElement(element, createDestructuringPropertyAccess(value, propName)); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); } } - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + else if (i === numElements - 1) { + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; + } + var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); } } - function createDefaultValueCheck(value, defaultValue, location) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54), defaultValue, ts.createToken(55), value); + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); } - function createDestructuringPropertyAccess(expression, propertyName) { - if (ts.isComputedPropertyName(propertyName)) { - return ts.createElementAccess(expression, ensureIdentifier(propertyName.expression, false, propertyName, emitTempVariableAssignment)); - } - else if (ts.isLiteralExpression(propertyName)) { - var clone_2 = ts.getSynthesizedClone(propertyName); - clone_2.text = ts.unescapeIdentifier(clone_2.text); - return ts.createElementAccess(expression, clone_2); - } - else { - if (ts.isGeneratedIdentifier(propertyName)) { - var clone_3 = ts.getSynthesizedClone(propertyName); - clone_3.text = ts.unescapeIdentifier(clone_3.text); - return ts.createPropertyAccess(expression, clone_3); + } + function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) { + var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var restContainingElements; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (flattenContext.level >= 1) { + if (element.transformFlags & 1048576) { + var temp = ts.createTempVariable(undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + } + restContainingElements = ts.append(restContainingElements, [temp, element]); + bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp)); } else { - return ts.createPropertyAccess(expression, ts.createIdentifier(ts.unescapeIdentifier(propertyName.text))); + bindingElements = ts.append(bindingElements, element); } } + else if (ts.isOmittedExpression(element)) { + continue; + } + else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var rhsValue = ts.createElementAccess(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); + } + else if (i === numElements - 1) { + var rhsValue = ts.createArraySlice(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); + } + } + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern); + } + if (restContainingElements) { + for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) { + var _a = restContainingElements_1[_i], id = _a[0], element = _a[1]; + flattenBindingOrAssignmentElement(flattenContext, element, id, element); + } } } - function ensureIdentifier(value, reuseIdentifierExpressions, location, emitTempVariableAssignment, visitor) { + function createDefaultValueCheck(flattenContext, value, defaultValue, location) { + value = ensureIdentifier(flattenContext, value, true, location); + return ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value); + } + function createDestructuringPropertyAccess(flattenContext, value, propertyName) { + if (ts.isComputedPropertyName(propertyName)) { + var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, false, propertyName); + return ts.createElementAccess(value, argumentExpression); + } + else if (ts.isStringOrNumericLiteral(propertyName)) { + var argumentExpression = ts.getSynthesizedClone(propertyName); + argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text); + return ts.createElementAccess(value, argumentExpression); + } + else { + var name_33 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name_33); + } + } + function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { if (ts.isIdentifier(value) && reuseIdentifierExpressions) { return value; } else { - if (visitor) { - value = ts.visitNode(value, visitor, ts.isExpression); + var temp = ts.createTempVariable(undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + flattenContext.emitExpression(ts.createAssignment(temp, value, location)); } - return emitTempVariableAssignment(value, location); + else { + flattenContext.emitBindingOrAssignment(temp, value, location, undefined); + } + return temp; } } + function makeArrayBindingPattern(elements) { + ts.Debug.assertEachNode(elements, ts.isArrayBindingElement); + return ts.createArrayBindingPattern(elements); + } + function makeArrayAssignmentPattern(elements) { + return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement)); + } + function makeObjectBindingPattern(elements) { + ts.Debug.assertEachNode(elements, ts.isBindingElement); + return ts.createObjectBindingPattern(elements); + } + function makeObjectAssignmentPattern(elements) { + return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement)); + } + function makeBindingElement(name) { + return ts.createBindingElement(undefined, undefined, name); + } + function makeAssignmentElement(name) { + return name; + } + var restHelper = { + name: "typescript:rest", + scoped: false, + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + }; + function createRestCall(context, value, elements, computedTempVariables, location) { + context.requestEmitHelper(restHelper); + var propertyNames = []; + var computedTempVariableOffset = 0; + for (var i = 0; i < elements.length - 1; i++) { + var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]); + if (propertyName) { + if (ts.isComputedPropertyName(propertyName)) { + var temp = computedTempVariables[computedTempVariableOffset]; + computedTempVariableOffset++; + propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral("")))); + } + else { + propertyNames.push(ts.createLiteral(propertyName)); + } + } + } + return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + } })(ts || (ts = {})); var ts; (function (ts) { var USE_NEW_TYPE_METADATA_FORMAT = false; function transformTypeScript(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); @@ -38689,7 +39066,6 @@ var ts; var currentNamespaceContainerName; var currentScope; var currentScopeFirstDeclarationsOfName; - var currentExternalHelpersModuleName; var enabledSubstitutions; var classAliases; var applicableSubstitutions; @@ -38698,7 +39074,11 @@ var ts; if (ts.isDeclarationFile(node)) { return node; } - return ts.visitNode(node, visitor, ts.isSourceFile); + currentSourceFile = node; + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function saveStateAndInvoke(node, f) { var savedCurrentScope = currentScope; @@ -38711,14 +39091,29 @@ var ts; currentScope = savedCurrentScope; return visited; } + function onBeforeVisitNode(node) { + switch (node.kind) { + case 261: + case 232: + case 231: + case 204: + currentScope = node; + currentScopeFirstDeclarationsOfName = undefined; + break; + case 226: + case 225: + if (ts.hasModifier(node, 2)) { + break; + } + recordEmittedDeclarationInScope(node); + break; + } + } function visitor(node) { return saveStateAndInvoke(node, visitorWorker); } function visitorWorker(node) { - if (node.kind === 261) { - return visitSourceFile(node); - } - else if (node.transformFlags & 1) { + if (node.transformFlags & 1) { return visitTypeScript(node); } else if (node.transformFlags & 2) { @@ -38834,6 +39229,7 @@ var ts; case 145: case 228: case 147: + return undefined; case 150: return visitConstructor(node); case 227: @@ -38886,53 +39282,9 @@ var ts; return ts.visitEachChild(node, visitor, context); } } - function onBeforeVisitNode(node) { - switch (node.kind) { - case 261: - case 232: - case 231: - case 204: - currentScope = node; - currentScopeFirstDeclarationsOfName = undefined; - break; - case 226: - case 225: - if (ts.hasModifier(node, 2)) { - break; - } - recordEmittedDeclarationInScope(node); - break; - } - } function visitSourceFile(node) { - currentSourceFile = node; - if (compilerOptions.alwaysStrict && - !(ts.isExternalModule(node) && (compilerOptions.target >= 2 || compilerOptions.module === ts.ModuleKind.ES2015))) { - node = ts.ensureUseStrict(node); - } - if (node.flags & 64512 - && compilerOptions.importHelpers - && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); - var externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText); - var externalHelpersModuleImport = ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); - externalHelpersModuleImport.parent = node; - externalHelpersModuleImport.flags &= ~8; - statements.push(externalHelpersModuleImport); - currentExternalHelpersModuleName = externalHelpersModuleName; - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); - currentExternalHelpersModuleName = undefined; - node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); - node.externalHelpersModuleName = externalHelpersModuleName; - } - else { - node = ts.visitEachChild(node, sourceElementVisitor, context); - } - ts.setEmitFlags(node, 1 | ts.getEmitFlags(node)); - return node; + var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); + return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict)); } function shouldEmitDecorateCallForClass(node) { if (node.decorators && node.decorators.length > 0) { @@ -38978,7 +39330,7 @@ var ts; } if (statements.length > 1) { statements.push(ts.createEndOfDeclarationMarker(node)); - ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432); + ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152); } return ts.singleOrMany(statements); } @@ -38986,7 +39338,7 @@ var ts; var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node); var emitFlags = ts.getEmitFlags(node); if (hasStaticProperties) { - emitFlags |= 1024; + emitFlags |= 32; } ts.setOriginalNode(classDeclaration, node); ts.setEmitFlags(classDeclaration, emitFlags); @@ -39017,7 +39369,7 @@ var ts; enableSubstitutionForClassAliases(); classAliases[ts.getOriginalNodeId(node)] = ts.getSynthesizedClone(temp); } - ts.setEmitFlags(classExpression, 524288 | ts.getEmitFlags(classExpression)); + ts.setEmitFlags(classExpression, 32768 | ts.getEmitFlags(classExpression)); expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression))); ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp)); expressions.push(ts.startOnNewLine(temp)); @@ -39036,7 +39388,7 @@ var ts; } function transformConstructor(node, hasExtendsClause) { var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty); - var hasParameterPropertyAssignments = node.transformFlags & 4194304; + var hasParameterPropertyAssignments = node.transformFlags & 262144; var constructor = ts.getFirstConstructorWithBody(node); if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) { return ts.visitEachChild(constructor, visitor, context); @@ -39046,14 +39398,13 @@ var ts; return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor)); } function transformConstructorParameters(constructor) { - return constructor - ? ts.visitNodes(constructor.parameters, visitor, ts.isParameter) - : []; + return ts.visitParameterList(constructor && constructor.parameters, visitor, context) + || []; } function transformConstructorBody(node, constructor, hasExtendsClause) { var statements = []; var indexOfFirstStatement = 0; - startLexicalEnvironment(); + resumeLexicalEnvironment(); if (constructor) { indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements); var propertyAssignments = getParametersWithPropertyAssignments(constructor); @@ -39068,7 +39419,7 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement)); } ts.addRange(statements, endLexicalEnvironment()); - return ts.setMultiLine(ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined), true); + return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true); } function addPrologueDirectivesAndInitialSuperCall(ctor, result) { if (ctor.body) { @@ -39097,9 +39448,9 @@ var ts; ts.Debug.assert(ts.isIdentifier(node.name)); var name = node.name; var propertyName = ts.getMutableClone(name); - ts.setEmitFlags(propertyName, 49152 | 1536); + ts.setEmitFlags(propertyName, 1536 | 48); var localName = ts.getMutableClone(name); - ts.setEmitFlags(localName, 49152); + ts.setEmitFlags(localName, 1536); return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1))); } function getInitializedProperties(node, isStatic) { @@ -39117,8 +39468,8 @@ var ts; && member.initializer !== undefined; } function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { - var property = properties_7[_i]; + for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { + var property = properties_8[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -39127,8 +39478,8 @@ var ts; } function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { - var property = properties_8[_i]; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -39201,10 +39552,11 @@ var ts; return undefined; } var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; - if (accessor !== firstAccessor) { + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + var decorators = firstAccessorWithDecorators.decorators; var parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -39229,14 +39581,14 @@ var ts; } return { decorators: decorators }; } - function transformAllDecoratorsOfDeclaration(node, allDecorators) { + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (!allDecorators) { return undefined; } var decoratorExpressions = []; ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } function addClassElementDecorationStatements(statements, node, isStatic) { @@ -39261,7 +39613,7 @@ var ts; } function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -39272,8 +39624,8 @@ var ts; ? ts.createVoidZero() : ts.createNull() : undefined; - var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); - ts.setEmitFlags(helper, 49152); + var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); + ts.setEmitFlags(helper, 1536); return helper; } function addConstructorDecorationStatement(statements, node) { @@ -39284,15 +39636,15 @@ var ts; } function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)]; var localName = ts.getLocalName(node, false, true); - var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName); + var decorate = createDecorateHelper(context, decoratorExpressions, localName); var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate); - ts.setEmitFlags(expression, 49152); + ts.setEmitFlags(expression, 1536); ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node)); return expression; } @@ -39305,48 +39657,48 @@ var ts; expressions = []; for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) { var decorator = decorators_1[_i]; - var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset, decorator.expression); - ts.setEmitFlags(helper, 49152); + var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, decorator.expression); + ts.setEmitFlags(helper, 1536); expressions.push(helper); } } return expressions; } - function addTypeMetadata(node, decoratorExpressions) { + function addTypeMetadata(node, container, decoratorExpressions) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node, decoratorExpressions) { + function addOldTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } } } - function addNewTypeMetadata(node, decoratorExpressions) { + function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node)))); } if (properties) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true))); + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true))); } } } @@ -39361,12 +39713,16 @@ var ts; return node.kind === 149; } function shouldAddParamTypesMetadata(node) { - var kind = node.kind; - return kind === 226 - || kind === 197 - || kind === 149 - || kind === 151 - || kind === 152; + switch (node.kind) { + case 226: + case 197: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 149: + case 151: + case 152: + return true; + } + return false; } function serializeTypeOfNode(node) { switch (node.kind) { @@ -39384,18 +39740,7 @@ var ts; return ts.createVoidZero(); } } - function getRestParameterElementType(node) { - if (node && node.kind === 162) { - return node.elementType; - } - else if (node && node.kind === 157) { - return ts.singleOrUndefined(node.typeArguments); - } - else { - return undefined; - } - } - function serializeParameterTypesOfNode(node) { + function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) @@ -39403,7 +39748,7 @@ var ts; : undefined; var expressions = []; if (valueDeclaration) { - var parameters = valueDeclaration.parameters; + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; @@ -39411,7 +39756,7 @@ var ts; continue; } if (parameter.dotDotDotToken) { - expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type))); + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); } else { expressions.push(serializeTypeOfNode(parameter)); @@ -39420,6 +39765,15 @@ var ts; } return ts.createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 151) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } function serializeReturnTypeOfNode(node) { if (ts.isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); @@ -39515,7 +39869,7 @@ var ts; case ts.TypeReferenceSerializationKind.Unknown: var serialized = serializeEntityNameAsExpression(node.typeName, true); var temp = ts.createTempVariable(hoistVariableDeclaration); - return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictEquality(ts.createTypeOf(ts.createAssignment(temp, serialized)), ts.createLiteral("function")), temp), ts.createIdentifier("Object")); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object")); case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: return serializeEntityNameAsExpression(node.typeName, false); case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType: @@ -39544,14 +39898,14 @@ var ts; function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 70: - var name_33 = ts.getMutableClone(node); - name_33.flags &= ~8; - name_33.original = undefined; - name_33.parent = currentScope; + var name_34 = ts.getMutableClone(node); + name_34.flags &= ~8; + name_34.original = undefined; + name_34.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_33), ts.createLiteral("undefined")), name_33); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_34), ts.createLiteral("undefined")), name_34); } - return name_33; + return name_34; case 141: return serializeQualifiedNameAsExpression(node, useFallback); } @@ -39571,7 +39925,7 @@ var ts; return ts.createPropertyAccess(left, node.right); } function getGlobalSymbolNameWithFallback() { - return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54), ts.createIdentifier("Symbol"), ts.createToken(55), ts.createIdentifier("Object")); + return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object")); } function getExpressionForPropertyName(member, generateNameForComputedPropertyName) { var name = member.name; @@ -39581,7 +39935,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeIdentifier(name.text)); } else { return ts.getSynthesizedClone(name); @@ -39626,11 +39980,12 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setCommentRange(method, node); - ts.setSourceMapRange(method, ts.moveRangePastDecorators(node)); - ts.setOriginalNode(method, node); - return method; + var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + if (updated !== node) { + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } function shouldEmitAccessorDeclaration(node) { return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128)); @@ -39639,86 +39994,46 @@ var ts; if (!shouldEmitAccessorDeclaration(node)) { return undefined; } - var accessor = ts.createGetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node); - ts.setOriginalNode(accessor, node); - ts.setCommentRange(accessor, node); - ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node)); - return accessor; + var updated = ts.updateGetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + if (updated !== node) { + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } function visitSetAccessor(node) { if (!shouldEmitAccessorDeclaration(node)) { return undefined; } - var accessor = ts.createSetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node); - ts.setOriginalNode(accessor, node); - ts.setCommentRange(accessor, node); - ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node)); - return accessor; + var updated = ts.updateSetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + if (updated !== node) { + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } function visitFunctionDeclaration(node) { if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createNotEmittedStatement(node); } - var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); + var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isNamespaceExport(node)) { - var statements = [func]; + var statements = [updated]; addExportMemberAssignment(statements, node); return statements; } - return func; + return updated; } function visitFunctionExpression(node) { if (ts.nodeIsMissing(node.body)) { return ts.createOmittedExpression(); } - var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); - return func; + var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + return updated; } function visitArrowFunction(node) { - var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node); - ts.setOriginalNode(func, node); - return func; - } - function transformFunctionBody(node) { - return transformFunctionBodyWorker(node.body); - } - function transformFunctionBodyWorker(body, start) { - if (start === void 0) { start = 0; } - var savedCurrentScope = currentScope; - var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; - currentScope = body; - currentScopeFirstDeclarationsOfName = ts.createMap(); - startLexicalEnvironment(); - var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start); - var visited = ts.updateBlock(body, statements); - var declarations = endLexicalEnvironment(); - currentScope = savedCurrentScope; - currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - } - function transformConciseBody(node) { - return transformConciseBodyWorker(node.body, false); - } - function transformConciseBodyWorker(body, forceBlockFunctionBody) { - if (ts.isBlock(body)) { - return transformFunctionBodyWorker(body); - } - else { - startLexicalEnvironment(); - var visited = ts.visitNode(body, visitor, ts.isConciseBody); - var declarations = endLexicalEnvironment(); - var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - if (forceBlockFunctionBody && !ts.isBlock(merged)) { - return ts.createBlock([ - ts.createReturn(merged) - ]); - } - else { - return merged; - } - } + var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + return updated; } function visitParameter(node) { if (ts.parameterIsThisKeyword(node)) { @@ -39728,7 +40043,7 @@ var ts; ts.setOriginalNode(parameter, node); ts.setCommentRange(parameter, node); ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); - ts.setEmitFlags(parameter.name, 1024); + ts.setEmitFlags(parameter.name, 32); return parameter; } function visitVariableStatement(node) { @@ -39746,7 +40061,7 @@ var ts; function transformInitializedVariable(node) { var name = node.name; if (ts.isBindingPattern(name)) { - return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor); + return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression); } else { return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node); @@ -39787,10 +40102,10 @@ var ts; return undefined; } var statements = []; - var emitFlags = 64; + var emitFlags = 2; if (addVarForEnumOrModuleDeclaration(statements, node)) { if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= 16384; + emitFlags |= 512; } } var parameterName = getNamespaceParameterName(node); @@ -39861,9 +40176,9 @@ var ts; } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_34 = node.symbol && node.symbol.name; - if (name_34) { - return currentScopeFirstDeclarationsOfName[name_34] === node; + var name_35 = node.symbol && node.symbol.name; + if (name_35) { + return currentScopeFirstDeclarationsOfName[name_35] === node; } } return false; @@ -39882,13 +40197,13 @@ var ts; ts.setSourceMapRange(statement, node); } ts.setCommentRange(statement, node); - ts.setEmitFlags(statement, 32768 | 33554432); + ts.setEmitFlags(statement, 1024 | 2097152); statements.push(statement); return true; } else { var mergeMarker = ts.createMergeDeclarationMarker(statement); - ts.setEmitFlags(mergeMarker, 49152 | 33554432); + ts.setEmitFlags(mergeMarker, 1536 | 2097152); statements.push(mergeMarker); return false; } @@ -39900,10 +40215,10 @@ var ts; ts.Debug.assert(ts.isIdentifier(node.name), "TypeScript module should have an Identifier name."); enableSubstitutionForNamespaceExports(); var statements = []; - var emitFlags = 64; + var emitFlags = 2; if (addVarForEnumOrModuleDeclaration(statements, node)) { if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= 16384; + emitFlags |= 512; } } var parameterName = getNamespaceParameterName(node); @@ -39959,7 +40274,7 @@ var ts; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); if (body.kind !== 231) { - ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152); + ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } @@ -40034,7 +40349,7 @@ var ts; return undefined; } var moduleReference = ts.createExpressionFromEntityName(node.moduleReference); - ts.setEmitFlags(moduleReference, 49152 | 65536); + ts.setEmitFlags(moduleReference, 1536 | 2048); if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node) @@ -40152,14 +40467,14 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2) { - var name_35 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_35); + var name_36 = node.name; + var exportedName = trySubstituteNamespaceExportedName(name_36); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_35, initializer, node); + return ts.createPropertyAssignment(name_36, initializer, node); } - return ts.createPropertyAssignment(name_35, exportedName, node); + return ts.createPropertyAssignment(name_36, exportedName, node); } } return node; @@ -40187,10 +40502,10 @@ var ts; if (declaration) { var classAlias = classAliases[declaration.id]; if (classAlias) { - var clone_4 = ts.getSynthesizedClone(classAlias); - ts.setSourceMapRange(clone_4, node); - ts.setCommentRange(clone_4, node); - return clone_4; + var clone_2 = ts.getSynthesizedClone(classAlias); + ts.setSourceMapRange(clone_2, node); + ts.setCommentRange(clone_2, node); + return clone_2; } } } @@ -40198,7 +40513,7 @@ var ts; return undefined; } function trySubstituteNamespaceExportedName(node) { - if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) { + if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); if (container && container.kind !== 261) { var substitute = (applicableSubstitutions & 2 && container.kind === 230) || @@ -40243,10 +40558,278 @@ var ts; } } ts.transformTypeScript = transformTypeScript; + var paramHelper = { + name: "typescript:param", + scoped: false, + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + }; + function createParamHelper(context, expression, parameterOffset, location) { + context.requestEmitHelper(paramHelper); + return ts.createCall(ts.getHelperName("__param"), undefined, [ + ts.createLiteral(parameterOffset), + expression + ], location); + } + var metadataHelper = { + name: "typescript:metadata", + scoped: false, + priority: 3, + text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" + }; + function createMetadataHelper(context, metadataKey, metadataValue) { + context.requestEmitHelper(metadataHelper); + return ts.createCall(ts.getHelperName("__metadata"), undefined, [ + ts.createLiteral(metadataKey), + metadataValue + ]); + } + var decorateHelper = { + name: "typescript:decorate", + scoped: false, + priority: 2, + text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" + }; + function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { + context.requestEmitHelper(decorateHelper); + var argumentsArray = []; + argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + return ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray, location); + } +})(ts || (ts = {})); +var ts; +(function (ts) { + function transformESNext(context) { + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + function visitor(node) { + return visitorWorker(node, false); + } + function visitorNoDestructuringValue(node) { + return visitorWorker(node, true); + } + function visitorWorker(node, noDestructuringValue) { + if ((node.transformFlags & 8) === 0) { + return node; + } + switch (node.kind) { + case 176: + return visitObjectLiteralExpression(node); + case 192: + return visitBinaryExpression(node, noDestructuringValue); + case 223: + return visitVariableDeclaration(node); + case 213: + return visitForOfStatement(node); + case 211: + return visitForStatement(node); + case 188: + return visitVoidExpression(node); + case 150: + return visitConstructorDeclaration(node); + case 149: + return visitMethodDeclaration(node); + case 151: + return visitGetAccessorDeclaration(node); + case 152: + return visitSetAccessorDeclaration(node); + case 225: + return visitFunctionDeclaration(node); + case 184: + return visitFunctionExpression(node); + case 185: + return visitArrowFunction(node); + case 144: + return visitParameter(node); + case 207: + return visitExpressionStatement(node); + case 183: + return visitParenthesizedExpression(node, noDestructuringValue); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function chunkObjectLiteralElements(elements) { + var chunkObject; + var objects = []; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var e = elements_3[_i]; + if (e.kind === 259) { + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + chunkObject = undefined; + } + var target = e.expression; + objects.push(ts.visitNode(target, visitor, ts.isExpression)); + } + else { + if (!chunkObject) { + chunkObject = []; + } + if (e.kind === 257) { + var p = e; + chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); + } + else { + chunkObject.push(e); + } + } + } + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + } + return objects; + } + function visitObjectLiteralExpression(node) { + if (node.transformFlags & 1048576) { + var objects = chunkObjectLiteralElements(node.properties); + if (objects.length && objects[0].kind !== 176) { + objects.unshift(ts.createObjectLiteral()); + } + return createAssignHelper(context, objects); + } + return ts.visitEachChild(node, visitor, context); + } + function visitExpressionStatement(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + function visitParenthesizedExpression(node, noDestructuringValue) { + return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context); + } + function visitBinaryExpression(node, noDestructuringValue) { + if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) { + return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue); + } + else if (node.operatorToken.kind === 25) { + return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + function visitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576) { + return ts.flattenDestructuringBinding(node, visitor, context, 1); + } + return ts.visitEachChild(node, visitor, context); + } + function visitForStatement(node) { + return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement)); + } + function visitVoidExpression(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + function visitForOfStatement(node) { + var leadingStatements; + var temp; + var initializer = ts.skipParentheses(node.initializer); + if (initializer.transformFlags & 1048576) { + if (ts.isVariableDeclarationList(initializer)) { + temp = ts.createTempVariable(undefined); + var firstDeclaration = ts.firstOrUndefined(initializer.declarations); + var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer); + leadingStatements = ts.append(leadingStatements, statement); + } + } + else if (ts.isAssignmentPattern(initializer)) { + temp = ts.createTempVariable(undefined); + var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1); + leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer)); + } + } + if (temp) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var block = ts.isBlock(statement) + ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements)) + : ts.createBlock(ts.append(leadingStatements, statement), statement, true); + return ts.updateForOf(node, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(temp, undefined, undefined, node.initializer) + ], node.initializer, 1), expression, block); + } + return ts.visitEachChild(node, visitor, context); + } + function visitParameter(node) { + if (node.transformFlags & 1048576) { + return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + function visitConstructorDeclaration(node) { + return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + } + function visitGetAccessorDeclaration(node) { + return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitSetAccessorDeclaration(node) { + return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + } + function visitMethodDeclaration(node) { + return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitFunctionDeclaration(node) { + return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitArrowFunction(node) { + return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitFunctionExpression(node) { + return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function transformFunctionBody(node) { + resumeLexicalEnvironment(); + var leadingStatements; + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (parameter.transformFlags & 1048576) { + var temp = ts.getGeneratedNameForNode(parameter); + var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations)); + ts.setEmitFlags(statement, 524288); + leadingStatements = ts.append(leadingStatements, statement); + } + } + } + var body = ts.visitNode(node.body, visitor, ts.isConciseBody); + var trailingStatements = endLexicalEnvironment(); + if (ts.some(leadingStatements) || ts.some(trailingStatements)) { + var block = ts.convertToFunctionBody(body, true); + return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements)); + } + return body; + } + } + ts.transformESNext = transformESNext; + var assignHelper = { + name: "typescript:assign", + scoped: false, + priority: 1, + text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" + }; + function createAssignHelper(context, attributesSegments) { + context.requestEmitHelper(assignHelper); + return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments); + } + ts.createAssignHelper = createAssignHelper; })(ts || (ts = {})); var ts; (function (ts) { - var entities = createEntitiesMap(); function transformJsx(context) { var compilerOptions = context.getCompilerOptions(); var currentSourceFile; @@ -40256,17 +40839,15 @@ var ts; return node; } currentSourceFile = node; - node = ts.visitEachChild(node, visitor, context); + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; - return node; + return visited; } function visitor(node) { if (node.transformFlags & 4) { return visitorWorker(node); } - else if (node.transformFlags & 8) { - return ts.visitEachChild(node, visitor, context); - } else { return node; } @@ -40280,8 +40861,7 @@ var ts; case 252: return visitJsxExpression(node); default: - ts.Debug.failBadSyntaxKind(node); - return undefined; + return ts.visitEachChild(node, visitor, context); } } function transformJsxChildToExpression(node) { @@ -40319,8 +40899,10 @@ var ts; if (ts.isJsxSpreadAttribute(attrs[0])) { segments.unshift(ts.createObjectLiteral()); } - objectProperties = ts.singleOrUndefined(segments) - || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments); + objectProperties = ts.singleOrUndefined(segments); + if (!objectProperties) { + objectProperties = ts.createAssignHelper(context, segments); + } } var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location); if (isChild) { @@ -40413,12 +40995,12 @@ var ts; return getTagName(node.openingElement); } else { - var name_36 = node.tagName; - if (ts.isIdentifier(name_36) && ts.isIntrinsicJsxName(name_36.text)) { - return ts.createLiteral(name_36.text); + var name_37 = node.tagName; + if (ts.isIdentifier(name_37) && ts.isIntrinsicJsxName(name_37.text)) { + return ts.createLiteral(name_37.text); } else { - return ts.createExpressionFromEntityName(name_36); + return ts.createExpressionFromEntityName(name_37); } } } @@ -40436,455 +41018,291 @@ var ts; } } ts.transformJsx = transformJsx; - function createEntitiesMap() { - return ts.createMap({ - "quot": 0x0022, - "amp": 0x0026, - "apos": 0x0027, - "lt": 0x003C, - "gt": 0x003E, - "nbsp": 0x00A0, - "iexcl": 0x00A1, - "cent": 0x00A2, - "pound": 0x00A3, - "curren": 0x00A4, - "yen": 0x00A5, - "brvbar": 0x00A6, - "sect": 0x00A7, - "uml": 0x00A8, - "copy": 0x00A9, - "ordf": 0x00AA, - "laquo": 0x00AB, - "not": 0x00AC, - "shy": 0x00AD, - "reg": 0x00AE, - "macr": 0x00AF, - "deg": 0x00B0, - "plusmn": 0x00B1, - "sup2": 0x00B2, - "sup3": 0x00B3, - "acute": 0x00B4, - "micro": 0x00B5, - "para": 0x00B6, - "middot": 0x00B7, - "cedil": 0x00B8, - "sup1": 0x00B9, - "ordm": 0x00BA, - "raquo": 0x00BB, - "frac14": 0x00BC, - "frac12": 0x00BD, - "frac34": 0x00BE, - "iquest": 0x00BF, - "Agrave": 0x00C0, - "Aacute": 0x00C1, - "Acirc": 0x00C2, - "Atilde": 0x00C3, - "Auml": 0x00C4, - "Aring": 0x00C5, - "AElig": 0x00C6, - "Ccedil": 0x00C7, - "Egrave": 0x00C8, - "Eacute": 0x00C9, - "Ecirc": 0x00CA, - "Euml": 0x00CB, - "Igrave": 0x00CC, - "Iacute": 0x00CD, - "Icirc": 0x00CE, - "Iuml": 0x00CF, - "ETH": 0x00D0, - "Ntilde": 0x00D1, - "Ograve": 0x00D2, - "Oacute": 0x00D3, - "Ocirc": 0x00D4, - "Otilde": 0x00D5, - "Ouml": 0x00D6, - "times": 0x00D7, - "Oslash": 0x00D8, - "Ugrave": 0x00D9, - "Uacute": 0x00DA, - "Ucirc": 0x00DB, - "Uuml": 0x00DC, - "Yacute": 0x00DD, - "THORN": 0x00DE, - "szlig": 0x00DF, - "agrave": 0x00E0, - "aacute": 0x00E1, - "acirc": 0x00E2, - "atilde": 0x00E3, - "auml": 0x00E4, - "aring": 0x00E5, - "aelig": 0x00E6, - "ccedil": 0x00E7, - "egrave": 0x00E8, - "eacute": 0x00E9, - "ecirc": 0x00EA, - "euml": 0x00EB, - "igrave": 0x00EC, - "iacute": 0x00ED, - "icirc": 0x00EE, - "iuml": 0x00EF, - "eth": 0x00F0, - "ntilde": 0x00F1, - "ograve": 0x00F2, - "oacute": 0x00F3, - "ocirc": 0x00F4, - "otilde": 0x00F5, - "ouml": 0x00F6, - "divide": 0x00F7, - "oslash": 0x00F8, - "ugrave": 0x00F9, - "uacute": 0x00FA, - "ucirc": 0x00FB, - "uuml": 0x00FC, - "yacute": 0x00FD, - "thorn": 0x00FE, - "yuml": 0x00FF, - "OElig": 0x0152, - "oelig": 0x0153, - "Scaron": 0x0160, - "scaron": 0x0161, - "Yuml": 0x0178, - "fnof": 0x0192, - "circ": 0x02C6, - "tilde": 0x02DC, - "Alpha": 0x0391, - "Beta": 0x0392, - "Gamma": 0x0393, - "Delta": 0x0394, - "Epsilon": 0x0395, - "Zeta": 0x0396, - "Eta": 0x0397, - "Theta": 0x0398, - "Iota": 0x0399, - "Kappa": 0x039A, - "Lambda": 0x039B, - "Mu": 0x039C, - "Nu": 0x039D, - "Xi": 0x039E, - "Omicron": 0x039F, - "Pi": 0x03A0, - "Rho": 0x03A1, - "Sigma": 0x03A3, - "Tau": 0x03A4, - "Upsilon": 0x03A5, - "Phi": 0x03A6, - "Chi": 0x03A7, - "Psi": 0x03A8, - "Omega": 0x03A9, - "alpha": 0x03B1, - "beta": 0x03B2, - "gamma": 0x03B3, - "delta": 0x03B4, - "epsilon": 0x03B5, - "zeta": 0x03B6, - "eta": 0x03B7, - "theta": 0x03B8, - "iota": 0x03B9, - "kappa": 0x03BA, - "lambda": 0x03BB, - "mu": 0x03BC, - "nu": 0x03BD, - "xi": 0x03BE, - "omicron": 0x03BF, - "pi": 0x03C0, - "rho": 0x03C1, - "sigmaf": 0x03C2, - "sigma": 0x03C3, - "tau": 0x03C4, - "upsilon": 0x03C5, - "phi": 0x03C6, - "chi": 0x03C7, - "psi": 0x03C8, - "omega": 0x03C9, - "thetasym": 0x03D1, - "upsih": 0x03D2, - "piv": 0x03D6, - "ensp": 0x2002, - "emsp": 0x2003, - "thinsp": 0x2009, - "zwnj": 0x200C, - "zwj": 0x200D, - "lrm": 0x200E, - "rlm": 0x200F, - "ndash": 0x2013, - "mdash": 0x2014, - "lsquo": 0x2018, - "rsquo": 0x2019, - "sbquo": 0x201A, - "ldquo": 0x201C, - "rdquo": 0x201D, - "bdquo": 0x201E, - "dagger": 0x2020, - "Dagger": 0x2021, - "bull": 0x2022, - "hellip": 0x2026, - "permil": 0x2030, - "prime": 0x2032, - "Prime": 0x2033, - "lsaquo": 0x2039, - "rsaquo": 0x203A, - "oline": 0x203E, - "frasl": 0x2044, - "euro": 0x20AC, - "image": 0x2111, - "weierp": 0x2118, - "real": 0x211C, - "trade": 0x2122, - "alefsym": 0x2135, - "larr": 0x2190, - "uarr": 0x2191, - "rarr": 0x2192, - "darr": 0x2193, - "harr": 0x2194, - "crarr": 0x21B5, - "lArr": 0x21D0, - "uArr": 0x21D1, - "rArr": 0x21D2, - "dArr": 0x21D3, - "hArr": 0x21D4, - "forall": 0x2200, - "part": 0x2202, - "exist": 0x2203, - "empty": 0x2205, - "nabla": 0x2207, - "isin": 0x2208, - "notin": 0x2209, - "ni": 0x220B, - "prod": 0x220F, - "sum": 0x2211, - "minus": 0x2212, - "lowast": 0x2217, - "radic": 0x221A, - "prop": 0x221D, - "infin": 0x221E, - "ang": 0x2220, - "and": 0x2227, - "or": 0x2228, - "cap": 0x2229, - "cup": 0x222A, - "int": 0x222B, - "there4": 0x2234, - "sim": 0x223C, - "cong": 0x2245, - "asymp": 0x2248, - "ne": 0x2260, - "equiv": 0x2261, - "le": 0x2264, - "ge": 0x2265, - "sub": 0x2282, - "sup": 0x2283, - "nsub": 0x2284, - "sube": 0x2286, - "supe": 0x2287, - "oplus": 0x2295, - "otimes": 0x2297, - "perp": 0x22A5, - "sdot": 0x22C5, - "lceil": 0x2308, - "rceil": 0x2309, - "lfloor": 0x230A, - "rfloor": 0x230B, - "lang": 0x2329, - "rang": 0x232A, - "loz": 0x25CA, - "spades": 0x2660, - "clubs": 0x2663, - "hearts": 0x2665, - "diams": 0x2666 - }); - } -})(ts || (ts = {})); -var ts; -(function (ts) { - function transformESNext(context) { - var hoistVariableDeclaration = context.hoistVariableDeclaration; - var currentSourceFile; - return transformSourceFile; - function transformSourceFile(node) { - currentSourceFile = node; - return ts.visitEachChild(node, visitor, context); - } - function visitor(node) { - if (node.transformFlags & 16) { - return visitorWorker(node); - } - else if (node.transformFlags & 32) { - return ts.visitEachChild(node, visitor, context); - } - else { - return node; - } - } - function visitorWorker(node) { - switch (node.kind) { - case 176: - return visitObjectLiteralExpression(node); - case 192: - return visitBinaryExpression(node); - case 223: - return visitVariableDeclaration(node); - case 213: - return visitForOfStatement(node); - case 172: - case 173: - return node; - case 225: - return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); - case 185: - return visitArrowFunction(node); - case 144: - return visitParameter(node); - default: - ts.Debug.failBadSyntaxKind(node); - return ts.visitEachChild(node, visitor, context); - } - } - function chunkObjectLiteralElements(elements) { - var chunkObject; - var objects = []; - for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { - var e = elements_3[_i]; - if (e.kind === 259) { - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - chunkObject = undefined; - } - var target = e.expression; - objects.push(ts.visitNode(target, visitor, ts.isExpression)); - } - else { - if (!chunkObject) { - chunkObject = []; - } - if (e.kind === 257) { - var p = e; - chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); - } - else { - chunkObject.push(e); - } - } - } - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - } - return objects; - } - function visitObjectLiteralExpression(node) { - var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176) { - objects.unshift(ts.createObjectLiteral()); - } - return ts.createCall(ts.createIdentifier("__assign"), undefined, objects); - } - function visitBinaryExpression(node) { - if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48) { - return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, visitor, true); - } - return ts.visitEachChild(node, visitor, context); - } - function visitVariableDeclaration(node) { - if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48) { - var result = ts.flattenVariableDestructuring(node, undefined, visitor, undefined, true); - return result; - } - return ts.visitEachChild(node, visitor, context); - } - function visitForOfStatement(node) { - var initializer = node.initializer; - if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) { - return ts.visitEachChild(node, visitor, context); - } - return ts.convertForOf(node, undefined, visitor, ts.noop, context, true); - } - function isRestBindingPattern(initializer) { - if (ts.isVariableDeclarationList(initializer)) { - var declaration = ts.firstOrUndefined(initializer.declarations); - return declaration && declaration.name && - declaration.name.kind === 172 && - !!(declaration.name.transformFlags & 8388608); - } - return false; - } - function isRestAssignment(initializer) { - return initializer.kind === 176 && - initializer.transformFlags & 8388608; - } - function visitParameter(node) { - if (isObjectRestParameter(node)) { - return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, node.initializer, node), node); - } - else { - return node; - } - } - function isObjectRestParameter(node) { - return node.name && - node.name.kind === 172 && - !!(node.name.transformFlags & 8388608); - } - function visitFunctionDeclaration(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) : - ts.visitEachChild(node.body, visitor, context); - return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node); - } - function visitArrowFunction(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) : - ts.visitEachChild(node.body, visitor, context); - var func = ts.setOriginalNode(ts.createArrowFunction(undefined, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, body, node), node); - ts.setEmitFlags(func, 256); - return func; - } - function visitFunctionExpression(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) : - ts.visitEachChild(node.body, visitor, context); - return ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node); - } - } - ts.transformESNext = transformESNext; + var entities = ts.createMap({ + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + }); })(ts || (ts = {})); var ts; (function (ts) { function transformES2017(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var resolver = context.getEmitResolver(); var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); - var currentSourceFileExternalHelpersModuleName; + var currentSourceFile; var enabledSubstitutions; - var applicableSubstitutions; var currentSuperContainer; var previousOnEmitNode = context.onEmitNode; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - var currentScope; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } - currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName; - return ts.visitEachChild(node, visitor, context); + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function visitor(node) { - if (node.transformFlags & 64) { - return visitorWorker(node); + if ((node.transformFlags & 16) === 0) { + return node; } - else if (node.transformFlags & 128) { - return ts.visitEachChild(node, visitor, context); - } - return node; - } - function visitorWorker(node) { switch (node.kind) { case 119: return undefined; @@ -40899,68 +41317,37 @@ var ts; case 185: return visitArrowFunction(node); default: - ts.Debug.failBadSyntaxKind(node); - return node; + return ts.visitEachChild(node, visitor, context); } } function visitAwaitExpression(node) { return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node); } function visitMethodDeclaration(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setCommentRange(method, node); - ts.setSourceMapRange(method, ts.moveRangePastDecorators(node)); - ts.setOriginalNode(method, node); - return method; + return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitFunctionDeclaration(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); - return func; + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitFunctionExpression(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } if (ts.nodeIsMissing(node.body)) { return ts.createOmittedExpression(); } - var func = ts.createFunctionExpression(undefined, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); - return func; + return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitArrowFunction(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node); - ts.setOriginalNode(func, node); - return func; - } - function transformFunctionBody(node) { - return transformAsyncFunctionBody(node); - } - function transformConciseBody(node) { - return transformAsyncFunctionBody(node); - } - function transformFunctionBodyWorker(body, start) { - if (start === void 0) { start = 0; } - var savedCurrentScope = currentScope; - currentScope = body; - startLexicalEnvironment(); - var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start); - var visited = ts.updateBlock(body, statements); - var declarations = endLexicalEnvironment(); - currentScope = savedCurrentScope; - return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; @@ -40969,52 +41356,49 @@ var ts; if (!isArrowFunction) { var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor); - statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(statements, node.body, true); if (languageVersion >= 2) { if (resolver.getNodeCheckFlags(node) & 4096) { enableSubstitutionForAsyncMethodsWithSuper(); - ts.setEmitFlags(block, 8); + ts.addEmitHelper(block, advancedAsyncSuperHelper); } else if (resolver.getNodeCheckFlags(node) & 2048) { enableSubstitutionForAsyncMethodsWithSuper(); - ts.setEmitFlags(block, 4); + ts.addEmitHelper(block, asyncSuperHelper); } } return block; } else { - return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, true)); + var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(expression); + return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements)); + } + return expression; } } - function transformConciseBodyWorker(body, forceBlockFunctionBody) { + function transformFunctionBodyWorker(body, start) { if (ts.isBlock(body)) { - return transformFunctionBodyWorker(body); + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); } else { startLexicalEnvironment(); - var visited = ts.visitNode(body, visitor, ts.isConciseBody); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); var declarations = endLexicalEnvironment(); - var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - if (forceBlockFunctionBody && !ts.isBlock(merged)) { - return ts.createBlock([ - ts.createReturn(merged) - ]); - } - else { - return merged; - } + return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); } } function getPromiseConstructor(type) { - if (type) { - var typeName = ts.getEntityNameFromTypeNode(type); - if (typeName && ts.isEntityName(typeName)) { - var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); - if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue - || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { - return typeName; - } + var typeName = type && ts.getEntityNameFromTypeNode(type); + if (typeName && ts.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { + return typeName; } } return undefined; @@ -41088,14 +41472,15 @@ var ts; || kind === 152; } function onEmitNode(emitContext, node, emitCallback) { - var savedApplicableSubstitutions = applicableSubstitutions; - var savedCurrentSuperContainer = currentSuperContainer; if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var savedCurrentSuperContainer = currentSuperContainer; currentSuperContainer = node; + previousOnEmitNode(emitContext, node, emitCallback); + currentSuperContainer = savedCurrentSuperContainer; + } + else { + previousOnEmitNode(emitContext, node, emitCallback); } - previousOnEmitNode(emitContext, node, emitCallback); - applicableSubstitutions = savedApplicableSubstitutions; - currentSuperContainer = savedCurrentSuperContainer; } function onSubstituteNode(emitContext, node) { node = previousOnSubstituteNode(emitContext, node); @@ -41118,6 +41503,33 @@ var ts; } } ts.transformES2017 = transformES2017; + function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(awaiterHelper); + var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; + return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ + ts.createThis(), + hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), + promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), + generatorFunc + ]); + } + var awaiterHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };" + }; + var asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: "\n const _super = name => super[name];" + }; + var advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" + }; })(ts || (ts = {})); var ts; (function (ts) { @@ -41131,55 +41543,52 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitor(node) { - if (node.transformFlags & 256) { - return visitorWorker(node); - } - else if (node.transformFlags & 512) { - return ts.visitEachChild(node, visitor, context); - } - else { + if ((node.transformFlags & 32) === 0) { return node; } - } - function visitorWorker(node) { switch (node.kind) { case 192: return visitBinaryExpression(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitBinaryExpression(node) { + switch (node.operatorToken.kind) { + case 61: + return visitExponentiationAssignmentExpression(node); + case 39: + return visitExponentiationExpression(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function visitExponentiationAssignmentExpression(node) { + var target; + var value; var left = ts.visitNode(node.left, visitor, ts.isExpression); var right = ts.visitNode(node.right, visitor, ts.isExpression); - if (node.operatorToken.kind === 61) { - var target = void 0; - var value = void 0; - if (ts.isElementAccessExpression(left)) { - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left); - value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left); - } - else if (ts.isPropertyAccessExpression(left)) { - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left); - value = ts.createPropertyAccess(expressionTemp, left.name, left); - } - else { - target = left; - value = left; - } - return ts.createAssignment(target, ts.createMathPow(value, right, node), node); + if (ts.isElementAccessExpression(left)) { + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left); + value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left); } - else if (node.operatorToken.kind === 39) { - return ts.createMathPow(left, right, node); + else if (ts.isPropertyAccessExpression(left)) { + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left); + value = ts.createPropertyAccess(expressionTemp, left.name, left); } else { - ts.Debug.failBadSyntaxKind(node); - return ts.visitEachChild(node, visitor, context); + target = left; + value = left; } + return ts.createAssignment(target, ts.createMathPow(value, right, node), node); + } + function visitExponentiationExpression(node) { + var left = ts.visitNode(node.left, visitor, ts.isExpression); + var right = ts.visitNode(node.right, visitor, ts.isExpression); + return ts.createMathPow(left, right, node); } } ts.transformES2016 = transformES2016; @@ -41187,7 +41596,7 @@ var ts; var ts; (function (ts) { function transformES2015(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -41213,7 +41622,11 @@ var ts; } currentSourceFile = node; currentText = node.text; - return ts.visitNode(node, visitor, ts.isSourceFile); + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + currentText = undefined; + return visited; } function visitor(node) { return saveStateAndInvoke(node, dispatcher); @@ -41252,6 +41665,38 @@ var ts; currentNode = savedCurrentNode; return visited; } + function onBeforeVisitNode(node) { + if (currentNode) { + if (ts.isBlockScope(currentNode, currentParent)) { + enclosingBlockScopeContainer = currentNode; + enclosingBlockScopeContainerParent = currentParent; + } + if (ts.isFunctionLike(currentNode)) { + enclosingFunction = currentNode; + if (currentNode.kind !== 185) { + enclosingNonArrowFunction = currentNode; + if (!(ts.getEmitFlags(currentNode) & 131072)) { + enclosingNonAsyncFunctionBody = currentNode; + } + } + } + switch (currentNode.kind) { + case 205: + enclosingVariableStatement = currentNode; + break; + case 224: + case 223: + case 174: + case 172: + case 173: + break; + default: + enclosingVariableStatement = undefined; + } + } + currentParent = currentNode; + currentNode = node; + } function returnCapturedThis(node) { return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } @@ -41259,7 +41704,7 @@ var ts; return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression; } function shouldCheckNode(node) { - return (node.transformFlags & 1024) !== 0 || + return (node.transformFlags & 64) !== 0 || node.kind === 219 || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); } @@ -41270,7 +41715,7 @@ var ts; else if (shouldCheckNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 2048 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { + else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { return ts.visitEachChild(node, visitor, context); } else { @@ -41370,14 +41815,14 @@ var ts; return visitTemplateExpression(node); case 195: return visitYieldExpression(node); + case 196: + return visitSpreadElement(node); case 96: return visitSuperKeyword(); case 195: return ts.visitEachChild(node, visitor, context); case 149: return visitMethodDeclaration(node); - case 261: - return visitSourceFileNode(node); case 205: return visitVariableStatement(node); default: @@ -41385,37 +41830,14 @@ var ts; return ts.visitEachChild(node, visitor, context); } } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 2097152)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - switch (currentNode.kind) { - case 205: - enclosingVariableStatement = currentNode; - break; - case 224: - case 223: - case 174: - case 172: - case 173: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; + function visitSourceFile(node) { + var statements = []; + startLexicalEnvironment(); + var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); + addCaptureThisForNodeIfNeeded(statements, node); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + ts.addRange(statements, endLexicalEnvironment()); + return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); } function visitSwitchStatement(node) { ts.Debug.assert(convertedLoopState !== undefined); @@ -41517,9 +41939,9 @@ var ts; statements.push(exportStatement); } var emitFlags = ts.getEmitFlags(node); - if ((emitFlags & 33554432) === 0) { + if ((emitFlags & 2097152) === 0) { statements.push(ts.createEndOfDeclarationMarker(node)); - ts.setEmitFlags(statement, emitFlags | 33554432); + ts.setEmitFlags(statement, emitFlags | 2097152); } return ts.singleOrMany(statements); } @@ -41532,15 +41954,15 @@ var ts; } var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node); var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, "_super")] : [], undefined, transformClassBody(node, extendsClauseElement)); - if (ts.getEmitFlags(node) & 524288) { - ts.setEmitFlags(classFunction, 524288); + if (ts.getEmitFlags(node) & 32768) { + ts.setEmitFlags(classFunction, 32768); } var inner = ts.createPartiallyEmittedExpression(classFunction); inner.end = node.end; - ts.setEmitFlags(inner, 49152); + ts.setEmitFlags(inner, 1536); var outer = ts.createPartiallyEmittedExpression(inner); outer.end = ts.skipTrivia(currentText, node.pos); - ts.setEmitFlags(outer, 49152); + ts.setEmitFlags(outer, 1536); return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)] : [])); @@ -41555,19 +41977,19 @@ var ts; var localName = ts.getLocalName(node); var outer = ts.createPartiallyEmittedExpression(localName); outer.end = closingBraceLocation.end; - ts.setEmitFlags(outer, 49152); + ts.setEmitFlags(outer, 1536); var statement = ts.createReturn(outer); statement.pos = closingBraceLocation.pos; - ts.setEmitFlags(statement, 49152 | 12288); + ts.setEmitFlags(statement, 1536 | 384); statements.push(statement); ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true); - ts.setEmitFlags(block, 49152); + ts.setEmitFlags(block, 1536); return block; } function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { - statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)), extendsClauseElement)); + statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement)); } } function addConstructor(statements, node, extendsClauseElement) { @@ -41575,29 +41997,27 @@ var ts; var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node); if (extendsClauseElement) { - ts.setEmitFlags(constructorFunction, 256); + ts.setEmitFlags(constructorFunction, 8); } statements.push(constructorFunction); } function transformConstructorParameters(constructor, hasSynthesizedSuper) { - if (constructor && !hasSynthesizedSuper) { - return ts.visitNodes(constructor.parameters, visitor, ts.isParameter); - } - return []; + return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) + || []; } function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { var statements = []; - startLexicalEnvironment(); + resumeLexicalEnvironment(); var statementOffset = -1; if (hasSynthesizedSuper) { - statementOffset = 1; + statementOffset = 0; } else if (constructor) { statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor); } if (constructor) { - ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, false); - ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + addDefaultValueAssignmentsIfNeeded(statements, constructor); + addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); @@ -41619,7 +42039,7 @@ var ts; ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true); if (!constructor) { - ts.setEmitFlags(block, 49152); + ts.setEmitFlags(block, 1536); } return block; } @@ -41645,7 +42065,7 @@ var ts; function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { if (!hasExtendsClause) { if (ctor) { - ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis); + addCaptureThisForNodeIfNeeded(statements, ctor); } return 0; } @@ -41654,7 +42074,7 @@ var ts; return 2; } if (hasSynthesizedSuper) { - ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); + captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); enableSubstitutionsForCapturedThis(); return 1; } @@ -41668,11 +42088,19 @@ var ts; superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); } } - if (superCallExpression && statementOffset === ctorStatements.length - 1) { - statements.push(ts.createReturn(superCallExpression)); + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 | 32768))) { + var returnStatement = ts.createReturn(superCallExpression); + if (superCallExpression.kind !== 192 + || superCallExpression.left.kind !== 179) { + ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); + } + ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); + statements.push(returnStatement); return 2; } - ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement); + captureThisForNode(statements, ctor, superCallExpression, firstStatement); if (superCallExpression) { return 1; } @@ -41680,7 +42108,7 @@ var ts; } function createDefaultSuperCallOrThis() { var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 128); + ts.setEmitFlags(actualThis, 4); var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); return ts.createLogicalOr(superCall, actualThis); } @@ -41698,6 +42126,86 @@ var ts; return node; } } + function shouldAddDefaultValueAssignments(node) { + return (node.transformFlags & 131072) !== 0; + } + function addDefaultValueAssignmentsIfNeeded(statements, node) { + if (!shouldAddDefaultValueAssignments(node)) { + return; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + var name_38 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + if (dotDotDotToken) { + continue; + } + if (ts.isBindingPattern(name_38)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name_38, initializer); + } + else if (initializer) { + addDefaultValueAssignmentForInitializer(statements, parameter, name_38, initializer); + } + } + } + function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) { + var temp = ts.getGeneratedNameForNode(parameter); + if (name.elements.length > 0) { + statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, temp))), 524288)); + } + else if (initializer) { + statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288)); + } + } + function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { + initializer = ts.visitNode(initializer, visitor, ts.isExpression); + var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter)) + ], parameter), 1 | 32 | 384), undefined, parameter); + statement.startsOnNewLine = true; + ts.setEmitFlags(statement, 384 | 32 | 524288); + statements.push(statement); + } + function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { + return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper; + } + function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { + var parameter = ts.lastOrUndefined(node.parameters); + if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { + return; + } + var declarationName = ts.getMutableClone(parameter.name); + ts.setEmitFlags(declarationName, 48); + var expressionName = ts.getSynthesizedClone(parameter.name); + var restIndex = node.parameters.length - 1; + var temp = ts.createLoopVariable(); + statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([])) + ]), parameter), 524288)); + var forStatement = ts.createFor(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex)) + ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([ + ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 + ? temp + : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter)) + ])); + ts.setEmitFlags(forStatement, 524288); + ts.startOnNewLine(forStatement); + statements.push(forStatement); + } + function addCaptureThisForNodeIfNeeded(statements, node) { + if (node.transformFlags & 32768 && node.kind !== 185) { + captureThisForNode(statements, node, ts.createThis()); + } + } + function captureThisForNode(statements, node, initializer, originalStatement) { + enableSubstitutionsForCapturedThis(); + var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_this", undefined, initializer) + ]), originalStatement); + ts.setEmitFlags(captureThisStatement, 1536 | 524288); + ts.setSourceMapRange(captureThisStatement, node); + statements.push(captureThisStatement); + } function addClassMembers(statements, node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; @@ -41729,33 +42237,34 @@ var ts; function transformClassMethodDeclarationToStatement(receiver, member) { var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); - var func = transformFunctionLikeToExpression(member, member, undefined); - ts.setEmitFlags(func, 49152); - ts.setSourceMapRange(func, sourceMapRange); - var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name), func), member); + var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name); + var memberFunction = transformFunctionLikeToExpression(member, member, undefined); + ts.setEmitFlags(memberFunction, 1536); + ts.setSourceMapRange(memberFunction, sourceMapRange); + var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); - ts.setEmitFlags(statement, 1536); + ts.setEmitFlags(statement, 48); return statement; } function transformAccessorsToStatement(receiver, accessors) { var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor)); - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); return statement; } function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; var target = ts.getMutableClone(receiver); - ts.setEmitFlags(target, 49152 | 1024); + ts.setEmitFlags(target, 1536 | 32); ts.setSourceMapRange(target, firstAccessor.name); var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName)); - ts.setEmitFlags(propertyName, 49152 | 512); + ts.setEmitFlags(propertyName, 1536 | 16); ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); - ts.setEmitFlags(getterFunction, 16384); + ts.setEmitFlags(getterFunction, 512); var getter = ts.createPropertyAssignment("get", getterFunction); ts.setCommentRange(getter, ts.getCommentRange(getAccessor)); properties.push(getter); @@ -41763,7 +42272,7 @@ var ts; if (setAccessor) { var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); - ts.setEmitFlags(setterFunction, 16384); + ts.setEmitFlags(setterFunction, 512); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); properties.push(setter); @@ -41780,28 +42289,91 @@ var ts; return call; } function visitArrowFunction(node) { - if (node.transformFlags & 262144) { + if (node.transformFlags & 16384) { enableSubstitutionsForCapturedThis(); } - var func = transformFunctionLikeToExpression(node, node, undefined); - ts.setEmitFlags(func, 256); + var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node); + ts.setOriginalNode(func, node); + ts.setEmitFlags(func, 8); return func; } function visitFunctionExpression(node) { - return transformFunctionLikeToExpression(node, node, node.name); + return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + ? transformFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitFunctionDeclaration(node) { - return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis), node), node); + return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + ? transformFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function transformFunctionLikeToExpression(node, location, name) { var savedContainingNonArrowFunction = enclosingNonArrowFunction; if (node.kind !== 185) { enclosingNonArrowFunction = node; } - var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location), node); + var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node); enclosingNonArrowFunction = savedContainingNonArrowFunction; return expression; } + function transformFunctionBody(node) { + var multiLine = false; + var singleLine = false; + var statementsLocation; + var closeBraceLocation; + var statements = []; + var body = node.body; + var statementOffset; + resumeLexicalEnvironment(); + if (ts.isBlock(body)) { + statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); + } + addCaptureThisForNodeIfNeeded(statements, node); + addDefaultValueAssignmentsIfNeeded(statements, node); + addRestParameterIfNeeded(statements, node, false); + if (!multiLine && statements.length > 0) { + multiLine = true; + } + if (ts.isBlock(body)) { + statementsLocation = body.statements; + ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); + if (!multiLine && body.multiLine) { + multiLine = true; + } + } + else { + ts.Debug.assert(node.kind === 185); + statementsLocation = ts.moveRangeEnd(body, -1); + var equalsGreaterThanToken = node.equalsGreaterThanToken; + if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { + if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { + singleLine = true; + } + else { + multiLine = true; + } + } + var expression = ts.visitNode(body, visitor, ts.isExpression); + var returnStatement = ts.createReturn(expression, body); + ts.setEmitFlags(returnStatement, 384 | 32 | 1024); + statements.push(returnStatement); + closeBraceLocation = body; + } + var lexicalEnvironment = context.endLexicalEnvironment(); + ts.addRange(statements, lexicalEnvironment); + if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { + multiLine = true; + } + var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine); + if (!multiLine && singleLine) { + ts.setEmitFlags(block, 1); + } + if (closeBraceLocation) { + ts.setTokenSourceMapRange(block, 17, closeBraceLocation); + } + ts.setOriginalNode(block, node.body); + return block; + } function visitExpressionStatement(node) { switch (node.expression.kind) { case 183: @@ -41812,19 +42384,20 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitParenthesizedExpression(node, needsDestructuringValue) { - if (needsDestructuringValue) { + if (!needsDestructuringValue) { switch (node.expression.kind) { case 183: - return ts.createParen(visitParenthesizedExpression(node.expression, true), node); + return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); case 192: - return ts.createParen(visitBinaryExpression(node.expression, true), node); + return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } return ts.visitEachChild(node, visitor, context); } function visitBinaryExpression(node, needsDestructuringValue) { - ts.Debug.assert(ts.isDestructuringAssignment(node)); - return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor); + if (ts.isDestructuringAssignment(node)) { + return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue); + } } function visitVariableStatement(node) { if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) { @@ -41835,7 +42408,7 @@ var ts; if (decl.initializer) { var assignment = void 0; if (ts.isBindingPattern(decl.name)) { - assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, undefined, visitor); + assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0); } else { assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression)); @@ -41862,7 +42435,7 @@ var ts; var declarationList = ts.createVariableDeclarationList(declarations, node); ts.setOriginalNode(declarationList, node); ts.setCommentRange(declarationList, node); - if (node.transformFlags & 67108864 + if (node.transformFlags & 8388608 && (ts.isBindingPattern(node.declarations[0].name) || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { var firstDeclaration = ts.firstOrUndefined(declarations); @@ -41895,17 +42468,17 @@ var ts; return visitVariableDeclaration(node); } if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) { - var clone_5 = ts.getMutableClone(node); - clone_5.initializer = ts.createVoidZero(); - return clone_5; + var clone_3 = ts.getMutableClone(node); + clone_3.initializer = ts.createVoidZero(); + return clone_3; } return ts.visitEachChild(node, visitor, context); } function visitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - var recordTempVariablesInLine = !enclosingVariableStatement - || !ts.hasModifier(enclosingVariableStatement, 1); - return ts.flattenVariableDestructuring(node, undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration); + var hoistTempVariables = enclosingVariableStatement + && ts.hasModifier(enclosingVariableStatement, 1); + return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables); } return ts.visitEachChild(node, visitor, context); } @@ -41944,7 +42517,69 @@ var ts; return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); } function convertForOfToFor(node, convertedLoopBodyStatements) { - return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, false); + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var initializer = node.initializer; + var statements = []; + var counter = ts.createLoopVariable(); + var rhsReference = expression.kind === 70 + ? ts.createUniqueName(expression.text) + : ts.createTempVariable(undefined); + var elementAccess = ts.createElementAccess(rhsReference, counter); + if (ts.isVariableDeclarationList(initializer)) { + if (initializer.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); + if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { + var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess); + var declarationList = ts.createVariableDeclarationList(declarations, initializer); + ts.setOriginalNode(declarationList, initializer); + var firstDeclaration = declarations[0]; + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + statements.push(ts.createVariableStatement(undefined, declarationList)); + } + else { + statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter)) + ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1))); + } + } + else { + var assignment = ts.createAssignment(initializer, elementAccess); + if (ts.isDestructuringAssignment(assignment)) { + statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0))); + } + else { + assignment.end = initializer.end; + statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1))); + } + } + var bodyLocation; + var statementsLocation; + if (convertedLoopBodyStatements) { + ts.addRange(statements, convertedLoopBodyStatements); + } + else { + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + if (ts.isBlock(statement)) { + ts.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; + } + else { + statements.push(statement); + } + } + ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression)); + var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation); + ts.setEmitFlags(body, 48 | 384); + var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)), + ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression) + ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node); + ts.setEmitFlags(forStatement, 256); + return forStatement; } function visitObjectLiteralExpression(node) { var properties = node.properties; @@ -41952,7 +42587,7 @@ var ts; var numInitialProperties = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 134217728 + if (property.transformFlags & 16777216 || property.name.kind === 142) { numInitialProperties = i; break; @@ -41961,7 +42596,7 @@ var ts; ts.Debug.assert(numInitialProperties !== numProperties); var temp = ts.createTempVariable(hoistVariableDeclaration); var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 524288)); + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); if (node.multiLine) { assignment.startsOnNewLine = true; } @@ -42038,30 +42673,35 @@ var ts; convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; } } + startLexicalEnvironment(); var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { - var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, 1, statements_3); - loopBody = ts.createBlock(statements_3, undefined, true); + if (loopOutParameters.length || lexicalEnvironment) { + var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, undefined, true); } if (!ts.isBlock(loopBody)) { loopBody = ts.createBlock([loopBody], undefined, true); } var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152) !== 0 - && (node.statement.transformFlags & 134217728) !== 0; + && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0 + && (node.statement.transformFlags & 16777216) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { - loopBodyFlags |= 256; + loopBodyFlags |= 8; } if (isAsyncBlockContainingAwait) { - loopBodyFlags |= 2097152; + loopBodyFlags |= 131072; } var convertedLoopVariable = ts.createVariableStatement(undefined, ts.setEmitFlags(ts.createVariableDeclarationList([ ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(undefined, isAsyncBlockContainingAwait ? ts.createToken(38) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags)) - ]), 16777216)); + ]), 1048576)); var statements = [convertedLoopVariable]; var extraVariableDeclarations; if (currentState.argumentsName) { @@ -42278,7 +42918,7 @@ var ts; ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); var temp = ts.createTempVariable(undefined); var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenVariableDestructuring(node.variableDeclaration, temp, visitor); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); var destructure = ts.createVariableStatement(undefined, list); return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); @@ -42290,7 +42930,7 @@ var ts; function visitMethodDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined); - ts.setEmitFlags(functionExpression, 16384 | ts.getEmitFlags(functionExpression)); + ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression)); return ts.createPropertyAssignment(node.name, functionExpression, node); } function visitShorthandPropertyAssignment(node) { @@ -42311,10 +42951,10 @@ var ts; function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) { var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; if (node.expression.kind === 96) { - ts.setEmitFlags(thisArg, 128); + ts.setEmitFlags(thisArg, 4); } var resultingCall; - if (node.transformFlags & 8388608) { + if (node.transformFlags & 524288) { resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); } else { @@ -42322,7 +42962,7 @@ var ts; } if (node.expression.kind === 96) { var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 128); + ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); return assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) @@ -42331,7 +42971,7 @@ var ts; return resultingCall; } function visitNewExpression(node) { - ts.Debug.assert((node.transformFlags & 8388608) !== 0); + ts.Debug.assert((node.transformFlags & 524288) !== 0); var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); } @@ -42359,6 +42999,9 @@ var ts; function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine); } + function visitSpreadElement(node) { + return ts.visitNode(node.expression, visitor, ts.isExpression); + } function visitExpressionOfSpread(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); } @@ -42436,18 +43079,6 @@ var ts; ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } - function visitSourceFileNode(node) { - var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1]; - var statements = []; - startLexicalEnvironment(); - ts.addRange(statements, prologue); - ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis); - ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement)); - ts.addRange(statements, endLexicalEnvironment()); - var clone = ts.getMutableClone(node); - clone.statements = ts.createNodeArray(statements, node.statements); - return clone; - } function onEmitNode(emitContext, node, emitCallback) { var savedEnclosingFunction = enclosingFunction; if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) { @@ -42527,7 +43158,7 @@ var ts; function substituteThisKeyword(node) { if (enabledSubstitutions & 1 && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 256) { + && ts.getEmitFlags(enclosingFunction) & 8) { return ts.createIdentifier("_this", node); } return node; @@ -42540,8 +43171,7 @@ var ts; if (!constructor || !hasExtendsClause) { return false; } - var parameter = ts.singleOrUndefined(constructor.parameters); - if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) { + if (ts.some(constructor.parameters)) { return false; } var statement = ts.firstOrUndefined(constructor.body.statements); @@ -42561,10 +43191,23 @@ var ts; return false; } var expression = callArgument.expression; - return ts.isIdentifier(expression) && expression === parameter.name; + return ts.isIdentifier(expression) && expression.text === "arguments"; } } ts.transformES2015 = transformES2015; + function createExtendsHelper(context, name) { + context.requestEmitHelper(extendsHelper); + return ts.createCall(ts.getHelperName("__extends"), undefined, [ + name, + ts.createIdentifier("_super") + ]); + } + var extendsHelper = { + name: "typescript:extends", + scoped: false, + priority: 0, + text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + }; })(ts || (ts = {})); var ts; (function (ts) { @@ -42576,7 +43219,7 @@ var ts; _a[7] = "endfinally", _a)); function transformGenerators(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var resolver = context.getEmitResolver(); @@ -42610,15 +43253,15 @@ var ts; var withBlockStack; return transformSourceFile; function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { + if (ts.isDeclarationFile(node) + || (node.transformFlags & 512) === 0) { return node; } - if (node.transformFlags & 8192) { - currentSourceFile = node; - node = ts.visitEachChild(node, visitor, context); - currentSourceFile = undefined; - } - return node; + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function visitor(node) { var transformFlags = node.transformFlags; @@ -42628,10 +43271,10 @@ var ts; else if (inGeneratorFunctionBody) { return visitJavaScriptInGeneratorFunctionBody(node); } - else if (transformFlags & 4096) { + else if (transformFlags & 256) { return visitGenerator(node); } - else if (transformFlags & 8192) { + else if (transformFlags & 512) { return ts.visitEachChild(node, visitor, context); } else { @@ -42674,10 +43317,10 @@ var ts; case 216: return visitReturnStatement(node); default: - if (node.transformFlags & 134217728) { + if (node.transformFlags & 16777216) { return visitJavaScriptContainingYield(node); } - else if (node.transformFlags & (8192 | 268435456)) { + else if (node.transformFlags & (512 | 33554432)) { return ts.visitEachChild(node, visitor, context); } else { @@ -42719,8 +43362,8 @@ var ts; } } function visitFunctionDeclaration(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -42740,8 +43383,8 @@ var ts; } } function visitFunctionExpression(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -42792,7 +43435,7 @@ var ts; operationArguments = undefined; operationLocations = undefined; state = ts.createTempVariable(undefined); - startLexicalEnvironment(); + resumeLexicalEnvironment(); var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); @@ -42814,12 +43457,12 @@ var ts; return ts.createBlock(statements, body, body.multiLine); } function visitVariableStatement(node) { - if (node.transformFlags & 134217728) { + if (node.transformFlags & 16777216) { transformAndEmitVariableDeclarationList(node.declarationList); return undefined; } else { - if (ts.getEmitFlags(node) & 8388608) { + if (ts.getEmitFlags(node) & 524288) { return node; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { @@ -42896,10 +43539,10 @@ var ts; else if (node.operatorToken.kind === 25) { return visitCommaExpression(node); } - var clone_6 = ts.getMutableClone(node); - clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_6; + var clone_4 = ts.getMutableClone(node); + clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_4; } return ts.visitEachChild(node, visitor, context); } @@ -42964,26 +43607,30 @@ var ts; return createGeneratorResume(); } function visitArrayLiteralExpression(node) { - return visitElements(node.elements, node.multiLine); + return visitElements(node.elements, undefined, undefined, node.multiLine); } - function visitElements(elements, _multiLine) { + function visitElements(elements, leadingElement, location, multiLine) { var numInitialElements = countInitialNodesWithoutYield(elements); var temp = declareLocal(); var hasAssignedTemp = false; if (numInitialElements > 0) { - emitAssignment(temp, ts.createArrayLiteral(ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements))); + var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); + emitAssignment(temp, ts.createArrayLiteral(leadingElement + ? [leadingElement].concat(initialElements) : initialElements)); + leadingElement = undefined; hasAssignedTemp = true; } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); return hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)]) - : ts.createArrayLiteral(expressions); + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine); function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { emitAssignment(temp, hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)]) - : ts.createArrayLiteral(expressions)); + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine)); hasAssignedTemp = true; + leadingElement = undefined; expressions = []; } expressions.push(ts.visitNode(element, visitor, ts.isExpression)); @@ -43017,10 +43664,10 @@ var ts; } function visitElementAccessExpression(node) { if (containsYield(node.argumentExpression)) { - var clone_7 = ts.getMutableClone(node); - clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_7; + var clone_5 = ts.getMutableClone(node); + clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -43034,7 +43681,7 @@ var ts; function visitNewExpression(node) { if (ts.forEach(node.arguments, containsYield)) { var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)), undefined, [], node), node); + return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node); } return ts.visitEachChild(node, visitor, context); } @@ -43476,7 +44123,7 @@ var ts; } } function containsYield(node) { - return node && (node.transformFlags & 134217728) !== 0; + return node && (node.transformFlags & 16777216) !== 0; } function countInitialNodesWithoutYield(nodes) { var numNodes = nodes.length; @@ -43506,12 +44153,12 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_37) { - var clone_8 = ts.getMutableClone(name_37); - ts.setSourceMapRange(clone_8, node); - ts.setCommentRange(clone_8, node); - return clone_8; + var name_39 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_39) { + var clone_6 = ts.getMutableClone(name_39); + ts.setSourceMapRange(clone_6, node); + ts.setCommentRange(clone_6, node); + return clone_6; } } } @@ -43902,10 +44549,7 @@ var ts; currentExceptionBlock = undefined; withBlockStack = undefined; var buildResult = buildStatements(); - return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), undefined, [ - ts.createThis(), - ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 4194304) - ]); + return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144)); } function buildStatements() { if (operations) { @@ -44168,6 +44812,16 @@ var ts; } } ts.transformGenerators = transformGenerators; + function createGeneratorHelper(context, body) { + context.requestEmitHelper(generatorHelper); + return ts.createCall(ts.getHelperName("__generator"), undefined, [ts.createThis(), body]); + } + var generatorHelper = { + name: "typescript:generator", + scoped: false, + priority: 6, + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + }; var _a; })(ts || (ts = {})); var ts; @@ -44224,7 +44878,7 @@ var ts; _a[ts.ModuleKind.AMD] = transformAMDModule, _a[ts.ModuleKind.UMD] = transformUMDModule, _a)); - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var host = context.getEmitHost(); @@ -44253,7 +44907,7 @@ var ts; return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver); + currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; var updated = transformModule(node); currentSourceFile = undefined; @@ -44264,12 +44918,13 @@ var ts; startLexicalEnvironment(); var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, false); var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); if (currentModuleInfo.hasExportStarsToExportValues) { - ts.setEmitFlags(updated, 2 | ts.getEmitFlags(node)); + ts.addEmitHelper(updated, exportStarHelper); } return updated; } @@ -44279,8 +44934,7 @@ var ts; return transformAsynchronousModule(node, define, moduleName, true); } function transformUMDModule(node) { - var define = ts.createIdentifier("define"); - ts.setEmitFlags(define, 16); + var define = ts.createRawExpression(umdHelper); return transformAsynchronousModule(node, define, undefined, false); } function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { @@ -44317,7 +44971,7 @@ var ts; var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); if (includeNonAmdDependencies && importAliasName) { - ts.setEmitFlags(importAliasName, 128); + ts.setEmitFlags(importAliasName, 4); aliasedModuleNames.push(externalModuleName); importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName)); } @@ -44331,12 +44985,13 @@ var ts; startLexicalEnvironment(); var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, true); var body = ts.createBlock(statements, undefined, true); if (currentModuleInfo.hasExportStarsToExportValues) { - ts.setEmitFlags(body, 2); + ts.addEmitHelper(body, exportStarHelper); } return body; } @@ -44344,12 +44999,12 @@ var ts; if (currentModuleInfo.exportEquals) { if (emitAsReturn) { var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 12288 | 49152); + ts.setEmitFlags(statement, 384 | 1536); statements.push(statement); } else { var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); statements.push(statement); } } @@ -44370,9 +45025,9 @@ var ts; return visitFunctionDeclaration(node); case 226: return visitClassDeclaration(node); - case 294: - return visitMergeDeclarationMarker(node); case 295: + return visitMergeDeclarationMarker(node); + case 296: return visitEndOfDeclarationMarker(node); default: return node; @@ -44563,7 +45218,7 @@ var ts; } function transformInitializedVariable(node) { if (ts.isBindingPattern(node.name)) { - return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression); + return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression); } else { return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, node.name), node.initializer); @@ -44577,7 +45232,7 @@ var ts; return node; } function hasAssociatedEndOfDeclarationMarker(node) { - return (ts.getEmitFlags(node) & 33554432) !== 0; + return (ts.getEmitFlags(node) & 2097152) !== 0; } function visitEndOfDeclarationMarker(node) { var id = ts.getOriginalNodeId(node); @@ -44697,7 +45352,7 @@ var ts; var statement = ts.createStatement(createExportExpression(name, value), location); ts.startOnNewLine(statement); if (!allowComments) { - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); } return statement; } @@ -44764,6 +45419,13 @@ var ts; return node; } function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + return node; + } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); if (exportContainer && exportContainer.kind === 261) { @@ -44775,8 +45437,8 @@ var ts; return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_38 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), node); + var name_40 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_40), node); } } } @@ -44835,6 +45497,12 @@ var ts; var _a; } ts.transformModule = transformModule; + var exportStarHelper = { + name: "typescript:export-star", + scoped: true, + text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" + }; + var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); var ts; (function (ts) { @@ -44873,22 +45541,25 @@ var ts; var id = ts.getOriginalNodeId(node); currentSourceFile = node; enclosingBlockScopedContainer = node; - moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver); + moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); contextObject = ts.createUniqueName("context"); var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); + var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ ts.createParameter(undefined, undefined, undefined, exportFunction), ts.createParameter(undefined, undefined, undefined, contextObject) - ], undefined, createSystemModuleBody(node, dependencyGroups)); + ], undefined, moduleBodyBlock); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray([ + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.createNodeArray([ ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), undefined, moduleName ? [moduleName, dependencies, moduleBodyFunction] : [dependencies, moduleBodyFunction])) - ], node.statements)); - ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1); + ], node.statements)), 1024); + if (!(compilerOptions.outFile || compilerOptions.out)) { + ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); + } if (noSubstitution) { noSubstitutionMap[id] = noSubstitution; noSubstitution = undefined; @@ -44929,6 +45600,7 @@ var ts; statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) ]))); + ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true); var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); ts.addRange(statements, hoistedStatements); ts.addRange(statements, endLexicalEnvironment()); @@ -44937,9 +45609,7 @@ var ts; ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true))) ]), true))); - var body = ts.createBlock(statements, undefined, true); - ts.setEmitFlags(body, 1); - return body; + return ts.createBlock(statements, undefined, true); } function addExportStarIfNeeded(statements) { if (!moduleInfo.hasExportStarsToExportValues) { @@ -44999,7 +45669,7 @@ var ts; var exports = ts.createIdentifier("exports"); var condition = ts.createStrictInequality(n, ts.createLiteral("default")); if (localNames) { - condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n))); + condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), undefined, [n]))); } return ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(undefined, undefined, undefined, m)], undefined, ts.createBlock([ ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ @@ -45008,7 +45678,7 @@ var ts; ts.createForIn(ts.createVariableDeclarationList([ ts.createVariableDeclaration(n, undefined) ]), m, ts.createBlock([ - ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32) + ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1) ])), ts.createStatement(ts.createCall(exportFunction, undefined, [exports])) ], undefined, true)); @@ -45180,14 +45850,14 @@ var ts; } } function shouldHoistVariableDeclarationList(node) { - return (ts.getEmitFlags(node) & 16777216) === 0 + return (ts.getEmitFlags(node) & 1048576) === 0 && (enclosingBlockScopedContainer.kind === 261 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; return ts.isBindingPattern(node.name) - ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor) + ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, false, createAssignment) : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); } function createExportedVariableAssignment(name, value, location) { @@ -45211,7 +45881,7 @@ var ts; return node; } function hasAssociatedEndOfDeclarationMarker(node) { - return (ts.getEmitFlags(node) & 33554432) !== 0; + return (ts.getEmitFlags(node) & 2097152) !== 0; } function visitEndOfDeclarationMarker(node) { var id = ts.getOriginalNodeId(node); @@ -45328,7 +45998,7 @@ var ts; var statement = ts.createStatement(createExportExpression(name, value)); ts.startOnNewLine(statement); if (!allowComments) { - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); } return statement; } @@ -45372,9 +46042,9 @@ var ts; return visitCatchClause(node); case 204: return visitBlock(node); - case 294: - return visitMergeDeclarationMarker(node); case 295: + return visitMergeDeclarationMarker(node); + case 296: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -45464,11 +46134,11 @@ var ts; return node; } function destructuringVisitor(node) { - if (node.transformFlags & 16384 + if (node.transformFlags & 1024 && node.kind === 192) { return visitDestructuringAssignment(node); } - else if (node.transformFlags & 32768) { + else if (node.transformFlags & 2048) { return ts.visitEachChild(node, destructuringVisitor, context); } else { @@ -45477,7 +46147,7 @@ var ts; } function visitDestructuringAssignment(node) { if (hasExportedReferenceInDestructuringTarget(node.left)) { - return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, destructuringVisitor); + return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, true); } return ts.visitEachChild(node, destructuringVisitor, context); } @@ -45559,6 +46229,13 @@ var ts; return node; } function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + return node; + } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { @@ -45646,13 +46323,30 @@ var ts; (function (ts) { function transformES2015Module(context) { var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.enableEmitNotification(261); + context.enableSubstitution(70); + var currentSourceFile; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - return ts.visitEachChild(node, visitor, context); + var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); + if (externalHelpersModuleName) { + var statements = []; + var statementOffset = ts.addPrologueDirectives(statements, node.statements); + ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + } + else { + return ts.visitEachChild(node, visitor, context); + } } return node; } @@ -45668,6 +46362,32 @@ var ts; function visitExportAssignment(node) { return node.isExportEquals ? undefined : node; } + function onEmitNode(emitContext, node, emitCallback) { + if (ts.isSourceFile(node)) { + currentSourceFile = node; + previousOnEmitNode(emitContext, node, emitCallback); + currentSourceFile = undefined; + } + else { + previousOnEmitNode(emitContext, node, emitCallback); + } + } + function onSubstituteNode(emitContext, node) { + node = previousOnSubstituteNode(emitContext, node); + if (ts.isIdentifier(node) && emitContext === 1) { + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + } + return node; + } } ts.transformES2015Module = transformES2015Module; })(ts || (ts = {})); @@ -45711,21 +46431,27 @@ var ts; } ts.getTransformers = getTransformers; function transformFiles(resolver, host, sourceFiles, transformers) { + var enabledSyntaxKindFeatures = new Array(298); + var lexicalEnvironmentDisabled = false; + var lexicalEnvironmentVariableDeclarations; + var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; var lexicalEnvironmentFunctionDeclarationsStack = []; - var enabledSyntaxKindFeatures = new Array(296); var lexicalEnvironmentStackOffset = 0; - var hoistedVariableDeclarations; - var hoistedFunctionDeclarations; - var lexicalEnvironmentDisabled; + var lexicalEnvironmentSuspended = false; + var emitHelpers; var context = { getCompilerOptions: function () { return host.getCompilerOptions(); }, getEmitResolver: function () { return resolver; }, getEmitHost: function () { return host; }, + startLexicalEnvironment: startLexicalEnvironment, + suspendLexicalEnvironment: suspendLexicalEnvironment, + resumeLexicalEnvironment: resumeLexicalEnvironment, + endLexicalEnvironment: endLexicalEnvironment, hoistVariableDeclaration: hoistVariableDeclaration, hoistFunctionDeclaration: hoistFunctionDeclaration, - startLexicalEnvironment: startLexicalEnvironment, - endLexicalEnvironment: endLexicalEnvironment, + requestEmitHelper: requestEmitHelper, + readEmitHelpers: readEmitHelpers, onSubstituteNode: function (_emitContext, node) { return node; }, enableSubstitution: enableSubstitution, isSubstitutionEnabled: isSubstitutionEnabled, @@ -45752,7 +46478,7 @@ var ts; } function isSubstitutionEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0 - && (ts.getEmitFlags(node) & 128) === 0; + && (ts.getEmitFlags(node) & 4) === 0; } function emitNodeWithSubstitution(emitContext, node, emitCallback) { if (node) { @@ -45771,7 +46497,7 @@ var ts; } function isEmitNotificationEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0 - || (ts.getEmitFlags(node) & 64) !== 0; + || (ts.getEmitFlags(node) & 2) !== 0; } function emitNodeWithNotification(emitContext, node, emitCallback) { if (node) { @@ -45786,39 +46512,51 @@ var ts; function hoistVariableDeclaration(name) { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); var decl = ts.createVariableDeclaration(name); - if (!hoistedVariableDeclarations) { - hoistedVariableDeclarations = [decl]; + if (!lexicalEnvironmentVariableDeclarations) { + lexicalEnvironmentVariableDeclarations = [decl]; } else { - hoistedVariableDeclarations.push(decl); + lexicalEnvironmentVariableDeclarations.push(decl); } } function hoistFunctionDeclaration(func) { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = [func]; + if (!lexicalEnvironmentFunctionDeclarations) { + lexicalEnvironmentFunctionDeclarations = [func]; } else { - hoistedFunctionDeclarations.push(func); + lexicalEnvironmentFunctionDeclarations.push(func); } } function startLexicalEnvironment() { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); - lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedVariableDeclarations; - lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedFunctionDeclarations; + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); + lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations; + lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations; lexicalEnvironmentStackOffset++; - hoistedVariableDeclarations = undefined; - hoistedFunctionDeclarations = undefined; + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + } + function suspendLexicalEnvironment() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); + lexicalEnvironmentSuspended = true; + } + function resumeLexicalEnvironment() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); + lexicalEnvironmentSuspended = false; } function endLexicalEnvironment() { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; - if (hoistedVariableDeclarations || hoistedFunctionDeclarations) { - if (hoistedFunctionDeclarations) { - statements = hoistedFunctionDeclarations.slice(); + if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { + if (lexicalEnvironmentFunctionDeclarations) { + statements = lexicalEnvironmentFunctionDeclarations.slice(); } - if (hoistedVariableDeclarations) { - var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(hoistedVariableDeclarations)); + if (lexicalEnvironmentVariableDeclarations) { + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations)); if (!statements) { statements = [statement]; } @@ -45828,10 +46566,25 @@ var ts; } } lexicalEnvironmentStackOffset--; - hoistedVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; - hoistedFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + if (lexicalEnvironmentStackOffset === 0) { + lexicalEnvironmentVariableDeclarationsStack = []; + lexicalEnvironmentFunctionDeclarationsStack = []; + } return statements; } + function requestEmitHelper(helper) { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); + emitHelpers = ts.append(emitHelpers, helper); + } + function readEmitHelpers() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + var helpers = emitHelpers; + emitHelpers = undefined; + return helpers; + } } ts.transformFiles = transformFiles; var _a; @@ -45966,6 +46719,7 @@ var ts; writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -46086,15 +46840,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { - var node = nodes_2[_i]; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { - var node = nodes_3[_i]; + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -46109,7 +46863,7 @@ var ts; } function writeJsDocComments(declaration) { if (declaration) { - var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText); + var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText); ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); ts.emitComments(currentText, currentLineMap, writer, jsDocComments, false, true, newLine, ts.writeCommentRange); } @@ -46296,9 +47050,9 @@ var ts; var count = 0; while (true) { count++; - var name_39 = baseName + "_" + count; - if (!(name_39 in currentIdentifiers)) { - return name_39; + var name_41 = baseName + "_" + count; + if (!(name_41 in currentIdentifiers)) { + return name_41; } } } @@ -46692,6 +47446,9 @@ var ts; case 225: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; + case 228: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; + break; default: ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); } @@ -46785,7 +47542,10 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false); + var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); + if (interfaceExtendsTypes && interfaceExtendsTypes.length) { + emitHeritageClause(interfaceExtendsTypes, false); + } write(" {"); writeLine(); increaseIndent(); @@ -47181,6 +47941,10 @@ var ts; return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 155: + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; case 149: case 148: if (ts.hasModifier(node.parent, 32)) { @@ -47503,12 +48267,12 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 292 - && (emitFlags & 512) === 0 + if (node.kind !== 293 + && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); } - if (emitFlags & 2048) { + if (emitFlags & 64) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -47516,8 +48280,8 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 292 - && (emitFlags & 1024) === 0 + if (node.kind !== 293 + && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); } @@ -47531,13 +48295,13 @@ var ts; var emitFlags = emitNode && emitNode.flags; var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos); - if ((emitFlags & 4096) === 0 && tokenPos >= 0) { + if ((emitFlags & 128) === 0 && tokenPos >= 0) { emitPos(tokenPos); } tokenPos = emitCallback(token, tokenPos); if (range) tokenPos = range.end; - if ((emitFlags & 8192) === 0 && tokenPos >= 0) { + if ((emitFlags & 256) === 0 && tokenPos >= 0) { emitPos(tokenPos); } return tokenPos; @@ -47565,7 +48329,7 @@ var ts; return; } encodeLastRecordedSourceMapSpan(); - return ts.stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, @@ -47647,7 +48411,7 @@ var ts; var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end; var emitFlags = ts.getEmitFlags(node); if ((pos < 0 && end < 0) || (pos === end)) { - if (emitFlags & 65536) { + if (emitFlags & 2048) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -47660,9 +48424,9 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 292; - var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0; - var skipTrailingComments = end < 0 || (emitFlags & 32768) !== 0; + var isEmittedNode = node.kind !== 293; + var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; + var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { emitLeadingComments(pos, isEmittedNode); } @@ -47681,7 +48445,7 @@ var ts; if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & 65536) { + if (emitFlags & 2048) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -47710,15 +48474,15 @@ var ts; } var pos = detachedRange.pos, end = detachedRange.end; var emitFlags = ts.getEmitFlags(node); - var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0; - var skipTrailingComments = disabled || end < 0 || (emitFlags & 32768) !== 0; + var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; + var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { emitDetachedCommentsAndUpdateCommentsInfo(detachedRange); } if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments"); } - if (emitFlags & 65536 && !disabled) { + if (emitFlags & 2048 && !disabled) { disabled = true; emitCallback(node); disabled = false; @@ -47731,6 +48495,9 @@ var ts; } if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); @@ -47879,18 +48646,6 @@ var ts; function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { var delimiters = createDelimiterMap(); var brackets = createBracketsMap(); - var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; - var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; - var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};"; - var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; - var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};"; - var generatorHelper = "\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};"; - var exportStarHelper = "\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}"; - var umdHelper = "\n(function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n})"; - var superHelper = "\nconst _super = name => super[name];"; - var advancedSuperHelper = "\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"; var compilerOptions = host.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); @@ -47912,12 +48667,7 @@ var ts; var currentSourceFile; var currentText; var currentFileIdentifiers; - var extendsEmitted; - var assignEmitted; - var restEmitted; - var decorateEmitted; - var paramEmitted; - var awaiterEmitted; + var bundledHelpers; var isOwnFileEmit; var emitSkipped = false; var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); @@ -47966,11 +48716,12 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNameSet = ts.createMap(); + bundledHelpers = isBundledEmit ? ts.createMap() : undefined; isOwnFileEmit = !isBundledEmit; if (isBundledEmit && moduleKind) { for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { var sourceFile = sourceFiles_5[_a]; - emitEmitHelpers(sourceFile); + emitHelpers(sourceFile, true); } } ts.forEach(sourceFiles, printSourceFile); @@ -47980,23 +48731,18 @@ var ts; write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); } if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false); + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); } if (sourceMapDataList) { sourceMapDataList.push(sourceMap.getSourceMapData()); } - ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM); + ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); sourceMap.reset(); comments.reset(); writer.reset(); tempFlags = 0; currentSourceFile = undefined; currentText = undefined; - extendsEmitted = false; - assignEmitted = false; - decorateEmitted = false; - paramEmitted = false; - awaiterEmitted = false; isOwnFileEmit = false; } function printSourceFile(node) { @@ -48364,8 +49110,10 @@ var ts; return emitJsxElement(node); case 247: return emitJsxSelfClosingElement(node); - case 293: + case 294: return emitPartiallyEmittedExpression(node); + case 297: + return writeLines(node.text); } } function emitNumericLiteral(node) { @@ -48385,12 +49133,7 @@ var ts; } } function emitIdentifier(node) { - if (ts.getEmitFlags(node) & 16) { - writeLines(umdHelper); - } - else { - write(getTextOfNode(node, false)); - } + write(getTextOfNode(node, false)); } function emitQualifiedName(node) { emitEntityName(node.left); @@ -48633,7 +49376,7 @@ var ts; write("{}"); } else { - var indentedFlag = ts.getEmitFlags(node) & 524288; + var indentedFlag = ts.getEmitFlags(node) & 32768; if (indentedFlag) { increaseIndent(); } @@ -48648,7 +49391,7 @@ var ts; function emitPropertyAccessExpression(node) { var indentBeforeDot = false; var indentAfterDot = false; - if (!(ts.getEmitFlags(node) & 1048576)) { + if (!(ts.getEmitFlags(node) & 65536)) { var dotRangeStart = node.expression.end; var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1; var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd }; @@ -48832,7 +49575,7 @@ var ts; } } function emitBlockStatements(node) { - if (ts.getEmitFlags(node) & 32) { + if (ts.getEmitFlags(node) & 1) { emitList(node, node.statements, 384); } else { @@ -49008,11 +49751,11 @@ var ts; var body = node.body; if (body) { if (ts.isBlock(body)) { - var indentedFlag = ts.getEmitFlags(node) & 524288; + var indentedFlag = ts.getEmitFlags(node) & 32768; if (indentedFlag) { increaseIndent(); } - if (ts.getEmitFlags(node) & 4194304) { + if (ts.getEmitFlags(node) & 262144) { emitSignatureHead(node); emitBlockFunctionBody(body); } @@ -49044,7 +49787,7 @@ var ts; emitWithPrefix(": ", node.type); } function shouldEmitBlockFunctionBodyOnSingleLine(body) { - if (ts.getEmitFlags(body) & 32) { + if (ts.getEmitFlags(body) & 1) { return true; } if (body.multiLine) { @@ -49099,7 +49842,7 @@ var ts; emitModifiers(node, node.modifiers); write("class"); emitNodeWithPrefix(" ", node.name, emitIdentifierName); - var indentedFlag = ts.getEmitFlags(node) & 524288; + var indentedFlag = ts.getEmitFlags(node) & 32768; if (indentedFlag) { increaseIndent(); } @@ -49358,7 +50101,7 @@ var ts; emit(node.name); write(": "); var initializer = node.initializer; - if ((ts.getEmitFlags(initializer) & 16384) === 0) { + if ((ts.getEmitFlags(initializer) & 512) === 0) { var commentRange = ts.getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos); } @@ -49412,71 +50155,31 @@ var ts; } return statements.length; } - function emitHelpers(node) { - var emitFlags = ts.getEmitFlags(node); + function emitHelpers(node, isBundle) { + var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile; + var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); + var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit; var helpersEmitted = false; - if (emitFlags & 1) { - helpersEmitted = emitEmitHelpers(currentSourceFile); - } - if (emitFlags & 2) { - writeLines(exportStarHelper); - helpersEmitted = true; - } - if (emitFlags & 4) { - writeLines(superHelper); - helpersEmitted = true; - } - if (emitFlags & 8) { - writeLines(advancedSuperHelper); - helpersEmitted = true; - } - return helpersEmitted; - } - function emitEmitHelpers(node) { - if (compilerOptions.noEmitHelpers) { - return false; - } - if (compilerOptions.importHelpers - && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { - return false; - } - var helpersEmitted = false; - if ((languageVersion < 2) && (!extendsEmitted && node.flags & 1024)) { - writeLines(extendsHelper); - extendsEmitted = true; - helpersEmitted = true; - } - if ((languageVersion < 5 || currentSourceFile.scriptKind === 2 || currentSourceFile.scriptKind === 4) && - compilerOptions.jsx !== 1 && - !assignEmitted && - node.flags & 16384) { - writeLines(assignHelper); - assignEmitted = true; - } - if (languageVersion < 5 && !restEmitted && node.flags & 32768) { - writeLines(restHelper); - restEmitted = true; - } - if (!decorateEmitted && node.flags & 2048) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); + var helpers = ts.getEmitHelpers(node); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + if (shouldSkip) + continue; + if (shouldBundle) { + if (bundledHelpers[helper.name]) { + continue; + } + bundledHelpers[helper.name] = true; + } + } + else if (isBundle) { + continue; + } + writeLines(helper.text); + helpersEmitted = true; } - decorateEmitted = true; - helpersEmitted = true; - } - if (!paramEmitted && node.flags & 4096) { - writeLines(paramHelper); - paramEmitted = true; - helpersEmitted = true; - } - if ((languageVersion < 4) && (!awaiterEmitted && node.flags & 8192)) { - writeLines(awaiterHelper); - if (languageVersion < 2) { - writeLines(generatorHelper); - } - awaiterEmitted = true; - helpersEmitted = true; } if (helpersEmitted) { writeLine(); @@ -49484,9 +50187,10 @@ var ts; return helpersEmitted; } function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); for (var i = 0; i < lines.length; i++) { - var line = lines[i]; + var line = indentation ? lines[i].slice(indentation) : lines[i]; if (line.length) { if (i > 0) { writeLine(); @@ -49495,6 +50199,21 @@ var ts; } } } + function guessIndentation(lines) { + var indentation; + for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { + var line = lines_1[_a]; + for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { + if (!ts.isWhiteSpace(line.charCodeAt(i))) { + if (indentation === undefined || i < indentation) { + indentation = i; + break; + } + } + } + } + return indentation; + } function emitShebang() { var shebang = ts.getShebang(currentText); if (shebang) { @@ -49836,21 +50555,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_40 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_40)) { + var name_42 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_42)) { tempFlags |= flags; - return name_40; + return name_42; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_41 = count < 26 + var name_43 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_41)) { - return name_41; + if (isUniqueName(name_43)) { + return name_43; } } } @@ -49971,7 +50690,6 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.2.0"; var emptyArray = []; function findConfigFile(searchPath, fileExists, configName) { if (configName === void 0) { configName = "tsconfig.json"; } @@ -50187,10 +50905,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_42 = names_1[_i]; - var result = name_42 in cache - ? cache[name_42] - : cache[name_42] = loader(name_42, containingFile); + var name_44 = names_1[_i]; + var result = name_44 in cache + ? cache[name_44] + : cache[name_44] = loader(name_44, containingFile); resolutions.push(result); } return resolutions; @@ -50244,7 +50962,8 @@ var ts; ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host); if (typeReferences.length) { - var containingFilename = ts.combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts"); + var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); + var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts"); var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename); for (var i = 0; i < typeReferences.length; i++) { processTypeReferenceDirective(typeReferences[i], resolutions[i]); @@ -50724,8 +51443,8 @@ var ts; } break; } - for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) { - var node = nodes_4[_b]; + for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { + var node = nodes_6[_b]; walk(node); } } @@ -51307,7 +52026,9 @@ var ts; this.text = text; } StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); }; StringScriptSnapshot.prototype.getLength = function () { return this.text.length; @@ -51758,7 +52479,7 @@ var ts; case 243: case 237: return ts.ScriptElementKind.alias; - case 284: + case 285: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -51973,7 +52694,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 291 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 292 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -52209,11 +52930,11 @@ var ts; } } if (node) { - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - if (jsDocComment.tags) { - for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) { + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + if (jsDoc.tags) { + for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; if (tag.pos <= position && position <= tag.end) { return tag; @@ -52378,6 +53099,7 @@ var ts; writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, + writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName); }, writeSymbol: writeSymbol, writeLine: writeLine, increaseIndent: function () { indent++; }, @@ -52535,7 +53257,7 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - else if (ts.isStringOrNumericLiteral(location.kind) && + else if (ts.isStringOrNumericLiteral(location) && location.parent.kind === 142) { return location.text; } @@ -53618,16 +54340,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 280: + case 281: processJSDocParameterTag(tag); break; - case 283: + case 284: processJSDocTemplateTag(tag); break; - case 282: + case 283: processElement(tag.typeExpression); break; - case 281: + case 282: processElement(tag.typeExpression); break; } @@ -53879,13 +54601,13 @@ var ts; function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var nameTable = ts.getNameTable(sourceFile); - for (var name_43 in nameTable) { - if (nameTable[name_43] === position) { + for (var name_45 in nameTable) { + if (nameTable[name_45] === position) { continue; } - if (!uniqueNames[name_43]) { - uniqueNames[name_43] = name_43; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_43), compilerOptions.target, true); + if (!uniqueNames[name_45]) { + uniqueNames[name_45] = name_45; + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, true); if (displayName) { var entry = { name: displayName, @@ -54307,11 +55029,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_14 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_14) { + var parent_13 = ts.getDirectoryPath(currentDir); + if (currentDir === parent_13) { break; } - currentDir = parent_14; + currentDir = parent_13; } else { break; @@ -54388,10 +55110,10 @@ var ts; function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) { var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_2 = completionData.location; - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_2) === entryName ? s : undefined; }); + var symbols = completionData.symbols, location_3 = completionData.location; + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_2, location_2, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), @@ -54417,8 +55139,8 @@ var ts; function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) { var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_3 = completionData.location; - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; }); + var symbols = completionData.symbols, location_4 = completionData.location; + return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_4) === entryName ? s : undefined; }); } return undefined; } @@ -54443,9 +55165,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 282: - case 280: + case 283: case 281: + case 282: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -54480,13 +55202,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_15 = contextToken.parent, kind = contextToken.kind; + var parent_14 = contextToken.parent, kind = contextToken.kind; if (kind === 22) { - if (parent_15.kind === 177) { + if (parent_14.kind === 177) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_15.kind === 141) { + else if (parent_14.kind === 141) { node = contextToken.parent.left; isRightOfDot = true; } @@ -54783,9 +55505,9 @@ var ts; switch (contextToken.kind) { case 16: case 25: - var parent_16 = contextToken.parent; - if (parent_16 && (parent_16.kind === 176 || parent_16.kind === 172)) { - return parent_16; + var parent_15 = contextToken.parent; + if (parent_15 && (parent_15.kind === 176 || parent_15.kind === 172)) { + return parent_15; } break; } @@ -54808,34 +55530,34 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_17 = contextToken.parent; + var parent_16 = contextToken.parent; switch (contextToken.kind) { case 27: case 40: case 70: case 250: case 251: - if (parent_17 && (parent_17.kind === 247 || parent_17.kind === 248)) { - return parent_17; + if (parent_16 && (parent_16.kind === 247 || parent_16.kind === 248)) { + return parent_16; } - else if (parent_17.kind === 250) { - return parent_17.parent; + else if (parent_16.kind === 250) { + return parent_16.parent; } break; case 9: - if (parent_17 && ((parent_17.kind === 250) || (parent_17.kind === 251))) { - return parent_17.parent; + if (parent_16 && ((parent_16.kind === 250) || (parent_16.kind === 251))) { + return parent_16.parent; } break; case 17: - if (parent_17 && - parent_17.kind === 252 && - parent_17.parent && - (parent_17.parent.kind === 250)) { - return parent_17.parent.parent; + if (parent_16 && + parent_16.kind === 252 && + parent_16.parent && + (parent_16.parent.kind === 250)) { + return parent_16.parent.parent; } - if (parent_17 && parent_17.kind === 251) { - return parent_17.parent; + if (parent_16 && parent_16.kind === 251) { + return parent_16.parent; } break; } @@ -54958,8 +55680,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_44 = element.propertyName || element.name; - existingImportsOrExports[name_44.text] = true; + var name_46 = element.propertyName || element.name; + existingImportsOrExports[name_46.text] = true; } if (!ts.someProperties(existingImportsOrExports)) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); @@ -55256,17 +55978,17 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_18 = child.parent; - if (ts.isFunctionBlock(parent_18) || parent_18.kind === 261) { - return parent_18; + var parent_17 = child.parent; + if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261) { + return parent_17; } - if (parent_18.kind === 221) { - var tryStatement = parent_18; + if (parent_17.kind === 221) { + var tryStatement = parent_17; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_18; + child = parent_17; } return undefined; } @@ -56101,24 +56823,24 @@ var ts; } var containingTypeReference = getContainingTypeReference(refNode); if (containingTypeReference) { - var parent_19 = containingTypeReference.parent; - if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); + var parent_18 = containingTypeReference.parent; + if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); } - else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { - if (parent_19.body.kind === 204) { - ts.forEachReturnStatement(parent_19.body, function (returnStatement) { + else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { + if (parent_18.body.kind === 204) { + ts.forEachReturnStatement(parent_18.body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); } }); } - else if (isImplementationExpression(parent_19.body)) { - maybeAdd(getReferenceEntryFromNode(parent_19.body)); + else if (isImplementationExpression(parent_18.body)) { + maybeAdd(getReferenceEntryFromNode(parent_18.body)); } } - else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_19.expression)); + else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { + maybeAdd(getReferenceEntryFromNode(parent_18.expression)); } } } @@ -56379,8 +57101,8 @@ var ts; if (!node_2 || node_2.kind !== 9) { return; } - var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); - if (type_2 === searchType) { + var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + if (type_1 === searchType) { references.push(getReferenceEntryFromNode(node_2)); } } @@ -56494,9 +57216,9 @@ var ts; return undefined; } } - var result_3 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3, ts.createMap()); - return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result_4 = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, ts.createMap()); + return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); } return undefined; }); @@ -56504,7 +57226,7 @@ var ts; function getNameFromObjectLiteralElement(node) { if (node.name.kind === 142) { var nameExpression = node.name.expression; - if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; } return undefined; @@ -56516,20 +57238,20 @@ var ts; var contextualType = typeChecker.getContextualType(objectLiteral); var name = getNameFromObjectLiteralElement(node); if (name && contextualType) { - var result_4 = []; + var result_5 = []; var symbol_2 = contextualType.getProperty(name); if (symbol_2) { - result_4.push(symbol_2); + result_5.push(symbol_2); } if (contextualType.flags & 65536) { ts.forEach(contextualType.types, function (t) { var symbol = t.getProperty(name); if (symbol) { - result_4.push(symbol); + result_5.push(symbol); } }); } - return result_4; + return result_5; } return undefined; } @@ -56757,13 +57479,13 @@ var ts; return undefined; } if (type.flags & 65536 && !(type.flags & 16)) { - var result_5 = []; + var result_6 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(result_5, getDefinitionFromSymbol(typeChecker, t.symbol, node)); + ts.addRange(result_6, getDefinitionFromSymbol(typeChecker, t.symbol, node)); } }); - return result_5; + return result_6; } if (!type.symbol) { return undefined; @@ -56933,6 +57655,7 @@ var ts; "lends", "link", "memberOf", + "method", "name", "namespace", "param", @@ -56955,7 +57678,7 @@ var ts; function getJsDocCommentsFromDeclarations(declarations) { var documentationComment = []; forEachUnique(declarations, function (declaration) { - var comments = ts.getJSDocComments(declaration, true); + var comments = ts.getCommentsFromJSDoc(declaration); if (!comments) { return; } @@ -57030,13 +57753,19 @@ var ts; var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; for (var i = 0, numParams = parameters.length; i < numParams; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 ? currentName.text : "param" + i; - docParams += indentationStr + " * @param " + paramName + newLine; + if (isJavaScriptFile) { + docParams += indentationStr + " * @param {any} " + paramName + newLine; + } + else { + docParams += indentationStr + " * @param " + paramName + newLine; + } } var preamble = "/**" + newLine + indentationStr + " * "; @@ -57094,10 +57823,10 @@ var ts; return; } var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_45 in nameToDeclarations) { - var declarations = nameToDeclarations[name_45]; + for (var name_47 in nameToDeclarations) { + var declarations = nameToDeclarations[name_47]; if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_45); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_47); if (!matches) { continue; } @@ -57108,14 +57837,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_45); + matches = patternMatcher.getMatches(containers, name_47); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_45, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_47, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -57368,9 +58097,9 @@ var ts; case 174: case 223: var decl = node; - var name_46 = decl.name; - if (ts.isBindingPattern(name_46)) { - addChildrenRecursively(name_46); + var name_48 = decl.name; + if (ts.isBindingPattern(name_48)) { + addChildrenRecursively(name_48); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { addChildrenRecursively(decl.initializer); @@ -57416,9 +58145,9 @@ var ts; addLeafNode(node); break; default: - ts.forEach(node.jsDocComments, function (jsDocComment) { - ts.forEach(jsDocComment.tags, function (tag) { - if (tag.kind === 284) { + ts.forEach(node.jsDoc, function (jsDoc) { + ts.forEach(jsDoc.tags, function (tag) { + if (tag.kind === 285) { addLeafNode(tag); } }); @@ -57534,7 +58263,7 @@ var ts; case 185: case 197: return getFunctionOrClassName(node); - case 284: + case 285: return getJSDocTypedefTagName(node); default: return undefined; @@ -57574,7 +58303,7 @@ var ts; return "()"; case 155: return "[]"; - case 284: + case 285: return getJSDocTypedefTagName(node); default: return ""; @@ -57621,7 +58350,7 @@ var ts; case 230: case 261: case 228: - case 284: + case 285: return true; case 150: case 149: @@ -57834,24 +58563,24 @@ var ts; switch (n.kind) { case 204: if (!ts.isFunctionBlock(n)) { - var parent_20 = n.parent; + var parent_19 = n.parent; var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); - if (parent_20.kind === 209 || - parent_20.kind === 212 || - parent_20.kind === 213 || - parent_20.kind === 211 || - parent_20.kind === 208 || - parent_20.kind === 210 || - parent_20.kind === 217 || - parent_20.kind === 256) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + if (parent_19.kind === 209 || + parent_19.kind === 212 || + parent_19.kind === 213 || + parent_19.kind === 211 || + parent_19.kind === 208 || + parent_19.kind === 210 || + parent_19.kind === 217 || + parent_19.kind === 256) { + addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_20.kind === 221) { - var tryStatement = parent_20; + if (parent_19.kind === 221) { + var tryStatement = parent_19; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -59465,8 +60194,8 @@ var ts; if (declaration.kind !== 223 && declaration.kind !== 225) { return false; } - for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { - if (parent_21.kind === 261 || parent_21.kind === 231) { + for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { + if (parent_20.kind === 261 || parent_20.kind === 231) { return false; } } @@ -59550,7 +60279,7 @@ var ts; return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_4 = function (opt) { + var _loop_3 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -59566,7 +60295,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_4(opt); + _loop_3(opt); } return options; } @@ -59953,7 +60682,7 @@ var ts; function RuleOperationContext() { var funcs = []; for (var _i = 0; _i < arguments.length; _i++) { - funcs[_i - 0] = arguments[_i]; + funcs[_i] = arguments[_i]; } this.customContextChecks = funcs; } @@ -60160,9 +60889,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_47 in o) { - if (o[name_47] === rule) { - return name_47; + for (var name_49 in o) { + if (o[name_49] === rule) { + return name_49; } } throw new Error("Unknown rule"); @@ -61341,11 +62070,23 @@ var ts; else { var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); - if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) { + if (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) { recordReplace(startLinePosition, tokenStart.character, indentationString); } } } + function characterToColumn(startLinePosition, characterInLine) { + var column = 0; + for (var i = 0; i < characterInLine; i++) { + if (sourceFile.text.charCodeAt(startLinePosition + i) === 9) { + column += options.tabSize - column % options.tabSize; + } + else { + column++; + } + } + return column; + } function indentationIsDifferent(indentationString, startLinePosition) { return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); } @@ -62050,6 +62791,579 @@ var ts; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var codefix; + (function (codefix) { + var ModuleSpecifierComparison; + (function (ModuleSpecifierComparison) { + ModuleSpecifierComparison[ModuleSpecifierComparison["Better"] = 0] = "Better"; + ModuleSpecifierComparison[ModuleSpecifierComparison["Equal"] = 1] = "Equal"; + ModuleSpecifierComparison[ModuleSpecifierComparison["Worse"] = 2] = "Worse"; + })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); + var ImportCodeActionMap = (function () { + function ImportCodeActionMap() { + this.symbolIdToActionMap = ts.createMap(); + } + ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { + if (!newAction) { + return; + } + if (!this.symbolIdToActionMap[symbolId]) { + this.symbolIdToActionMap[symbolId] = [newAction]; + return; + } + if (newAction.kind === "CodeChange") { + this.symbolIdToActionMap[symbolId].push(newAction); + return; + } + var updatedNewImports = []; + for (var _i = 0, _a = this.symbolIdToActionMap[symbolId]; _i < _a.length; _i++) { + var existingAction = _a[_i]; + if (existingAction.kind === "CodeChange") { + updatedNewImports.push(existingAction); + continue; + } + switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) { + case ModuleSpecifierComparison.Better: + if (newAction.kind === "NewImport") { + return; + } + case ModuleSpecifierComparison.Equal: + updatedNewImports.push(existingAction); + break; + case ModuleSpecifierComparison.Worse: + continue; + } + } + updatedNewImports.push(newAction); + this.symbolIdToActionMap[symbolId] = updatedNewImports; + }; + ImportCodeActionMap.prototype.addActions = function (symbolId, newActions) { + for (var _i = 0, newActions_1 = newActions; _i < newActions_1.length; _i++) { + var newAction = newActions_1[_i]; + this.addAction(symbolId, newAction); + } + }; + ImportCodeActionMap.prototype.getAllActions = function () { + var result = []; + for (var symbolId in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + } + return result; + }; + ImportCodeActionMap.prototype.compareModuleSpecifiers = function (moduleSpecifier1, moduleSpecifier2) { + if (moduleSpecifier1 === moduleSpecifier2) { + return ModuleSpecifierComparison.Equal; + } + if (moduleSpecifier2.indexOf(moduleSpecifier1) === 0) { + return ModuleSpecifierComparison.Better; + } + if (moduleSpecifier1.indexOf(moduleSpecifier2) === 0) { + return ModuleSpecifierComparison.Worse; + } + if (ts.isExternalModuleNameRelative(moduleSpecifier1) && ts.isExternalModuleNameRelative(moduleSpecifier2)) { + var regex = new RegExp(ts.directorySeparator, "g"); + var moduleSpecifier1LevelCount = (moduleSpecifier1.match(regex) || []).length; + var moduleSpecifier2LevelCount = (moduleSpecifier2.match(regex) || []).length; + return moduleSpecifier1LevelCount < moduleSpecifier2LevelCount + ? ModuleSpecifierComparison.Better + : moduleSpecifier1LevelCount === moduleSpecifier2LevelCount + ? ModuleSpecifierComparison.Equal + : ModuleSpecifierComparison.Worse; + } + return ModuleSpecifierComparison.Equal; + }; + return ImportCodeActionMap; + }()); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var checker = context.program.getTypeChecker(); + var allSourceFiles = context.program.getSourceFiles(); + var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + var name = token.getText(); + var symbolIdActionMap = new ImportCodeActionMap(); + var cachedImportDeclarations = ts.createMap(); + var cachedNewImportInsertPosition; + var allPotentialModules = checker.getAmbientModules(); + for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { + var otherSourceFile = allSourceFiles_1[_i]; + if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) { + allPotentialModules.push(otherSourceFile.symbol); + } + } + var currentTokenMeaning = ts.getMeaningFromLocation(token); + for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { + var moduleSymbol = allPotentialModules_1[_a]; + context.cancellationToken.throwIfCancellationRequested(); + var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); + if (defaultExport) { + var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport); + if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { + var symbolId = getUniqueSymbolId(localSymbol); + symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, true)); + } + } + var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol); + if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) { + var symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName); + symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol)); + } + } + return symbolIdActionMap.getAllActions(); + function getImportDeclarations(moduleSymbol) { + var moduleSymbolId = getUniqueSymbolId(moduleSymbol); + if (cachedImportDeclarations[moduleSymbolId]) { + return cachedImportDeclarations[moduleSymbolId]; + } + var existingDeclarations = []; + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var importModuleSpecifier = _a[_i]; + var importSymbol = checker.getSymbolAtLocation(importModuleSpecifier); + if (importSymbol === moduleSymbol) { + existingDeclarations.push(getImportDeclaration(importModuleSpecifier)); + } + } + cachedImportDeclarations[moduleSymbolId] = existingDeclarations; + return existingDeclarations; + function getImportDeclaration(moduleSpecifier) { + var node = moduleSpecifier; + while (node) { + if (node.kind === 235) { + return node; + } + if (node.kind === 234) { + return node; + } + node = node.parent; + } + return undefined; + } + } + function getUniqueSymbolId(symbol) { + if (symbol.flags & 8388608) { + return ts.getSymbolId(checker.getAliasedSymbol(symbol)); + } + return ts.getSymbolId(symbol); + } + function checkSymbolHasMeaning(symbol, meaning) { + var declarations = symbol.getDeclarations(); + return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; + } + function getCodeActionForImport(moduleSymbol, isDefault) { + var existingDeclarations = getImportDeclarations(moduleSymbol); + if (existingDeclarations.length > 0) { + return getCodeActionsForExistingImport(existingDeclarations); + } + else { + return [getCodeActionForNewImport()]; + } + function getCodeActionsForExistingImport(declarations) { + var actions = []; + var namespaceImportDeclaration; + var namedImportDeclaration; + var existingModuleSpecifier; + for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { + var declaration = declarations_11[_i]; + if (declaration.kind === 235) { + var namedBindings = declaration.importClause && declaration.importClause.namedBindings; + if (namedBindings && namedBindings.kind === 237) { + namespaceImportDeclaration = declaration; + } + else { + namedImportDeclaration = declaration; + } + existingModuleSpecifier = declaration.moduleSpecifier.getText(); + } + else { + namespaceImportDeclaration = declaration; + existingModuleSpecifier = getModuleSpecifierFromImportEqualsDeclaration(declaration); + } + } + if (namespaceImportDeclaration) { + actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); + } + if (namedImportDeclaration && namedImportDeclaration.importClause && + (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { + var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); + var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); + actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); + } + else { + actions.push(getCodeActionForNewImport(existingModuleSpecifier)); + } + return actions; + function getModuleSpecifierFromImportEqualsDeclaration(declaration) { + if (declaration.moduleReference && declaration.moduleReference.kind === 245) { + return declaration.moduleReference.expression.getText(); + } + return declaration.moduleReference.getText(); + } + function getTextChangeForImportClause(importClause) { + var newImportText = isDefault ? "default as " + name : name; + var importList = importClause.namedBindings; + if (!importList && importClause.name) { + var start = importClause.name.getEnd(); + return { + newText: ", { " + newImportText + " }", + span: { start: start, length: 0 } + }; + } + if (importList.elements.length === 0) { + var start = importList.getStart(); + return { + newText: "{ " + newImportText + " }", + span: { start: start, length: importList.getEnd() - start } + }; + } + var insertPoint = importList.elements[importList.elements.length - 1].getEnd(); + var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart()); + var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd()); + var oneImportPerLine = endLine - startLine > importList.elements.length; + return { + newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText, + span: { start: insertPoint, length: 0 } + }; + } + function getCodeActionForNamespaceImport(declaration) { + var namespacePrefix; + if (declaration.kind === 235) { + namespacePrefix = declaration.importClause.namedBindings.name.getText(); + } + else { + namespacePrefix = declaration.name.getText(); + } + namespacePrefix = ts.stripQuotes(namespacePrefix); + return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange"); + } + } + function getCodeActionForNewImport(moduleSpecifier) { + if (!cachedNewImportInsertPosition) { + var lastModuleSpecifierEnd = -1; + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var moduleSpecifier_1 = _a[_i]; + var end = moduleSpecifier_1.getEnd(); + if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) { + lastModuleSpecifierEnd = end; + } + } + cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart(); + } + var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); + var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); + var importStatementText = isDefault + ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" + : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; + var newText = cachedNewImportInsertPosition === sourceFile.getStart() + ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter + : "" + context.newLineCharacter + importStatementText + ";"; + return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes); + function getModuleSpecifierForNewImport() { + var fileName = sourceFile.path; + var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path; + var sourceDirectory = ts.getDirectoryPath(fileName); + var options = context.program.getCompilerOptions(); + return tryGetModuleNameFromAmbientModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || + tryGetModuleNameFromTypeRoots() || + tryGetModuleNameAsNodeModule() || + ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); + function tryGetModuleNameFromAmbientModule() { + if (moduleSymbol.valueDeclaration.kind !== 261) { + return moduleSymbol.name; + } + } + function tryGetModuleNameFromBaseUrl() { + if (!options.baseUrl) { + return undefined; + } + var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName); + var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl); + if (!relativeName) { + return undefined; + } + relativeName = removeExtensionAndIndexPostFix(relativeName); + if (options.paths) { + for (var key in options.paths) { + for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { + var pattern = _a[_i]; + var indexOfStar = pattern.indexOf("*"); + if (indexOfStar === 0 && pattern.length === 1) { + continue; + } + else if (indexOfStar !== -1) { + var prefix = pattern.substr(0, indexOfStar); + var suffix = pattern.substr(indexOfStar + 1); + if (relativeName.length >= prefix.length + suffix.length && + ts.startsWith(relativeName, prefix) && + ts.endsWith(relativeName, suffix)) { + var matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length); + return key.replace("\*", matchedStar); + } + } + else if (pattern === relativeName) { + return key; + } + } + } + } + return relativeName; + } + function tryGetModuleNameFromRootDirs() { + if (options.rootDirs) { + var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, undefined, getCanonicalFileName); }); + var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs); + var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs); + if (normalizedTargetPath !== undefined) { + var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath; + return ts.removeFileExtension(relativePath); + } + } + return undefined; + } + function tryGetModuleNameFromTypeRoots() { + var typeRoots = ts.getEffectiveTypeRoots(options, context.host); + if (typeRoots) { + var normalizedTypeRoots = ts.map(typeRoots, function (typeRoot) { return ts.toPath(typeRoot, undefined, getCanonicalFileName); }); + for (var _i = 0, normalizedTypeRoots_1 = normalizedTypeRoots; _i < normalizedTypeRoots_1.length; _i++) { + var typeRoot = normalizedTypeRoots_1[_i]; + if (ts.startsWith(moduleFileName, typeRoot)) { + var relativeFileName = moduleFileName.substring(typeRoot.length + 1); + return removeExtensionAndIndexPostFix(relativeFileName); + } + } + } + } + function tryGetModuleNameAsNodeModule() { + if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) { + return undefined; + } + var indexOfNodeModules = moduleFileName.indexOf("node_modules"); + if (indexOfNodeModules < 0) { + return undefined; + } + var relativeFileName; + if (sourceDirectory.indexOf(moduleFileName.substring(0, indexOfNodeModules - 1)) === 0) { + relativeFileName = moduleFileName.substring(indexOfNodeModules + 13); + } + else { + relativeFileName = getRelativePath(moduleFileName, sourceDirectory); + } + relativeFileName = ts.removeFileExtension(relativeFileName); + if (ts.endsWith(relativeFileName, "/index")) { + relativeFileName = ts.getDirectoryPath(relativeFileName); + } + else { + try { + var moduleDirectory = ts.getDirectoryPath(moduleFileName); + var packageJsonContent = JSON.parse(context.host.readFile(ts.combinePaths(moduleDirectory, "package.json"))); + if (packageJsonContent) { + var mainFile = packageJsonContent.main || packageJsonContent.typings; + if (mainFile) { + var mainExportFile = ts.toPath(mainFile, moduleDirectory, getCanonicalFileName); + if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(moduleFileName)) { + relativeFileName = ts.getDirectoryPath(relativeFileName); + } + } + } + } + catch (e) { } + } + return relativeFileName; + } + } + function getPathRelativeToRootDirs(path, rootDirs) { + for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) { + var rootDir = rootDirs_2[_i]; + var relativeName = tryRemoveParentDirectoryName(path, rootDir); + if (relativeName !== undefined) { + return relativeName; + } + } + return undefined; + } + function removeExtensionAndIndexPostFix(fileName) { + fileName = ts.removeFileExtension(fileName); + if (ts.endsWith(fileName, "/index")) { + fileName = fileName.substr(0, fileName.length - 6); + } + return fileName; + } + function getRelativePath(path, directoryPath) { + var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); + return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath; + } + function tryRemoveParentDirectoryName(path, parentDirectory) { + var index = path.indexOf(parentDirectory); + if (index === 0) { + return ts.endsWith(parentDirectory, ts.directorySeparator) + ? path.substring(parentDirectory.length) + : path.substring(parentDirectory.length + 1); + } + return undefined; + } + } + } + function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) { + return { + description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)), + changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }], + kind: kind, + moduleSpecifier: moduleSpecifier + }; + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + if (token.kind === 20) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70: + switch (token.parent.kind) { + case 223: + switch (token.parent.parent.parent.kind) { + case 211: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); + } + else { + return removeSingleItem(forInitializer.declarations, token); + } + case 213: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 224) { + var forOfInitializer = forOfStatement.initializer; + return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); + } + break; + case 212: + return undefined; + case 256: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return createCodeFix("", parameter.pos, parameter.end - parameter.pos); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); + } + else { + var declarations = variableStatement.declarationList.declarations; + return removeSingleItem(declarations, token); + } + } + case 143: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); + } + else { + return removeSingleItem(typeParameters, token); + } + case 144: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else { + return removeSingleItem(functionDeclaration.parameters, token); + } + case 234: + var importEquals = findImportDeclaration(token); + return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); + case 239: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + var importSpec = findImportDeclaration(token); + return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); + } + else { + return removeSingleItem(namedImports.elements, token); + } + case 236: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = findImportDeclaration(importClause); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); + } + case 237: + var namespaceImport = token.parent; + if (namespaceImport.name == token && !namespaceImport.parent.name) { + var importDecl = findImportDeclaration(namespaceImport); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + var start_4 = namespaceImport.parent.name.end; + return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); + } + } + break; + case 147: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + case 237: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + if (ts.isDeclarationName(token)) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); + } + else { + return undefined; + } + function findImportDeclaration(token) { + var importDecl = token; + while (importDecl.kind != 235 && importDecl.parent) { + importDecl = importDecl.parent; + } + return importDecl; + } + function createCodeFix(newText, start, length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ newText: newText, span: { start: start, length: length } }] + }] + }]; + } + function removeSingleItem(elements, token) { + if (elements[0] === token.parent) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + else { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + } + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; (function (ts) { ts.servicesVersion = "0.5"; function createNode(kind, pos, end, parent) { @@ -62111,11 +63425,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(291, nodes.pos, nodes.end, this); + var list = createNode(292, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var node = nodes_5[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -62134,7 +63448,7 @@ var ts; ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 290; + var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 291; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -62152,8 +63466,8 @@ var ts; children.push(_this.createSyntaxList(nodes)); pos_3 = nodes.end; }; - if (this.jsDocComments) { - for (var _i = 0, _a = this.jsDocComments; _i < _a.length; _i++) { + if (this.jsDoc) { + for (var _i = 0, _a = this.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; processNode(jsDocComment); } @@ -62373,6 +63687,19 @@ var ts; SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) { return ts.getPositionOfLineAndCharacter(this, line, character); }; + SourceFileObject.prototype.getLineEndOfPosition = function (pos) { + var line = this.getLineAndCharacterOfPosition(pos).line; + var lineStarts = this.getLineStarts(); + var lastCharPos; + if (line + 1 >= lineStarts.length) { + lastCharPos = this.getEnd(); + } + if (!lastCharPos) { + lastCharPos = lineStarts[line + 1] - 1; + } + var fullText = this.getFullText(); + return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos; + }; SourceFileObject.prototype.getNamedDeclarations = function () { if (!this.namedDeclarations) { this.namedDeclarations = this.computeNamedDeclarations(); @@ -62394,9 +63721,9 @@ var ts; } function getDeclarationName(declaration) { if (declaration.name) { - var result_6 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_6 !== undefined) { - return result_6; + var result_7 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_7 !== undefined) { + return result_7; } if (declaration.name.kind === 142) { var expr = declaration.name.expression; @@ -62437,8 +63764,8 @@ var ts; else { declarations.push(functionDeclaration); } - ts.forEachChild(node, visit); } + ts.forEachChild(node, visit); break; case 226: case 197: @@ -62878,6 +64205,7 @@ var ts; return program; } function cleanupSemanticCache() { + program = undefined; } function dispose() { if (program) { @@ -63222,7 +64550,9 @@ var ts; sourceFile: sourceFile, span: span, program: program, - newLineCharacter: newLineChar + newLineCharacter: newLineChar, + host: host, + cancellationToken: cancellationToken }; var fixes = ts.codefix.getFixes(context); if (fixes) { @@ -63239,7 +64569,7 @@ var ts; return false; } var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + if (ts.isInString(sourceFile, position)) { return false; } if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { @@ -63387,10 +64717,10 @@ var ts; break; default: ts.forEachChild(node, walk); - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - ts.forEachChild(jsDocComment, walk); + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + ts.forEachChild(jsDoc, walk); } } } @@ -63418,22 +64748,160 @@ var ts; (function (ts) { var server; (function (server) { + var TextStorage = (function () { + function TextStorage(host, fileName) { + this.host = host; + this.fileName = fileName; + this.svcVersion = 0; + this.textVersion = 0; + } + TextStorage.prototype.getVersion = function () { + return this.svc + ? "SVC-" + this.svcVersion + "-" + this.svc.getSnapshot().version + : "Text-" + this.textVersion; + }; + TextStorage.prototype.hasScriptVersionCache = function () { + return this.svc !== undefined; + }; + TextStorage.prototype.useScriptVersionCache = function (newText) { + this.switchToScriptVersionCache(newText); + }; + TextStorage.prototype.useText = function (newText) { + this.svc = undefined; + this.setText(newText); + }; + TextStorage.prototype.edit = function (start, end, newText) { + this.switchToScriptVersionCache().edit(start, end - start, newText); + }; + TextStorage.prototype.reload = function (text) { + if (this.svc) { + this.svc.reload(text); + } + else { + this.setText(text); + } + }; + TextStorage.prototype.reloadFromFile = function (tempFileName) { + if (this.svc || (tempFileName !== this.fileName)) { + this.reload(this.getFileText(tempFileName)); + } + else { + this.setText(undefined); + } + }; + TextStorage.prototype.getSnapshot = function () { + return this.svc + ? this.svc.getSnapshot() + : ts.ScriptSnapshot.fromString(this.getOrLoadText()); + }; + TextStorage.prototype.getLineInfo = function (line) { + return this.switchToScriptVersionCache().getSnapshot().index.lineNumberToInfo(line); + }; + TextStorage.prototype.lineToTextSpan = function (line) { + if (!this.svc) { + var lineMap = this.getLineMap(); + var start = lineMap[line]; + var end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length; + return ts.createTextSpanFromBounds(start, end); + } + var index = this.svc.getSnapshot().index; + var lineInfo = index.lineNumberToInfo(line + 1); + var len; + if (lineInfo.leaf) { + len = lineInfo.leaf.text.length; + } + else { + var nextLineInfo = index.lineNumberToInfo(line + 2); + len = nextLineInfo.offset - lineInfo.offset; + } + return ts.createTextSpan(lineInfo.offset, len); + }; + TextStorage.prototype.lineOffsetToPosition = function (line, offset) { + if (!this.svc) { + return ts.computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1); + } + var index = this.svc.getSnapshot().index; + var lineInfo = index.lineNumberToInfo(line); + return (lineInfo.offset + offset - 1); + }; + TextStorage.prototype.positionToLineOffset = function (position) { + if (!this.svc) { + var _a = ts.computeLineAndCharacterOfPosition(this.getLineMap(), position), line = _a.line, character = _a.character; + return { line: line + 1, offset: character + 1 }; + } + var index = this.svc.getSnapshot().index; + var lineOffset = index.charOffsetToLineNumberAndPos(position); + return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + }; + TextStorage.prototype.getFileText = function (tempFileName) { + return this.host.readFile(tempFileName || this.fileName) || ""; + }; + TextStorage.prototype.ensureNoScriptVersionCache = function () { + ts.Debug.assert(!this.svc, "ScriptVersionCache should not be set"); + }; + TextStorage.prototype.switchToScriptVersionCache = function (newText) { + if (!this.svc) { + this.svc = server.ScriptVersionCache.fromString(this.host, newText !== undefined ? newText : this.getOrLoadText()); + this.svcVersion++; + this.text = undefined; + } + return this.svc; + }; + TextStorage.prototype.getOrLoadText = function () { + this.ensureNoScriptVersionCache(); + if (this.text === undefined) { + this.setText(this.getFileText()); + } + return this.text; + }; + TextStorage.prototype.getLineMap = function () { + this.ensureNoScriptVersionCache(); + return this.lineMap || (this.lineMap = ts.computeLineStarts(this.getOrLoadText())); + }; + TextStorage.prototype.setText = function (newText) { + this.ensureNoScriptVersionCache(); + if (newText === undefined || this.text !== newText) { + this.text = newText; + this.lineMap = undefined; + this.textVersion++; + } + }; + return TextStorage; + }()); + server.TextStorage = TextStorage; var ScriptInfo = (function () { - function ScriptInfo(host, fileName, content, scriptKind, isOpen, hasMixedContent) { - if (isOpen === void 0) { isOpen = false; } + function ScriptInfo(host, fileName, scriptKind, hasMixedContent) { if (hasMixedContent === void 0) { hasMixedContent = false; } this.host = host; this.fileName = fileName; this.scriptKind = scriptKind; - this.isOpen = isOpen; this.hasMixedContent = hasMixedContent; this.containingProjects = []; this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); - this.svc = server.ScriptVersionCache.fromString(host, content); + this.textStorage = new TextStorage(host, fileName); + if (hasMixedContent) { + this.textStorage.reload(""); + } this.scriptKind = scriptKind ? scriptKind : ts.getScriptKindFromFileName(fileName); } + ScriptInfo.prototype.isScriptOpen = function () { + return this.isOpen; + }; + ScriptInfo.prototype.open = function (newText) { + this.isOpen = true; + this.textStorage.useScriptVersionCache(newText); + this.markContainingProjectsAsDirty(); + }; + ScriptInfo.prototype.close = function () { + this.isOpen = false; + this.textStorage.useText(this.hasMixedContent ? "" : undefined); + this.markContainingProjectsAsDirty(); + }; + ScriptInfo.prototype.getSnapshot = function () { + return this.textStorage.getSnapshot(); + }; ScriptInfo.prototype.getFormatCodeSettings = function () { return this.formatCodeSettings; }; @@ -63487,6 +64955,12 @@ var ts; } return this.containingProjects[0]; }; + ScriptInfo.prototype.registerFileUpdate = function () { + for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) { + var p = _a[_i]; + p.registerFileUpdate(this.path); + } + }; ScriptInfo.prototype.setFormatOptions = function (formatSettings) { if (formatSettings) { if (!this.formatCodeSettings) { @@ -63506,14 +64980,14 @@ var ts; } }; ScriptInfo.prototype.getLatestVersion = function () { - return this.svc.latestVersion().toString(); + return this.textStorage.getVersion(); }; ScriptInfo.prototype.reload = function (script) { - this.svc.reload(script); + this.textStorage.reload(script); this.markContainingProjectsAsDirty(); }; ScriptInfo.prototype.saveTo = function (fileName) { - var snap = this.snap(); + var snap = this.textStorage.getSnapshot(); this.host.writeFile(fileName, snap.getText(0, snap.getLength())); }; ScriptInfo.prototype.reloadFromFile = function (tempFileName) { @@ -63521,19 +64995,15 @@ var ts; this.reload(""); } else { - this.svc.reloadFromFile(tempFileName || this.fileName); + this.textStorage.reloadFromFile(tempFileName); this.markContainingProjectsAsDirty(); } }; - ScriptInfo.prototype.snap = function () { - return this.svc.getSnapshot(); - }; ScriptInfo.prototype.getLineInfo = function (line) { - var snap = this.snap(); - return snap.index.lineNumberToInfo(line); + return this.textStorage.getLineInfo(line); }; ScriptInfo.prototype.editContent = function (start, end, newText) { - this.svc.edit(start, end - start, newText); + this.textStorage.edit(start, end, newText); this.markContainingProjectsAsDirty(); }; ScriptInfo.prototype.markContainingProjectsAsDirty = function () { @@ -63543,27 +65013,13 @@ var ts; } }; ScriptInfo.prototype.lineToTextSpan = function (line) { - var index = this.snap().index; - var lineInfo = index.lineNumberToInfo(line + 1); - var len; - if (lineInfo.leaf) { - len = lineInfo.leaf.text.length; - } - else { - var nextLineInfo = index.lineNumberToInfo(line + 2); - len = nextLineInfo.offset - lineInfo.offset; - } - return ts.createTextSpan(lineInfo.offset, len); + return this.textStorage.lineToTextSpan(line); }; ScriptInfo.prototype.lineOffsetToPosition = function (line, offset) { - var index = this.snap().index; - var lineInfo = index.lineNumberToInfo(line); - return (lineInfo.offset + offset - 1); + return this.textStorage.lineOffsetToPosition(line, offset); }; ScriptInfo.prototype.positionToLineOffset = function (position) { - var index = this.snap().index; - var lineOffset = index.charOffsetToLineNumberAndPos(position); - return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + return this.textStorage.positionToLineOffset(position); }; return ScriptInfo; }()); @@ -63587,7 +65043,7 @@ var ts; this.trace = function (s) { return host.trace(s); }; } this.resolveModuleName = function (moduleName, containingFile, compilerOptions, host) { - var globalCache = _this.project.getTypingOptions().enableAutoDiscovery + var globalCache = _this.project.getTypeAcquisition().enable ? _this.project.projectService.typingsInstaller.globalTypingsCacheLocation : undefined; var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host); @@ -63619,15 +65075,15 @@ var ts; var compilerOptions = this.getCompilationSettings(); var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName; for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { - var name_48 = names_2[_i]; - var resolution = newResolutions[name_48]; + var name_50 = names_2[_i]; + var resolution = newResolutions[name_50]; if (!resolution) { - var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_48]; + var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_50]; if (moduleResolutionIsValid(existingResolution)) { resolution = existingResolution; } else { - newResolutions[name_48] = resolution = loader(name_48, containingFile, compilerOptions, this); + newResolutions[name_50] = resolution = loader(name_50, containingFile, compilerOptions, this); } if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { this.filesWithChangedSetOfUnresolvedImports.push(path); @@ -63692,7 +65148,7 @@ var ts; LSHost.prototype.getScriptSnapshot = function (filename) { var scriptInfo = this.project.getScriptInfoLSHost(filename); if (scriptInfo) { - return scriptInfo.snap(); + return scriptInfo.getSnapshot(); } }; LSHost.prototype.getScriptFileNames = function () { @@ -63789,8 +65245,8 @@ var ts; } return unique === 0; } - function typingOptionsChanged(opt1, opt2) { - return opt1.enableAutoDiscovery !== opt2.enableAutoDiscovery || + function typeAcquisitionChanged(opt1, opt2) { + return opt1.enable !== opt2.enable || !setIsEqualTo(opt1.include, opt2.include) || !setIsEqualTo(opt1.exclude, opt2.exclude); } @@ -63809,32 +65265,32 @@ var ts; this.perProjectCache = ts.createMap(); } TypingsCache.prototype.getTypingsForProject = function (project, unresolvedImports, forceRefresh) { - var typingOptions = project.getTypingOptions(); - if (!typingOptions || !typingOptions.enableAutoDiscovery) { + var typeAcquisition = project.getTypeAcquisition(); + if (!typeAcquisition || !typeAcquisition.enable) { return server.emptyArray; } var entry = this.perProjectCache[project.getProjectName()]; var result = entry ? entry.typings : server.emptyArray; if (forceRefresh || !entry || - typingOptionsChanged(typingOptions, entry.typingOptions) || + typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) || unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) { this.perProjectCache[project.getProjectName()] = { compilerOptions: project.getCompilerOptions(), - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, typings: result, unresolvedImports: unresolvedImports, poisoned: true }; - this.installer.enqueueInstallTypingsRequest(project, typingOptions, unresolvedImports); + this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); } return result; }; - TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typingOptions, unresolvedImports, newTypings) { + TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) { this.perProjectCache[projectName] = { compilerOptions: compilerOptions, - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, typings: server.toSortedReadonlyArray(newTypings), unresolvedImports: unresolvedImports, poisoned: false @@ -63908,10 +65364,15 @@ var ts; function AbstractBuilder(project, ctor) { this.project = project; this.ctor = ctor; - this.fileInfos = ts.createFileMap(); } + AbstractBuilder.prototype.getFileInfos = function () { + return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = ts.createFileMap()); + }; + AbstractBuilder.prototype.clear = function () { + this.fileInfos_doNotAccessDirectly = undefined; + }; AbstractBuilder.prototype.getFileInfo = function (path) { - return this.fileInfos.get(path); + return this.getFileInfos().get(path); }; AbstractBuilder.prototype.getOrCreateFileInfo = function (path) { var fileInfo = this.getFileInfo(path); @@ -63923,16 +65384,16 @@ var ts; return fileInfo; }; AbstractBuilder.prototype.getFileInfoPaths = function () { - return this.fileInfos.getKeys(); + return this.getFileInfos().getKeys(); }; AbstractBuilder.prototype.setFileInfo = function (path, info) { - this.fileInfos.set(path, info); + this.getFileInfos().set(path, info); }; AbstractBuilder.prototype.removeFileInfo = function (path) { - this.fileInfos.remove(path); + this.getFileInfos().remove(path); }; AbstractBuilder.prototype.forEachFileInfo = function (action) { - this.fileInfos.forEachValue(function (_path, value) { return action(value); }); + this.getFileInfos().forEachValue(function (_path, value) { return action(value); }); }; AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) { var fileInfo = this.getFileInfo(scriptInfo.path); @@ -64034,6 +65495,10 @@ var ts; _this.project = project; return _this; } + ModuleBuilder.prototype.clear = function () { + this.projectVersionForDependencyGraph = undefined; + _super.prototype.clear.call(this); + }; ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) { var _this = this; if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { @@ -64231,16 +65696,17 @@ var ts; }()); server.UnresolvedImportsMap = UnresolvedImportsMap; var Project = (function () { - function Project(projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) { + function Project(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) { + this.projectName = projectName; this.projectKind = projectKind; this.projectService = projectService; this.documentRegistry = documentRegistry; - this.languageServiceEnabled = languageServiceEnabled; this.compilerOptions = compilerOptions; this.compileOnSaveEnabled = compileOnSaveEnabled; this.rootFiles = []; this.rootFilesMap = ts.createFileMap(); this.cachedUnresolvedImportsPerFile = new UnresolvedImportsMap(); + this.languageServiceEnabled = true; this.lastReportedVersion = 0; this.projectStructureVersion = 0; this.projectStateVersion = 0; @@ -64253,13 +65719,11 @@ var ts; else if (hasExplicitListOfFiles) { this.compilerOptions.allowNonTsExtensions = true; } - if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { - this.compilerOptions.noEmitForJsFiles = true; - } - if (languageServiceEnabled) { - this.enableLanguageService(); - } - else { + this.setInternalCompilerOptionsForEmittingJsFiles(); + this.lsHost = new server.LSHost(this.projectService.host, this, this.projectService.cancellationToken); + this.lsHost.setCompilationSettings(this.compilerOptions); + this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry); + if (!languageServiceEnabled) { this.disableLanguageService(); } this.builder = server.createBuilder(this); @@ -64276,6 +65740,11 @@ var ts; Project.prototype.getCachedUnresolvedImportsPerFile_TestOnly = function () { return this.cachedUnresolvedImportsPerFile; }; + Project.prototype.setInternalCompilerOptionsForEmittingJsFiles = function () { + if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { + this.compilerOptions.noEmitForJsFiles = true; + } + }; Project.prototype.getProjectErrors = function () { return this.projectErrors; }; @@ -64297,16 +65766,22 @@ var ts; return this.projectStateVersion.toString(); }; Project.prototype.enableLanguageService = function () { - var lsHost = new server.LSHost(this.projectService.host, this, this.projectService.cancellationToken); - lsHost.setCompilationSettings(this.compilerOptions); - this.languageService = ts.createLanguageService(lsHost, this.documentRegistry); - this.lsHost = lsHost; + if (this.languageServiceEnabled) { + return; + } this.languageServiceEnabled = true; + this.projectService.onUpdateLanguageServiceStateForProject(this, true); }; Project.prototype.disableLanguageService = function () { - this.languageService = server.nullLanguageService; - this.lsHost = server.nullLanguageServiceHost; + if (!this.languageServiceEnabled) { + return; + } + this.languageService.cleanupSemanticCache(); this.languageServiceEnabled = false; + this.projectService.onUpdateLanguageServiceStateForProject(this, false); + }; + Project.prototype.getProjectName = function () { + return this.projectName; }; Project.prototype.getSourceFile = function (path) { if (!this.program) { @@ -64352,7 +65827,9 @@ var ts; if (this.rootFiles) { for (var _i = 0, _a = this.rootFiles; _i < _a.length; _i++) { var f = _a[_i]; - result.push(f.fileName); + if (this.languageServiceEnabled || f.isScriptOpen()) { + result.push(f.fileName); + } } if (this.typingFiles) { for (var _b = 0, _c = this.typingFiles; _b < _c.length; _b++) { @@ -64368,6 +65845,9 @@ var ts; }; Project.prototype.getScriptInfos = function () { var _this = this; + if (!this.languageServiceEnabled) { + return this.rootFiles; + } return ts.map(this.program.getSourceFiles(), function (sourceFile) { var scriptInfo = _this.projectService.getScriptInfoForPath(sourceFile.path); if (!scriptInfo) { @@ -64426,7 +65906,7 @@ var ts; }; Project.prototype.containsFile = function (filename, requireOpen) { var info = this.projectService.getScriptInfoForNormalizedPath(filename); - if (info && (info.isOpen || !requireOpen)) { + if (info && (info.isScriptOpen() || !requireOpen)) { return this.containsScriptInfo(info); } }; @@ -64451,6 +65931,9 @@ var ts; } this.markAsDirty(); }; + Project.prototype.registerFileUpdate = function (fileName) { + (this.updatedFileNames || (this.updatedFileNames = ts.createMap()))[fileName] = fileName; + }; Project.prototype.markAsDirty = function () { this.projectStateVersion++; }; @@ -64465,9 +65948,9 @@ var ts; } var unresolvedImports; if (file.resolvedModules) { - for (var name_49 in file.resolvedModules) { - if (!file.resolvedModules[name_49] && !ts.isExternalModuleNameRelative(name_49)) { - var trimmed = name_49.trim(); + for (var name_51 in file.resolvedModules) { + if (!file.resolvedModules[name_51] && !ts.isExternalModuleNameRelative(name_51)) { + var trimmed = name_51.trim(); var i = trimmed.indexOf("/"); if (i !== -1 && trimmed.charCodeAt(0) === 64) { i = trimmed.indexOf("/", i + 1); @@ -64483,9 +65966,6 @@ var ts; this.cachedUnresolvedImportsPerFile.set(file.path, unresolvedImports || server.emptyArray); }; Project.prototype.updateGraph = function () { - if (!this.languageServiceEnabled) { - return true; - } this.lsHost.startRecordingFilesWithChangedResolutions(); var hasChanges = this.updateGraphWorker(); var changedFiles = this.lsHost.finishRecordingFilesWithChangedResolutions() || server.emptyArray; @@ -64507,6 +65987,12 @@ var ts; if (this.setTypings(cachedTypings)) { hasChanges = this.updateGraphWorker() || hasChanges; } + if (this.languageServiceEnabled) { + this.builder.onProjectUpdateGraph(); + } + else { + this.builder.clear(); + } if (hasChanges) { this.projectStructureVersion++; } @@ -64539,7 +66025,6 @@ var ts; } } } - this.builder.onProjectUpdateGraph(); return hasChanges; }; Project.prototype.getScriptInfoLSHost = function (fileName) { @@ -64581,6 +66066,7 @@ var ts; this.lastCachedUnresolvedImportsList = undefined; } this.compilerOptions = compilerOptions; + this.setInternalCompilerOptionsForEmittingJsFiles(); this.lsHost.setCompilationSettings(compilerOptions); this.markAsDirty(); } @@ -64600,16 +66086,20 @@ var ts; projectName: this.getProjectName(), version: this.projectStructureVersion, isInferred: this.projectKind === ProjectKind.Inferred, - options: this.getCompilerOptions() + options: this.getCompilerOptions(), + languageServiceDisabled: !this.languageServiceEnabled }; + var updatedFileNames = this.updatedFileNames; + this.updatedFileNames = undefined; if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) { - if (this.projectStructureVersion == this.lastReportedVersion) { + if (this.projectStructureVersion == this.lastReportedVersion && !updatedFileNames) { return { info: info, projectErrors: this.projectErrors }; } var lastReportedFileNames = this.lastReportedFileNames; var currentFiles = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); var added = []; var removed = []; + var updated = ts.getOwnKeys(updatedFileNames); for (var id in currentFiles) { if (!ts.hasProperty(lastReportedFileNames, id)) { added.push(id); @@ -64622,7 +66112,7 @@ var ts; } this.lastReportedFileNames = currentFiles; this.lastReportedVersion = this.projectStructureVersion; - return { info: info, changes: { added: added, removed: removed }, projectErrors: this.projectErrors }; + return { info: info, changes: { added: added, removed: removed, updated: updated }, projectErrors: this.projectErrors }; } else { var projectFileNames = this.getFileNames(); @@ -64688,16 +66178,11 @@ var ts; server.Project = Project; var InferredProject = (function (_super) { __extends(InferredProject, _super); - function InferredProject(projectService, documentRegistry, languageServiceEnabled, compilerOptions) { - var _this = _super.call(this, ProjectKind.Inferred, projectService, documentRegistry, undefined, languageServiceEnabled, compilerOptions, false) || this; + function InferredProject(projectService, documentRegistry, compilerOptions) { + var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this; _this.directoriesWatchedForTsconfig = []; - _this.inferredProjectName = server.makeInferredProjectName(InferredProject.NextId); - InferredProject.NextId++; return _this; } - InferredProject.prototype.getProjectName = function () { - return this.inferredProjectName; - }; InferredProject.prototype.getProjectRootPath = function () { if (this.projectService.useSingleInferredProject) { return undefined; @@ -64712,45 +66197,52 @@ var ts; this.projectService.stopWatchingDirectory(directory); } }; - InferredProject.prototype.getTypingOptions = function () { + InferredProject.prototype.getTypeAcquisition = function () { return { - enableAutoDiscovery: allRootFilesAreJsOrDts(this), + enable: allRootFilesAreJsOrDts(this), include: [], exclude: [] }; }; return InferredProject; }(Project)); - InferredProject.NextId = 1; + InferredProject.newName = (function () { + var nextId = 1; + return function () { + var id = nextId; + nextId++; + return server.makeInferredProjectName(id); + }; + })(); server.InferredProject = InferredProject; var ConfiguredProject = (function (_super) { __extends(ConfiguredProject, _super); function ConfiguredProject(configFileName, projectService, documentRegistry, hasExplicitListOfFiles, compilerOptions, wildcardDirectories, languageServiceEnabled, compileOnSaveEnabled) { - var _this = _super.call(this, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; - _this.configFileName = configFileName; + var _this = _super.call(this, configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; _this.wildcardDirectories = wildcardDirectories; _this.compileOnSaveEnabled = compileOnSaveEnabled; _this.openRefCount = 0; + _this.canonicalConfigFilePath = server.asNormalizedPath(projectService.toCanonicalFileName(configFileName)); return _this; } + ConfiguredProject.prototype.getConfigFilePath = function () { + return this.getProjectName(); + }; ConfiguredProject.prototype.getProjectRootPath = function () { - return ts.getDirectoryPath(this.configFileName); + return ts.getDirectoryPath(this.getConfigFilePath()); }; ConfiguredProject.prototype.setProjectErrors = function (projectErrors) { this.projectErrors = projectErrors; }; - ConfiguredProject.prototype.setTypingOptions = function (newTypingOptions) { - this.typingOptions = newTypingOptions; + ConfiguredProject.prototype.setTypeAcquisition = function (newTypeAcquisition) { + this.typeAcquisition = newTypeAcquisition; }; - ConfiguredProject.prototype.getTypingOptions = function () { - return this.typingOptions; - }; - ConfiguredProject.prototype.getProjectName = function () { - return this.configFileName; + ConfiguredProject.prototype.getTypeAcquisition = function () { + return this.typeAcquisition; }; ConfiguredProject.prototype.watchConfigFile = function (callback) { var _this = this; - this.projectFileWatcher = this.projectService.host.watchFile(this.configFileName, function (_) { return callback(_this); }); + this.projectFileWatcher = this.projectService.host.watchFile(this.getConfigFilePath(), function (_) { return callback(_this); }); }; ConfiguredProject.prototype.watchTypeRoots = function (callback) { var _this = this; @@ -64768,7 +66260,7 @@ var ts; if (this.directoryWatcher) { return; } - var directoryToWatch = ts.getDirectoryPath(this.configFileName); + var directoryToWatch = ts.getDirectoryPath(this.getConfigFilePath()); this.projectService.logger.info("Add recursive watcher for: " + directoryToWatch); this.directoryWatcher = this.projectService.host.watchDirectory(directoryToWatch, function (path) { return callback(_this, path); }, true); }; @@ -64777,7 +66269,7 @@ var ts; if (!this.wildcardDirectories) { return; } - var configDirectoryPath = ts.getDirectoryPath(this.configFileName); + var configDirectoryPath = ts.getDirectoryPath(this.getConfigFilePath()); this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) { if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) { var recursive = (flag & 1) !== 0; @@ -64827,8 +66319,7 @@ var ts; var ExternalProject = (function (_super) { __extends(ExternalProject, _super); function ExternalProject(externalProjectName, projectService, documentRegistry, compilerOptions, languageServiceEnabled, compileOnSaveEnabled, projectFilePath) { - var _this = _super.call(this, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; - _this.externalProjectName = externalProjectName; + var _this = _super.call(this, externalProjectName, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; _this.compileOnSaveEnabled = compileOnSaveEnabled; _this.projectFilePath = projectFilePath; return _this; @@ -64837,37 +66328,34 @@ var ts; if (this.projectFilePath) { return ts.getDirectoryPath(this.projectFilePath); } - return ts.getDirectoryPath(ts.normalizeSlashes(this.externalProjectName)); + return ts.getDirectoryPath(ts.normalizeSlashes(this.getProjectName())); }; - ExternalProject.prototype.getTypingOptions = function () { - return this.typingOptions; + ExternalProject.prototype.getTypeAcquisition = function () { + return this.typeAcquisition; }; ExternalProject.prototype.setProjectErrors = function (projectErrors) { this.projectErrors = projectErrors; }; - ExternalProject.prototype.setTypingOptions = function (newTypingOptions) { - if (!newTypingOptions) { - newTypingOptions = { - enableAutoDiscovery: allRootFilesAreJsOrDts(this), + ExternalProject.prototype.setTypeAcquisition = function (newTypeAcquisition) { + if (!newTypeAcquisition) { + newTypeAcquisition = { + enable: allRootFilesAreJsOrDts(this), include: [], exclude: [] }; } else { - if (newTypingOptions.enableAutoDiscovery === undefined) { - newTypingOptions.enableAutoDiscovery = allRootFilesAreJsOrDts(this); + if (newTypeAcquisition.enable === undefined) { + newTypeAcquisition.enable = allRootFilesAreJsOrDts(this); } - if (!newTypingOptions.include) { - newTypingOptions.include = []; + if (!newTypeAcquisition.include) { + newTypeAcquisition.include = []; } - if (!newTypingOptions.exclude) { - newTypingOptions.exclude = []; + if (!newTypeAcquisition.exclude) { + newTypeAcquisition.exclude = []; } } - this.typingOptions = newTypingOptions; - }; - ExternalProject.prototype.getProjectName = function () { - return this.externalProjectName; + this.typeAcquisition = newTypeAcquisition; }; return ExternalProject; }(Project)); @@ -64879,6 +66367,9 @@ var ts; var server; (function (server) { server.maxProgramSizeForNonTsFiles = 20 * 1024 * 1024; + server.ContextEvent = "context"; + server.ConfigFileDiagEvent = "configFileDiag"; + server.ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions) { var map = ts.createMap(); for (var _i = 0, commandLineOptions_1 = commandLineOptions; _i < commandLineOptions_1.length; _i++) { @@ -64947,7 +66438,10 @@ var ts; var fileNamePropertyReader = { getFileName: function (x) { return x; }, getScriptKind: function (_) { return undefined; }, - hasMixedContent: function (_) { return false; } + hasMixedContent: function (fileName, extraFileExtensions) { + var mixedContentExtensions = ts.map(ts.filter(extraFileExtensions, function (item) { return item.isMixedContent; }), function (item) { return item.extension; }); + return ts.forEach(mixedContentExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); + } }; var externalFilePropertyReader = { getFileName: function (x) { return x.fileName; }, @@ -65027,7 +66521,8 @@ var ts; this.typingsCache = new server.TypingsCache(this.typingsInstaller); this.hostConfiguration = { formatCodeOptions: server.getDefaultFormatCodeSettings(this.host), - hostInfo: "Unknown host" + hostInfo: "Unknown host", + extraFileExtensions: [] }; this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory()); } @@ -65040,6 +66535,15 @@ var ts; ProjectService.prototype.getCompilerOptionsForInferredProjects = function () { return this.compilerOptionsForInferredProjects; }; + ProjectService.prototype.onUpdateLanguageServiceStateForProject = function (project, languageServiceEnabled) { + if (!this.eventHandler) { + return; + } + this.eventHandler({ + eventName: server.ProjectLanguageServiceStateEvent, + data: { project: project, languageServiceEnabled: languageServiceEnabled } + }); + }; ProjectService.prototype.updateTypingsForProject = function (response) { var project = this.findProject(response.projectName); if (!project) { @@ -65047,7 +66551,7 @@ var ts; } switch (response.kind) { case server.ActionSet: - this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typingOptions, response.unresolvedImports, response.typings); + this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings); break; case server.ActionInvalidate: this.typingsCache.deleteTypingsForProject(response.projectName); @@ -65144,7 +66648,7 @@ var ts; this.handleDeletedFile(info); } else { - if (info && (!info.isOpen)) { + if (info && (!info.isScriptOpen())) { info.reloadFromFile(); this.updateProjectGraphs(info.containingProjects); } @@ -65153,7 +66657,7 @@ var ts; ProjectService.prototype.handleDeletedFile = function (info) { this.logger.info(info.fileName + " deleted"); info.stopWatcher(); - if (!info.isOpen) { + if (!info.isScriptOpen()) { this.filenameToScriptInfo.remove(info.path); this.lastDeletedFile = info; var containingProjects = info.containingProjects.slice(); @@ -65165,7 +66669,10 @@ var ts; } for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { var openFile = _a[_i]; - this.eventHandler({ eventName: "context", data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } }); + this.eventHandler({ + eventName: server.ContextEvent, + data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } + }); } } this.printProjects(); @@ -65173,7 +66680,7 @@ var ts; ProjectService.prototype.onTypeRootFileChanged = function (project, fileName) { var _this = this; this.logger.info("Type root file " + fileName + " changed"); - this.throttledOperations.schedule(project.configFileName + " * type root", 250, function () { + this.throttledOperations.schedule(project.getConfigFilePath() + " * type root", 250, function () { project.updateTypes(); _this.updateConfiguredProject(project); _this.refreshInferredProjects(); @@ -65181,15 +66688,15 @@ var ts; }; ProjectService.prototype.onSourceFileInDirectoryChangedForConfiguredProject = function (project, fileName) { var _this = this; - if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions())) { + if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions(), this.hostConfiguration.extraFileExtensions)) { return; } this.logger.info("Detected source file changes: " + fileName); - this.throttledOperations.schedule(project.configFileName, 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); }); + this.throttledOperations.schedule(project.getConfigFilePath(), 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); }); }; ProjectService.prototype.handleChangeInSourceFileForConfiguredProject = function (project, triggerFile) { var _this = this; - var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; + var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; this.reportConfigFileDiagnostics(project.getProjectName(), configFileErrors, triggerFile); var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); })); var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); })); @@ -65200,8 +66707,10 @@ var ts; } }; ProjectService.prototype.onConfigChangedForConfiguredProject = function (project) { - this.logger.info("Config file changed: " + project.configFileName); - this.updateConfiguredProject(project); + var configFileName = project.getConfigFilePath(); + this.logger.info("Config file changed: " + configFileName); + var configFileErrors = this.updateConfiguredProject(project); + this.reportConfigFileDiagnostics(configFileName, configFileErrors, configFileName); this.refreshInferredProjects(); }; ProjectService.prototype.onConfigFileAddedForInferredProject = function (fileName) { @@ -65278,13 +66787,15 @@ var ts; } }; ProjectService.prototype.closeOpenFile = function (info) { - info.reloadFromFile(); + info.close(); server.removeItemFromSet(this.openFiles, info); - info.isOpen = false; var projectsToRemove; for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) { var p = _a[_i]; if (p.projectKind === server.ProjectKind.Configured) { + if (info.hasMixedContent) { + info.registerFileUpdate(); + } if (p.deleteOpenRef() === 0) { (projectsToRemove || (projectsToRemove = [])).push(p); } @@ -65292,6 +66803,9 @@ var ts; else if (p.projectKind === server.ProjectKind.Inferred && p.isRoot(info)) { (projectsToRemove || (projectsToRemove = [])).push(p); } + if (!p.languageServiceEnabled) { + p.markAsDirty(); + } } if (projectsToRemove) { for (var _b = 0, projectsToRemove_1 = projectsToRemove; _b < projectsToRemove_1.length; _b++) { @@ -65387,7 +66901,13 @@ var ts; } }; ProjectService.prototype.findConfiguredProjectByProjectName = function (configFileName) { - return findProjectByName(configFileName, this.configuredProjects); + configFileName = server.asNormalizedPath(this.toCanonicalFileName(configFileName)); + for (var _i = 0, _a = this.configuredProjects; _i < _a.length; _i++) { + var proj = _a[_i]; + if (proj.canonicalConfigFilePath === configFileName) { + return proj; + } + } }; ProjectService.prototype.findExternalProjectByProjectName = function (projectFileName) { return findProjectByName(projectFileName, this.externalProjects); @@ -65403,7 +66923,7 @@ var ts; config = sanitizedConfig; errors = diagnostics.length ? diagnostics : [result.error]; } - var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename); + var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename, [], this.hostConfiguration.extraFileExtensions); if (parsedCommandLine.errors.length) { errors = ts.concatenate(errors, parsedCommandLine.errors); } @@ -65417,7 +66937,7 @@ var ts; compilerOptions: parsedCommandLine.options, configHasFilesProperty: config["files"] !== undefined, wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories), - typingOptions: parsedCommandLine.typingOptions, + typeAcquisition: parsedCommandLine.typeAcquisition, compileOnSave: parsedCommandLine.compileOnSave }; return { success: true, projectOptions: projectOptions, configFileErrors: errors }; @@ -65440,10 +66960,10 @@ var ts; } return false; }; - ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typingOptions) { + ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typeAcquisition) { var compilerOptions = convertCompilerOptions(options); var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave); - this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typingOptions, undefined); + this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typeAcquisition, undefined); this.externalProjects.push(project); return project; }; @@ -65452,7 +66972,7 @@ var ts; return; } this.eventHandler({ - eventName: "configFileDiag", + eventName: server.ConfigFileDiagEvent, data: { configFileName: configFileName, diagnostics: diagnostics || [], triggerFile: triggerFile } }); }; @@ -65460,7 +66980,7 @@ var ts; var _this = this; var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader); var project = new server.ConfiguredProject(configFileName, this, this.documentRegistry, projectOptions.configHasFilesProperty, projectOptions.compilerOptions, projectOptions.wildcardDirectories, !sizeLimitExceeded, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave); - this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typingOptions, configFileErrors); + this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors); project.watchConfigFile(function (project) { return _this.onConfigChangedForConfiguredProject(project); }); if (!sizeLimitExceeded) { this.watchConfigDirectoryForProject(project, projectOptions); @@ -65476,13 +66996,13 @@ var ts; project.watchConfigDirectory(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); }); } }; - ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typingOptions, configFileErrors) { + ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors) { var errors; for (var _i = 0, files_4 = files; _i < files_4.length; _i++) { var f = files_4[_i]; var rootFilename = propertyReader.getFileName(f); var scriptKind = propertyReader.getScriptKind(f); - var hasMixedContent = propertyReader.hasMixedContent(f); + var hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); if (this.host.fileExists(rootFilename)) { var info = this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(rootFilename), clientFileName == rootFilename, undefined, scriptKind, hasMixedContent); project.addRoot(info); @@ -65492,7 +67012,7 @@ var ts; } } project.setProjectErrors(ts.concatenate(configFileErrors, errors)); - project.setTypingOptions(typingOptions); + project.setTypeAcquisition(typeAcquisition); project.updateGraph(); }; ProjectService.prototype.openConfigFile = function (configFileName, clientFileName) { @@ -65507,7 +67027,7 @@ var ts; errors: project.getProjectErrors() }; }; - ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypingOptions, compileOnSave, configFileErrors) { + ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors) { var oldRootScriptInfos = project.getRootScriptInfos(); var newRootScriptInfos = []; var newRootScriptInfoMap = server.createNormalizedPathMap(); @@ -65526,7 +67046,7 @@ var ts; rootFilesChanged = true; if (!scriptInfo) { var scriptKind = propertyReader.getScriptKind(f); - var hasMixedContent = propertyReader.hasMixedContent(f); + var hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, false, undefined, scriptKind, hasMixedContent); } } @@ -65557,7 +67077,7 @@ var ts; if (toAdd) { for (var _d = 0, toAdd_1 = toAdd; _d < toAdd_1.length; _d++) { var f = toAdd_1[_d]; - if (f.isOpen && isRootFileInInferredProject(f)) { + if (f.isScriptOpen() && isRootFileInInferredProject(f)) { var inferredProject = f.containingProjects[0]; inferredProject.removeFile(f); if (!inferredProject.hasRoots()) { @@ -65569,7 +67089,7 @@ var ts; } } project.setCompilerOptions(newOptions); - project.setTypingOptions(newTypingOptions); + project.setTypeAcquisition(newTypeAcquisition); if (compileOnSave !== undefined) { project.compileOnSaveEnabled = compileOnSave; } @@ -65577,12 +67097,12 @@ var ts; project.updateGraph(); }; ProjectService.prototype.updateConfiguredProject = function (project) { - if (!this.host.fileExists(project.configFileName)) { + if (!this.host.fileExists(project.getConfigFilePath())) { this.logger.info("Config file deleted"); this.removeProject(project); return; } - var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; + var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; if (!success) { this.updateNonInferredProject(project, [], fileNamePropertyReader, {}, {}, false, configFileErrors); return configFileErrors; @@ -65590,25 +67110,24 @@ var ts; if (this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) { project.setCompilerOptions(projectOptions.compilerOptions); if (!project.languageServiceEnabled) { - return; + return configFileErrors; } project.disableLanguageService(); project.stopWatchingDirectory(); } else { - if (!project.languageServiceEnabled) { - project.enableLanguageService(); - } + project.enableLanguageService(); this.watchConfigDirectoryForProject(project, projectOptions); - this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typingOptions, projectOptions.compileOnSave, configFileErrors); + this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors); } + return configFileErrors; }; ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root) { var _this = this; var useExistingProject = this.useSingleInferredProject && this.inferredProjects.length; var project = useExistingProject ? this.inferredProjects[0] - : new server.InferredProject(this, this.documentRegistry, true, this.compilerOptionsForInferredProjects); + : new server.InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects); project.addRoot(root); this.directoryWatchers.startWatchingContainingDirectoriesForFile(root.fileName, project, function (fileName) { return _this.onConfigFileAddedForInferredProject(fileName); }); project.updateGraph(); @@ -65627,29 +67146,30 @@ var ts; var _this = this; var info = this.getScriptInfoForNormalizedPath(fileName); if (!info) { - var content = void 0; - if (this.host.fileExists(fileName)) { - content = fileContent || (hasMixedContent ? "" : this.host.readFile(fileName)); - } - if (!content) { - if (openedByClient) { - content = ""; - } - } - if (content !== undefined) { - info = new server.ScriptInfo(this.host, fileName, content, scriptKind, openedByClient, hasMixedContent); + if (openedByClient || this.host.fileExists(fileName)) { + info = new server.ScriptInfo(this.host, fileName, scriptKind, hasMixedContent); this.filenameToScriptInfo.set(info.path, info); - if (!info.isOpen && !hasMixedContent) { - info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); })); + if (openedByClient) { + if (fileContent === undefined) { + fileContent = this.host.readFile(fileName) || ""; + } + } + else { + if (!hasMixedContent) { + info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); })); + } } } } if (info) { - if (fileContent !== undefined) { - info.reload(fileContent); + if (openedByClient && !info.isScriptOpen()) { + info.open(fileContent); + if (hasMixedContent) { + info.registerFileUpdate(); + } } - if (openedByClient) { - info.isOpen = true; + else if (fileContent !== undefined) { + info.reload(fileContent); } } return info; @@ -65677,6 +67197,10 @@ var ts; server.mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); this.logger.info("Format host information updated"); } + if (args.extraFileExtensions) { + this.hostConfiguration.extraFileExtensions = args.extraFileExtensions; + this.logger.info("Host file extension mappings updated"); + } } }; ProjectService.prototype.closeLog = function () { @@ -65724,30 +67248,39 @@ var ts; return this.openClientFileWithNormalizedPath(server.toNormalizedPath(fileName), fileContent, scriptKind); }; ProjectService.prototype.openClientFileWithNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent) { - var _a = this.findContainingExternalProject(fileName) - ? {} - : this.openOrUpdateConfiguredProjectForFile(fileName), _b = _a.configFileName, configFileName = _b === void 0 ? undefined : _b, _c = _a.configFileErrors, configFileErrors = _c === void 0 ? undefined : _c; + var configFileName; + var configFileErrors; + var project = this.findContainingExternalProject(fileName); + if (!project) { + (_a = this.openOrUpdateConfiguredProjectForFile(fileName), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors); + if (configFileName) { + project = this.findConfiguredProjectByProjectName(configFileName); + } + } + if (project && !project.languageServiceEnabled) { + project.markAsDirty(); + } var info = this.getOrCreateScriptInfoForNormalizedPath(fileName, true, fileContent, scriptKind, hasMixedContent); this.assignScriptInfoToInferredProjectIfNecessary(info, true); this.printProjects(); return { configFileName: configFileName, configFileErrors: configFileErrors }; + var _a; }; ProjectService.prototype.closeClientFile = function (uncheckedFileName) { var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName)); if (info) { this.closeOpenFile(info); - info.isOpen = false; } this.printProjects(); }; ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { - var _loop_5 = function (proj) { + var _loop_4 = function (proj) { var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); }; for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { var proj = currentProjects_1[_i]; - _loop_5(proj); + _loop_4(proj); } }; ProjectService.prototype.synchronizeProjectList = function (knownProjects) { @@ -65763,7 +67296,7 @@ var ts; for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) { var file = openFiles_1[_i]; var scriptInfo = this.getScriptInfo(file.fileName); - ts.Debug.assert(!scriptInfo || !scriptInfo.isOpen); + ts.Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen()); var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName); this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent); } @@ -65830,7 +67363,27 @@ var ts; } } }; - ProjectService.prototype.openExternalProject = function (proj) { + ProjectService.prototype.openExternalProjects = function (projects) { + var projectsToClose = ts.arrayToMap(this.externalProjects, function (p) { return p.getProjectName(); }, function (_) { return true; }); + for (var externalProjectName in this.externalProjectToConfiguredProjectMap) { + projectsToClose[externalProjectName] = true; + } + for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { + var externalProject = projects_4[_i]; + this.openExternalProject(externalProject, true); + delete projectsToClose[externalProject.projectFileName]; + } + for (var externalProjectName in projectsToClose) { + this.closeExternalProject(externalProjectName, true); + } + this.refreshInferredProjects(); + }; + ProjectService.prototype.openExternalProject = function (proj, suppressRefreshOfInferredProjects) { + if (suppressRefreshOfInferredProjects === void 0) { suppressRefreshOfInferredProjects = false; } + if (proj.typingOptions && !proj.typeAcquisition) { + var typeAcquisition = ts.convertEnableAutoDiscoveryToEnable(proj.typingOptions); + proj.typeAcquisition = typeAcquisition; + } var tsConfigFiles; var rootFiles = []; for (var _i = 0, _a = proj.rootFiles; _i < _a.length; _i++) { @@ -65852,7 +67405,14 @@ var ts; var exisingConfigFiles; if (externalProject) { if (!tsConfigFiles) { - this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typingOptions, proj.options.compileOnSave, undefined); + var compilerOptions = convertCompilerOptions(proj.options); + if (this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, proj.rootFiles, externalFilePropertyReader)) { + externalProject.disableLanguageService(); + } + else { + externalProject.enableLanguageService(); + } + this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, undefined); return; } this.closeExternalProject(proj.projectFileName, true); @@ -65902,9 +67462,11 @@ var ts; } else { delete this.externalProjectToConfiguredProjectMap[proj.projectFileName]; - this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typingOptions); + this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); + } + if (!suppressRefreshOfInferredProjects) { + this.refreshInferredProjects(); } - this.refreshInferredProjects(); }; return ProjectService; }()); @@ -66066,14 +67628,11 @@ var ts; this.changeSeq = 0; this.handlers = ts.createMap((_a = {}, _a[CommandNames.OpenExternalProject] = function (request) { - _this.projectService.openExternalProject(request.arguments); + _this.projectService.openExternalProject(request.arguments, false); return _this.requiredResponse(true); }, _a[CommandNames.OpenExternalProjects] = function (request) { - for (var _i = 0, _a = request.arguments.projects; _i < _a.length; _i++) { - var proj = _a[_i]; - _this.projectService.openExternalProject(proj); - } + _this.projectService.openExternalProjects(request.arguments.projects); return _this.requiredResponse(true); }, _a[CommandNames.CloseExternalProject] = function (request) { @@ -66315,14 +67874,22 @@ var ts; Session.prototype.defaultEventHandler = function (event) { var _this = this; switch (event.eventName) { - case "context": + case server.ContextEvent: var _a = event.data, project = _a.project, fileName = _a.fileName; this.projectService.logger.info("got context event, updating diagnostics for " + fileName); this.updateErrorCheck([{ fileName: fileName, project: project }], this.changeSeq, function (n) { return n === _this.changeSeq; }, 100); break; - case "configFileDiag": + case server.ConfigFileDiagEvent: var _b = event.data, triggerFile = _b.triggerFile, configFileName = _b.configFileName, diagnostics = _b.diagnostics; this.configFileDiagnosticEvent(triggerFile, configFileName, diagnostics); + break; + case server.ProjectLanguageServiceStateEvent: + var eventName = "projectLanguageServiceState"; + this.event({ + projectName: event.data.project.getProjectName(), + languageServiceEnabled: event.data.languageServiceEnabled + }, eventName); + break; } }; Session.prototype.logError = function (err, cmd) { @@ -66462,8 +68029,8 @@ var ts; return; } this.logger.info("cleaning " + caption); - for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { - var p = projects_4[_i]; + for (var _i = 0, projects_5 = projects; _i < projects_5.length; _i++) { + var p = projects_5[_i]; p.getLanguageService(false).cleanupSemanticCache(); } }; @@ -66759,7 +68326,7 @@ var ts; var displayString = ts.displayPartsToString(nameInfo.displayParts); var nameSpan = nameInfo.textSpan; var nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset; - var nameText = scriptInfo.snap().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + var nameText = scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); var refs = server.combineProjectOutput(projects, function (project) { var references = project.getLanguageService().getReferencesAtPosition(file, position); if (!references) { @@ -66769,7 +68336,7 @@ var ts; var refScriptInfo = project.getScriptInfo(ref.fileName); var start = refScriptInfo.positionToLineOffset(ref.textSpan.start); var refLineSpan = refScriptInfo.lineToTextSpan(start.line - 1); - var lineText = refScriptInfo.snap().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + var lineText = refScriptInfo.getSnapshot().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); return { file: ref.fileName, start: start, @@ -66972,9 +68539,9 @@ var ts; if (simplifiedResult) { return completions.entries.reduce(function (result, entry) { if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { - var name_50 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; + var name_52 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined; - result.push({ name: name_50, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); + result.push({ name: name_52, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); } return result; }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); @@ -67019,6 +68586,9 @@ var ts; if (!project) { server.Errors.ThrowNoProject(); } + if (!project.languageServiceEnabled) { + return false; + } var scriptInfo = project.getScriptInfo(file); return project.builder.emitFile(scriptInfo, function (path, data, writeByteOrderMark) { return _this.host.writeFile(path, data, writeByteOrderMark); }); }; @@ -67284,7 +68854,7 @@ var ts; highPriorityFiles.push(fileNameInProject); else { var info = this.projectService.getScriptInfo(fileNameInProject); - if (!info.isOpen) { + if (!info.isScriptOpen()) { if (fileNameInProject.indexOf(".d.ts") > 0) veryLowPriorityFiles.push(fileNameInProject); else @@ -67741,8 +69311,9 @@ var ts; } }; LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { - var oldSnap = oldSnapshot; - return this.getTextChangeRangeSinceVersion(oldSnap.version); + if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) { + return this.getTextChangeRangeSinceVersion(oldSnapshot.version); + } }; return LineIndexSnapshot; }()); @@ -68226,32 +69797,40 @@ var ts; var childProcess = require("child_process"); var os = require("os"); function getGlobalTypingsCacheLocation() { - var basePath; switch (process.platform) { - case "win32": - basePath = process.env.LOCALAPPDATA || + case "win32": { + var basePath = process.env.LOCALAPPDATA || process.env.APPDATA || (os.homedir && os.homedir()) || process.env.USERPROFILE || (process.env.HOMEDRIVE && process.env.HOMEPATH && ts.normalizeSlashes(process.env.HOMEDRIVE + process.env.HOMEPATH)) || os.tmpdir(); - break; - case "linux": - basePath = (os.homedir && os.homedir()) || - process.env.HOME || - ((process.env.LOGNAME || process.env.USER) && "/home/" + (process.env.LOGNAME || process.env.USER)) || - os.tmpdir(); - break; + return ts.combinePaths(ts.normalizeSlashes(basePath), "Microsoft/TypeScript"); + } case "darwin": - var homeDir = (os.homedir && os.homedir()) || - process.env.HOME || - ((process.env.LOGNAME || process.env.USER) && "/Users/" + (process.env.LOGNAME || process.env.USER)) || - os.tmpdir(); - basePath = ts.combinePaths(homeDir, "Library/Application Support/"); - break; + case "linux": + case "android": { + var cacheLocation = getNonWindowsCacheLocation(process.platform === "darwin"); + return ts.combinePaths(cacheLocation, "typescript"); + } + default: + ts.Debug.fail("unsupported platform '" + process.platform + "'"); + return; } - ts.Debug.assert(basePath !== undefined); - return ts.combinePaths(ts.normalizeSlashes(basePath), "Microsoft/TypeScript"); + } + function getNonWindowsCacheLocation(platformIsDarwin) { + if (process.env.XDG_CACHE_HOME) { + return process.env.XDG_CACHE_HOME; + } + var usersDir = platformIsDarwin ? "Users" : "home"; + var homePath = (os.homedir && os.homedir()) || + process.env.HOME || + ((process.env.LOGNAME || process.env.USER) && "/" + usersDir + "/" + (process.env.LOGNAME || process.env.USER)) || + os.tmpdir(); + var cacheFolder = platformIsDarwin + ? "Library/Caches" + : ".cache"; + return ts.combinePaths(ts.normalizeSlashes(homePath), cacheFolder); } var readline = require("readline"); var fs = require("fs"); @@ -68360,7 +69939,7 @@ var ts; this.socket.write(server.formatMessage({ seq: seq, type: "event", event: event, body: body }, this.logger, Buffer.byteLength, this.newLine), "utf8"); }; NodeTypingsInstaller.prototype.setTelemetrySender = function (telemetrySender) { - this.telemetrySender = telemetrySender; + this.eventSender = telemetrySender; }; NodeTypingsInstaller.prototype.attach = function (projectService) { var _this = this; @@ -68399,9 +69978,9 @@ var ts; NodeTypingsInstaller.prototype.onProjectClosed = function (p) { this.installer.send({ projectName: p.getProjectName(), kind: "closeProject" }); }; - NodeTypingsInstaller.prototype.enqueueInstallTypingsRequest = function (project, typingOptions, unresolvedImports) { + NodeTypingsInstaller.prototype.enqueueInstallTypingsRequest = function (project, typeAcquisition, unresolvedImports) { var _this = this; - var request = server.createInstallTypingsRequest(project, typingOptions, unresolvedImports); + var request = server.createInstallTypingsRequest(project, typeAcquisition, unresolvedImports); if (this.logger.hasLevel(server.LogLevel.verbose)) { if (this.logger.hasLevel(server.LogLevel.verbose)) { this.logger.info("Scheduling throttled operation: " + JSON.stringify(request)); @@ -68418,18 +69997,41 @@ var ts; if (this.logger.hasLevel(server.LogLevel.verbose)) { this.logger.info("Received response: " + JSON.stringify(response)); } - if (response.kind === server.EventInstall) { - if (this.telemetrySender) { - var body = { + if (response.kind === server.EventBeginInstallTypes) { + if (!this.eventSender) { + return; + } + var body = { + eventId: response.eventId, + packages: response.packagesToInstall, + }; + var eventName = "beginInstallTypes"; + this.eventSender.event(body, eventName); + return; + } + if (response.kind === server.EventEndInstallTypes) { + if (!this.eventSender) { + return; + } + if (this.telemetryEnabled) { + var body_1 = { telemetryEventName: "typingsInstalled", payload: { installedPackages: response.packagesToInstall.join(","), - installSuccess: response.installSuccess + installSuccess: response.installSuccess, + typingsInstallerVersion: response.typingsInstallerVersion } }; - var eventName = "telemetry"; - this.telemetrySender.event(body, eventName); + var eventName_1 = "telemetry"; + this.eventSender.event(body_1, eventName_1); } + var body = { + eventId: response.eventId, + packages: response.packagesToInstall, + success: response.installSuccess, + }; + var eventName = "endInstallTypes"; + this.eventSender.event(body, eventName); return; } this.projectService.updateTypingsForProject(response); @@ -68636,6 +70238,10 @@ var ts; eventPort = v; } } + var localeStr = server.findArgument("--locale"); + if (localeStr) { + ts.validateLocaleAndSetLanguage(localeStr, sys); + } var useSingleInferredProject = server.hasArgument("--useSingleInferredProject"); var disableAutomaticTypingAcquisition = server.hasArgument("--disableAutomaticTypingAcquisition"); var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry); @@ -69244,7 +70850,7 @@ var ts; if (result.error) { return { options: {}, - typingOptions: {}, + typeAcquisition: {}, files: [], raw: {}, errors: [realizeDiagnostic(result.error, "\r\n")] @@ -69254,7 +70860,7 @@ var ts; var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName); return { options: configFile.options, - typingOptions: configFile.typingOptions, + typeAcquisition: configFile.typeAcquisition, files: configFile.fileNames, raw: configFile.raw, errors: realizeDiagnostics(configFile.errors, "\r\n") @@ -69269,7 +70875,7 @@ var ts; var getCanonicalFileName = ts.createGetCanonicalFileName(false); return this.forwardJSONCall("discoverTypings()", function () { var info = JSON.parse(discoverTypingsJson); - return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.unresolvedImports); + return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports); }); }; return CoreServicesShimObject; diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index 9888241431b..e01f4393032 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -318,7 +318,8 @@ declare namespace ts.server.protocol { projectFileName: string; rootFiles: ExternalFile[]; options: ExternalProjectCompilerOptions; - typingOptions?: TypingOptions; + typingOptions?: TypeAcquisition; + typeAcquisition?: TypeAcquisition; } interface CompileOnSaveMixin { compileOnSave?: boolean; @@ -329,10 +330,12 @@ declare namespace ts.server.protocol { isInferred: boolean; version: number; options: ts.CompilerOptions; + languageServiceDisabled: boolean; } interface ProjectChanges { added: string[]; removed: string[]; + updated: string[]; } interface ProjectFiles { info?: ProjectVersionInfo; @@ -350,6 +353,7 @@ declare namespace ts.server.protocol { hostInfo?: string; file?: string; formatOptions?: FormatCodeSettings; + extraFileExtensions?: FileExtensionInfo[]; } interface ConfigureRequest extends Request { command: CommandTypes.Configure; @@ -614,6 +618,15 @@ declare namespace ts.server.protocol { body?: ConfigFileDiagnosticEventBody; event: "configFileDiag"; } + type ProjectLanguageServiceStateEventName = "projectLanguageServiceState"; + interface ProjectLanguageServiceStateEvent extends Event { + event: ProjectLanguageServiceStateEventName; + body?: ProjectLanguageServiceStateEventBody; + } + interface ProjectLanguageServiceStateEventBody { + projectName: string; + languageServiceEnabled: boolean; + } interface ReloadRequestArgs extends FileRequestArgs { tmpfile: string; } @@ -706,6 +719,26 @@ declare namespace ts.server.protocol { interface TypingsInstalledTelemetryEventPayload { installedPackages: string; installSuccess: boolean; + typingsInstallerVersion: string; + } + type BeginInstallTypesEventName = "beginInstallTypes"; + type EndInstallTypesEventName = "endInstallTypes"; + interface BeginInstallTypesEvent extends Event { + event: BeginInstallTypesEventName; + body: BeginInstallTypesEventBody; + } + interface EndInstallTypesEvent extends Event { + event: EndInstallTypesEventName; + body: EndInstallTypesEventBody; + } + interface InstallTypesEventBody { + eventId: number; + packages: ReadonlyArray; + } + interface BeginInstallTypesEventBody extends InstallTypesEventBody { + } + interface EndInstallTypesEventBody extends InstallTypesEventBody { + success: boolean; } interface NavBarResponse extends Response { body?: NavigationBarItem[]; @@ -1139,23 +1172,25 @@ declare namespace ts { JSDocThisType = 277, JSDocComment = 278, JSDocTag = 279, - JSDocParameterTag = 280, - JSDocReturnTag = 281, - JSDocTypeTag = 282, - JSDocTemplateTag = 283, - JSDocTypedefTag = 284, - JSDocPropertyTag = 285, - JSDocTypeLiteral = 286, - JSDocLiteralType = 287, - JSDocNullKeyword = 288, - JSDocUndefinedKeyword = 289, - JSDocNeverKeyword = 290, - SyntaxList = 291, - NotEmittedStatement = 292, - PartiallyEmittedExpression = 293, - MergeDeclarationMarker = 294, - EndOfDeclarationMarker = 295, - Count = 296, + JSDocAugmentsTag = 280, + JSDocParameterTag = 281, + JSDocReturnTag = 282, + JSDocTypeTag = 283, + JSDocTemplateTag = 284, + JSDocTypedefTag = 285, + JSDocPropertyTag = 286, + JSDocTypeLiteral = 287, + JSDocLiteralType = 288, + JSDocNullKeyword = 289, + JSDocUndefinedKeyword = 290, + JSDocNeverKeyword = 291, + SyntaxList = 292, + NotEmittedStatement = 293, + PartiallyEmittedExpression = 294, + MergeDeclarationMarker = 295, + EndOfDeclarationMarker = 296, + RawExpression = 297, + Count = 298, FirstAssignment = 57, LastAssignment = 69, FirstCompoundAssignment = 58, @@ -1182,9 +1217,9 @@ declare namespace ts { LastBinaryOperator = 69, FirstNode = 141, FirstJSDocNode = 262, - LastJSDocNode = 287, + LastJSDocNode = 288, FirstJSDocTagNode = 278, - LastJSDocTagNode = 290, + LastJSDocTagNode = 291, } const enum NodeFlags { None = 0, @@ -1198,26 +1233,20 @@ declare namespace ts { HasImplicitReturn = 128, HasExplicitReturn = 256, GlobalAugmentation = 512, - HasClassExtends = 1024, - HasDecorators = 2048, - HasParamDecorators = 4096, - HasAsyncFunctions = 8192, - HasSpreadAttribute = 16384, - HasRestAttribute = 32768, - DisallowInContext = 65536, - YieldContext = 131072, - DecoratorContext = 262144, - AwaitContext = 524288, - ThisNodeHasError = 1048576, - JavaScriptFile = 2097152, - ThisNodeOrAnySubNodesHasError = 4194304, - HasAggregatedChildData = 8388608, + HasAsyncFunctions = 1024, + DisallowInContext = 2048, + YieldContext = 4096, + DecoratorContext = 8192, + AwaitContext = 16384, + ThisNodeHasError = 32768, + JavaScriptFile = 65536, + ThisNodeOrAnySubNodesHasError = 131072, + HasAggregatedChildData = 262144, BlockScoped = 3, ReachabilityCheckFlags = 384, - EmitHelperFlags = 64512, - ReachabilityAndEmitFlags = 64896, - ContextFlags = 3080192, - TypeExcludesFlags = 655360, + ReachabilityAndEmitFlags = 1408, + ContextFlags = 96256, + TypeExcludesFlags = 20480, } const enum ModifierFlags { None = 0, @@ -1261,7 +1290,8 @@ declare namespace ts { parent?: Node; original?: Node; startsOnNewLine?: boolean; - jsDocComments?: JSDoc[]; + jsDoc?: JSDoc[]; + jsDocCache?: (JSDoc | JSDocTag)[]; symbol?: Symbol; locals?: SymbolTable; nextContainer?: Node; @@ -1271,6 +1301,7 @@ declare namespace ts { } interface NodeArray extends Array, TextRange { hasTrailingComma?: boolean; + transformFlags?: TransformFlags; } interface Token extends Node { kind: TKind; @@ -1313,14 +1344,14 @@ declare namespace ts { right: Identifier; } type EntityName = Identifier | QualifiedName; - type PropertyName = Identifier | LiteralExpression | ComputedPropertyName; - type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; + type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName; + type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern; interface Declaration extends Node { _declarationBrand: any; name?: DeclarationName; } interface DeclarationStatement extends Declaration, Statement { - name?: Identifier | LiteralExpression; + name?: Identifier | StringLiteral | NumericLiteral; } interface ComputedPropertyName extends Node { kind: SyntaxKind.ComputedPropertyName; @@ -1422,18 +1453,16 @@ declare namespace ts { interface PropertyLikeDeclaration extends Declaration { name: PropertyName; } - interface BindingPattern extends Node { - elements: NodeArray; - } - interface ObjectBindingPattern extends BindingPattern { + interface ObjectBindingPattern extends Node { kind: SyntaxKind.ObjectBindingPattern; elements: NodeArray; } - type ArrayBindingElement = BindingElement | OmittedExpression; - interface ArrayBindingPattern extends BindingPattern { + interface ArrayBindingPattern extends Node { kind: SyntaxKind.ArrayBindingPattern; elements: NodeArray; } + type BindingPattern = ObjectBindingPattern | ArrayBindingPattern; + type ArrayBindingElement = BindingElement | OmittedExpression; interface FunctionLikeDeclaration extends SignatureDeclaration { _functionLikeDeclarationBrand: any; asteriskToken?: AsteriskToken; @@ -1556,7 +1585,7 @@ declare namespace ts { } interface StringLiteral extends LiteralExpression { kind: SyntaxKind.StringLiteral; - textSourceNode?: Identifier | StringLiteral; + textSourceNode?: Identifier | StringLiteral | NumericLiteral; } interface Expression extends Node { _expressionBrand: any; @@ -1655,17 +1684,25 @@ declare namespace ts { operatorToken: BinaryOperatorToken; right: Expression; } - interface AssignmentExpression extends BinaryExpression { + type AssignmentOperatorToken = Token; + interface AssignmentExpression extends BinaryExpression { left: LeftHandSideExpression; - operatorToken: Token; + operatorToken: TOperator; } - interface ObjectDestructuringAssignment extends AssignmentExpression { + interface ObjectDestructuringAssignment extends AssignmentExpression { left: ObjectLiteralExpression; } - interface ArrayDestructuringAssignment extends AssignmentExpression { + interface ArrayDestructuringAssignment extends AssignmentExpression { left: ArrayLiteralExpression; } type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment; + type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression | Identifier | PropertyAccessExpression | ElementAccessExpression; + type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment; + type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression; + type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression; + type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression; + type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression; + type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern; interface ConditionalExpression extends Expression { kind: SyntaxKind.ConditionalExpression; condition: Expression; @@ -1858,6 +1895,10 @@ declare namespace ts { interface EndOfDeclarationMarker extends Statement { kind: SyntaxKind.EndOfDeclarationMarker; } + interface RawExpression extends PrimaryExpression { + kind: SyntaxKind.RawExpression; + text: string; + } interface MergeDeclarationMarker extends Statement { kind: SyntaxKind.MergeDeclarationMarker; } @@ -1885,6 +1926,9 @@ declare namespace ts { kind: SyntaxKind.ExpressionStatement; expression: Expression; } + interface PrologueDirective extends ExpressionStatement { + expression: StringLiteral; + } interface IfStatement extends Statement { kind: SyntaxKind.IfStatement; expression: Expression; @@ -2032,7 +2076,7 @@ declare namespace ts { type ModuleName = Identifier | StringLiteral; interface ModuleDeclaration extends DeclarationStatement { kind: SyntaxKind.ModuleDeclaration; - name: Identifier | LiteralExpression; + name: Identifier | StringLiteral; body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier; } interface NamespaceDeclaration extends ModuleDeclaration { @@ -2184,7 +2228,7 @@ declare namespace ts { type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; interface JSDocRecordMember extends PropertySignature { kind: SyntaxKind.JSDocRecordMember; - name: Identifier | LiteralExpression; + name: Identifier | StringLiteral | NumericLiteral; type?: JSDocType; } interface JSDoc extends Node { @@ -2200,6 +2244,10 @@ declare namespace ts { interface JSDocUnknownTag extends JSDocTag { kind: SyntaxKind.JSDocTag; } + interface JSDocAugmentsTag extends JSDocTag { + kind: SyntaxKind.JSDocAugmentsTag; + typeExpression: JSDocTypeExpression; + } interface JSDocTemplateTag extends JSDocTag { kind: SyntaxKind.JSDocTemplateTag; typeParameters: NodeArray; @@ -2323,7 +2371,6 @@ declare namespace ts { moduleAugmentations: LiteralExpression[]; patternAmbientModules?: PatternAmbientModule[]; ambientModuleNames: string[]; - externalHelpersModuleName?: Identifier; } interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; @@ -2444,6 +2491,7 @@ declare namespace ts { getJsxIntrinsicTagNames(): Symbol[]; isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; + tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; tryFindAmbientModuleWithoutAugmentations(moduleName: string): Symbol; getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; getGlobalDiagnostics(): Diagnostic[]; @@ -2472,6 +2520,7 @@ declare namespace ts { writeSpace(text: string): void; writeStringLiteral(text: string): void; writeParameter(text: string): void; + writeProperty(text: string): void; writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; @@ -2768,13 +2817,14 @@ declare namespace ts { PossiblyFalsy = 7406, Intrinsic = 16015, Primitive = 8190, - StringLike = 34, + StringLike = 262178, NumberLike = 340, BooleanLike = 136, EnumLike = 272, UnionOrIntersection = 196608, StructuredType = 229376, StructuredOrTypeParameter = 507904, + TypeVariable = 540672, Narrowable = 1033215, NotUnionOrUnit = 33281, RequiresWidening = 6291456, @@ -2844,7 +2894,8 @@ declare namespace ts { interface UnionOrIntersectionType extends Type { types: Type[]; resolvedProperties: SymbolTable; - couldContainTypeParameters: boolean; + resolvedIndexType: IndexType; + couldContainTypeVariables: boolean; } interface UnionType extends UnionOrIntersectionType { } @@ -2860,6 +2911,7 @@ declare namespace ts { typeParameter?: TypeParameter; constraintType?: Type; templateType?: Type; + modifiersType?: Type; mapper?: TypeMapper; } interface EvolvingArrayType extends ObjectType { @@ -2881,21 +2933,23 @@ declare namespace ts { iterableElementType?: Type; iteratorElementType?: Type; } - interface TypeParameter extends Type { + interface TypeVariable extends Type { + resolvedApparentType: Type; + resolvedIndexType: IndexType; + } + interface TypeParameter extends TypeVariable { constraint: Type; target?: TypeParameter; mapper?: TypeMapper; - resolvedApparentType: Type; - resolvedIndexType: IndexType; - resolvedIndexedAccessTypes: IndexedAccessType[]; isThisType?: boolean; } - interface IndexType extends Type { - type: TypeParameter; - } - interface IndexedAccessType extends Type { + interface IndexedAccessType extends TypeVariable { objectType: Type; - indexType: TypeParameter; + indexType: Type; + constraint?: Type; + } + interface IndexType extends Type { + type: TypeVariable | UnionOrIntersectionType; } const enum SignatureKind { Call = 0, @@ -2954,6 +3008,11 @@ declare namespace ts { PrototypeProperty = 3, ThisProperty = 4, } + interface FileExtensionInfo { + extension: string; + scriptKind: ScriptKind; + isMixedContent: boolean; + } interface DiagnosticMessage { key: string; category: DiagnosticCategory; @@ -3062,8 +3121,9 @@ declare namespace ts { watch?: boolean; [option: string]: CompilerOptionsValue | undefined; } - interface TypingOptions { + interface TypeAcquisition { enableAutoDiscovery?: boolean; + enable?: boolean; include?: string[]; exclude?: string[]; [option: string]: string[] | boolean | undefined; @@ -3073,7 +3133,7 @@ declare namespace ts { projectRootPath: string; safeListPath: string; packageNameToTypingLocation: Map; - typingOptions: TypingOptions; + typeAcquisition: TypeAcquisition; compilerOptions: CompilerOptions; unresolvedImports: ReadonlyArray; } @@ -3124,7 +3184,7 @@ declare namespace ts { } interface ParsedCommandLine { options: CompilerOptions; - typingOptions?: TypingOptions; + typeAcquisition?: TypeAcquisition; fileNames: string[]; raw?: any; errors: Diagnostic[]; @@ -3345,95 +3405,112 @@ declare namespace ts { None = 0, TypeScript = 1, ContainsTypeScript = 2, - Jsx = 4, - ContainsJsx = 8, - ESNext = 16, - ContainsESNext = 32, - ES2017 = 64, - ContainsES2017 = 128, - ES2016 = 256, - ContainsES2016 = 512, - ES2015 = 1024, - ContainsES2015 = 2048, - Generator = 4096, - ContainsGenerator = 8192, - DestructuringAssignment = 16384, - ContainsDestructuringAssignment = 32768, - ContainsDecorators = 65536, - ContainsPropertyInitializer = 131072, - ContainsLexicalThis = 262144, - ContainsCapturedLexicalThis = 524288, - ContainsLexicalThisInComputedPropertyName = 1048576, - ContainsDefaultValueAssignments = 2097152, - ContainsParameterPropertyAssignments = 4194304, - ContainsSpreadExpression = 8388608, - ContainsComputedPropertyName = 16777216, - ContainsBlockScopedBinding = 33554432, - ContainsBindingPattern = 67108864, - ContainsYield = 134217728, - ContainsHoistedDeclarationOrCompletion = 268435456, + ContainsJsx = 4, + ContainsESNext = 8, + ContainsES2017 = 16, + ContainsES2016 = 32, + ES2015 = 64, + ContainsES2015 = 128, + Generator = 256, + ContainsGenerator = 512, + DestructuringAssignment = 1024, + ContainsDestructuringAssignment = 2048, + ContainsDecorators = 4096, + ContainsPropertyInitializer = 8192, + ContainsLexicalThis = 16384, + ContainsCapturedLexicalThis = 32768, + ContainsLexicalThisInComputedPropertyName = 65536, + ContainsDefaultValueAssignments = 131072, + ContainsParameterPropertyAssignments = 262144, + ContainsSpread = 524288, + ContainsObjectSpread = 1048576, + ContainsRest = 524288, + ContainsObjectRest = 1048576, + ContainsComputedPropertyName = 2097152, + ContainsBlockScopedBinding = 4194304, + ContainsBindingPattern = 8388608, + ContainsYield = 16777216, + ContainsHoistedDeclarationOrCompletion = 33554432, HasComputedFlags = 536870912, AssertTypeScript = 3, - AssertJsx = 12, - AssertESNext = 48, - AssertES2017 = 192, - AssertES2016 = 768, - AssertES2015 = 3072, - AssertGenerator = 12288, - AssertDestructuringAssignment = 49152, - NodeExcludes = 536892757, - ArrowFunctionExcludes = 979719509, - FunctionExcludes = 980243797, - ConstructorExcludes = 975983957, - MethodOrAccessorExcludes = 975983957, - ClassExcludes = 559895893, - ModuleExcludes = 839734613, + AssertJsx = 4, + AssertESNext = 8, + AssertES2017 = 16, + AssertES2016 = 32, + AssertES2015 = 192, + AssertGenerator = 768, + AssertDestructuringAssignment = 3072, + NodeExcludes = 536872257, + ArrowFunctionExcludes = 601249089, + FunctionExcludes = 601281857, + ConstructorExcludes = 601015617, + MethodOrAccessorExcludes = 601015617, + ClassExcludes = 539358529, + ModuleExcludes = 574674241, TypeExcludes = -3, - ObjectLiteralExcludes = 554784085, - ArrayLiteralOrCallOrNewExcludes = 545281365, - VariableDeclarationListExcludes = 604001621, - ParameterExcludes = 604001621, - TypeScriptClassSyntaxMask = 4390912, - ES2015FunctionSyntaxMask = 2621440, + ObjectLiteralExcludes = 540087617, + ArrayLiteralOrCallOrNewExcludes = 537396545, + VariableDeclarationListExcludes = 546309441, + ParameterExcludes = 536872257, + CatchClauseExcludes = 537920833, + BindingPatternExcludes = 537396545, + TypeScriptClassSyntaxMask = 274432, + ES2015FunctionSyntaxMask = 163840, } interface EmitNode { + annotatedNodes?: Node[]; flags?: EmitFlags; commentRange?: TextRange; sourceMapRange?: TextRange; tokenSourceMapRanges?: Map; - annotatedNodes?: Node[]; constantValue?: number; + externalHelpersModuleName?: Identifier; + helpers?: EmitHelper[]; } const enum EmitFlags { - EmitEmitHelpers = 1, - EmitExportStar = 2, - EmitSuperHelper = 4, - EmitAdvancedSuperHelper = 8, - UMDDefine = 16, - SingleLine = 32, - AdviseOnEmitNode = 64, - NoSubstitution = 128, - CapturesThis = 256, - NoLeadingSourceMap = 512, - NoTrailingSourceMap = 1024, - NoSourceMap = 1536, - NoNestedSourceMaps = 2048, - NoTokenLeadingSourceMaps = 4096, - NoTokenTrailingSourceMaps = 8192, - NoTokenSourceMaps = 12288, - NoLeadingComments = 16384, - NoTrailingComments = 32768, - NoComments = 49152, - NoNestedComments = 65536, - ExportName = 131072, - LocalName = 262144, - Indented = 524288, - NoIndentation = 1048576, - AsyncFunctionBody = 2097152, - ReuseTempVariableScope = 4194304, - CustomPrologue = 8388608, - NoHoisting = 16777216, - HasEndOfDeclarationMarker = 33554432, + SingleLine = 1, + AdviseOnEmitNode = 2, + NoSubstitution = 4, + CapturesThis = 8, + NoLeadingSourceMap = 16, + NoTrailingSourceMap = 32, + NoSourceMap = 48, + NoNestedSourceMaps = 64, + NoTokenLeadingSourceMaps = 128, + NoTokenTrailingSourceMaps = 256, + NoTokenSourceMaps = 384, + NoLeadingComments = 512, + NoTrailingComments = 1024, + NoComments = 1536, + NoNestedComments = 2048, + HelperName = 4096, + ExportName = 8192, + LocalName = 16384, + Indented = 32768, + NoIndentation = 65536, + AsyncFunctionBody = 131072, + ReuseTempVariableScope = 262144, + CustomPrologue = 524288, + NoHoisting = 1048576, + HasEndOfDeclarationMarker = 2097152, + } + interface EmitHelper { + readonly name: string; + readonly scoped: boolean; + readonly text: string; + readonly priority?: number; + } + const enum ExternalEmitHelpers { + Extends = 1, + Assign = 2, + Rest = 4, + Decorate = 8, + Metadata = 16, + Param = 32, + Awaiter = 64, + Generator = 128, + FirstEmitHelper = 1, + LastEmitHelper = 128, } const enum EmitContext { SourceFile = 0, @@ -3441,10 +3518,40 @@ declare namespace ts { IdentifierName = 2, Unspecified = 3, } - interface LexicalEnvironment { - startLexicalEnvironment(): void; - endLexicalEnvironment(): Statement[]; + interface EmitHost extends ScriptReferenceHost { + getSourceFiles(): SourceFile[]; + isSourceFileFromExternalLibrary(file: SourceFile): boolean; + getCommonSourceDirectory(): string; + getCanonicalFileName(fileName: string): string; + getNewLine(): string; + isEmitBlocked(emitFileName: string): boolean; + writeFile: WriteFileCallback; } + interface TransformationContext { + getCompilerOptions(): CompilerOptions; + getEmitResolver(): EmitResolver; + getEmitHost(): EmitHost; + startLexicalEnvironment(): void; + suspendLexicalEnvironment(): void; + resumeLexicalEnvironment(): void; + endLexicalEnvironment(): Statement[]; + hoistFunctionDeclaration(node: FunctionDeclaration): void; + hoistVariableDeclaration(node: Identifier): void; + requestEmitHelper(helper: EmitHelper): void; + readEmitHelpers(): EmitHelper[] | undefined; + enableSubstitution(kind: SyntaxKind): void; + isSubstitutionEnabled(node: Node): boolean; + onSubstituteNode?: (emitContext: EmitContext, node: Node) => Node; + enableEmitNotification(kind: SyntaxKind): void; + isEmitNotificationEnabled(node: Node): boolean; + onEmitNode?: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void; + } + interface TransformationResult { + transformed: SourceFile[]; + emitNodeWithSubstitution(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; + emitNodeWithNotification(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; + } + type Transformer = (context: TransformationContext) => (node: SourceFile) => SourceFile; interface TextSpan { start: number; length: number; @@ -3476,6 +3583,9 @@ declare namespace ts.performance { function enable(): void; function disable(): void; } +declare namespace ts { + const version = "2.2.0"; +} declare namespace ts { const enum Ternary { False = 0, @@ -3523,6 +3633,7 @@ declare namespace ts { function sum(array: any[], prop: string): number; function append(to: T[] | undefined, value: T | undefined): T[] | undefined; function addRange(to: T[] | undefined, from: T[] | undefined): T[] | undefined; + function stableSort(array: T[], comparer?: (x: T, y: T) => Comparison): T[]; function rangeEquals(array1: T[], array2: T[], pos: number, end: number): boolean; function firstOrUndefined(array: T[]): T; function lastOrUndefined(array: T[]): T; @@ -3540,11 +3651,11 @@ declare namespace ts { function forEachProperty(map: Map, callback: (value: T, key: string) => U): U; function someProperties(map: Map, predicate?: (value: T, key: string) => boolean): boolean; function copyProperties(source: Map, target: MapLike): void; + function appendProperty(map: Map, key: string | number, value: T): Map; function assign, T2, T3>(t: T1, arg1: T2, arg2: T3): T1 & T2 & T3; function assign, T2>(t: T1, arg1: T2): T1 & T2; function assign>(t: T1, ...args: any[]): any; function reduceProperties(map: Map, callback: (aggregate: U, value: T, key: string) => U, initial: U): U; - function reduceOwnProperties(map: MapLike, callback: (aggregate: U, value: T, key: string) => U, initial: U): U; function equalOwnProperties(left: MapLike, right: MapLike, equalityComparer?: (left: T, right: T) => boolean): boolean; function arrayToMap(array: T[], makeKey: (value: T) => string): Map; function arrayToMap(array: T[], makeKey: (value: T) => string, makeValue: (value: T) => U): Map; @@ -3585,6 +3696,7 @@ declare namespace ts { function isExternalModuleNameRelative(moduleName: string): boolean; function getEmitScriptTarget(compilerOptions: CompilerOptions): ScriptTarget; function getEmitModuleKind(compilerOptions: CompilerOptions): ModuleKind; + function getEmitModuleResolutionKind(compilerOptions: CompilerOptions): ModuleResolutionKind; function hasZeroOrOneAsteriskCharacter(str: string): boolean; function isRootedDiskPath(path: string): boolean; function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string; @@ -3622,10 +3734,10 @@ declare namespace ts { const supportedTypeScriptExtensions: string[]; const supportedTypescriptExtensionsForExtractExtension: string[]; const supportedJavascriptExtensions: string[]; - function getSupportedExtensions(options?: CompilerOptions): string[]; + function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]): string[]; function hasJavaScriptFileExtension(fileName: string): boolean; function hasTypeScriptFileExtension(fileName: string): boolean; - function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions): boolean; + function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]): boolean; const enum ExtensionPriority { TypeScriptFiles = 0, DeclarationAndJavaScriptFiles = 2, @@ -3662,6 +3774,7 @@ declare namespace ts { function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void; function fail(message?: string): void; } + function orderedRemoveItem(array: T[], item: T): boolean; function orderedRemoveItemAt(array: T[], index: number): void; function unorderedRemoveItemAt(array: T[], index: number): void; function unorderedRemoveItem(array: T[], item: T): void; @@ -5001,6 +5114,12 @@ declare namespace ts { key: string; message: string; }; + An_abstract_accessor_cannot_have_an_implementation: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Duplicate_identifier_0: { code: number; category: DiagnosticCategory; @@ -5259,6 +5378,12 @@ declare namespace ts { key: string; message: string; }; + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Type_0_does_not_satisfy_the_constraint_1: { code: number; category: DiagnosticCategory; @@ -5319,6 +5444,12 @@ declare namespace ts { key: string; message: string; }; + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: number; category: DiagnosticCategory; @@ -6321,7 +6452,7 @@ declare namespace ts { key: string; message: string; }; - Type_0_is_not_constrained_to_keyof_1: { + Type_0_cannot_be_used_to_index_type_1: { code: number; category: DiagnosticCategory; key: string; @@ -6711,7 +6842,13 @@ declare namespace ts { key: string; message: string; }; - An_object_rest_element_must_be_an_identifier: { + The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: number; category: DiagnosticCategory; key: string; @@ -7137,12 +7274,30 @@ declare namespace ts { key: string; message: string; }; + Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: number; category: DiagnosticCategory; key: string; message: string; }; + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; The_current_host_does_not_support_the_0_option: { code: number; category: DiagnosticCategory; @@ -7389,7 +7544,7 @@ declare namespace ts { key: string; message: string; }; - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: number; category: DiagnosticCategory; key: string; @@ -8355,6 +8510,12 @@ declare namespace ts { key: string; message: string; }; + Language_service_is_disabled: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: number; category: DiagnosticCategory; @@ -8415,7 +8576,13 @@ declare namespace ts { key: string; message: string; }; - Unknown_typing_option_0: { + Unknown_type_acquisition_option_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: number; category: DiagnosticCategory; key: string; @@ -8427,7 +8594,7 @@ declare namespace ts { key: string; message: string; }; - The_path_in_an_extends_options_must_be_relative_or_rooted: { + A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: number; category: DiagnosticCategory; key: string; @@ -8499,6 +8666,24 @@ declare namespace ts { key: string; message: string; }; + Import_0_from_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Change_0_to_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Add_0_to_existing_import_declaration_from_1: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; }; } declare namespace ts { @@ -8570,12 +8755,13 @@ declare namespace ts { declare namespace ts { const compileOnSaveCommandLineOption: CommandLineOption; const optionDeclarations: CommandLineOption[]; - let typingOptionDeclarations: CommandLineOption[]; + let typeAcquisitionDeclarations: CommandLineOption[]; interface OptionNameMap { optionNameMap: Map; shortOptionNames: Map; } const defaultInitCompilerOptions: CompilerOptions; + function convertEnableAutoDiscoveryToEnable(typeAcquisition: TypeAcquisition): TypeAcquisition; function getOptionNameMap(): OptionNameMap; function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic; function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]): string | number; @@ -8592,14 +8778,14 @@ declare namespace ts { function generateTSConfig(options: CompilerOptions, fileNames: string[]): { compilerOptions: Map; }; - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine; + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine; function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; errors: Diagnostic[]; }; - function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { - options: TypingOptions; + function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: TypeAcquisition; errors: Diagnostic[]; }; } @@ -8611,7 +8797,7 @@ declare namespace ts.JsTyping { readDirectory: (rootDir: string, extensions: string[], excludes: string[], includes: string[], depth?: number) => string[]; } const nodeCoreModuleList: ReadonlyArray; - function discoverTypings(host: TypingResolutionHost, fileNames: string[], projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map, typingOptions: TypingOptions, unresolvedImports: ReadonlyArray): { + function discoverTypings(host: TypingResolutionHost, fileNames: string[], projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map, typeAcquisition: TypeAcquisition, unresolvedImports: ReadonlyArray): { cachedTypingPaths: string[]; newTypingNames: string[]; filesToWatch: string[]; @@ -8620,7 +8806,8 @@ declare namespace ts.JsTyping { declare namespace ts.server { const ActionSet: ActionSet; const ActionInvalidate: ActionInvalidate; - const EventInstall: EventInstall; + const EventBeginInstallTypes: EventBeginInstallTypes; + const EventEndInstallTypes: EventEndInstallTypes; namespace Arguments { const GlobalCacheLocation = "--globalTypingsCacheLocation"; const LogFile = "--logFile"; @@ -8657,7 +8844,7 @@ declare namespace ts.server { const Perf: Perf; type Types = Err | Info | Perf; } - function createInstallTypingsRequest(project: Project, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray, cachePath?: string): DiscoverTypings; + function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, cachePath?: string): DiscoverTypings; namespace Errors { function ThrowNoProject(): never; function ThrowProjectLanguageServiceDisabled(): never; @@ -8679,20 +8866,12 @@ declare namespace ts.server { remove(path: NormalizedPath): void; } function createNormalizedPathMap(): NormalizedPathMap; - const nullLanguageService: LanguageService; - interface ServerLanguageServiceHost { - setCompilationSettings(options: CompilerOptions): void; - notifyFileRemoved(info: ScriptInfo): void; - startRecordingFilesWithChangedResolutions(): void; - finishRecordingFilesWithChangedResolutions(): Path[]; - } - const nullLanguageServiceHost: ServerLanguageServiceHost; interface ProjectOptions { configHasFilesProperty?: boolean; files?: string[]; wildcardDirectories?: Map; compilerOptions?: CompilerOptions; - typingOptions?: TypingOptions; + typeAcquisition?: TypeAcquisition; compileOnSave?: boolean; } function isInferredProjectName(name: string): boolean; @@ -8718,6 +8897,7 @@ declare namespace ts.server { declare namespace ts { function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void; function isTraceEnabled(compilerOptions: CompilerOptions, host: ModuleResolutionHost): boolean; + function moduleHasNonRelativeName(moduleName: string): boolean; function getEffectiveTypeRoots(options: CompilerOptions, host: { directoryExists?: (directoryName: string) => boolean; getCurrentDirectory?: () => string; @@ -8744,15 +8924,6 @@ declare namespace ts { interface StringSymbolWriter extends SymbolWriter { string(): string; } - interface EmitHost extends ScriptReferenceHost { - getSourceFiles(): SourceFile[]; - isSourceFileFromExternalLibrary(file: SourceFile): boolean; - getCommonSourceDirectory(): string; - getCanonicalFileName(fileName: string): string; - getNewLine(): string; - isEmitBlocked(emitFileName: string): boolean; - writeFile: WriteFileCallback; - } function getSingleLineStringWriter(): StringSymbolWriter; function releaseStringWriter(writer: StringSymbolWriter): void; function getFullWidth(node: Node): number; @@ -8773,7 +8944,7 @@ declare namespace ts { function getEndLinePosition(line: number, sourceFile: SourceFile): number; function nodeIsMissing(node: Node): boolean; function nodeIsPresent(node: Node): boolean; - function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDocComment?: boolean): number; + function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDoc?: boolean): number; function isJSDocNode(node: Node): boolean; function isJSDocTag(node: Node): boolean; function getNonDecoratorTokenPosOfNode(node: Node, sourceFile?: SourceFile): number; @@ -8792,6 +8963,7 @@ declare namespace ts { function isBlockScopedContainerTopLevel(node: Node): boolean; function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean; function isExternalModuleAugmentation(node: Node): boolean; + function isEffectiveExternalModule(node: SourceFile, compilerOptions: CompilerOptions): boolean; function isBlockScope(node: Node, parentNode: Node): boolean; function getEnclosingBlockScopeContainer(node: Node): Node; function declarationNameToString(name: DeclarationName): string; @@ -8808,17 +8980,17 @@ declare namespace ts { function isConst(node: Node): boolean; function isLet(node: Node): boolean; function isSuperCall(n: Node): n is SuperCall; - function isPrologueDirective(node: Node): boolean; + function isPrologueDirective(node: Node): node is PrologueDirective; function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; function getLeadingCommentRangesOfNodeFromText(node: Node, text: string): CommentRange[]; - function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; - function getJsDocCommentsFromText(node: Node, text: string): CommentRange[]; + function getJSDocCommentRanges(node: Node, text: string): CommentRange[]; let fullTripleSlashReferencePathRegEx: RegExp; let fullTripleSlashReferenceTypeReferenceDirectiveRegEx: RegExp; let fullTripleSlashAMDReferencePathRegEx: RegExp; function isPartOfTypeNode(node: Node): boolean; function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T; function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void; + function getRestParameterElementType(node: TypeNode): TypeNode; function isVariableLike(node: Node): node is VariableLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; function isClassLike(node: Node): node is ClassLikeDeclaration; @@ -8861,11 +9033,12 @@ declare namespace ts { function isDefaultImport(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean; function hasQuestionToken(node: Node): boolean; function isJSDocConstructSignature(node: Node): boolean; - function getJSDocComments(node: Node, checkParentVariableStatement: boolean): string[]; - function getJSDocTypeTag(node: Node): JSDocTypeTag; + function getCommentsFromJSDoc(node: Node): string[]; + function getJSDocParameterTags(param: Node): JSDocParameterTag[]; + function getJSDocType(node: Node): JSDocType; + function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag; function getJSDocReturnTag(node: Node): JSDocReturnTag; function getJSDocTemplateTag(node: Node): JSDocTemplateTag; - function getCorrespondingJSDocParameterTag(parameter: ParameterDeclaration): JSDocParameterTag; function hasRestParameter(s: SignatureDeclaration): boolean; function hasDeclaredRestParameter(s: SignatureDeclaration): boolean; function isRestParameter(node: ParameterDeclaration): boolean; @@ -8894,11 +9067,11 @@ declare namespace ts { function isKeyword(token: SyntaxKind): boolean; function isTrivia(token: SyntaxKind): boolean; function isAsyncFunctionLike(node: Node): boolean; - function isStringOrNumericLiteral(kind: SyntaxKind): boolean; + function isStringOrNumericLiteral(node: Node): node is StringLiteral | NumericLiteral; function hasDynamicName(declaration: Declaration): boolean; function isDynamicName(name: DeclarationName): boolean; function isWellKnownSymbolSyntactically(node: Expression): boolean; - function getPropertyNameForPropertyNameNode(name: DeclarationName): string; + function getPropertyNameForPropertyNameNode(name: DeclarationName | ParameterDeclaration): string; function getPropertyNameForKnownSymbolName(symbolName: string): string; function isESSymbolIdentifier(node: Node): boolean; function isPushOrUnshiftIdentifier(node: Identifier): boolean; @@ -8921,7 +9094,7 @@ declare namespace ts { function getExpressionAssociativity(expression: Expression): Associativity; function getOperatorAssociativity(kind: SyntaxKind, operator: SyntaxKind, hasArguments?: boolean): Associativity; function getExpressionPrecedence(expression: Expression): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7; - function getOperator(expression: Expression): SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.NumericLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.Identifier | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.LetKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.StaticKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AbstractKeyword | SyntaxKind.AsKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.GetKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.NumberKeyword | SyntaxKind.SetKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.TypeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.FromKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.OfKeyword | SyntaxKind.QualifiedName | SyntaxKind.ComputedPropertyName | SyntaxKind.TypeParameter | SyntaxKind.Parameter | SyntaxKind.Decorator | SyntaxKind.PropertySignature | SyntaxKind.PropertyDeclaration | SyntaxKind.MethodSignature | SyntaxKind.MethodDeclaration | SyntaxKind.Constructor | SyntaxKind.GetAccessor | SyntaxKind.SetAccessor | SyntaxKind.CallSignature | SyntaxKind.ConstructSignature | SyntaxKind.IndexSignature | SyntaxKind.TypePredicate | SyntaxKind.TypeReference | SyntaxKind.FunctionType | SyntaxKind.ConstructorType | SyntaxKind.TypeQuery | SyntaxKind.TypeLiteral | SyntaxKind.ArrayType | SyntaxKind.TupleType | SyntaxKind.UnionType | SyntaxKind.IntersectionType | SyntaxKind.ParenthesizedType | SyntaxKind.ThisType | SyntaxKind.TypeOperator | SyntaxKind.IndexedAccessType | SyntaxKind.MappedType | SyntaxKind.LiteralType | SyntaxKind.ObjectBindingPattern | SyntaxKind.ArrayBindingPattern | SyntaxKind.BindingElement | SyntaxKind.ArrayLiteralExpression | SyntaxKind.ObjectLiteralExpression | SyntaxKind.PropertyAccessExpression | SyntaxKind.ElementAccessExpression | SyntaxKind.CallExpression | SyntaxKind.NewExpression | SyntaxKind.TaggedTemplateExpression | SyntaxKind.TypeAssertionExpression | SyntaxKind.ParenthesizedExpression | SyntaxKind.FunctionExpression | SyntaxKind.ArrowFunction | SyntaxKind.DeleteExpression | SyntaxKind.TypeOfExpression | SyntaxKind.VoidExpression | SyntaxKind.AwaitExpression | SyntaxKind.ConditionalExpression | SyntaxKind.TemplateExpression | SyntaxKind.YieldExpression | SyntaxKind.SpreadElement | SyntaxKind.ClassExpression | SyntaxKind.OmittedExpression | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.AsExpression | SyntaxKind.NonNullExpression | SyntaxKind.TemplateSpan | SyntaxKind.SemicolonClassElement | SyntaxKind.Block | SyntaxKind.VariableStatement | SyntaxKind.EmptyStatement | SyntaxKind.ExpressionStatement | SyntaxKind.IfStatement | SyntaxKind.DoStatement | SyntaxKind.WhileStatement | SyntaxKind.ForStatement | SyntaxKind.ForInStatement | SyntaxKind.ForOfStatement | SyntaxKind.ContinueStatement | SyntaxKind.BreakStatement | SyntaxKind.ReturnStatement | SyntaxKind.WithStatement | SyntaxKind.SwitchStatement | SyntaxKind.LabeledStatement | SyntaxKind.ThrowStatement | SyntaxKind.TryStatement | SyntaxKind.DebuggerStatement | SyntaxKind.VariableDeclaration | SyntaxKind.VariableDeclarationList | SyntaxKind.FunctionDeclaration | SyntaxKind.ClassDeclaration | SyntaxKind.InterfaceDeclaration | SyntaxKind.TypeAliasDeclaration | SyntaxKind.EnumDeclaration | SyntaxKind.ModuleDeclaration | SyntaxKind.ModuleBlock | SyntaxKind.CaseBlock | SyntaxKind.NamespaceExportDeclaration | SyntaxKind.ImportEqualsDeclaration | SyntaxKind.ImportDeclaration | SyntaxKind.ImportClause | SyntaxKind.NamespaceImport | SyntaxKind.NamedImports | SyntaxKind.ImportSpecifier | SyntaxKind.ExportAssignment | SyntaxKind.ExportDeclaration | SyntaxKind.NamedExports | SyntaxKind.ExportSpecifier | SyntaxKind.MissingDeclaration | SyntaxKind.ExternalModuleReference | SyntaxKind.JsxElement | SyntaxKind.JsxSelfClosingElement | SyntaxKind.JsxOpeningElement | SyntaxKind.JsxClosingElement | SyntaxKind.JsxAttribute | SyntaxKind.JsxSpreadAttribute | SyntaxKind.JsxExpression | SyntaxKind.CaseClause | SyntaxKind.DefaultClause | SyntaxKind.HeritageClause | SyntaxKind.CatchClause | SyntaxKind.PropertyAssignment | SyntaxKind.ShorthandPropertyAssignment | SyntaxKind.SpreadAssignment | SyntaxKind.EnumMember | SyntaxKind.SourceFile | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocArrayType | SyntaxKind.JSDocUnionType | SyntaxKind.JSDocTupleType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocRecordType | SyntaxKind.JSDocRecordMember | SyntaxKind.JSDocTypeReference | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocConstructorType | SyntaxKind.JSDocThisType | SyntaxKind.JSDocComment | SyntaxKind.JSDocTag | SyntaxKind.JSDocParameterTag | SyntaxKind.JSDocReturnTag | SyntaxKind.JSDocTypeTag | SyntaxKind.JSDocTemplateTag | SyntaxKind.JSDocTypedefTag | SyntaxKind.JSDocPropertyTag | SyntaxKind.JSDocTypeLiteral | SyntaxKind.JSDocLiteralType | SyntaxKind.JSDocNullKeyword | SyntaxKind.JSDocUndefinedKeyword | SyntaxKind.JSDocNeverKeyword | SyntaxKind.SyntaxList | SyntaxKind.NotEmittedStatement | SyntaxKind.PartiallyEmittedExpression | SyntaxKind.MergeDeclarationMarker | SyntaxKind.EndOfDeclarationMarker | SyntaxKind.Count; + function getOperator(expression: Expression): SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.NumericLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.Identifier | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.LetKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.StaticKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AbstractKeyword | SyntaxKind.AsKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.GetKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.NumberKeyword | SyntaxKind.SetKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.TypeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.FromKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.OfKeyword | SyntaxKind.QualifiedName | SyntaxKind.ComputedPropertyName | SyntaxKind.TypeParameter | SyntaxKind.Parameter | SyntaxKind.Decorator | SyntaxKind.PropertySignature | SyntaxKind.PropertyDeclaration | SyntaxKind.MethodSignature | SyntaxKind.MethodDeclaration | SyntaxKind.Constructor | SyntaxKind.GetAccessor | SyntaxKind.SetAccessor | SyntaxKind.CallSignature | SyntaxKind.ConstructSignature | SyntaxKind.IndexSignature | SyntaxKind.TypePredicate | SyntaxKind.TypeReference | SyntaxKind.FunctionType | SyntaxKind.ConstructorType | SyntaxKind.TypeQuery | SyntaxKind.TypeLiteral | SyntaxKind.ArrayType | SyntaxKind.TupleType | SyntaxKind.UnionType | SyntaxKind.IntersectionType | SyntaxKind.ParenthesizedType | SyntaxKind.ThisType | SyntaxKind.TypeOperator | SyntaxKind.IndexedAccessType | SyntaxKind.MappedType | SyntaxKind.LiteralType | SyntaxKind.ObjectBindingPattern | SyntaxKind.ArrayBindingPattern | SyntaxKind.BindingElement | SyntaxKind.ArrayLiteralExpression | SyntaxKind.ObjectLiteralExpression | SyntaxKind.PropertyAccessExpression | SyntaxKind.ElementAccessExpression | SyntaxKind.CallExpression | SyntaxKind.NewExpression | SyntaxKind.TaggedTemplateExpression | SyntaxKind.TypeAssertionExpression | SyntaxKind.ParenthesizedExpression | SyntaxKind.FunctionExpression | SyntaxKind.ArrowFunction | SyntaxKind.DeleteExpression | SyntaxKind.TypeOfExpression | SyntaxKind.VoidExpression | SyntaxKind.AwaitExpression | SyntaxKind.ConditionalExpression | SyntaxKind.TemplateExpression | SyntaxKind.YieldExpression | SyntaxKind.SpreadElement | SyntaxKind.ClassExpression | SyntaxKind.OmittedExpression | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.AsExpression | SyntaxKind.NonNullExpression | SyntaxKind.TemplateSpan | SyntaxKind.SemicolonClassElement | SyntaxKind.Block | SyntaxKind.VariableStatement | SyntaxKind.EmptyStatement | SyntaxKind.ExpressionStatement | SyntaxKind.IfStatement | SyntaxKind.DoStatement | SyntaxKind.WhileStatement | SyntaxKind.ForStatement | SyntaxKind.ForInStatement | SyntaxKind.ForOfStatement | SyntaxKind.ContinueStatement | SyntaxKind.BreakStatement | SyntaxKind.ReturnStatement | SyntaxKind.WithStatement | SyntaxKind.SwitchStatement | SyntaxKind.LabeledStatement | SyntaxKind.ThrowStatement | SyntaxKind.TryStatement | SyntaxKind.DebuggerStatement | SyntaxKind.VariableDeclaration | SyntaxKind.VariableDeclarationList | SyntaxKind.FunctionDeclaration | SyntaxKind.ClassDeclaration | SyntaxKind.InterfaceDeclaration | SyntaxKind.TypeAliasDeclaration | SyntaxKind.EnumDeclaration | SyntaxKind.ModuleDeclaration | SyntaxKind.ModuleBlock | SyntaxKind.CaseBlock | SyntaxKind.NamespaceExportDeclaration | SyntaxKind.ImportEqualsDeclaration | SyntaxKind.ImportDeclaration | SyntaxKind.ImportClause | SyntaxKind.NamespaceImport | SyntaxKind.NamedImports | SyntaxKind.ImportSpecifier | SyntaxKind.ExportAssignment | SyntaxKind.ExportDeclaration | SyntaxKind.NamedExports | SyntaxKind.ExportSpecifier | SyntaxKind.MissingDeclaration | SyntaxKind.ExternalModuleReference | SyntaxKind.JsxElement | SyntaxKind.JsxSelfClosingElement | SyntaxKind.JsxOpeningElement | SyntaxKind.JsxClosingElement | SyntaxKind.JsxAttribute | SyntaxKind.JsxSpreadAttribute | SyntaxKind.JsxExpression | SyntaxKind.CaseClause | SyntaxKind.DefaultClause | SyntaxKind.HeritageClause | SyntaxKind.CatchClause | SyntaxKind.PropertyAssignment | SyntaxKind.ShorthandPropertyAssignment | SyntaxKind.SpreadAssignment | SyntaxKind.EnumMember | SyntaxKind.SourceFile | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocArrayType | SyntaxKind.JSDocUnionType | SyntaxKind.JSDocTupleType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocRecordType | SyntaxKind.JSDocRecordMember | SyntaxKind.JSDocTypeReference | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocConstructorType | SyntaxKind.JSDocThisType | SyntaxKind.JSDocComment | SyntaxKind.JSDocTag | SyntaxKind.JSDocAugmentsTag | SyntaxKind.JSDocParameterTag | SyntaxKind.JSDocReturnTag | SyntaxKind.JSDocTypeTag | SyntaxKind.JSDocTemplateTag | SyntaxKind.JSDocTypedefTag | SyntaxKind.JSDocPropertyTag | SyntaxKind.JSDocTypeLiteral | SyntaxKind.JSDocLiteralType | SyntaxKind.JSDocNullKeyword | SyntaxKind.JSDocUndefinedKeyword | SyntaxKind.JSDocNeverKeyword | SyntaxKind.SyntaxList | SyntaxKind.NotEmittedStatement | SyntaxKind.PartiallyEmittedExpression | SyntaxKind.MergeDeclarationMarker | SyntaxKind.EndOfDeclarationMarker | SyntaxKind.RawExpression | SyntaxKind.Count; function getOperatorPrecedence(nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7; function createDiagnosticCollection(): DiagnosticCollection; function escapeString(s: string): string; @@ -8993,7 +9166,8 @@ declare namespace ts { function isLogicalOperator(token: SyntaxKind): boolean; function isAssignmentOperator(token: SyntaxKind): boolean; function tryGetClassExtendingExpressionWithTypeArguments(node: Node): ClassLikeDeclaration | undefined; - function isAssignmentExpression(node: Node): node is AssignmentExpression; + function isAssignmentExpression(node: Node, excludeCompoundAssignment: true): node is AssignmentExpression; + function isAssignmentExpression(node: Node, excludeCompoundAssignment?: false): node is AssignmentExpression; function isDestructuringAssignment(node: Node): node is DestructuringAssignment; function isSupportedExpressionWithTypeArguments(node: ExpressionWithTypeArguments): boolean; function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean; @@ -9002,7 +9176,6 @@ declare namespace ts { function isEmptyObjectLiteralOrArrayLiteral(expression: Node): boolean; function getLocalSymbolForExportDefault(symbol: Symbol): Symbol; function tryExtractTypeScriptExtension(fileName: string): string | undefined; - const stringify: (value: any) => string; function convertToBase64(input: string): string; function getNewLineCharacter(options: CompilerOptions): string; function isSimpleExpression(node: Expression): boolean; @@ -9024,15 +9197,6 @@ declare namespace ts { function rangeEndIsOnSameLineAsRangeStart(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; function positionsAreOnSameLine(pos1: number, pos2: number, sourceFile: SourceFile): boolean; function getStartPositionOfRange(range: TextRange, sourceFile: SourceFile): number; - interface ExternalModuleInfo { - externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; - exportSpecifiers: Map; - exportedBindings: Map; - exportedNames: Identifier[]; - exportEquals: ExportAssignment | undefined; - hasExportStarsToExportValues: boolean; - } - function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver): ExternalModuleInfo; function isDeclarationNameOfEnumOrNamespace(node: Identifier): boolean; function getInitializedVariables(node: VariableDeclarationList): VariableDeclaration[]; function isMergedWithClass(node: Node): boolean; @@ -9061,9 +9225,16 @@ declare namespace ts { function isClassElement(node: Node): node is ClassElement; function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike; function isTypeNode(node: Node): node is TypeNode; + function isArrayBindingPattern(node: Node): node is ArrayBindingPattern; + function isObjectBindingPattern(node: Node): node is ObjectBindingPattern; function isBindingPattern(node: Node): node is BindingPattern; + function isAssignmentPattern(node: Node): node is AssignmentPattern; function isBindingElement(node: Node): node is BindingElement; function isArrayBindingElement(node: Node): node is ArrayBindingElement; + function isDeclarationBindingElement(bindingElement: BindingOrAssignmentElement): bindingElement is VariableDeclaration | ParameterDeclaration | BindingElement; + function isBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is BindingOrAssignmentPattern; + function isObjectBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is ObjectBindingOrAssignmentPattern; + function isArrayBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is ArrayBindingOrAssignmentPattern; function isArrayLiteralExpression(node: Node): node is ArrayLiteralExpression; function isObjectLiteralExpression(node: Node): node is ObjectLiteralExpression; function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression; @@ -9141,9 +9312,15 @@ declare namespace ts { let unchangedTextChangeRange: TextChangeRange; function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; - function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean; + function isParameterPropertyDeclaration(node: Node): boolean; function getCombinedModifierFlags(node: Node): ModifierFlags; function getCombinedNodeFlags(node: Node): NodeFlags; + function validateLocaleAndSetLanguage(locale: string, sys: { + getExecutingFilePath(): string; + resolvePath(path: string): string; + fileExists(fileName: string): boolean; + readFile(fileName: string): string; + }, errors?: Diagnostic[]): void; } declare namespace ts { function updateNode(updated: T, original: T): T; @@ -9152,7 +9329,7 @@ declare namespace ts { function createSynthesizedNodeArray(elements?: T[]): NodeArray; function getSynthesizedClone(node: T): T; function getMutableClone(node: T): T; - function createLiteral(textSource: StringLiteral | Identifier, location?: TextRange): StringLiteral; + function createLiteral(textSource: StringLiteral | NumericLiteral | Identifier, location?: TextRange): StringLiteral; function createLiteral(value: string, location?: TextRange): StringLiteral; function createLiteral(value: number, location?: TextRange): NumericLiteral; function createLiteral(value: boolean, location?: TextRange): BooleanLiteral; @@ -9169,7 +9346,7 @@ declare namespace ts { function createComputedPropertyName(expression: Expression, location?: TextRange): ComputedPropertyName; function updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName; function createParameter(decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: string | Identifier | BindingPattern, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression, location?: TextRange, flags?: NodeFlags): ParameterDeclaration; - function updateParameter(node: ParameterDeclaration, decorators: Decorator[], modifiers: Modifier[], name: BindingName, type: TypeNode, initializer: Expression): ParameterDeclaration; + function updateParameter(node: ParameterDeclaration, decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: BindingName, type: TypeNode, initializer: Expression): ParameterDeclaration; function createProperty(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, questionToken: QuestionToken, type: TypeNode, initializer: Expression, location?: TextRange): PropertyDeclaration; function updateProperty(node: PropertyDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, type: TypeNode, initializer: Expression): PropertyDeclaration; function createMethod(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): MethodDeclaration; @@ -9185,7 +9362,7 @@ declare namespace ts { function createArrayBindingPattern(elements: ArrayBindingElement[], location?: TextRange): ArrayBindingPattern; function updateArrayBindingPattern(node: ArrayBindingPattern, elements: ArrayBindingElement[]): ArrayBindingPattern; function createBindingElement(propertyName: string | PropertyName, dotDotDotToken: DotDotDotToken, name: string | BindingName, initializer?: Expression, location?: TextRange): BindingElement; - function updateBindingElement(node: BindingElement, propertyName: PropertyName, name: BindingName, initializer: Expression): BindingElement; + function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken, propertyName: PropertyName, name: BindingName, initializer: Expression): BindingElement; function createArrayLiteral(elements?: Expression[], location?: TextRange, multiLine?: boolean): ArrayLiteralExpression; function updateArrayLiteral(node: ArrayLiteralExpression, elements: Expression[]): ArrayLiteralExpression; function createObjectLiteral(properties?: ObjectLiteralElementLike[], location?: TextRange, multiLine?: boolean): ObjectLiteralExpression; @@ -9220,6 +9397,7 @@ declare namespace ts { function updatePostfix(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression; function createBinary(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression, location?: TextRange): BinaryExpression; function updateBinary(node: BinaryExpression, left: Expression, right: Expression): BinaryExpression; + function createConditional(condition: Expression, whenTrue: Expression, whenFalse: Expression, location?: TextRange): ConditionalExpression; function createConditional(condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression, location?: TextRange): ConditionalExpression; function updateConditional(node: ConditionalExpression, condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression; function createTemplateExpression(head: TemplateHead, templateSpans: TemplateSpan[], location?: TextRange): TemplateExpression; @@ -9332,8 +9510,10 @@ declare namespace ts { function createMergeDeclarationMarker(original: Node): MergeDeclarationMarker; function createPartiallyEmittedExpression(expression: Expression, original?: Node, location?: TextRange): PartiallyEmittedExpression; function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression; + function createRawExpression(text: string): RawExpression; function createComma(left: Expression, right: Expression): Expression; function createLessThan(left: Expression, right: Expression, location?: TextRange): Expression; + function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression, location?: TextRange): DestructuringAssignment; function createAssignment(left: Expression, right: Expression, location?: TextRange): BinaryExpression; function createStrictEquality(left: Expression, right: Expression): BinaryExpression; function createStrictInequality(left: Expression, right: Expression): BinaryExpression; @@ -9344,6 +9524,8 @@ declare namespace ts { function createLogicalOr(left: Expression, right: Expression): BinaryExpression; function createLogicalNot(operand: Expression): PrefixUnaryExpression; function createVoidZero(): VoidExpression; + type TypeOfTag = "undefined" | "number" | "boolean" | "string" | "symbol" | "object" | "function"; + function createTypeCheck(value: Expression, tag: TypeOfTag): BinaryExpression; function createMemberAccessForPropertyName(target: Expression, memberName: PropertyName, location?: TextRange): MemberExpression; function createFunctionCall(func: Expression, thisArg: Expression, argumentsList: Expression[], location?: TextRange): CallExpression; function createFunctionApply(func: Expression, thisArg: Expression, argumentsExpression: Expression, location?: TextRange): CallExpression; @@ -9356,16 +9538,7 @@ declare namespace ts { function createLetStatement(name: Identifier, initializer: Expression, location?: TextRange): VariableStatement; function createLetDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList; function createConstDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList; - function createHelperName(externalHelpersModuleName: Identifier | undefined, name: string): Identifier | PropertyAccessExpression; - function createExtendsHelper(externalHelpersModuleName: Identifier | undefined, name: Identifier): CallExpression; - function createAssignHelper(externalHelpersModuleName: Identifier | undefined, attributesSegments: Expression[]): CallExpression; - function createParamHelper(externalHelpersModuleName: Identifier | undefined, expression: Expression, parameterOffset: number, location?: TextRange): CallExpression; - function createMetadataHelper(externalHelpersModuleName: Identifier | undefined, metadataKey: string, metadataValue: Expression): CallExpression; - function createDecorateHelper(externalHelpersModuleName: Identifier | undefined, decoratorExpressions: Expression[], target: Expression, memberName?: Expression, descriptor?: Expression, location?: TextRange): CallExpression; - function createAwaiterHelper(externalHelpersModuleName: Identifier | undefined, hasLexicalArguments: boolean, promiseConstructor: EntityName | Expression, body: Block): CallExpression; - function createHasOwnProperty(target: LeftHandSideExpression, propertyName: Expression): CallExpression; - function createAdvancedAsyncSuperHelper(): VariableStatement; - function createSimpleAsyncSuperHelper(): VariableStatement; + function getHelperName(name: string): Identifier; interface CallBinding { target: LeftHandSideExpression; thisArg: Expression; @@ -9382,9 +9555,12 @@ declare namespace ts { function getDeclarationName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; function getExternalModuleOrNamespaceExportName(ns: Identifier | undefined, node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier | PropertyAccessExpression; function getNamespaceMemberName(ns: Identifier, name: Identifier, allowComments?: boolean, allowSourceMaps?: boolean): PropertyAccessExpression; + function convertToFunctionBody(node: ConciseBody, multiLine?: boolean): Block; function addPrologueDirectives(target: Statement[], source: Statement[], ensureUseStrict?: boolean, visitor?: (node: Node) => VisitResult): number; - function ensureUseStrict(node: SourceFile): SourceFile; + function startsWithUseStrict(statements: Statement[]): boolean; + function ensureUseStrict(statements: NodeArray): NodeArray; function parenthesizeBinaryOperand(binaryOperator: SyntaxKind, operand: Expression, isLeftSideOfBinary: boolean, leftOperand?: Expression): Expression; + function parenthesizeForConditionalHead(condition: Expression): Expression; function parenthesizeForNew(expression: Expression): LeftHandSideExpression; function parenthesizeForAccess(expression: Expression): LeftHandSideExpression; function parenthesizePostfixOperand(operand: Expression): LeftHandSideExpression; @@ -9409,16 +9585,25 @@ declare namespace ts { function startOnNewLine(node: T): T; function setOriginalNode(node: T, original: Node): T; function disposeEmitNodes(sourceFile: SourceFile): void; + function getOrCreateEmitNode(node: Node): EmitNode; function getEmitFlags(node: Node): EmitFlags; function setEmitFlags(node: T, emitFlags: EmitFlags): T; - function setSourceMapRange(node: T, range: TextRange): T; - function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange): T; - function setCommentRange(node: T, range: TextRange): T; - function getCommentRange(node: Node): TextRange; function getSourceMapRange(node: Node): TextRange; + function setSourceMapRange(node: T, range: TextRange): T; function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange; + function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange): T; + function getCommentRange(node: Node): TextRange; + function setCommentRange(node: T, range: TextRange): T; function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number; function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: number): PropertyAccessExpression | ElementAccessExpression; + function getExternalHelpersModuleName(node: SourceFile): Identifier; + function getOrCreateExternalHelpersModuleNameIfNeeded(node: SourceFile, compilerOptions: CompilerOptions): Identifier; + function addEmitHelper(node: T, helper: EmitHelper): T; + function addEmitHelpers(node: T, helpers: EmitHelper[] | undefined): T; + function removeEmitHelper(node: Node, helper: EmitHelper): boolean; + function getEmitHelpers(node: Node): EmitHelper[] | undefined; + function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void; + function compareEmitHelpers(x: EmitHelper, y: EmitHelper): Comparison; function setTextRange(node: T, location: TextRange): T; function setNodeFlags(node: T, flags: NodeFlags): T; function setMultiLine(node: T, multiLine: boolean): T; @@ -9426,12 +9611,27 @@ declare namespace ts { function getLocalNameForExternalImport(node: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile): Identifier; function getExternalModuleNameLiteral(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile, host: EmitHost, resolver: EmitResolver, compilerOptions: CompilerOptions): StringLiteral; function tryGetModuleNameFromFile(file: SourceFile, host: EmitHost, options: CompilerOptions): StringLiteral; - function transformFunctionBody(node: FunctionLikeDeclaration, visitor: (node: Node) => VisitResult, currentSourceFile: SourceFile, context: TransformationContext, enableSubstitutionsForCapturedThis: () => void, convertObjectRest?: boolean): Block; - function addCaptureThisForNodeIfNeeded(statements: Statement[], node: Node, enableSubstitutionsForCapturedThis: () => void): void; - function captureThisForNode(statements: Statement[], node: Node, initializer: Expression | undefined, enableSubstitutionsForCapturedThis?: () => void, originalStatement?: Statement): void; - function addDefaultValueAssignmentsIfNeeded(statements: Statement[], node: FunctionLikeDeclaration, visitor: (node: Node) => VisitResult, convertObjectRest: boolean): void; - function addRestParameterIfNeeded(statements: Statement[], node: FunctionLikeDeclaration, inConstructorWithSynthesizedSuper: boolean): void; - function convertForOf(node: ForOfStatement, convertedLoopBodyStatements: Statement[], visitor: (node: Node) => VisitResult, enableSubstitutionsForBlockScopedBindings: () => void, context: TransformationContext, convertObjectRest?: boolean): ForStatement | ForOfStatement; + function getInitializerOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): Expression | undefined; + function getTargetOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementTarget; + function getRestIndicatorOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementRestIndicator; + function getPropertyNameOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): PropertyName; + function getElementsOfBindingOrAssignmentPattern(name: BindingOrAssignmentPattern): BindingOrAssignmentElement[]; + function convertToArrayAssignmentElement(element: BindingOrAssignmentElement): Expression; + function convertToObjectAssignmentElement(element: BindingOrAssignmentElement): ObjectLiteralElementLike; + function convertToAssignmentPattern(node: BindingOrAssignmentPattern): AssignmentPattern; + function convertToObjectAssignmentPattern(node: ObjectBindingOrAssignmentPattern): ObjectLiteralExpression; + function convertToArrayAssignmentPattern(node: ArrayBindingOrAssignmentPattern): ArrayLiteralExpression; + function convertToAssignmentElementTarget(node: BindingOrAssignmentElementTarget): Expression; + interface ExternalModuleInfo { + externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; + externalHelpersImportDeclaration: ImportDeclaration | undefined; + exportSpecifiers: Map; + exportedBindings: Map; + exportedNames: Identifier[]; + exportEquals: ExportAssignment | undefined; + hasExportStarsToExportValues: boolean; + } + function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver, compilerOptions: CompilerOptions): ExternalModuleInfo; } declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; @@ -9467,12 +9667,18 @@ declare namespace ts { } declare namespace ts { type VisitResult = T | T[]; - function reduceEachChild(node: Node, f: (memo: T, node: Node) => T, initial: T): T; + function reduceEachChild(node: Node, initial: T, cbNode: (memo: T, node: Node) => T, cbNodeArray?: (memo: T, nodes: Node[]) => T): T; function visitNode(node: T, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, optional?: boolean, lift?: (node: NodeArray) => T): T; function visitNode(node: T, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, optional: boolean, lift: (node: NodeArray) => T, parenthesize: (node: Node, parentNode: Node) => Node, parentNode: Node): T; function visitNodes(nodes: NodeArray, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, start?: number, count?: number): NodeArray; function visitNodes(nodes: NodeArray, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, start: number, count: number, parenthesize: (node: Node, parentNode: Node) => Node, parentNode: Node): NodeArray; - function visitEachChild(node: T, visitor: (node: Node) => VisitResult, context: LexicalEnvironment): T; + function visitLexicalEnvironment(statements: NodeArray, visitor: (node: Node) => VisitResult, context: TransformationContext, start?: number, ensureUseStrict?: boolean): NodeArray; + function visitParameterList(nodes: NodeArray, visitor: (node: Node) => VisitResult, context: TransformationContext): NodeArray; + function visitFunctionBody(node: FunctionBody, visitor: (node: Node) => VisitResult, context: TransformationContext): FunctionBody; + function visitFunctionBody(node: ConciseBody, visitor: (node: Node) => VisitResult, context: TransformationContext): ConciseBody; + function visitEachChild(node: T, visitor: (node: Node) => VisitResult, context: TransformationContext): T; + function mergeLexicalEnvironment(statements: NodeArray, declarations: Statement[]): NodeArray; + function mergeLexicalEnvironment(statements: Statement[], declarations: Statement[]): Statement[]; function mergeFunctionBodyLexicalEnvironment(body: FunctionBody, declarations: Statement[]): FunctionBody; function mergeFunctionBodyLexicalEnvironment(body: ConciseBody, declarations: Statement[]): ConciseBody; function liftToBlock(nodes: Node[]): Statement; @@ -9480,23 +9686,30 @@ declare namespace ts { namespace Debug { const failNotOptional: typeof noop; const failBadSyntaxKind: (node: Node, message?: string) => void; + const assertEachNode: (nodes: Node[], test: (node: Node) => boolean, message?: string) => void; const assertNode: (node: Node, test: (node: Node) => boolean, message?: string) => void; + const assertOptionalNode: (node: Node, test: (node: Node) => boolean, message?: string) => void; + const assertOptionalToken: (node: Node, kind: SyntaxKind, message?: string) => void; + const assertMissingNode: (node: Node, message?: string) => void; } } declare namespace ts { - function flattenDestructuringAssignment(context: TransformationContext, node: BinaryExpression, needsValue: boolean, recordTempVariable: (node: Identifier) => void, visitor?: (node: Node) => VisitResult, transformRest?: boolean): Expression; - function flattenParameterDestructuring(node: ParameterDeclaration, value: Expression, visitor?: (node: Node) => VisitResult, transformRest?: boolean): VariableDeclaration[]; - function flattenVariableDestructuring(node: VariableDeclaration, value?: Expression, visitor?: (node: Node) => VisitResult, recordTempVariable?: (node: Identifier) => void, transformRest?: boolean): VariableDeclaration[]; - function flattenVariableDestructuringToExpression(node: VariableDeclaration, recordTempVariable: (name: Identifier) => void, createAssignmentCallback?: (name: Identifier, value: Expression, location?: TextRange) => Expression, visitor?: (node: Node) => VisitResult): Expression; + const enum FlattenLevel { + All = 0, + ObjectRest = 1, + } + function flattenDestructuringAssignment(node: VariableDeclaration | DestructuringAssignment, visitor: ((node: Node) => VisitResult) | undefined, context: TransformationContext, level: FlattenLevel, needsValue?: boolean, createAssignmentCallback?: (name: Identifier, value: Expression, location?: TextRange) => Expression): Expression; + function flattenDestructuringBinding(node: VariableDeclaration | ParameterDeclaration, visitor: (node: Node) => VisitResult, context: TransformationContext, level: FlattenLevel, rval?: Expression, hoistTempVariables?: boolean, skipInitializer?: boolean): VariableDeclaration[]; } declare namespace ts { function transformTypeScript(context: TransformationContext): (node: SourceFile) => SourceFile; } declare namespace ts { - function transformJsx(context: TransformationContext): (node: SourceFile) => SourceFile; + function transformESNext(context: TransformationContext): (node: SourceFile) => SourceFile; + function createAssignHelper(context: TransformationContext, attributesSegments: Expression[]): CallExpression; } declare namespace ts { - function transformESNext(context: TransformationContext): (node: SourceFile) => SourceFile; + function transformJsx(context: TransformationContext): (node: SourceFile) => SourceFile; } declare namespace ts { function transformES2017(context: TransformationContext): (node: SourceFile) => SourceFile; @@ -9523,25 +9736,6 @@ declare namespace ts { function transformES2015Module(context: TransformationContext): (node: SourceFile) => SourceFile; } declare namespace ts { - interface TransformationResult { - transformed: SourceFile[]; - emitNodeWithSubstitution(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; - emitNodeWithNotification(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; - } - interface TransformationContext extends LexicalEnvironment { - getCompilerOptions(): CompilerOptions; - getEmitResolver(): EmitResolver; - getEmitHost(): EmitHost; - hoistFunctionDeclaration(node: FunctionDeclaration): void; - hoistVariableDeclaration(node: Identifier): void; - enableSubstitution(kind: SyntaxKind): void; - isSubstitutionEnabled(node: Node): boolean; - onSubstituteNode?: (emitContext: EmitContext, node: Node) => Node; - enableEmitNotification(kind: SyntaxKind): void; - isEmitNotificationEnabled(node: Node): boolean; - onEmitNode?: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void; - } - type Transformer = (context: TransformationContext) => (node: SourceFile) => SourceFile; function getTransformers(compilerOptions: CompilerOptions): Transformer[]; function transformFiles(resolver: EmitResolver, host: EmitHost, sourceFiles: SourceFile[], transformers: Transformer[]): TransformationResult; } @@ -9577,7 +9771,6 @@ declare namespace ts { function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile, emitOnlyDtsFiles?: boolean): EmitResult; } declare namespace ts { - const version = "2.2.0"; function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; function computeCommonSourceDirectoryOfFilenames(fileNames: string[], currentDirectory: string, getCanonicalFileName: (fileName: string) => string): string; @@ -9642,6 +9835,7 @@ declare namespace ts { nameTable: Map; getNamedDeclarations(): Map; getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineEndOfPosition(pos: number): number; getLineStarts(): number[]; getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; @@ -10772,6 +10966,8 @@ declare namespace ts { span: TextSpan; program: Program; newLineCharacter: string; + host: LanguageServiceHost; + cancellationToken: CancellationToken; } namespace codefix { function registerCodeFix(action: CodeFix): void; @@ -10781,6 +10977,10 @@ declare namespace ts { } declare namespace ts.codefix { } +declare namespace ts.codefix { +} +declare namespace ts.codefix { +} declare namespace ts { const servicesVersion = "0.5"; interface DisplayPartsSymbolWriter extends SymbolWriter { @@ -10799,24 +10999,57 @@ declare namespace ts { function getDefaultLibFilePath(options: CompilerOptions): string; } declare namespace ts.server { + class TextStorage { + private readonly host; + private readonly fileName; + private svc; + private svcVersion; + private text; + private lineMap; + private textVersion; + constructor(host: ServerHost, fileName: NormalizedPath); + getVersion(): string; + hasScriptVersionCache(): boolean; + useScriptVersionCache(newText?: string): void; + useText(newText?: string): void; + edit(start: number, end: number, newText: string): void; + reload(text: string): void; + reloadFromFile(tempFileName?: string): void; + getSnapshot(): IScriptSnapshot; + getLineInfo(line: number): ILineInfo; + lineToTextSpan(line: number): TextSpan; + lineOffsetToPosition(line: number, offset: number): number; + positionToLineOffset(position: number): ILineInfo; + private getFileText(tempFileName?); + private ensureNoScriptVersionCache(); + private switchToScriptVersionCache(newText?); + private getOrLoadText(); + private getLineMap(); + private setText(newText); + } class ScriptInfo { private readonly host; readonly fileName: NormalizedPath; readonly scriptKind: ScriptKind; - isOpen: boolean; hasMixedContent: boolean; readonly containingProjects: Project[]; private formatCodeSettings; readonly path: Path; private fileWatcher; - private svc; - constructor(host: ServerHost, fileName: NormalizedPath, content: string, scriptKind: ScriptKind, isOpen?: boolean, hasMixedContent?: boolean); + private textStorage; + private isOpen; + constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent?: boolean); + isScriptOpen(): boolean; + open(newText: string): void; + close(): void; + getSnapshot(): IScriptSnapshot; getFormatCodeSettings(): FormatCodeSettings; attachToProject(project: Project): boolean; isAttached(project: Project): boolean; detachFromProject(project: Project): void; detachAllProjects(): void; getDefaultProject(): Project; + registerFileUpdate(): void; setFormatOptions(formatSettings: FormatCodeSettings): void; setWatcher(watcher: FileWatcher): void; stopWatcher(): void; @@ -10824,7 +11057,6 @@ declare namespace ts.server { reload(script: string): void; saveTo(fileName: string): void; reloadFromFile(tempFileName?: NormalizedPath): void; - snap(): LineIndexSnapshot; getLineInfo(line: number): ILineInfo; editContent(start: number, end: number, newText: string): void; markContainingProjectsAsDirty(): void; @@ -10834,7 +11066,7 @@ declare namespace ts.server { } } declare namespace ts.server { - class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost, ServerLanguageServiceHost { + class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost { private readonly host; private readonly project; private readonly cancellationToken; @@ -10875,7 +11107,7 @@ declare namespace ts.server { } declare namespace ts.server { interface ITypingsInstaller { - enqueueInstallTypingsRequest(p: Project, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray): void; + enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray): void; attach(projectService: ProjectService): void; onProjectClosed(p: Project): void; readonly globalTypingsCacheLocation: string; @@ -10886,7 +11118,7 @@ declare namespace ts.server { private readonly perProjectCache; constructor(installer: ITypingsInstaller); getTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray, forceRefresh: boolean): SortedReadonlyArray; - updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray, newTypings: string[]): void; + updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, newTypings: string[]): void; deleteTypingsForProject(projectName: string): void; onProjectClosed(project: Project): void; } @@ -10909,6 +11141,7 @@ declare namespace ts.server { getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; onProjectUpdateGraph(): void; emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean; + clear(): void; } function createBuilder(project: Project): Builder; } @@ -10933,10 +11166,10 @@ declare namespace ts.server { set(path: Path, value: ReadonlyArray): void; } abstract class Project { + private readonly projectName; readonly projectKind: ProjectKind; readonly projectService: ProjectService; private documentRegistry; - languageServiceEnabled: boolean; private compilerOptions; compileOnSaveEnabled: boolean; private rootFiles; @@ -10945,8 +11178,10 @@ declare namespace ts.server { private program; private cachedUnresolvedImportsPerFile; private lastCachedUnresolvedImportsList; - private languageService; + private readonly languageService; + languageServiceEnabled: boolean; builder: Builder; + private updatedFileNames; private lastReportedFileNames; private lastReportedVersion; private projectStructureVersion; @@ -10957,16 +11192,17 @@ declare namespace ts.server { isNonTsProject(): boolean; isJsOnlyProject(): boolean; getCachedUnresolvedImportsPerFile_TestOnly(): UnresolvedImportsMap; - constructor(projectKind: ProjectKind, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, languageServiceEnabled: boolean, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean); + constructor(projectName: string, projectKind: ProjectKind, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, languageServiceEnabled: boolean, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean); + private setInternalCompilerOptionsForEmittingJsFiles(); getProjectErrors(): Diagnostic[]; getLanguageService(ensureSynchronized?: boolean): LanguageService; getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[]; getProjectVersion(): string; enableLanguageService(): void; disableLanguageService(): void; - abstract getProjectName(): string; + getProjectName(): string; abstract getProjectRootPath(): string | undefined; - abstract getTypingOptions(): TypingOptions; + abstract getTypeAcquisition(): TypeAcquisition; getSourceFile(path: Path): SourceFile; updateTypes(): void; close(): void; @@ -10984,6 +11220,7 @@ declare namespace ts.server { isRoot(info: ScriptInfo): boolean; addRoot(info: ScriptInfo): void; removeFile(info: ScriptInfo, detachFromProject?: boolean): void; + registerFileUpdate(fileName: string): void; markAsDirty(): void; private extractUnresolvedImportsFromSourceFile(file, result); updateGraph(): boolean; @@ -11000,31 +11237,29 @@ declare namespace ts.server { private removeRootFileIfNecessary(info); } class InferredProject extends Project { - private static NextId; - private readonly inferredProjectName; + private static newName; directoriesWatchedForTsconfig: string[]; - constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, languageServiceEnabled: boolean, compilerOptions: CompilerOptions); - getProjectName(): string; + constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions); getProjectRootPath(): string; close(): void; - getTypingOptions(): TypingOptions; + getTypeAcquisition(): TypeAcquisition; } class ConfiguredProject extends Project { - readonly configFileName: NormalizedPath; private wildcardDirectories; compileOnSaveEnabled: boolean; - private typingOptions; + private typeAcquisition; private projectFileWatcher; private directoryWatcher; private directoriesWatchedForWildcards; private typeRootsWatchers; + readonly canonicalConfigFilePath: NormalizedPath; openRefCount: number; constructor(configFileName: NormalizedPath, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, compilerOptions: CompilerOptions, wildcardDirectories: Map, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean); + getConfigFilePath(): string; getProjectRootPath(): string; setProjectErrors(projectErrors: Diagnostic[]): void; - setTypingOptions(newTypingOptions: TypingOptions): void; - getTypingOptions(): TypingOptions; - getProjectName(): NormalizedPath; + setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; + getTypeAcquisition(): TypeAcquisition; watchConfigFile(callback: (project: ConfiguredProject) => void): void; watchTypeRoots(callback: (project: ConfiguredProject, path: string) => void): void; watchConfigDirectory(callback: (project: ConfiguredProject, path: string) => void): void; @@ -11036,34 +11271,44 @@ declare namespace ts.server { getEffectiveTypeRoots(): string[]; } class ExternalProject extends Project { - readonly externalProjectName: string; compileOnSaveEnabled: boolean; private readonly projectFilePath; - private typingOptions; + private typeAcquisition; constructor(externalProjectName: string, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean, projectFilePath?: string); getProjectRootPath(): string; - getTypingOptions(): TypingOptions; + getTypeAcquisition(): TypeAcquisition; setProjectErrors(projectErrors: Diagnostic[]): void; - setTypingOptions(newTypingOptions: TypingOptions): void; - getProjectName(): string; + setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; } } declare namespace ts.server { const maxProgramSizeForNonTsFiles: number; - type ProjectServiceEvent = { - eventName: "context"; + const ContextEvent = "context"; + const ConfigFileDiagEvent = "configFileDiag"; + const ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; + interface ContextEvent { + eventName: typeof ContextEvent; data: { project: Project; fileName: NormalizedPath; }; - } | { - eventName: "configFileDiag"; + } + interface ConfigFileDiagEvent { + eventName: typeof ConfigFileDiagEvent; data: { triggerFile: string; configFileName: string; diagnostics: Diagnostic[]; }; - }; + } + interface ProjectLanguageServiceStateEvent { + eventName: typeof ProjectLanguageServiceStateEvent; + data: { + project: Project; + languageServiceEnabled: boolean; + }; + } + type ProjectServiceEvent = ContextEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent; interface ProjectServiceEventHandler { (event: ProjectServiceEvent): void; } @@ -11075,9 +11320,10 @@ declare namespace ts.server { interface HostConfiguration { formatCodeOptions: FormatCodeSettings; hostInfo: string; + extraFileExtensions?: FileExtensionInfo[]; } interface OpenConfiguredProjectResult { - configFileName?: string; + configFileName?: NormalizedPath; configFileErrors?: Diagnostic[]; } class ProjectService { @@ -11101,12 +11347,13 @@ declare namespace ts.server { private readonly throttledOperations; private readonly hostConfiguration; private changedFiles; - private toCanonicalFileName; + readonly toCanonicalFileName: (f: string) => string; lastDeletedFile: ScriptInfo; constructor(host: ServerHost, logger: Logger, cancellationToken: HostCancellationToken, useSingleInferredProject: boolean, typingsInstaller?: ITypingsInstaller, eventHandler?: ProjectServiceEventHandler); getChangedFiles_TestOnly(): ScriptInfo[]; ensureInferredProjectsUpToDate_TestOnly(): void; getCompilerOptionsForInferredProjects(): CompilerOptions; + onUpdateLanguageServiceStateForProject(project: Project, languageServiceEnabled: boolean): void; updateTypingsForProject(response: SetTypings | InvalidateCachedTypings): void; setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions): void; stopWatchingDirectory(directory: string): void; @@ -11134,13 +11381,13 @@ declare namespace ts.server { private findExternalProjectByProjectName(projectFileName); private convertConfigFileContentToProjectOptions(configFilename); private exceededTotalSizeLimitForNonTsFiles(options, fileNames, propertyReader); - private createAndAddExternalProject(projectFileName, files, options, typingOptions); + private createAndAddExternalProject(projectFileName, files, options, typeAcquisition); private reportConfigFileDiagnostics(configFileName, diagnostics, triggerFile); private createAndAddConfiguredProject(configFileName, projectOptions, configFileErrors, clientFileName?); private watchConfigDirectoryForProject(project, options); - private addFilesToProjectAndUpdateGraph(project, files, propertyReader, clientFileName, typingOptions, configFileErrors); + private addFilesToProjectAndUpdateGraph(project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors); private openConfigFile(configFileName, clientFileName?); - private updateNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypingOptions, compileOnSave, configFileErrors); + private updateNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors); private updateConfiguredProject(project); createInferredProjectWithRootFileIfNecessary(root: ScriptInfo): InferredProject; getOrCreateScriptInfo(uncheckedFileName: string, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind): ScriptInfo; @@ -11160,7 +11407,8 @@ declare namespace ts.server { applyChangesInOpenFiles(openFiles: protocol.ExternalFile[], changedFiles: protocol.ChangedOpenFile[], closedFiles: string[]): void; private closeConfiguredProject(configFile); closeExternalProject(uncheckedFileName: string, suppressRefresh?: boolean): void; - openExternalProject(proj: protocol.ExternalProject): void; + openExternalProjects(projects: protocol.ExternalProject[]): void; + openExternalProject(proj: protocol.ExternalProject, suppressRefreshOfInferredProjects?: boolean): void; } } declare namespace ts.server { @@ -11399,8 +11647,8 @@ declare namespace ts.server { static fromString(host: ServerHost, script: string): ScriptVersionCache; } class LineIndexSnapshot implements ts.IScriptSnapshot { - version: number; - cache: ScriptVersionCache; + readonly version: number; + readonly cache: ScriptVersionCache; index: LineIndex; changesSincePreviousVersion: TextChange[]; constructor(version: number, cache: ScriptVersionCache); diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 6991547347c..842c5458a89 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -136,6 +136,9 @@ var ts; })(performance = ts.performance || (ts.performance = {})); })(ts || (ts = {})); var ts; +(function (ts) { + ts.version = "2.2.0"; +})(ts || (ts = {})); (function (ts) { var createObject = Object.create; ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; @@ -606,7 +609,7 @@ var ts; if (value === undefined) return to; if (to === undefined) - to = []; + return [value]; to.push(value); return to; } @@ -621,6 +624,14 @@ var ts; return to; } ts.addRange = addRange; + function stableSort(array, comparer) { + if (comparer === void 0) { comparer = compareValues; } + return array + .map(function (_, i) { return i; }) + .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); }) + .map(function (i) { return array[i]; }); + } + ts.stableSort = stableSort; function rangeEquals(array1, array2, pos, end) { while (pos < end) { if (array1[pos] !== array2[pos]) { @@ -775,6 +786,15 @@ var ts; } } ts.copyProperties = copyProperties; + function appendProperty(map, key, value) { + if (key === undefined || value === undefined) + return map; + if (map === undefined) + map = createMap(); + map[key] = value; + return map; + } + ts.appendProperty = appendProperty; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -798,15 +818,6 @@ var ts; return result; } ts.reduceProperties = reduceProperties; - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -1227,6 +1238,14 @@ var ts; getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS; } ts.getEmitModuleKind = getEmitModuleKind; + function getEmitModuleResolutionKind(compilerOptions) { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + } + return moduleResolution; + } + ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind; function hasZeroOrOneAsteriskCharacter(str) { var seenAsterisk = false; for (var i = 0; i < str.length; i++) { @@ -1645,8 +1664,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (needAllExtensions || extInfo.scriptKind === 3) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -1657,11 +1687,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -1777,6 +1807,16 @@ var ts; } Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); + function orderedRemoveItem(array, item) { + for (var i = 0; i < array.length; i++) { + if (array[i] === item) { + orderedRemoveItemAt(array, i); + return true; + } + } + return false; + } + ts.orderedRemoveItem = orderedRemoveItem; function orderedRemoveItemAt(array, index) { for (var i = index; i < array.length - 1; i++) { array[i] = array[i + 1]; @@ -2591,6 +2631,7 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2634,6 +2675,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -2644,6 +2686,7 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, @@ -2811,7 +2854,7 @@ var ts; Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." }, - Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." }, + Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." }, Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." }, Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." }, Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." }, @@ -2876,7 +2919,8 @@ var ts; An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, - An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." }, + The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, + _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2947,7 +2991,10 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, @@ -2989,7 +3036,7 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -3150,6 +3197,7 @@ var ts; type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, + Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", message: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, @@ -3160,9 +3208,10 @@ var ts; A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, - Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." }, + Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, - The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." }, + A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, @@ -3174,6 +3223,9 @@ var ts; Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, }; })(ts || (ts = {})); var ts; @@ -4994,7 +5046,7 @@ var ts; "es2017": 4, "esnext": 5, }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, paramType: ts.Diagnostics.VERSION, }, { @@ -5175,11 +5227,15 @@ var ts; description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file } ]; - ts.typingOptionDeclarations = [ + ts.typeAcquisitionDeclarations = [ { name: "enableAutoDiscovery", type: "boolean", }, + { + name: "enable", + type: "boolean", + }, { name: "include", type: "list", @@ -5204,6 +5260,18 @@ var ts; sourceMap: false, }; var optionNameMapCache; + function convertEnableAutoDiscoveryToEnable(typeAcquisition) { + if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { + var result = { + enable: typeAcquisition.enableAutoDiscovery, + include: typeAcquisition.include || [], + exclude: typeAcquisition.exclude || [] + }; + return result; + } + return typeAcquisition; + } + ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; function getOptionNameMap() { if (optionNameMapCache) { return optionNameMapCache; @@ -5226,14 +5294,7 @@ var ts; } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; function parseListTypeOption(opt, value, errors) { @@ -5473,9 +5534,10 @@ var ts; } return output; } - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); @@ -5483,14 +5545,15 @@ var ts; return { options: {}, fileNames: [], - typingOptions: {}, + typeAcquisition: {}, raw: json, errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))], wildcardDirectories: {} }; } var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + var jsonOptions = json["typeAcquisition"] || json["typingOptions"]; + var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); if (json["extends"]) { var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3]; if (typeof json["extends"] === "string") { @@ -5517,7 +5580,7 @@ var ts; return { options: options, fileNames: fileNames, - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, raw: json, errors: errors, wildcardDirectories: wildcardDirectories, @@ -5525,7 +5588,7 @@ var ts; }; function tryExtendsName(extendedConfig) { if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted)); + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); return; } var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName); @@ -5588,7 +5651,7 @@ var ts; errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); } else { - excludeSpecs = ["node_modules", "bower_components", "jspm_packages"]; + excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"]; var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; if (outDir) { excludeSpecs.push(outDir); @@ -5597,7 +5660,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -5623,12 +5686,12 @@ var ts; return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; - function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { var errors = []; - var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } - ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } @@ -5636,9 +5699,10 @@ var ts; convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); return options; } - function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; - convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); + convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors); return options; } function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { @@ -5700,7 +5764,7 @@ var ts; var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; var literalFileMap = ts.createMap(); @@ -5712,7 +5776,7 @@ var ts; exclude = validateSpecs(exclude, errors, true); } var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); if (fileNames) { for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; @@ -5857,9 +5921,9 @@ var ts; "constants", "process", "v8", "timers", "console" ]; var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); - function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) { + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { var inferredTypings = ts.createMap(); - if (!typingOptions || !typingOptions.enableAutoDiscovery) { + if (!typeAcquisition || !typeAcquisition.enable) { return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; } fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { @@ -5873,8 +5937,8 @@ var ts; var filesToWatch = []; var searchDirs = []; var exclude = []; - mergeTypings(typingOptions.include); - exclude = typingOptions.exclude || []; + mergeTypings(typeAcquisition.include); + exclude = typeAcquisition.exclude || []; var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); if (projectRootPath) { possibleSearchDirs.push(projectRootPath); @@ -6007,7 +6071,8 @@ var ts; (function (server) { server.ActionSet = "action::set"; server.ActionInvalidate = "action::invalidate"; - server.EventInstall = "event::install"; + server.EventBeginInstallTypes = "event::beginInstallTypes"; + server.EventEndInstallTypes = "event::endInstallTypes"; var Arguments; (function (Arguments) { Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation"; @@ -6056,12 +6121,12 @@ var ts; return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName; } } - function createInstallTypingsRequest(project, typingOptions, unresolvedImports, cachePath) { + function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { return { projectName: project.getProjectName(), fileNames: project.getFileNames(true), compilerOptions: project.getCompilerOptions(), - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, unresolvedImports: unresolvedImports, projectRootPath: getProjectRootPath(project), cachePath: cachePath, @@ -6160,59 +6225,6 @@ var ts; }; } server.createNormalizedPathMap = createNormalizedPathMap; - function throwLanguageServiceIsDisabledError() { - throw new Error("LanguageService is disabled"); - } - server.nullLanguageService = { - cleanupSemanticCache: throwLanguageServiceIsDisabledError, - getSyntacticDiagnostics: throwLanguageServiceIsDisabledError, - getSemanticDiagnostics: throwLanguageServiceIsDisabledError, - getCompilerOptionsDiagnostics: throwLanguageServiceIsDisabledError, - getSyntacticClassifications: throwLanguageServiceIsDisabledError, - getEncodedSyntacticClassifications: throwLanguageServiceIsDisabledError, - getSemanticClassifications: throwLanguageServiceIsDisabledError, - getEncodedSemanticClassifications: throwLanguageServiceIsDisabledError, - getCompletionsAtPosition: throwLanguageServiceIsDisabledError, - findReferences: throwLanguageServiceIsDisabledError, - getCompletionEntryDetails: throwLanguageServiceIsDisabledError, - getQuickInfoAtPosition: throwLanguageServiceIsDisabledError, - findRenameLocations: throwLanguageServiceIsDisabledError, - getNameOrDottedNameSpan: throwLanguageServiceIsDisabledError, - getBreakpointStatementAtPosition: throwLanguageServiceIsDisabledError, - getBraceMatchingAtPosition: throwLanguageServiceIsDisabledError, - getSignatureHelpItems: throwLanguageServiceIsDisabledError, - getDefinitionAtPosition: throwLanguageServiceIsDisabledError, - getRenameInfo: throwLanguageServiceIsDisabledError, - getTypeDefinitionAtPosition: throwLanguageServiceIsDisabledError, - getReferencesAtPosition: throwLanguageServiceIsDisabledError, - getDocumentHighlights: throwLanguageServiceIsDisabledError, - getOccurrencesAtPosition: throwLanguageServiceIsDisabledError, - getNavigateToItems: throwLanguageServiceIsDisabledError, - getNavigationBarItems: throwLanguageServiceIsDisabledError, - getNavigationTree: throwLanguageServiceIsDisabledError, - getOutliningSpans: throwLanguageServiceIsDisabledError, - getTodoComments: throwLanguageServiceIsDisabledError, - getIndentationAtPosition: throwLanguageServiceIsDisabledError, - getFormattingEditsForRange: throwLanguageServiceIsDisabledError, - getFormattingEditsForDocument: throwLanguageServiceIsDisabledError, - getFormattingEditsAfterKeystroke: throwLanguageServiceIsDisabledError, - getDocCommentTemplateAtPosition: throwLanguageServiceIsDisabledError, - isValidBraceCompletionAtPosition: throwLanguageServiceIsDisabledError, - getEmitOutput: throwLanguageServiceIsDisabledError, - getProgram: throwLanguageServiceIsDisabledError, - getNonBoundSourceFile: throwLanguageServiceIsDisabledError, - dispose: throwLanguageServiceIsDisabledError, - getCompletionEntrySymbol: throwLanguageServiceIsDisabledError, - getImplementationAtPosition: throwLanguageServiceIsDisabledError, - getSourceFile: throwLanguageServiceIsDisabledError, - getCodeFixesAtPosition: throwLanguageServiceIsDisabledError - }; - server.nullLanguageServiceHost = { - setCompilationSettings: function () { return undefined; }, - notifyFileRemoved: function () { return undefined; }, - startRecordingFilesWithChangedResolutions: function () { return undefined; }, - finishRecordingFilesWithChangedResolutions: function () { return undefined; } - }; function isInferredProjectName(name) { return /dev\/null\/inferredProject\d+\*/.test(name); } @@ -6301,6 +6313,7 @@ var ts; function moduleHasNonRelativeName(moduleName) { return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } + ts.moduleHasNonRelativeName = moduleHasNonRelativeName; function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { @@ -6881,6 +6894,7 @@ var ts; writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, writeLine: function () { return str_1 += " "; }, increaseIndent: ts.noop, @@ -6953,17 +6967,17 @@ var ts; ts.hasChangesInResolutions = hasChangesInResolutions; function containsParseError(node) { aggregateChildData(node); - return (node.flags & 4194304) !== 0; + return (node.flags & 131072) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.flags & 8388608)) { - var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576) !== 0) || + if (!(node.flags & 262144)) { + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { - node.flags |= 4194304; + node.flags |= 131072; } - node.flags |= 8388608; + node.flags |= 262144; } } function getSourceFileOfNode(node) { @@ -7034,28 +7048,28 @@ var ts; return !nodeIsMissing(node); } ts.nodeIsPresent = nodeIsPresent; - function getTokenPosOfNode(node, sourceFile, includeJsDocComment) { + function getTokenPosOfNode(node, sourceFile, includeJsDoc) { if (nodeIsMissing(node)) { return node.pos; } if (isJSDocNode(node)) { return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true); } - if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) { - return getTokenPosOfNode(node.jsDocComments[0]); + if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { + return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 291 && node._children.length > 0) { - return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment); + if (node.kind === 292 && node._children.length > 0) { + return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 && node.kind <= 287; + return node.kind >= 262 && node.kind <= 288; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 && node.kind <= 290; + return node.kind >= 278 && node.kind <= 291; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -7187,6 +7201,10 @@ var ts; return false; } ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { case 261: @@ -7232,7 +7250,7 @@ var ts; case 8: return name.text; case 142: - if (isStringOrNumericLiteral(name.expression.kind)) { + if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } } @@ -7354,7 +7372,8 @@ var ts; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 && node.expression.kind === 9; + return node.kind === 207 + && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -7365,25 +7384,20 @@ var ts; return ts.getLeadingCommentRanges(text, node.pos); } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; - function getJsDocComments(node, sourceFileOfNode) { - return getJsDocCommentsFromText(node, sourceFileOfNode.text); - } - ts.getJsDocComments = getJsDocComments; - function getJsDocCommentsFromText(node, text) { + function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 144 || node.kind === 143 || node.kind === 184 || node.kind === 185) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); - return ts.filter(commentRanges, isJsDocComment); - function isJsDocComment(comment) { + return ts.filter(commentRanges, function (comment) { return text.charCodeAt(comment.pos + 1) === 42 && text.charCodeAt(comment.pos + 2) === 42 && text.charCodeAt(comment.pos + 3) !== 47; - } + }); } - ts.getJsDocCommentsFromText = getJsDocCommentsFromText; + ts.getJSDocCommentRanges = getJSDocCommentRanges; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; @@ -7515,6 +7529,18 @@ var ts; } } ts.forEachYieldExpression = forEachYieldExpression; + function getRestParameterElementType(node) { + if (node && node.kind === 162) { + return node.elementType; + } + else if (node && node.kind === 157) { + return ts.singleOrUndefined(node.typeArguments); + } + else { + return undefined; + } + } + ts.getRestParameterElementType = getRestParameterElementType; function isVariableLike(node) { if (node) { switch (node.kind) { @@ -7909,6 +7935,7 @@ var ts; case 145: case 252: case 251: + case 259: return true; case 199: return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); @@ -7945,7 +7972,7 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.flags & 2097152); + return node && !!(node.flags & 65536); } ts.isInJavaScriptFile = isInJavaScriptFile; function isRequireCall(expression, checkArgumentIsStringLiteral) { @@ -8063,152 +8090,118 @@ var ts; node.parameters[0].type.kind === 276; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getJSDocTag(node, kind, checkParentVariableStatement) { - if (!node) { - return undefined; - } - var jsDocTags = getJSDocTags(node, checkParentVariableStatement); - if (!jsDocTags) { - return undefined; - } - for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) { - var tag = jsDocTags_1[_i]; - if (tag.kind === kind) { - return tag; - } - } + function getCommentsFromJSDoc(node) { + return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); } - function append(previous, additional) { - if (additional) { - if (!previous) { - previous = []; - } - for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) { - var x = additional_1[_i]; - previous.push(x); - } - } - return previous; - } - function getJSDocComments(node, checkParentVariableStatement) { - return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); }); - } - ts.getJSDocComments = getJSDocComments; - function getJSDocTags(node, checkParentVariableStatement) { - return getJSDocs(node, checkParentVariableStatement, function (docs) { + ts.getCommentsFromJSDoc = getCommentsFromJSDoc; + function getJSDocTags(node, kind) { + var docs = getJSDocs(node); + if (docs) { var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.tags) { - result.push.apply(result, doc.tags); + if (doc.kind === 281) { + if (doc.kind === kind) { + result.push(doc); + } + } + else { + result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; })); } } return result; - }, function (tags) { return tags; }); + } } - function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) { - var result = undefined; - if (checkParentVariableStatement) { - var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) && - (node.parent).initializer === node && - node.parent.parent.parent.kind === 205; + function getFirstJSDocTag(node, kind) { + return node && ts.firstOrUndefined(getJSDocTags(node, kind)); + } + function getJSDocs(node) { + var cache = node.jsDocCache; + if (!cache) { + getJSDocsWorker(node); + node.jsDocCache = cache; + } + return cache; + function getJSDocsWorker(node) { + var parent = node.parent; + var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && + parent.initializer === node && + parent.parent.parent.kind === 205; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - node.parent.parent.kind === 205; - var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : - isVariableOfVariableDeclarationStatement ? node.parent.parent : + parent.parent.kind === 205; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : + isVariableOfVariableDeclarationStatement ? parent.parent : undefined; if (variableStatementNode) { - result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags)); + getJSDocsWorker(variableStatementNode); } - if (node.kind === 230 && - node.parent && node.parent.kind === 230) { - result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags)); - } - var parent_4 = node.parent; - var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent && - parent_4.kind === 192 && - parent_4.operatorToken.kind === 57 && - parent_4.parent.kind === 207; + var isSourceOfAssignmentExpressionStatement = parent && parent.parent && + parent.kind === 192 && + parent.operatorToken.kind === 57 && + parent.parent.kind === 207; if (isSourceOfAssignmentExpressionStatement) { - result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags)); + getJSDocsWorker(parent.parent); } - var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 257; - if (isPropertyAssignmentExpression) { - result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags)); + var isModuleDeclaration = node.kind === 230 && + parent && parent.kind === 230; + var isPropertyAssignmentExpression = parent && parent.kind === 257; + if (isModuleDeclaration || isPropertyAssignmentExpression) { + getJSDocsWorker(parent); } if (node.kind === 144) { - var paramTags = getJSDocParameterTag(node, checkParentVariableStatement); - if (paramTags) { - result = append(result, getTags(paramTags)); - } + cache = ts.concatenate(cache, getJSDocParameterTags(node)); } - } - if (isVariableLike(node) && node.initializer) { - result = append(result, getJSDocs(node.initializer, false, getDocs, getTags)); - } - if (node.jsDocComments) { - if (result) { - result = append(result, getDocs(node.jsDocComments)); - } - else { - return getDocs(node.jsDocComments); + if (isVariableLike(node) && node.initializer) { + cache = ts.concatenate(cache, node.initializer.jsDoc); } + cache = ts.concatenate(cache, node.jsDoc); } - return result; } - function getJSDocParameterTag(param, checkParentVariableStatement) { + function getJSDocParameterTags(param) { + if (!isParameter(param)) { + return undefined; + } var func = param.parent; - var tags = getJSDocTags(func, checkParentVariableStatement); + var tags = getJSDocTags(func, 281); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { var name_8 = param.name.text; - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 && tag.parameterName.text === name_8; }); - if (paramTags) { - return paramTags; - } + return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_8; }); } else { return undefined; } } - function getJSDocTypeTag(node) { - return getJSDocTag(node, 282, false); + ts.getJSDocParameterTags = getJSDocParameterTags; + function getJSDocType(node) { + var tag = getFirstJSDocTag(node, 283); + if (!tag && node.kind === 144) { + var paramTags = getJSDocParameterTags(node); + if (paramTags) { + tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); + } + } + return tag && tag.typeExpression && tag.typeExpression.type; } - ts.getJSDocTypeTag = getJSDocTypeTag; + ts.getJSDocType = getJSDocType; + function getJSDocAugmentsTag(node) { + return getFirstJSDocTag(node, 280); + } + ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 281, true); + return getFirstJSDocTag(node, 282); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 283, false); + return getFirstJSDocTag(node, 284); } ts.getJSDocTemplateTag = getJSDocTemplateTag; - function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 70) { - var parameterName = parameter.name.text; - var jsDocTags = getJSDocTags(parameter.parent, true); - if (!jsDocTags) { - return undefined; - } - for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) { - var tag = jsDocTags_2[_i]; - if (tag.kind === 280) { - var parameterTag = tag; - if (parameterTag.parameterName.text === parameterName) { - return parameterTag; - } - } - } - } - return undefined; - } - ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; function hasRestParameter(s) { return isRestParameter(ts.lastOrUndefined(s.parameters)); } @@ -8218,14 +8211,11 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 2097152)) { - if (node.type && node.type.kind === 275) { + if (node && (node.flags & 65536)) { + if (node.type && node.type.kind === 275 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) { return true; } - var paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 275; - } } return isDeclaredRestParam(node); } @@ -8448,8 +8438,10 @@ var ts; return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; - function isStringOrNumericLiteral(kind) { - return kind === 9 || kind === 8; + function isStringOrNumericLiteral(node) { + var kind = node.kind; + return kind === 9 + || kind === 8; } ts.isStringOrNumericLiteral = isStringOrNumericLiteral; function hasDynamicName(declaration) { @@ -8458,7 +8450,7 @@ var ts; ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { return name.kind === 142 && - !isStringOrNumericLiteral(name.expression.kind) && + !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } ts.isDynamicName = isDynamicName; @@ -8664,6 +8656,7 @@ var ts; case 194: case 183: case 198: + case 297: return 19; case 181: case 177: @@ -9425,19 +9418,19 @@ var ts; } } ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments; - function isAssignmentExpression(node) { + function isAssignmentExpression(node, excludeCompoundAssignment) { return isBinaryExpression(node) - && isAssignmentOperator(node.operatorToken.kind) + && (excludeCompoundAssignment + ? node.operatorToken.kind === 57 + : isAssignmentOperator(node.operatorToken.kind)) && isLeftHandSideExpression(node.left); } ts.isAssignmentExpression = isAssignmentExpression; function isDestructuringAssignment(node) { - if (isBinaryExpression(node)) { - if (node.operatorToken.kind === 57) { - var kind = node.left.kind; - return kind === 176 - || kind === 175; - } + if (isAssignmentExpression(node, true)) { + var kind = node.left.kind; + return kind === 176 + || kind === 175; } return false; } @@ -9519,39 +9512,6 @@ var ts; } return output; } - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - function stringifyFallback(value) { - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; - } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; - } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; - } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); - } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function convertToBase64(input) { var result = ""; @@ -9748,122 +9708,6 @@ var ts; return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos); } ts.getStartPositionOfRange = getStartPositionOfRange; - function collectExternalModuleInfo(sourceFile, resolver) { - var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); - var uniqueExports = ts.createMap(); - var hasExportDefault = false; - var exportEquals = undefined; - var hasExportStarsToExportValues = false; - for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { - var node = _a[_i]; - switch (node.kind) { - case 235: - externalImports.push(node); - break; - case 234: - if (node.moduleReference.kind === 245) { - externalImports.push(node); - } - break; - case 241: - if (node.moduleSpecifier) { - if (!node.exportClause) { - externalImports.push(node); - hasExportStarsToExportValues = true; - } - else { - externalImports.push(node); - } - } - else { - for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { - var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_10 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_10) - || resolver.getReferencedValueDeclaration(name_10); - if (decl) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name); - } - uniqueExports[specifier.name.text] = specifier.name; - } - } - } - break; - case 240: - if (node.isExportEquals && !exportEquals) { - exportEquals = node; - } - break; - case 205: - if (hasModifier(node, 1)) { - for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { - var decl = _e[_d]; - collectExportedVariableInfo(decl, uniqueExports); - } - } - break; - case 225: - if (hasModifier(node, 1)) { - if (hasModifier(node, 512)) { - if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); - hasExportDefault = true; - } - } - else { - var name_11 = node.name; - if (!uniqueExports[name_11.text]) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_11); - uniqueExports[name_11.text] = name_11; - } - } - } - break; - case 226: - if (hasModifier(node, 1)) { - if (hasModifier(node, 512)) { - if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); - hasExportDefault = true; - } - } - else { - var name_12 = node.name; - if (!uniqueExports[name_12.text]) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_12); - uniqueExports[name_12.text] = name_12; - } - } - } - break; - } - } - var exportedNames; - for (var key in uniqueExports) { - exportedNames = ts.append(exportedNames, uniqueExports[key]); - } - return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames }; - } - ts.collectExternalModuleInfo = collectExternalModuleInfo; - function collectExportedVariableInfo(decl, uniqueExports) { - if (isBindingPattern(decl.name)) { - for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (!isOmittedExpression(element)) { - collectExportedVariableInfo(element, uniqueExports); - } - } - } - else if (!isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = decl.name; - } - } - } function isDeclarationNameOfEnumOrNamespace(node) { var parseNode = getParseTreeNode(node); if (parseNode) { @@ -10034,6 +9878,14 @@ var ts; return isTypeNodeKind(node.kind); } ts.isTypeNode = isTypeNode; + function isArrayBindingPattern(node) { + return node.kind === 173; + } + ts.isArrayBindingPattern = isArrayBindingPattern; + function isObjectBindingPattern(node) { + return node.kind === 172; + } + ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; @@ -10043,6 +9895,12 @@ var ts; return false; } ts.isBindingPattern = isBindingPattern; + function isAssignmentPattern(node) { + var kind = node.kind; + return kind === 175 + || kind === 176; + } + ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { return node.kind === 174; } @@ -10053,6 +9911,39 @@ var ts; || kind === 198; } ts.isArrayBindingElement = isArrayBindingElement; + function isDeclarationBindingElement(bindingElement) { + switch (bindingElement.kind) { + case 223: + case 144: + case 174: + return true; + } + return false; + } + ts.isDeclarationBindingElement = isDeclarationBindingElement; + function isBindingOrAssignmentPattern(node) { + return isObjectBindingOrAssignmentPattern(node) + || isArrayBindingOrAssignmentPattern(node); + } + ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; + function isObjectBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 172: + case 176: + return true; + } + return false; + } + ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; + function isArrayBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 173: + case 175: + return true; + } + return false; + } + ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; function isArrayLiteralExpression(node) { return node.kind === 175; } @@ -10119,7 +10010,8 @@ var ts; || kind === 98 || kind === 100 || kind === 96 - || kind === 201; + || kind === 201 + || kind === 297; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); @@ -10147,6 +10039,7 @@ var ts; || kind === 196 || kind === 200 || kind === 198 + || kind === 297 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10160,11 +10053,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 293; + return node.kind === 294; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 292; + return node.kind === 293; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10276,7 +10169,7 @@ var ts; || kind === 228 || kind === 143 || kind === 223 - || kind === 284; + || kind === 285; } function isDeclarationStatementKind(kind) { return kind === 225 @@ -10311,9 +10204,9 @@ var ts; || kind === 205 || kind === 210 || kind === 217 - || kind === 292 - || kind === 295 - || kind === 294; + || kind === 293 + || kind === 296 + || kind === 295; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10601,6 +10494,53 @@ var ts; return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; + function validateLocaleAndSetLanguage(locale, sys, errors) { + var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); + if (!matchResult) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); + } + return; + } + var language = matchResult[1]; + var territory = matchResult[3]; + if (!trySetLanguageAndTerritory(language, territory, errors)) { + trySetLanguageAndTerritory(language, undefined, errors); + } + function trySetLanguageAndTerritory(language, territory, errors) { + var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath()); + var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath); + var filePath = ts.combinePaths(containingDirectoryPath, language); + if (territory) { + filePath = filePath + "-" + territory; + } + filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")); + if (!sys.fileExists(filePath)) { + return false; + } + var fileContents = ""; + try { + fileContents = sys.readFile(filePath); + } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)); + } + return false; + } + try { + ts.localizedDiagnosticMessages = JSON.parse(fileContents); + } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)); + } + return false; + } + return true; + } + } + ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; })(ts || (ts = {})); var ts; (function (ts) { @@ -10801,9 +10741,9 @@ var ts; return node; } ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node); + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) { + return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node); } return node; } @@ -10936,9 +10876,9 @@ var ts; return node; } ts.createBindingElement = createBindingElement; - function updateBindingElement(node, propertyName, name, initializer) { - if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) { - return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node); + function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { + if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) { + return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node); } return node; } @@ -10978,7 +10918,7 @@ var ts; function createPropertyAccess(expression, name, location, flags) { var node = createNode(177, location, flags); node.expression = parenthesizeForAccess(expression); - (node.emitNode || (node.emitNode = {})).flags |= 1048576; + (node.emitNode || (node.emitNode = {})).flags |= 65536; node.name = typeof name === "string" ? createIdentifier(name) : name; return node; } @@ -11199,13 +11139,21 @@ var ts; return node; } ts.updateBinary = updateBinary; - function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) { - var node = createNode(193, location); - node.condition = condition; - node.questionToken = questionToken; - node.whenTrue = whenTrue; - node.colonToken = colonToken; - node.whenFalse = whenFalse; + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { + var node = createNode(193, whenFalse ? location : colonTokenOrLocation); + node.condition = parenthesizeForConditionalHead(condition); + if (whenFalse) { + node.questionToken = questionTokenOrWhenTrue; + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); + node.colonToken = colonTokenOrLocation; + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); + } + else { + node.questionToken = createToken(54); + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); + node.colonToken = createToken(55); + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); + } return node; } ts.createConditional = createConditional; @@ -12015,35 +11963,33 @@ var ts; updated.imports = node.imports; if (node.moduleAugmentations !== undefined) updated.moduleAugmentations = node.moduleAugmentations; - if (node.externalHelpersModuleName !== undefined) - updated.externalHelpersModuleName = node.externalHelpersModuleName; return updateNode(updated, node); } return node; } ts.updateSourceFileNode = updateSourceFileNode; function createNotEmittedStatement(original) { - var node = createNode(292, original); + var node = createNode(293, original); node.original = original; return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(295); + var node = createNode(296); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(294); + var node = createNode(295); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(293, location || original); + var node = createNode(294, location || original); node.expression = expression; node.original = original; return node; @@ -12056,6 +12002,12 @@ var ts; return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; + function createRawExpression(text) { + var node = createNode(297); + node.text = text; + return node; + } + ts.createRawExpression = createRawExpression; function createComma(left, right) { return createBinary(left, 25, right); } @@ -12104,13 +12056,19 @@ var ts; return createVoid(createLiteral(0)); } ts.createVoidZero = createVoidZero; + function createTypeCheck(value, tag) { + return tag === "undefined" + ? createStrictEquality(value, createVoidZero()) + : createStrictEquality(createTypeOf(value), createLiteral(tag)); + } + ts.createTypeCheck = createTypeCheck; function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) { return createElementAccess(target, memberName.expression, location); } else { var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - (expression.emitNode || (expression.emitNode = {})).flags |= 2048; + (expression.emitNode || (expression.emitNode = {})).flags |= 64; return expression; } } @@ -12152,7 +12110,10 @@ var ts; } function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { - return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536)); + var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); + var right = createSynthesizedNode(70); + right.text = jsxFactory.right.text; + return createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); @@ -12206,114 +12167,10 @@ var ts; return createVariableDeclarationList(declarations, location, 2); } ts.createConstDeclarationList = createConstDeclarationList; - function createHelperName(externalHelpersModuleName, name) { - return externalHelpersModuleName - ? createPropertyAccess(externalHelpersModuleName, name) - : createIdentifier(name); + function getHelperName(name) { + return setEmitFlags(createIdentifier(name), 4096 | 2); } - ts.createHelperName = createHelperName; - function createExtendsHelper(externalHelpersModuleName, name) { - return createCall(createHelperName(externalHelpersModuleName, "__extends"), undefined, [ - name, - createIdentifier("_super") - ]); - } - ts.createExtendsHelper = createExtendsHelper; - function createAssignHelper(externalHelpersModuleName, attributesSegments) { - return createCall(createHelperName(externalHelpersModuleName, "__assign"), undefined, attributesSegments); - } - ts.createAssignHelper = createAssignHelper; - function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) { - return createCall(createHelperName(externalHelpersModuleName, "__param"), undefined, [ - createLiteral(parameterOffset), - expression - ], location); - } - ts.createParamHelper = createParamHelper; - function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) { - return createCall(createHelperName(externalHelpersModuleName, "__metadata"), undefined, [ - createLiteral(metadataKey), - metadataValue - ]); - } - ts.createMetadataHelper = createMetadataHelper; - function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) { - var argumentsArray = []; - argumentsArray.push(createArrayLiteral(decoratorExpressions, undefined, true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); - } - } - return createCall(createHelperName(externalHelpersModuleName, "__decorate"), undefined, argumentsArray, location); - } - ts.createDecorateHelper = createDecorateHelper; - function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) { - var generatorFunc = createFunctionExpression(undefined, createToken(38), undefined, undefined, [], undefined, body); - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152; - return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), undefined, [ - createThis(), - hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(), - promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(), - generatorFunc - ]); - } - ts.createAwaiterHelper = createAwaiterHelper; - function createHasOwnProperty(target, propertyName) { - return createCall(createPropertyAccess(target, "hasOwnProperty"), undefined, [propertyName]); - } - ts.createHasOwnProperty = createHasOwnProperty; - function createObjectCreate(prototype) { - return createCall(createPropertyAccess(createIdentifier("Object"), "create"), undefined, [prototype]); - } - function createGeti(target) { - return createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createElementAccess(target, createIdentifier("name"))); - } - function createSeti(target) { - return createArrowFunction(undefined, undefined, [ - createParameter(undefined, undefined, undefined, "name"), - createParameter(undefined, undefined, undefined, "value") - ], undefined, createToken(35), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value"))); - } - function createAdvancedAsyncSuperHelper() { - var createCache = createVariableStatement(undefined, createConstDeclarationList([ - createVariableDeclaration("cache", undefined, createObjectCreate(createNull())) - ])); - var getter = createGetAccessor(undefined, undefined, "value", [], undefined, createBlock([ - createReturn(createCall(createIdentifier("geti"), undefined, [createIdentifier("name")])) - ])); - var setter = createSetAccessor(undefined, undefined, "value", [createParameter(undefined, undefined, undefined, "v")], createBlock([ - createStatement(createCall(createIdentifier("seti"), undefined, [ - createIdentifier("name"), - createIdentifier("v") - ])) - ])); - var getOrCreateAccessorsForName = createReturn(createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([ - getter, - setter - ])))))); - return createVariableStatement(undefined, createConstDeclarationList([ - createVariableDeclaration("_super", undefined, createCall(createParen(createFunctionExpression(undefined, undefined, undefined, undefined, [ - createParameter(undefined, undefined, undefined, "geti"), - createParameter(undefined, undefined, undefined, "seti") - ], undefined, createBlock([ - createCache, - getOrCreateAccessorsForName - ]))), undefined, [ - createGeti(createSuper()), - createSeti(createSuper()) - ])) - ])); - } - ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper; - function createSimpleAsyncSuperHelper() { - return createVariableStatement(undefined, createConstDeclarationList([ - createVariableDeclaration("_super", undefined, createGeti(createSuper())) - ])); - } - ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper; + ts.getHelperName = getHelperName; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12459,19 +12316,19 @@ var ts; return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method)); } function getLocalName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 262144); + return getName(node, allowComments, allowSourceMaps, 16384); } ts.getLocalName = getLocalName; function isLocalName(node) { - return (getEmitFlags(node) & 262144) !== 0; + return (getEmitFlags(node) & 16384) !== 0; } ts.isLocalName = isLocalName; function getExportName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 131072); + return getName(node, allowComments, allowSourceMaps, 8192); } ts.getExportName = getExportName; function isExportName(node) { - return (getEmitFlags(node) & 131072) !== 0; + return (getEmitFlags(node) & 8192) !== 0; } ts.isExportName = isExportName; function getDeclarationName(node, allowComments, allowSourceMaps) { @@ -12480,15 +12337,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_13 = getMutableClone(node.name); + var name_10 = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) - emitFlags |= 1536; + emitFlags |= 48; if (!allowComments) - emitFlags |= 49152; + emitFlags |= 1536; if (emitFlags) - setEmitFlags(name_13, emitFlags); - return name_13; + setEmitFlags(name_10, emitFlags); + return name_10; } return getGeneratedNameForNode(node); } @@ -12503,14 +12360,18 @@ var ts; var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name); var emitFlags; if (!allowSourceMaps) - emitFlags |= 1536; + emitFlags |= 48; if (!allowComments) - emitFlags |= 49152; + emitFlags |= 1536; if (emitFlags) setEmitFlags(qualifiedName, emitFlags); return qualifiedName; } ts.getNamespaceMemberName = getNamespaceMemberName; + function convertToFunctionBody(node, multiLine) { + return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine); + } + ts.convertToFunctionBody = convertToFunctionBody; function isUseStrictPrologue(node) { return node.expression.text === "use strict"; } @@ -12537,7 +12398,7 @@ var ts; } while (statementOffset < numStatements) { var statement = source[statementOffset]; - if (getEmitFlags(statement) & 8388608) { + if (getEmitFlags(statement) & 524288) { target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); } else { @@ -12548,10 +12409,17 @@ var ts; return statementOffset; } ts.addPrologueDirectives = addPrologueDirectives; - function ensureUseStrict(node) { + function startsWithUseStrict(statements) { + var firstStatement = ts.firstOrUndefined(statements); + return firstStatement !== undefined + && ts.isPrologueDirective(firstStatement) + && isUseStrictPrologue(firstStatement); + } + ts.startsWithUseStrict = startsWithUseStrict; + function ensureUseStrict(statements) { var foundUseStrict = false; - for (var _i = 0, _a = node.statements; _i < _a.length; _i++) { - var statement = _a[_i]; + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; if (ts.isPrologueDirective(statement)) { if (isUseStrictPrologue(statement)) { foundUseStrict = true; @@ -12563,11 +12431,11 @@ var ts; } } if (!foundUseStrict) { - var statements = []; - statements.push(startOnNewLine(createStatement(createLiteral("use strict")))); - return updateSourceFileNode(node, statements.concat(node.statements)); + return createNodeArray([ + startOnNewLine(createStatement(createLiteral("use strict"))) + ].concat(statements), statements); } - return node; + return statements; } ts.ensureUseStrict = ensureUseStrict; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { @@ -12642,6 +12510,21 @@ var ts; } return 0; } + function parenthesizeForConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(193, 54); + var emittedCondition = skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { + return createParen(condition); + } + return condition; + } + ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; + function parenthesizeSubexpressionOfConditionalExpression(e) { + return e.kind === 192 && e.operatorToken.kind === 25 + ? createParen(e) + : e; + } function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { @@ -12747,7 +12630,7 @@ var ts; case 177: node = node.expression; continue; - case 293: + case 294: node = node.expression; continue; } @@ -12795,7 +12678,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 293) { + while (node.kind === 294) { node = node.expression; } return node; @@ -12817,8 +12700,8 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges; - if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges)) + var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) destEmitNode = {}; if (flags) destEmitNode.flags = flags; @@ -12828,6 +12711,10 @@ var ts; destEmitNode.sourceMapRange = sourceMapRange; if (tokenSourceMapRanges) destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -12861,6 +12748,7 @@ var ts; } return node.emitNode; } + ts.getOrCreateEmitNode = getOrCreateEmitNode; function getEmitFlags(node) { var emitNode = node.emitNode; return emitNode && emitNode.flags; @@ -12871,11 +12759,22 @@ var ts; return node; } ts.setEmitFlags = setEmitFlags; + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; function setSourceMapRange(node, range) { getOrCreateEmitNode(node).sourceMapRange = range; return node; } ts.setSourceMapRange = setSourceMapRange; + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; function setTokenSourceMapRange(node, token, range) { var emitNode = getOrCreateEmitNode(node); var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); @@ -12883,27 +12782,16 @@ var ts; return node; } ts.setTokenSourceMapRange = setTokenSourceMapRange; - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; function getCommentRange(node) { var emitNode = node.emitNode; return (emitNode && emitNode.commentRange) || node; } ts.getCommentRange = getCommentRange; - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; } - ts.getSourceMapRange = getSourceMapRange; - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; + ts.setCommentRange = setCommentRange; function getConstantValue(node) { var emitNode = node.emitNode; return emitNode && emitNode.constantValue; @@ -12915,6 +12803,103 @@ var ts; return node; } ts.setConstantValue = setConstantValue; + function getExternalHelpersModuleName(node) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = parseNode && parseNode.emitNode; + return emitNode && emitNode.externalHelpersModuleName; + } + ts.getExternalHelpersModuleName = getExternalHelpersModuleName; + function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) { + if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { + var externalHelpersModuleName = getExternalHelpersModuleName(node); + if (externalHelpersModuleName) { + return externalHelpersModuleName; + } + var helpers = getEmitHelpers(node); + if (helpers) { + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!helper.scoped) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText)); + } + } + } + } + } + ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + function compareEmitHelpers(x, y) { + if (x === y) + return 0; + if (x.priority === y.priority) + return 0; + if (x.priority === undefined) + return 1; + if (y.priority === undefined) + return -1; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; function setTextRange(node, location) { if (location) { node.pos = location.pos; @@ -12941,8 +12926,8 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_14 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_14) ? name_14 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name_11 = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } if (node.kind === 235 && node.importClause) { return getGeneratedNameForNode(node); @@ -12985,221 +12970,291 @@ var ts; function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) { return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); } - function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) { - var multiLine = false; - var singleLine = false; - var statementsLocation; - var closeBraceLocation; - var statements = []; - var body = node.body; - var statementOffset; - context.startLexicalEnvironment(); - if (ts.isBlock(body)) { - statementOffset = addPrologueDirectives(statements, body.statements, false, visitor); + function getInitializerOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + return bindingElement.initializer; } - addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis); - addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest); - addRestParameterIfNeeded(statements, node, false); - if (!multiLine && statements.length > 0) { - multiLine = true; + if (ts.isPropertyAssignment(bindingElement)) { + return ts.isAssignmentExpression(bindingElement.initializer, true) + ? bindingElement.initializer.right + : undefined; } - if (ts.isBlock(body)) { - statementsLocation = body.statements; - ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); - if (!multiLine && body.multiLine) { - multiLine = true; + if (ts.isShorthandPropertyAssignment(bindingElement)) { + return bindingElement.objectAssignmentInitializer; + } + if (ts.isAssignmentExpression(bindingElement, true)) { + return bindingElement.right; + } + if (ts.isSpreadExpression(bindingElement)) { + return getInitializerOfBindingOrAssignmentElement(bindingElement.expression); + } + } + ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement; + function getTargetOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + return bindingElement.name; + } + if (ts.isObjectLiteralElementLike(bindingElement)) { + switch (bindingElement.kind) { + case 257: + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); + case 258: + return bindingElement.name; + case 259: + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + return undefined; + } + if (ts.isAssignmentExpression(bindingElement, true)) { + return getTargetOfBindingOrAssignmentElement(bindingElement.left); + } + if (ts.isSpreadExpression(bindingElement)) { + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + return bindingElement; + } + ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; + function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 144: + case 174: + return bindingElement.dotDotDotToken; + case 196: + case 259: + return bindingElement; + } + return undefined; + } + ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; + function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 174: + if (bindingElement.propertyName) { + var propertyName = bindingElement.propertyName; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 257: + if (bindingElement.name) { + var propertyName = bindingElement.name; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 259: + return bindingElement.name; + } + var target = getTargetOfBindingOrAssignmentElement(bindingElement); + if (target && ts.isPropertyName(target)) { + return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression) + ? target.expression + : target; + } + ts.Debug.fail("Invalid property name for binding element."); + } + ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; + function getElementsOfBindingOrAssignmentPattern(name) { + switch (name.kind) { + case 172: + case 173: + case 175: + return name.elements; + case 176: + return name.properties; + } + } + ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern; + function convertToArrayAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createSpread(element.name, element), element); + } + var expression = convertToAssignmentElementTarget(element.name); + return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression; + } + ts.Debug.assertNode(element, ts.isExpression); + return element; + } + ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement; + function convertToObjectAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createSpreadAssignment(element.name, element), element); + } + if (element.propertyName) { + var expression = convertToAssignmentElementTarget(element.name); + return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element); + } + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element); + } + ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); + return element; + } + ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; + function convertToAssignmentPattern(node) { + switch (node.kind) { + case 173: + case 175: + return convertToArrayAssignmentPattern(node); + case 172: + case 176: + return convertToObjectAssignmentPattern(node); + } + } + ts.convertToAssignmentPattern = convertToAssignmentPattern; + function convertToObjectAssignmentPattern(node) { + if (ts.isObjectBindingPattern(node)) { + return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node); + } + ts.Debug.assertNode(node, ts.isObjectLiteralExpression); + return node; + } + ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; + function convertToArrayAssignmentPattern(node) { + if (ts.isArrayBindingPattern(node)) { + return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node); + } + ts.Debug.assertNode(node, ts.isArrayLiteralExpression); + return node; + } + ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern; + function convertToAssignmentElementTarget(node) { + if (ts.isBindingPattern(node)) { + return convertToAssignmentPattern(node); + } + ts.Debug.assertNode(node, ts.isExpression); + return node; + } + ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; + function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { + var externalImports = []; + var exportSpecifiers = ts.createMap(); + var exportedBindings = ts.createMap(); + var uniqueExports = ts.createMap(); + var exportedNames; + var hasExportDefault = false; + var exportEquals = undefined; + var hasExportStarsToExportValues = false; + var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions); + var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText)); + if (externalHelpersImportDeclaration) { + externalImports.push(externalHelpersImportDeclaration); + } + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 235: + externalImports.push(node); + break; + case 234: + if (node.moduleReference.kind === 245) { + externalImports.push(node); + } + break; + case 241: + if (node.moduleSpecifier) { + if (!node.exportClause) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } + else { + externalImports.push(node); + } + } + else { + for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { + var specifier = _c[_b]; + if (!uniqueExports[specifier.name.text]) { + var name_12 = specifier.propertyName || specifier.name; + ts.multiMapAdd(exportSpecifiers, name_12.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name_12) + || resolver.getReferencedValueDeclaration(name_12); + if (decl) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + } + uniqueExports[specifier.name.text] = true; + exportedNames = ts.append(exportedNames, specifier.name); + } + } + } + break; + case 240: + if (node.isExportEquals && !exportEquals) { + exportEquals = node; + } + break; + case 205: + if (ts.hasModifier(node, 1)) { + for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { + var decl = _e[_d]; + exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames); + } + } + break; + case 225: + if (ts.hasModifier(node, 1)) { + if (ts.hasModifier(node, 512)) { + if (!hasExportDefault) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + var name_13 = node.name; + if (!uniqueExports[name_13.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13); + uniqueExports[name_13.text] = true; + exportedNames = ts.append(exportedNames, name_13); + } + } + } + break; + case 226: + if (ts.hasModifier(node, 1)) { + if (ts.hasModifier(node, 512)) { + if (!hasExportDefault) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + var name_14 = node.name; + if (!uniqueExports[name_14.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_14); + uniqueExports[name_14.text] = true; + exportedNames = ts.append(exportedNames, name_14); + } + } + } + break; } } - else { - ts.Debug.assert(node.kind === 185); - statementsLocation = ts.moveRangeEnd(body, -1); - var equalsGreaterThanToken = node.equalsGreaterThanToken; - if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { - if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { - singleLine = true; - } - else { - multiLine = true; + return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration }; + } + ts.collectExternalModuleInfo = collectExternalModuleInfo; + function collectExportedVariableInfo(decl, uniqueExports, exportedNames) { + if (ts.isBindingPattern(decl.name)) { + for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames); } } - var expression = ts.visitNode(body, visitor, ts.isExpression); - var returnStatement = createReturn(expression, body); - setEmitFlags(returnStatement, 12288 | 1024 | 32768); - statements.push(returnStatement); - closeBraceLocation = body; } - var lexicalEnvironment = context.endLexicalEnvironment(); - ts.addRange(statements, lexicalEnvironment); - if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { - multiLine = true; - } - var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine); - if (!multiLine && singleLine) { - setEmitFlags(block, 32); - } - if (closeBraceLocation) { - setTokenSourceMapRange(block, 17, closeBraceLocation); - } - setOriginalNode(block, node.body); - return block; - } - ts.transformFunctionBody = transformFunctionBody; - function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) { - if (node.transformFlags & 524288 && node.kind !== 185) { - captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis); - } - } - ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded; - function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) { - enableSubstitutionsForCapturedThis(); - var captureThisStatement = createVariableStatement(undefined, createVariableDeclarationList([ - createVariableDeclaration("_this", undefined, initializer) - ]), originalStatement); - setEmitFlags(captureThisStatement, 49152 | 8388608); - setSourceMapRange(captureThisStatement, node); - statements.push(captureThisStatement); - } - ts.captureThisForNode = captureThisForNode; - function shouldAddDefaultValueAssignments(node) { - return (node.transformFlags & 2097152) !== 0; - } - function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) { - if (!shouldAddDefaultValueAssignments(node)) { - return; - } - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var parameter = _a[_i]; - var name_15 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; - if (dotDotDotToken) { - continue; - } - if (ts.isBindingPattern(name_15)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_15, initializer, visitor, convertObjectRest); - } - else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_15, initializer, visitor); + else if (!ts.isGeneratedIdentifier(decl.name)) { + if (!uniqueExports[decl.name.text]) { + uniqueExports[decl.name.text] = true; + exportedNames = ts.append(exportedNames, decl.name); } } + return exportedNames; } - ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded; - function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) { - var temp = getGeneratedNameForNode(parameter); - if (name.elements.length > 0) { - statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608)); - } - else if (initializer) { - statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608)); - } - } - function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) { - initializer = ts.visitNode(initializer, visitor, ts.isExpression); - var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([ - createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536), setEmitFlags(initializer, 1536 | getEmitFlags(initializer)), parameter)) - ], parameter), 32 | 1024 | 12288), undefined, parameter); - statement.startsOnNewLine = true; - setEmitFlags(statement, 12288 | 1024 | 8388608); - statements.push(statement); - } - function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { - return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper; - } - function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { - var parameter = ts.lastOrUndefined(node.parameters); - if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { - return; - } - var declarationName = getMutableClone(parameter.name); - setEmitFlags(declarationName, 1536); - var expressionName = getSynthesizedClone(parameter.name); - var restIndex = node.parameters.length - 1; - var temp = createLoopVariable(); - statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList([ - createVariableDeclaration(declarationName, undefined, createArrayLiteral([])) - ]), parameter), 8388608)); - var forStatement = createFor(createVariableDeclarationList([ - createVariableDeclaration(temp, undefined, createLiteral(restIndex)) - ], parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"), parameter), createPostfixIncrement(temp, parameter), createBlock([ - startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)), parameter)) - ])); - setEmitFlags(forStatement, 8388608); - startOnNewLine(forStatement); - statements.push(forStatement); - } - ts.addRestParameterIfNeeded = addRestParameterIfNeeded; - function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var initializer = node.initializer; - var statements = []; - var counter = convertObjectRest ? undefined : createLoopVariable(); - var rhsReference = expression.kind === 70 - ? createUniqueName(expression.text) - : createTempVariable(undefined); - var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter); - if (ts.isVariableDeclarationList(initializer)) { - if (initializer.flags & 3) { - enableSubstitutionsForBlockScopedBindings(); - } - var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); - if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { - var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor, undefined, convertObjectRest); - var declarationList = createVariableDeclarationList(declarations, initializer); - setOriginalNode(declarationList, initializer); - var firstDeclaration = declarations[0]; - var lastDeclaration = ts.lastOrUndefined(declarations); - setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - statements.push(createVariableStatement(undefined, declarationList)); - } - else { - statements.push(createVariableStatement(undefined, setOriginalNode(createVariableDeclarationList([ - createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(undefined), undefined, createElementAccess(rhsReference, counter)) - ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1))); - } - } - else { - var assignment = createAssignment(initializer, elementAccess); - if (ts.isDestructuringAssignment(assignment)) { - statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment, false, context.hoistVariableDeclaration, visitor, convertObjectRest))); - } - else { - assignment.end = initializer.end; - statements.push(createStatement(assignment, ts.moveRangeEnd(initializer, -1))); - } - } - var bodyLocation; - var statementsLocation; - if (convertedLoopBodyStatements) { - ts.addRange(statements, convertedLoopBodyStatements); - } - else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); - if (ts.isBlock(statement)) { - ts.addRange(statements, statement.statements); - bodyLocation = statement; - statementsLocation = statement.statements; - } - else { - statements.push(statement); - } - } - setEmitFlags(expression, 1536 | getEmitFlags(expression)); - var body = createBlock(createNodeArray(statements, statementsLocation), bodyLocation); - setEmitFlags(body, 1536 | 12288); - var forStatement; - if (convertObjectRest) { - forStatement = createForOf(createVariableDeclarationList([ - createVariableDeclaration(rhsReference, undefined, undefined, node.expression) - ], node.expression), node.expression, body, node); - } - else { - forStatement = createFor(setEmitFlags(createVariableDeclarationList([ - createVariableDeclaration(counter, undefined, createLiteral(0), ts.moveRangePos(node.expression, -1)), - createVariableDeclaration(rhsReference, undefined, expression, node.expression) - ], node.expression), 16777216), createLessThan(counter, createPropertyAccess(rhsReference, "length"), node.expression), createPostfixIncrement(counter, node.expression), body, node); - } - setEmitFlags(forStatement, 8192); - return forStatement; - } - ts.convertForOf = convertForOf; })(ts || (ts = {})); var ts; (function (ts) { @@ -13597,29 +13652,31 @@ var ts; visitNode(cbNode, node.type); case 278: return visitNodes(cbNodes, node.tags); - case 280: + case 281: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 281: - return visitNode(cbNode, node.typeExpression); case 282: return visitNode(cbNode, node.typeExpression); case 283: - return visitNodes(cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 280: + return visitNode(cbNode, node.typeExpression); case 284: + return visitNodes(cbNodes, node.typeParameters); + case 285: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 286: + case 287: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 285: + case 286: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 293: + case 294: return visitNode(cbNode, node.expression); - case 287: + case 288: return visitNode(cbNode, node.literal); } } @@ -13660,7 +13717,7 @@ var ts; var Parser; (function (Parser) { var scanner = ts.createScanner(5, true); - var disallowInAndDecoratorContext = 65536 | 262144; + var disallowInAndDecoratorContext = 2048 | 8192; var NodeConstructor; var TokenConstructor; var IdentifierConstructor; @@ -13708,7 +13765,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 || scriptKind === 2 ? 2097152 : 0; + contextFlags = scriptKind === 1 || scriptKind === 2 ? 65536 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); @@ -13743,7 +13800,7 @@ var ts; return sourceFile; } function addJSDocComment(node) { - var comments = ts.getJsDocCommentsFromText(node, sourceFile.text); + var comments = ts.getJSDocCommentRanges(node, sourceFile.text); if (comments) { for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { var comment = comments_2[_i]; @@ -13751,10 +13808,10 @@ var ts; if (!jsDoc) { continue; } - if (!node.jsDocComments) { - node.jsDocComments = []; + if (!node.jsDoc) { + node.jsDoc = []; } - node.jsDocComments.push(jsDoc); + node.jsDoc.push(jsDoc); } } return node; @@ -13769,12 +13826,12 @@ var ts; var saveParent = parent; parent = n; forEachChild(n, visitNode); - if (n.jsDocComments) { - for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - jsDocComment.parent = n; - parent = jsDocComment; - forEachChild(jsDocComment, visitNode); + if (n.jsDoc) { + for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + jsDoc.parent = n; + parent = jsDoc; + forEachChild(jsDoc, visitNode); } } parent = saveParent; @@ -13803,16 +13860,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 65536); + setContextFlag(val, 2048); } function setYieldContext(val) { - setContextFlag(val, 131072); + setContextFlag(val, 4096); } function setDecoratorContext(val) { - setContextFlag(val, 262144); + setContextFlag(val, 8192); } function setAwaitContext(val) { - setContextFlag(val, 524288); + setContextFlag(val, 16384); } function doOutsideOfContext(context, func) { var contextFlagsToClear = context & contextFlags; @@ -13835,40 +13892,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(65536, func); + return doOutsideOfContext(2048, func); } function disallowInAnd(func) { - return doInsideOfContext(65536, func); + return doInsideOfContext(2048, func); } function doInYieldContext(func) { - return doInsideOfContext(131072, func); + return doInsideOfContext(4096, func); } function doInDecoratorContext(func) { - return doInsideOfContext(262144, func); + return doInsideOfContext(8192, func); } function doInAwaitContext(func) { - return doInsideOfContext(524288, func); + return doInsideOfContext(16384, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(524288, func); + return doOutsideOfContext(16384, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(131072 | 524288, func); + return doInsideOfContext(4096 | 16384, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(131072); + return inContext(4096); } function inDisallowInContext() { - return inContext(65536); + return inContext(2048); } function inDecoratorContext() { - return inContext(262144); + return inContext(8192); } function inAwaitContext() { - return inContext(524288); + return inContext(16384); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -14030,7 +14087,7 @@ var ts; } if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 1048576; + node.flags |= 32768; } return node; } @@ -14348,7 +14405,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.flags & 3080192; + var nodeContextFlags = node.flags & 96256; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -15021,6 +15078,8 @@ var ts; case 16: case 20: case 26: + case 48: + case 47: case 93: case 9: case 8: @@ -15073,6 +15132,7 @@ var ts; return parseArrayTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { var types = createNodeArray([type], type.pos); @@ -15153,7 +15213,7 @@ var ts; } } function parseType() { - return doOutsideOfContext(655360, parseTypeWorker); + return doOutsideOfContext(20480, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { @@ -16784,7 +16844,7 @@ var ts; property.type = parseTypeAnnotation(); property.initializer = ts.hasModifier(property, 32) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(131072 | 65536, parseNonParameterInitializer); + : doOutsideOfContext(4096 | 2048, parseNonParameterInitializer); parseSemicolon(); return addJSDocComment(finishNode(property)); } @@ -16951,8 +17011,8 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_16 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_16, undefined); + var name_15 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_15, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } @@ -17599,7 +17659,7 @@ var ts; return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(287); + var result = createNode(288); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -17701,7 +17761,7 @@ var ts; break; case 38: var asterisk = scanner.getTokenText(); - if (state === 1) { + if (state === 1 || state === 2) { state = 2; pushComment(asterisk); } @@ -17716,7 +17776,10 @@ var ts; break; case 5: var whitespace = scanner.getTokenText(); - if (state === 2 || margin !== undefined && indent + whitespace.length > margin) { + if (state === 2) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -17724,6 +17787,7 @@ var ts; case 1: break; default: + state = 2; pushComment(scanner.getTokenText()); break; } @@ -17779,6 +17843,9 @@ var ts; var tag; if (tagName) { switch (tagName.text) { + case "augments": + tag = parseAugmentsTag(atToken, tagName); + break; case "param": tag = parseParamTag(atToken, tagName); break; @@ -17918,7 +17985,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(280, atToken.pos); + var result = createNode(281, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -17929,20 +17996,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281; })) { + if (ts.forEach(tags, function (t) { return t.kind === 282; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(281, atToken.pos); + var result = createNode(282, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -17957,17 +18024,25 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(285, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; result.typeExpression = typeExpression; return finishNode(result); } + function parseAugmentsTag(atToken, tagName) { + var typeExpression = tryParseTypeExpression(); + var result = createNode(280, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + result.typeExpression = typeExpression; + return finishNode(result); + } function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(284, atToken.pos); + var typedefTag = createNode(285, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -17984,8 +18059,8 @@ var ts; if (typeExpression.type.kind === 272) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { - var name_17 = jsDocTypeReference.name; - if (name_17.text === "Object") { + var name_16 = jsDocTypeReference.name; + if (name_16.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -17999,7 +18074,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(286, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(287, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -18084,19 +18159,19 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); while (true) { - var name_18 = parseJSDocIdentifierName(); + var name_17 = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_18) { + if (!name_17) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143, name_18.pos); - typeParameter.name = name_18; + var typeParameter = createNode(143, name_17.pos); + typeParameter.name = name_17; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25) { @@ -18107,7 +18182,7 @@ var ts; break; } } - var result = createNode(283, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -18187,8 +18262,8 @@ var ts; ts.Debug.assert(text === newText.substring(node.pos, node.end)); } forEachChild(node, visitNode, visitArray); - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; forEachChild(jsDocComment, visitNode, visitArray); } @@ -18572,7 +18647,7 @@ var ts; } if (node.name.kind === 142) { var nameExpression = node.name.expression; - if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; } ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); @@ -18617,7 +18692,7 @@ var ts; var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 284: + case 285: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; if (parentNode && parentNode.kind === 205) { @@ -18692,7 +18767,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 284 && + var isJSDocTypedefInJSDocNamespace = node.kind === 285 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -18747,7 +18822,7 @@ var ts; activeLabels = undefined; hasExplicitReturn = false; bindChildren(node); - node.flags &= ~64896; + node.flags &= ~1408; if (!(currentFlow.flags & 1) && containerFlags & 8 && ts.nodeIsPresent(node.body)) { node.flags |= 128; if (hasExplicitReturn) @@ -18797,12 +18872,35 @@ var ts; subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags); } } + function bindEach(nodes) { + if (nodes === undefined) { + return; + } + if (skipTransformFlagAggregation) { + ts.forEach(nodes, bind); + } + else { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0; + var nodeArrayFlags = 0; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; + bind(node); + nodeArrayFlags |= node.transformFlags & ~536870912; + } + nodes.transformFlags = nodeArrayFlags | 536870912; + subtreeTransformFlags |= savedSubtreeTransformFlags; + } + } + function bindEachChild(node) { + ts.forEachChild(node, bind, bindEach); + } function bindChildrenWorker(node) { - if (ts.isInJavaScriptFile(node) && node.jsDocComments) { - ts.forEach(node.jsDocComments, bind); + if (ts.isInJavaScriptFile(node) && node.jsDoc) { + ts.forEach(node.jsDoc, bind); } if (checkUnreachable(node)) { - ts.forEachChild(node, bind); + bindEachChild(node); return; } switch (node.kind) { @@ -18867,7 +18965,7 @@ var ts; bindCallExpressionFlow(node); break; default: - ts.forEachChild(node, bind); + bindEachChild(node); break; } } @@ -19170,7 +19268,7 @@ var ts; } return undefined; } - function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { + function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { var flowLabel = node.kind === 215 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); @@ -19183,11 +19281,11 @@ var ts; var activeLabel = findActiveLabel(node.label.text); if (activeLabel) { activeLabel.referenced = true; - bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); } } else { - bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); } } function bindTryStatement(node) { @@ -19238,6 +19336,8 @@ var ts; currentFlow = finishFlowLabel(postSwitchLabel); } function bindCaseBlock(node) { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0; var clauses = node.clauses; var fallthroughFlow = unreachableFlow; for (var i = 0; i < clauses.length; i++) { @@ -19257,13 +19357,15 @@ var ts; errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); } } + clauses.transformFlags = subtreeTransformFlags | 536870912; + subtreeTransformFlags |= savedSubtreeTransformFlags; } function bindCaseClause(node) { var saveCurrentFlow = currentFlow; currentFlow = preSwitchCaseFlow; bind(node.expression); currentFlow = saveCurrentFlow; - ts.forEach(node.statements, bind); + bindEach(node.statements); } function pushActiveLabel(name, breakTarget, continueTarget) { var activeLabel = { @@ -19349,19 +19451,19 @@ var ts; var saveTrueTarget = currentTrueTarget; currentTrueTarget = currentFalseTarget; currentFalseTarget = saveTrueTarget; - ts.forEachChild(node, bind); + bindEachChild(node); currentFalseTarget = currentTrueTarget; currentTrueTarget = saveTrueTarget; } else { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.operator === 42 || node.operator === 43) { bindAssignmentTargetFlow(node.operand); } } } function bindPostfixUnaryExpressionFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.operator === 42 || node.operator === 43) { bindAssignmentTargetFlow(node.operand); } @@ -19379,7 +19481,7 @@ var ts; } } else { - ts.forEachChild(node, bind); + bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); if (operator === 57 && node.left.kind === 178) { @@ -19392,7 +19494,7 @@ var ts; } } function bindDeleteExpressionFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.expression.kind === 177) { bindAssignmentTargetFlow(node.expression); } @@ -19425,7 +19527,7 @@ var ts; } } function bindVariableDeclarationFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) { bindInitializedVariableFlow(node); } @@ -19436,12 +19538,12 @@ var ts; expr = expr.expression; } if (expr.kind === 184 || expr.kind === 185) { - ts.forEach(node.typeArguments, bind); - ts.forEach(node.arguments, bind); + bindEach(node.typeArguments); + bindEach(node.arguments); bind(node.expression); } else { - ts.forEachChild(node, bind); + bindEachChild(node); } if (node.expression.kind === 177) { var propertyAccess = node.expression; @@ -19457,7 +19559,7 @@ var ts; case 229: case 176: case 161: - case 286: + case 287: case 270: return 1; case 227: @@ -19526,7 +19628,7 @@ var ts; case 176: case 227: case 270: - case 286: + case 287: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 158: case 159: @@ -19820,8 +19922,8 @@ var ts; } function updateStrictModeStatementList(statements) { if (!inStrictMode) { - for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { - var statement = statements_1[_i]; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; if (!ts.isPrologueDirective(statement)) { return; } @@ -19841,7 +19943,7 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 284) { + while (parentNode && parentNode.kind !== 285) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); @@ -19903,15 +20005,12 @@ var ts; return bindParameter(node); case 223: case 174: - if (node.dotDotDotToken && node.parent.kind === 172) { - emitFlags |= 32768; - } return bindVariableDeclarationOrBindingElement(node); case 147: case 146: case 271: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 285: + case 286: return bindJSDocProperty(node); case 257: case 258: @@ -19932,7 +20031,6 @@ var ts; } root = root.parent; } - emitFlags |= hasRest ? 32768 : 16384; return; case 153: case 154: @@ -19955,7 +20053,7 @@ var ts; return bindFunctionOrConstructorType(node); case 161: case 170: - case 286: + case 287: case 270: return bindAnonymousDeclaration(node, 2048, "__type"); case 176: @@ -19974,7 +20072,7 @@ var ts; return bindClassLikeDeclaration(node); case 227: return bindBlockScopedDeclaration(node, 64, 792968); - case 284: + case 285: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } @@ -20048,12 +20146,12 @@ var ts; return; } else { - var parent_5 = node.parent; - if (!ts.isExternalModule(parent_5)) { + var parent_4 = node.parent; + if (!ts.isExternalModule(parent_4)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_5.isDeclarationFile) { + if (!parent_4.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -20128,14 +20226,6 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 1024; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; - } - } if (node.kind === 226) { bindBlockScopedDeclaration(node, 32, 899519); } @@ -20179,11 +20269,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (2048 | 4096); - } if (inStrictMode) { checkStrictModeEvalOrArguments(node, node.name); } @@ -20201,7 +20286,7 @@ var ts; function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + emitFlags |= 1024; } } checkStrictModeFunctionName(node); @@ -20216,7 +20301,7 @@ var ts; function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + emitFlags |= 1024; } } if (currentFlow) { @@ -20229,10 +20314,7 @@ var ts; function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; + emitFlags |= 1024; } } if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -20339,12 +20421,12 @@ var ts; if (node.typeArguments) { transformFlags |= 3; } - if (subtreeFlags & 8388608 + if (subtreeFlags & 524288 || isSuperOrSuperProperty(expression, expressionKind)) { - transformFlags |= 3072; + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~545281365; + return transformFlags & ~537396545; } function isSuperOrSuperProperty(node, kind) { switch (kind) { @@ -20363,28 +20445,28 @@ var ts; if (node.typeArguments) { transformFlags |= 3; } - if (subtreeFlags & 8388608) { - transformFlags |= 3072; + if (subtreeFlags & 524288) { + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~545281365; + return transformFlags & ~537396545; } function computeBinaryExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; if (operatorTokenKind === 57 && leftKind === 176) { - transformFlags |= 48 | 3072 | 49152; + transformFlags |= 8 | 192 | 3072; } else if (operatorTokenKind === 57 && leftKind === 175) { - transformFlags |= 3072 | 49152; + transformFlags |= 192 | 3072; } else if (operatorTokenKind === 39 || operatorTokenKind === 61) { - transformFlags |= 768; + transformFlags |= 32; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeParameter(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20394,21 +20476,21 @@ var ts; var dotDotDotToken = node.dotDotDotToken; if (node.questionToken || node.type - || subtreeFlags & 65536 + || subtreeFlags & 4096 || ts.isThisIdentifier(name)) { transformFlags |= 3; } if (modifierFlags & 92) { - transformFlags |= 3 | 4194304; + transformFlags |= 3 | 262144; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } - if (subtreeFlags & 67108864 || initializer || dotDotDotToken) { - transformFlags |= 3072 | 2097152; + if (subtreeFlags & 8388608 || initializer || dotDotDotToken) { + transformFlags |= 192 | 131072; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~604001621; + return transformFlags & ~536872257; } function computeParenthesizedExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20419,11 +20501,11 @@ var ts; || expressionKind === 182) { transformFlags |= 3; } - if (expressionTransformFlags & 16384) { - transformFlags |= 16384; + if (expressionTransformFlags & 1024) { + transformFlags |= 1024; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeClassDeclaration(node, subtreeFlags) { var transformFlags; @@ -20432,35 +20514,35 @@ var ts; transformFlags = 3; } else { - transformFlags = subtreeFlags | 3072; - if ((subtreeFlags & 4390912) + transformFlags = subtreeFlags | 192; + if ((subtreeFlags & 274432) || node.typeParameters) { transformFlags |= 3; } - if (subtreeFlags & 1048576) { - transformFlags |= 262144; + if (subtreeFlags & 65536) { + transformFlags |= 16384; } } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~559895893; + return transformFlags & ~539358529; } function computeClassExpression(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; - if (subtreeFlags & 4390912 + var transformFlags = subtreeFlags | 192; + if (subtreeFlags & 274432 || node.typeParameters) { transformFlags |= 3; } - if (subtreeFlags & 1048576) { - transformFlags |= 262144; + if (subtreeFlags & 65536) { + transformFlags |= 16384; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~559895893; + return transformFlags & ~539358529; } function computeHeritageClause(node, subtreeFlags) { var transformFlags = subtreeFlags; switch (node.token) { case 84: - transformFlags |= 3072; + transformFlags |= 192; break; case 107: transformFlags |= 3; @@ -20470,23 +20552,23 @@ var ts; break; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeCatchClause(node, subtreeFlags) { var transformFlags = subtreeFlags; if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) { - transformFlags |= 3072; + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~537920833; } function computeExpressionWithTypeArguments(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; + var transformFlags = subtreeFlags | 192; if (node.typeArguments) { transformFlags |= 3; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeConstructor(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20494,11 +20576,14 @@ var ts; || !node.body) { transformFlags |= 3; } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~975983957; + return transformFlags & ~601015617; } function computeMethod(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; + var transformFlags = subtreeFlags | 192; if (node.decorators || ts.hasModifier(node, 2270) || node.typeParameters @@ -20506,14 +20591,17 @@ var ts; || !node.body) { transformFlags |= 3; } - if (ts.hasModifier(node, 256)) { - transformFlags |= 192; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - transformFlags |= 12288; + if (ts.hasModifier(node, 256)) { + transformFlags |= 16; + } + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~975983957; + return transformFlags & ~601015617; } function computeAccessor(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20523,16 +20611,19 @@ var ts; || !node.body) { transformFlags |= 3; } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~975983957; + return transformFlags & ~601015617; } function computePropertyDeclaration(node, subtreeFlags) { var transformFlags = subtreeFlags | 3; if (node.initializer) { - transformFlags |= 131072; + transformFlags |= 8192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeFunctionDeclaration(node, subtreeFlags) { var transformFlags; @@ -20542,27 +20633,27 @@ var ts; transformFlags = 3; } else { - transformFlags = subtreeFlags | 268435456; + transformFlags = subtreeFlags | 33554432; if (modifierFlags & 2270 || node.typeParameters || node.type) { transformFlags |= 3; } if (modifierFlags & 256) { + transformFlags |= 16; + } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } + if (subtreeFlags & 163840) { transformFlags |= 192; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; - } - if (subtreeFlags & 2621440) { - transformFlags |= 3072; - } - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - transformFlags |= 12288; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + transformFlags |= 768; } } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~980243797; + return transformFlags & ~601281857; } function computeFunctionExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20572,63 +20663,60 @@ var ts; transformFlags |= 3; } if (ts.hasModifier(node, 256)) { + transformFlags |= 16; + } + if (subtreeFlags & 1048576) { + transformFlags |= 8; + } + if (subtreeFlags & 163840) { transformFlags |= 192; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; - } - if (subtreeFlags & 2621440) { - transformFlags |= 3072; - } - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - transformFlags |= 12288; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~980243797; + return transformFlags & ~601281857; } function computeArrowFunction(node, subtreeFlags) { - var transformFlags = subtreeFlags | 3072; + var transformFlags = subtreeFlags | 192; if (ts.hasModifier(node, 2270) || node.typeParameters || node.type) { transformFlags |= 3; } if (ts.hasModifier(node, 256)) { - transformFlags |= 192; + transformFlags |= 16; } - if (subtreeFlags & 8388608) { - transformFlags |= 48; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } - if (subtreeFlags & 262144) { - transformFlags |= 524288; + if (subtreeFlags & 16384) { + transformFlags |= 32768; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~979719509; + return transformFlags & ~601249089; } function computePropertyAccess(node, subtreeFlags) { var transformFlags = subtreeFlags; var expression = node.expression; var expressionKind = expression.kind; if (expressionKind === 96) { - transformFlags |= 262144; + transformFlags |= 16384; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeVariableDeclaration(node, subtreeFlags) { var transformFlags = subtreeFlags; - var nameKind = node.name.kind; - if (nameKind === 172) { - transformFlags |= 48 | 3072 | 67108864; - } - else if (nameKind === 173) { - transformFlags |= 3072 | 67108864; + transformFlags |= 192 | 8388608; + if (subtreeFlags & 1048576) { + transformFlags |= 8; } if (node.type) { transformFlags |= 3; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeVariableStatement(node, subtreeFlags) { var transformFlags; @@ -20639,21 +20727,21 @@ var ts; } else { transformFlags = subtreeFlags; - if (declarationListTransformFlags & 67108864) { - transformFlags |= 3072; + if (declarationListTransformFlags & 8388608) { + transformFlags |= 192; } } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeLabeledStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; - if (subtreeFlags & 33554432 + if (subtreeFlags & 4194304 && ts.isIterationStatement(node, true)) { - transformFlags |= 3072; + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeImportEquals(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -20661,15 +20749,15 @@ var ts; transformFlags |= 3; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeExpressionStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; - if (node.expression.transformFlags & 16384) { - transformFlags |= 3072; + if (node.expression.transformFlags & 1024) { + transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~536892757; + return transformFlags & ~536872257; } function computeModuleDeclaration(node, subtreeFlags) { var transformFlags = 3; @@ -20678,26 +20766,26 @@ var ts; transformFlags |= subtreeFlags; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~839734613; + return transformFlags & ~574674241; } function computeVariableDeclarationList(node, subtreeFlags) { - var transformFlags = subtreeFlags | 268435456; - if (subtreeFlags & 67108864) { - transformFlags |= 3072; + var transformFlags = subtreeFlags | 33554432; + if (subtreeFlags & 8388608) { + transformFlags |= 192; } if (node.flags & 3) { - transformFlags |= 3072 | 33554432; + transformFlags |= 192 | 4194304; } node.transformFlags = transformFlags | 536870912; - return transformFlags & ~604001621; + return transformFlags & ~546309441; } function computeOther(node, kind, subtreeFlags) { var transformFlags = subtreeFlags; - var excludeFlags = 536892757; + var excludeFlags = 536872257; switch (kind) { case 119: case 189: - transformFlags |= 192; + transformFlags |= 16; break; case 113: case 111: @@ -20721,10 +20809,10 @@ var ts; case 250: case 251: case 252: - transformFlags |= 12; + transformFlags |= 4; break; case 213: - transformFlags |= 48; + transformFlags |= 8; case 12: case 13: case 14: @@ -20733,10 +20821,10 @@ var ts; case 181: case 258: case 114: - transformFlags |= 3072; + transformFlags |= 192; break; case 195: - transformFlags |= 3072 | 134217728; + transformFlags |= 192 | 16777216; break; case 118: case 132: @@ -20773,73 +20861,79 @@ var ts; excludeFlags = -3; break; case 142: - transformFlags |= 16777216; - if (subtreeFlags & 262144) { - transformFlags |= 1048576; + transformFlags |= 2097152; + if (subtreeFlags & 16384) { + transformFlags |= 65536; } break; case 196: - case 259: - transformFlags |= 8388608; + transformFlags |= 192 | 524288; + break; + case 259: + transformFlags |= 8 | 1048576; break; - case 174: - if (node.dotDotDotToken) { - transformFlags |= 8388608; - } case 96: - transformFlags |= 3072; + transformFlags |= 192; break; case 98: - transformFlags |= 262144; + transformFlags |= 16384; break; case 172: - case 173: - if (subtreeFlags & 8388608) { - transformFlags |= 48 | 67108864; + transformFlags |= 192 | 8388608; + if (subtreeFlags & 524288) { + transformFlags |= 8 | 1048576; } - else { - transformFlags |= 3072 | 67108864; + excludeFlags = 537396545; + break; + case 173: + transformFlags |= 192 | 8388608; + excludeFlags = 537396545; + break; + case 174: + transformFlags |= 192; + if (node.dotDotDotToken) { + transformFlags |= 524288; } break; case 145: - transformFlags |= 3 | 65536; + transformFlags |= 3 | 4096; break; case 176: - excludeFlags = 554784085; - if (subtreeFlags & 16777216) { - transformFlags |= 3072; + excludeFlags = 540087617; + if (subtreeFlags & 2097152) { + transformFlags |= 192; + } + if (subtreeFlags & 65536) { + transformFlags |= 16384; } if (subtreeFlags & 1048576) { - transformFlags |= 262144; - } - if (subtreeFlags & 8388608) { - transformFlags |= 48; + transformFlags |= 8; } break; case 175: case 180: - excludeFlags = 545281365; - if (subtreeFlags & 8388608) { - transformFlags |= 3072; + excludeFlags = 537396545; + if (subtreeFlags & 524288) { + transformFlags |= 192; } break; case 209: case 210: case 211: case 212: - if (subtreeFlags & 33554432) { - transformFlags |= 3072; + if (subtreeFlags & 4194304) { + transformFlags |= 192; } break; case 261: - if (subtreeFlags & 524288) { - transformFlags |= 3072; + if (subtreeFlags & 32768) { + transformFlags |= 192; } break; case 216: case 214: case 215: - transformFlags |= 268435456; + transformFlags |= 33554432; break; } node.transformFlags = transformFlags | 536870912; @@ -20853,27 +20947,27 @@ var ts; case 179: case 180: case 175: - return 545281365; + return 537396545; case 230: - return 839734613; + return 574674241; case 144: - return 604001621; + return 536872257; case 185: - return 979719509; + return 601249089; case 184: case 225: - return 980243797; + return 601281857; case 224: - return 604001621; + return 546309441; case 226: case 197: - return 559895893; + return 539358529; case 150: - return 975983957; + return 601015617; case 149: case 151: case 152: - return 975983957; + return 601015617; case 118: case 132: case 129: @@ -20891,9 +20985,14 @@ var ts; case 228: return -3; case 176: - return 554784085; + return 540087617; + case 256: + return 537920833; + case 172: + case 173: + return 537396545; default: - return 536892757; + return 536872257; } } ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions; @@ -20923,6 +21022,8 @@ var ts; ts.getSymbolId = getSymbolId; function createTypeChecker(host, produceDiagnostics) { var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); @@ -20985,6 +21086,7 @@ var ts; getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, isOptionalParameter: isOptionalParameter, + tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, false); } @@ -20994,6 +21096,7 @@ var ts; var intersectionTypes = ts.createMap(); var stringLiteralTypes = ts.createMap(); var numericLiteralTypes = ts.createMap(); + var indexedAccessTypes = ts.createMap(); var evolvingArrayTypes = []; var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); @@ -21013,7 +21116,6 @@ var ts; var voidType = createIntrinsicType(1024, "void"); var neverType = createIntrinsicType(8192, "never"); var silentNeverType = createIntrinsicType(8192, "never"); - var stringOrNumberType = getUnionType([stringType, numberType]); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); @@ -21229,9 +21331,7 @@ var ts; (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) { target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -21563,6 +21663,7 @@ var ts; if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && + !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } @@ -21639,6 +21740,16 @@ var ts; return undefined; } } + function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) { + if (meaning === 1920) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name); + return true; + } + } + return false; + } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { if (meaning & (107455 & ~1024)) { var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined)); @@ -21680,7 +21791,7 @@ var ts; } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { if (node.moduleReference.kind === 245) { @@ -21744,28 +21855,28 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_19 = specifier.propertyName || specifier.name; - if (name_19.text) { + var name_18 = specifier.propertyName || specifier.name; + if (name_18.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_19.text); + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_18.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_19.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_18.text); } symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_19.text); - if (!symbolFromModule && allowSyntheticDefaultImports && name_19.text === "default") { + var symbolFromModule = getExportOfModule(targetSymbol, name_18.text); + if (!symbolFromModule && allowSyntheticDefaultImports && name_18.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_19, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_19)); + error(name_18, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_18)); } return symbol; } @@ -21947,9 +22058,8 @@ var ts; } if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - ts.Debug.assert(!!moduleNotFoundError); var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } else if (compilerOptions.noImplicitAny && moduleNotFoundError) { error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); @@ -21990,6 +22100,12 @@ var ts; function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function tryGetMemberInModuleExports(memberName, moduleSymbol) { + var symbolTable = getExportsOfModule(moduleSymbol); + if (symbolTable) { + return symbolTable[memberName]; + } + } function getExportsOfSymbol(symbol) { return symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; } @@ -22172,6 +22288,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { return true; @@ -22185,26 +22311,28 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + if (isAccessible(symbols[symbol.name])) { + return [symbol]; + } + return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -22505,9 +22633,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_6) { - walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false); + var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent_5) { + walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -22640,12 +22768,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -22926,7 +23054,7 @@ var ts; } ts.Debug.assert(bindingElement.kind === 174); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55); writeSpace(writer); } @@ -23069,12 +23197,12 @@ var ts; if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_8 = getDeclarationContainer(node); + var parent_7 = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 234 && parent_8.kind !== 261 && ts.isInAmbientContext(parent_8))) { - return isGlobalSourceFile(parent_8); + !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) { + return isGlobalSourceFile(parent_7); } - return isDeclarationVisible(parent_8); + return isDeclarationVisible(parent_7); case 147: case 146: case 151: @@ -23230,15 +23358,21 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); } function isComputedNonLiteralName(name) { - return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { - ts.Debug.assert(!!(source.flags & 32768), "Rest types only support object types right now."); + source = filterType(source, function (t) { return !(t.flags & 6144); }); + if (source.flags & 8192) { + return emptyObjectType; + } + if (source.flags & 65536) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_20 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_20)] = true; + var name_19 = properties_2[_i]; + names[ts.getTextOfPropertyName(name_19)] = true; } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; @@ -23269,33 +23403,33 @@ var ts; var type; if (pattern.kind === 172) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & 32768)) { + if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } var literalMembers = []; for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198 && !element.dotDotDotToken) { + if (!element.dotDotDotToken) { literalMembers.push(element.propertyName || element.name); } } type = getRestType(parentType, literalMembers, declaration.symbol); } else { - var name_21 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_21)) { + var name_20 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_20)) { return anyType; } if (declaration.initializer) { getContextualType(declaration.initializer); } - var text = ts.getTextOfPropertyName(name_21); + var text = ts.getTextOfPropertyName(name_20); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_21)); + error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_20)); return unknownType; } } @@ -23329,29 +23463,9 @@ var ts; type; } function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { - var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); - if (jsDocType) { - return getTypeFromTypeNode(jsDocType); - } - } - function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) { - var typeTag = ts.getJSDocTypeTag(declaration); - if (typeTag && typeTag.typeExpression) { - return typeTag.typeExpression.type; - } - if (declaration.kind === 223 && - declaration.parent.kind === 224 && - declaration.parent.parent.kind === 205) { - var annotation = ts.getJSDocTypeTag(declaration.parent.parent); - if (annotation && annotation.typeExpression) { - return annotation.typeExpression.type; - } - } - else if (declaration.kind === 144) { - var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type; - } + var jsdocType = ts.getJSDocType(declaration); + if (jsdocType) { + return getTypeFromTypeNode(jsdocType); } return undefined; } @@ -23367,14 +23481,15 @@ var ts; return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } if (declaration.parent.parent.kind === 212) { - return stringType; + var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); + return indexType.flags & (16384 | 262144) ? indexType : stringType; } if (declaration.parent.parent.kind === 213) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; @@ -23385,7 +23500,8 @@ var ts; if (declaration.type) { return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); } - if (declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && + if ((compilerOptions.noImplicitAny || declaration.flags & 65536) && + declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -23445,13 +23561,18 @@ var ts; } function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { + if (isComputedNonLiteralName(name)) { hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, false); + return; + } var text = ts.getTextOfPropertyName(name); var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); var symbol = createSymbol(flags, text); @@ -23459,7 +23580,7 @@ var ts; symbol.bindingElement = e; members[symbol.name] = symbol; }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -23524,7 +23645,7 @@ var ts; if (declaration.kind === 240) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 2097152 && declaration.kind === 285 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 286 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { @@ -23533,10 +23654,10 @@ var ts; var type = void 0; if (declaration.kind === 192 || declaration.kind === 177 && declaration.parent.kind === 192) { - if (declaration.flags & 2097152) { - var typeTag = ts.getJSDocTypeTag(declaration.parent); - if (typeTag && typeTag.typeExpression) { - return links.type = getTypeFromTypeNode(typeTag.typeExpression.type); + if (declaration.flags & 65536) { + var jsdocType = ts.getJSDocType(declaration.parent); + if (jsdocType) { + return links.type = getTypeFromTypeNode(jsdocType); } } var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ? @@ -23548,16 +23669,7 @@ var ts; type = getWidenedTypeForVariableLikeDeclaration(declaration, true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -23587,7 +23699,7 @@ var ts; if (!links.type) { var getter = ts.getDeclarationOfKind(symbol, 151); var setter = ts.getDeclarationOfKind(symbol, 152); - if (getter && getter.flags & 2097152) { + if (getter && getter.flags & 65536) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; @@ -23669,10 +23781,27 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!pushTypeResolution(symbol, 0)) { + return unknownType; + } + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; } return links.type; } + function reportCircularityError(symbol) { + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { if (symbol.flags & 16777216) { return getTypeOfInstantiatedSymbol(symbol); @@ -23837,6 +23966,13 @@ var ts; } baseType = getReturnTypeOfSignature(constructors[0]); } + var valueDecl = type.symbol.valueDeclaration; + if (valueDecl && ts.isInJavaScriptFile(valueDecl)) { + var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration); + if (augTag) { + baseType = getTypeFromTypeNode(augTag.typeExpression.type); + } + } if (baseType === unknownType) { return; } @@ -23845,7 +23981,7 @@ var ts; return; } if (type === baseType || hasBaseType(baseType, type)) { - error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); + error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); return; } if (type.resolvedBaseTypes === emptyArray) { @@ -23947,7 +24083,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 284); + var declaration = ts.getDeclarationOfKind(symbol, 285); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -24433,36 +24569,42 @@ var ts; function resolveMappedTypeMembers(type) { var members = ts.createMap(); var stringIndexInfo; - var numberIndexInfo; + setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var isReadonly = !!type.declaration.readonlyToken; - var isOptional = !!type.declaration.questionToken; - var keyType = constraintType.flags & 16384 ? getApparentType(constraintType) : constraintType; - var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; - forEachType(iterationType, function (t) { + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 168) { + forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + if (getIndexInfoOfType(modifiersType, 0)) { + addMemberForKeyType(stringType); + } + } + else { + var keyType = constraintType.flags & 540672 ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t) { var iterationMapper = createUnaryTypeMapper(typeParameter, t); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); - if (t.flags & (32 | 64 | 256)) { + if (t.flags & 32) { var propName = t.text; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 536870912); var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; + prop.type = propType; + prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); members[propName] = prop; } else if (t.flags & 2) { - stringIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } - else if (t.flags & 4) { - numberIndexInfo = createIndexInfo(propType, isReadonly); - } - }); - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeParameterFromMappedType(type) { return type.typeParameter || @@ -24475,13 +24617,31 @@ var ts; function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 168) { + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; + } + function getErasedTemplateTypeFromMappedType(type) { + return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + } function isGenericMappedType(type) { if (getObjectFlags(type) & 32) { var constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (16384 | 262144)); + return maybeTypeOfKind(constraintType, 540672 | 262144); } return false; } @@ -24555,24 +24715,23 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } - function getApparentTypeOfTypeParameter(type) { + function getApparentTypeOfTypeVariable(type) { if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); + var constraintType = getConstraintOfTypeVariable(type); while (constraintType && constraintType.flags & 16384) { - constraintType = getConstraintOfTypeParameter(constraintType); + constraintType = getConstraintOfTypeVariable(constraintType); } type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); } return type.resolvedApparentType; } function getApparentType(type) { - var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) : type; - return t.flags & 34 ? globalStringType : + var t = type.flags & 540672 ? getApparentTypeOfTypeVariable(type) : type; + return t.flags & 262178 ? globalStringType : t.flags & 340 ? globalNumberType : t.flags & 136 ? globalBooleanType : t.flags & 512 ? getGlobalESSymbolType() : - t.flags & 262144 ? stringOrNumberType : - t; + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; @@ -24713,7 +24872,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -24741,17 +24900,20 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 2097152) { + if (node.flags & 65536) { if (node.type && node.type.kind === 273) { return true; } - var paramTag = ts.getCorrespondingJSDocParameterTag(node); - if (paramTag) { - if (paramTag.isBracketed) { - return true; - } - if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273; + var paramTags = ts.getJSDocParameterTags(node); + if (paramTags) { + for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) { + var paramTag = paramTags_1[_i]; + if (paramTag.isBracketed) { + return true; + } + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 273; + } } } } @@ -24867,7 +25029,7 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; @@ -25059,6 +25221,11 @@ var ts; } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } + function getConstraintOfTypeVariable(type) { + return type.flags & 16384 ? getConstraintOfTypeParameter(type) : + type.flags & 524288 ? type.constraint : + undefined; + } function getParentSymbolOfTypeParameter(typeParameter) { return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent); } @@ -25519,6 +25686,9 @@ var ts; typeSet.containsAny = true; } else if (!(type.flags & 8192) && (strictNullChecks || !(type.flags & 6144)) && !ts.contains(typeSet, type)) { + if (type.flags & 65536 && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } typeSet.push(type); } } @@ -25532,17 +25702,6 @@ var ts; if (types.length === 0) { return emptyObjectType; } - var _loop_2 = function (i) { - var type_1 = types[i]; - if (type_1.flags & 65536) { - return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }), false, aliasSymbol, aliasTypeArguments) }; - } - }; - for (var i = 0; i < types.length; i++) { - var state_2 = _loop_2(i); - if (typeof state_2 === "object") - return state_2.value; - } var typeSet = []; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { @@ -25551,6 +25710,11 @@ var ts; if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { @@ -25569,7 +25733,7 @@ var ts; } return links.resolvedType; } - function getIndexTypeForTypeParameter(type) { + function getIndexTypeForGenericType(type) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(262144); type.resolvedIndexType.type = type; @@ -25585,11 +25749,15 @@ var ts; return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); } function getIndexType(type) { - return type.flags & 16384 ? getIndexTypeForTypeParameter(type) : - type.flags & 1 || getIndexInfoOfType(type, 0) ? stringOrNumberType : - getIndexInfoOfType(type, 1) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) : + return maybeTypeOfKind(type, 540672) ? getIndexTypeForGenericType(type) : + getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) : + type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType : getLiteralTypeFromPropertyNames(type); } + function getIndexTypeOrString(type) { + var indexType = getIndexType(type); + return indexType !== neverType ? indexType : stringType; + } function getTypeFromTypeOperatorNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -25601,12 +25769,19 @@ var ts; var type = createType(524288); type.objectType = objectType; type.indexType = indexType; + if (type.objectType.flags & 229376) { + type.constraint = getIndexTypeOfType(type.objectType, 0); + } + else if (type.objectType.flags & 540672) { + var apparentType = getApparentTypeOfTypeVariable(type.objectType); + if (apparentType !== emptyObjectType) { + type.constraint = isTypeOfKind(type.indexType, 262178) ? + getIndexedAccessType(apparentType, type.indexType) : + getIndexTypeOfType(apparentType, 0); + } + } return type; } - function getIndexedAccessTypeForTypeParameter(objectType, indexType) { - var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []); - return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType)); - } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; var propName = indexType.flags & (32 | 64 | 256) ? @@ -25629,7 +25804,7 @@ var ts; return getTypeOfSymbol(prop); } } - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 | 340 | 512)) { + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 | 340 | 512)) { if (isTypeAny(objectType)) { return anyType; } @@ -25669,20 +25844,41 @@ var ts; } return unknownType; } - function getIndexedAccessType(objectType, indexType, accessNode) { - if (indexType.flags & 16384) { - if (accessNode && !isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - return getIndexedAccessTypeForTypeParameter(objectType, indexType); + function getIndexedAccessForMappedType(type, indexType, accessNode) { + var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { + error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); + return unknownType; } - var apparentType = getApparentType(objectType); + var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); + } + function getIndexedAccessType(objectType, indexType, accessNode) { + if (maybeTypeOfKind(indexType, 540672 | 262144) || + maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 178) || + isGenericMappedType(objectType)) { + if (objectType.flags & 1) { + return objectType; + } + if (accessNode) { + if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return unknownType; + } + } + if (isGenericMappedType(objectType)) { + return getIndexedAccessForMappedType(objectType, indexType, accessNode); + } + var id = objectType.id + "," + indexType.id; + return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + } + var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 && !(indexType.flags & 8190)) { var propTypes = []; for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) { var t = _a[_i]; - var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, false); + var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, false); if (propType === unknownType) { return unknownType; } @@ -25690,7 +25886,7 @@ var ts; } return getUnionType(propTypes); } - return getPropertyTypeForIndexType(apparentType, indexType, accessNode, true); + return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, true); } function getTypeFromIndexedAccessTypeNode(node) { var links = getNodeLinks(node); @@ -25707,6 +25903,7 @@ var ts; type.aliasSymbol = getAliasSymbolForTypeNode(node); type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); links.resolvedType = type; + getConstraintTypeFromMappedType(type); } return links.resolvedType; } @@ -25734,10 +25931,23 @@ var ts; return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } function getSpreadType(left, right, isFromObjectLiteral) { - ts.Debug.assert(!!(left.flags & (32768 | 1)) && !!(right.flags & (32768 | 1)), "Only object types may be spread."); if (left.flags & 1 || right.flags & 1) { return anyType; } + left = filterType(left, function (t) { return !(t.flags & 6144); }); + if (left.flags & 8192) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144); }); + if (right.flags & 8192) { + return left; + } + if (left.flags & 65536) { + return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + } + if (right.flags & 65536) { + return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); var stringIndexInfo; @@ -25875,18 +26085,18 @@ var ts; return nullType; case 129: return neverType; - case 288: - return nullType; case 289: - return undefinedType; + return nullType; case 290: + return undefinedType; + case 291: return neverType; case 167: case 98: return getTypeFromThisTypeNode(node); case 171: return getTypeFromLiteralTypeNode(node); - case 287: + case 288: return getTypeFromLiteralTypeNode(node.literal); case 157: case 272: @@ -25919,7 +26129,7 @@ var ts; case 158: case 159: case 161: - case 286: + case 287: case 274: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 168: @@ -26080,6 +26290,28 @@ var ts; return result; } function instantiateMappedType(type, mapper) { + var constraintType = getConstraintTypeFromMappedType(type); + if (constraintType.flags & 262144) { + var typeVariable_1 = constraintType.type; + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } + } + return instantiateMappedObjectType(type, mapper); + } + function isMappableType(type) { + return type.flags & (16384 | 32768 | 131072 | 524288); + } + function instantiateMappedObjectType(type, mapper) { var result = createObjectType(32 | 64, type.symbol); result.declaration = type.declaration; result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; @@ -26438,7 +26670,7 @@ var ts; return false; if (target.flags & 1 || source.flags & 8192) return true; - if (source.flags & 34 && target.flags & 2) + if (source.flags & 262178 && target.flags & 2) return true; if (source.flags & 340 && target.flags & 4) return true; @@ -26547,6 +26779,23 @@ var ts; reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608)) { + return false; + } + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source.flags & 96 && source.flags & 1048576) { @@ -26562,11 +26811,6 @@ var ts; } if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return -1; - if (source.flags & 262144) { - if (maybeTypeOfKind(target, 2) && maybeTypeOfKind(target, 4)) { - return -1; - } - } if (getObjectFlags(source) & 128 && source.flags & 1048576) { if (hasExcessProperties(source, target, reportErrors)) { if (reportErrors) { @@ -26574,7 +26818,7 @@ var ts; } return 0; } - if (target.flags & 196608) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -26605,11 +26849,22 @@ var ts; return result; } } - if (target.flags & 16384) { - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; + else if (target.flags & 16384) { + if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) { + if (!source.declaration.questionToken) { + var templateType = getTemplateTypeFromMappedType(source); + var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); + if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { + return result; + } + } + } + else { + var constraint = getConstraintOfTypeParameter(target); + if (constraint && constraint.flags & 262144) { + if (result = isRelatedTo(source, constraint, reportErrors)) { + return result; + } } } } @@ -26619,23 +26874,56 @@ var ts; return result; } } - var constraint = getConstraintOfTypeParameter(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + if (target.type.flags & 540672) { + var constraint = getConstraintOfTypeVariable(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } + } + } + else if (target.flags & 524288) { + if (source.flags & 524288 && source.indexType === target.indexType) { + if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { + return result; + } + } + if (target.constraint) { + if (result = isRelatedTo(source, target.constraint, reportErrors)) { + errorInfo = saveErrorInfo; return result; } } } if (source.flags & 16384) { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1) { - constraint = emptyObjectType; + if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) { + var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } - constraint = getTypeWithThisArgument(constraint, source); - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; - return result; + else { + var constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + constraint = getTypeWithThisArgument(constraint, source); + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + else if (source.flags & 524288) { + if (source.constraint) { + if (result = isRelatedTo(source.constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } else { @@ -26644,22 +26932,12 @@ var ts; return result; } } - if (isGenericMappedType(target)) { - if (isGenericMappedType(source)) { - if ((result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) && - (result = isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors))) { - return result; - } - } - } - else { - var apparentSource = getApparentType(source); - if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) { - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190); - if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { - errorInfo = saveErrorInfo; - return result; - } + var apparentSource = getApparentType(source); + if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + errorInfo = saveErrorInfo; + return result; } } } @@ -26866,6 +27144,9 @@ var ts; if (expandingFlags === 3) { result = 1; } + else if (isGenericMappedType(source) || isGenericMappedType(target)) { + result = mappedTypeRelatedTo(source, target, reportErrors); + } else { result = propertiesRelatedTo(source, target, reportErrors); if (result) { @@ -26893,6 +27174,33 @@ var ts; } return result; } + function mappedTypeRelatedTo(source, target, reportErrors) { + if (isGenericMappedType(target)) { + if (isGenericMappedType(source)) { + var result_2; + if (relation === identityRelation) { + var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; + var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; + if (readonlyMatches && optionalMatches) { + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); + } + } + } + else { + if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + } + } + } + } + } + else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { + return -1; + } + return 0; + } function propertiesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { return propertiesIdenticalTo(source, target); @@ -27368,7 +27676,7 @@ var ts; return type; } var types = [type]; - if (flags & 34) + if (flags & 262178) types.push(emptyStringType); if (flags & 340) types.push(zeroType); @@ -27572,25 +27880,69 @@ var ts; isFixed: false, }; } - function couldContainTypeParameters(type) { + function couldContainTypeVariables(type) { var objectFlags = getObjectFlags(type); - return !!(type.flags & 16384 || - objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeParameters) || + return !!(type.flags & 540672 || + objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeVariables) || objectFlags & 16 && type.symbol && type.symbol.flags & (8192 | 2048 | 32) || objectFlags & 32 || - type.flags & 196608 && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & 196608 && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || type.flags & 196608 && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); } - function inferTypes(context, originalSource, originalTarget) { - var typeParameters = context.signature.typeParameters; + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 536870912; + var members = createSymbolTable(properties); + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var prop = properties_4[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 | 67108864 | prop.flags & optionalMask, prop.name); + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); + members[prop.name] = inferredProp; + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; @@ -27606,7 +27958,7 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -27645,13 +27997,13 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384) { + if (target.flags & 540672) { if (source.flags & 8388608) { return; } - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : @@ -27659,7 +28011,7 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & 16384 && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -27677,21 +28029,21 @@ var ts; } else if (target.flags & 196608) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; + var typeVariableCount = 0; + var typeVariable = void 0; for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { var t = targetTypes_2[_d]; - if (t.flags & 16384 && ts.contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + if (t.flags & 540672 && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -27703,19 +28055,6 @@ var ts; } } else { - if (getObjectFlags(target) & 32) { - var constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & 32) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); - return; - } - if (constraintType.flags & 16384) { - inferFromTypes(getIndexType(source), constraintType); - inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); - return; - } - } source = getApparentType(source); if (source.flags & 32768) { if (isInProcess(source, target)) { @@ -27736,18 +28075,41 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; depth++; - inferFromProperties(source, target); - inferFromSignatures(source, target, 0); - inferFromSignatures(source, target, 1); - inferFromIndexTypes(source, target); + inferFromObjectTypes(source, target); depth--; } } } + function inferFromObjectTypes(source, target) { + if (getObjectFlags(target) & 32) { + var constraintType = getConstraintTypeFromMappedType(target); + if (constraintType.flags & 262144) { + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } + return; + } + if (constraintType.flags & 16384) { + inferFromTypes(getIndexType(source), constraintType); + inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); + return; + } + } + inferFromProperties(source, target); + inferFromSignatures(source, target, 0); + inferFromSignatures(source, target, 1); + inferFromIndexTypes(source, target); + } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var targetProp = properties_5[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -28078,7 +28440,7 @@ var ts; } function getTypeWithDefault(type, defaultExpression) { if (defaultExpression) { - var defaultType = checkExpression(defaultExpression); + var defaultType = getTypeOfExpression(defaultExpression); return getUnionType([getTypeWithFacts(type, 131072), defaultType]); } return type; @@ -28101,7 +28463,7 @@ var ts; function getAssignedTypeOfBinaryExpression(node) { return node.parent.kind === 175 || node.parent.kind === 257 ? getTypeWithDefault(getAssignedType(node), node.right) : - checkExpression(node.right); + getTypeOfExpression(node.right); } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); @@ -28149,7 +28511,7 @@ var ts; } function getTypeOfInitializer(node) { var links = getNodeLinks(node); - return links.resolvedType || checkExpression(node); + return links.resolvedType || getTypeOfExpression(node); } function getInitialTypeOfVariableDeclaration(node) { if (node.initializer) { @@ -28202,7 +28564,7 @@ var ts; } function getTypeOfSwitchClause(clause) { if (clause.kind === 253) { - var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression)); + var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } return neverType; @@ -28282,7 +28644,7 @@ var ts; return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType)); } function addEvolvingArrayElementType(evolvingArrayType, node) { - var elementType = getBaseTypeOfLiteralType(checkExpression(node)); + var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { @@ -28330,7 +28692,7 @@ var ts; parent.parent.operatorToken.kind === 57 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && - isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 | 2048); + isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 | 2048); return isLengthPushOrUnshift || isElementAssignment; } function maybeTypePredicateCall(node) { @@ -28468,7 +28830,7 @@ var ts; } } else { - var indexType = checkExpression(node.left.argumentExpression); + var indexType = getTypeOfExpression(node.left.argumentExpression); if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 | 2048)) { evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right); } @@ -28649,7 +29011,7 @@ var ts; if (operator === 32 || operator === 34) { assumeTrue = !assumeTrue; } - var valueType = checkExpression(value); + var valueType = getTypeOfExpression(value); if (valueType.flags & 6144) { if (!strictNullChecks) { return type; @@ -28721,7 +29083,7 @@ var ts; } return type; } - var rightType = checkExpression(expr.right); + var rightType = getTypeOfExpression(expr.right); if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } @@ -28749,16 +29111,16 @@ var ts; } } if (targetType) { - return getNarrowedType(type, targetType, assumeTrue); + return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf); } return type; } - function getNarrowedType(type, candidate, assumeTrue) { + function getNarrowedType(type, candidate, assumeTrue, isRelated) { if (!assumeTrue) { - return filterType(type, function (t) { return !isTypeInstanceOf(t, candidate); }); + return filterType(type, function (t) { return !isRelated(t, candidate); }); } if (type.flags & 65536) { - var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); }); + var assignableType = filterType(type, function (t) { return isRelated(t, candidate); }); if (!(assignableType.flags & 8192)) { return assignableType; } @@ -28785,7 +29147,7 @@ var ts; var predicateArgument = callExpression.arguments[predicate.parameterIndex]; if (predicateArgument) { if (isMatchingReference(reference, predicateArgument)) { - return getNarrowedType(type, predicate.type, assumeTrue); + return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } if (containsMatchingReference(reference, predicateArgument)) { return declaredType; @@ -28798,7 +29160,7 @@ var ts; var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { - return getNarrowedType(type, predicate.type, assumeTrue); + return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } if (containsMatchingReference(reference, possibleReference)) { return declaredType; @@ -28834,7 +29196,7 @@ var ts; location = location.parent; } if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) { - var type = checkExpression(location); + var type = getTypeOfExpression(location); if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { return type; } @@ -28906,7 +29268,7 @@ var ts; error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } - if (node.flags & 524288) { + if (node.flags & 16384) { getNodeLinks(container).flags |= 8192; } return getTypeOfSymbol(symbol); @@ -28917,8 +29279,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (languageVersion === 2 - && declaration_1.kind === 226 + if (declaration_1.kind === 226 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -29092,18 +29453,21 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + if (!superCall || superCall.end > node.pos) { + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; if (container.kind === 150) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - if (!superCall || superCall.end > node.pos) { - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } if (container.kind === 185) { container = ts.getThisContainer(container, false); @@ -29170,9 +29534,9 @@ var ts; return anyType; } function getTypeForThisExpressionFromJSDoc(node) { - var typeTag = ts.getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 274) { - var jsDocFunctionType = typeTag.typeExpression.type; + var jsdocType = ts.getJSDocType(node); + if (jsdocType && jsdocType.kind === 274) { + var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } @@ -29217,6 +29581,9 @@ var ts; } return unknownType; } + if (!isCallExpression && container.kind === 150) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } if ((ts.getModifierFlags(container) & 32) || isCallExpression) { nodeCheckFlag = 512; } @@ -29357,11 +29724,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_22 = declaration.propertyName || declaration.name; + var name_21 = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_22)) { - var text = ts.getTextOfPropertyName(name_22); + !ts.isBindingPattern(name_21)) { + var text = ts.getTextOfPropertyName(name_21); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -29440,13 +29807,13 @@ var ts; return undefined; } if (node === binaryExpression.right) { - return checkExpression(binaryExpression.left); + return getTypeOfExpression(binaryExpression.left); } } else if (operator === 53) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { - type = checkExpression(binaryExpression.left); + type = getTypeOfExpression(binaryExpression.left); } return type; } @@ -29672,7 +30039,7 @@ var ts; return mapper && mapper.context; } function checkSpreadExpression(node, contextualMapper) { - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); + var arrayOrIterableType = checkExpression(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { @@ -29752,7 +30119,7 @@ var ts; var links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 34 | 512)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 262178 | 512)) { error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { @@ -29761,10 +30128,10 @@ var ts; } return links.resolvedType; } - function getObjectLiteralIndexInfo(node, properties, kind) { + function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) { var propTypes = []; for (var i = 0; i < properties.length; i++) { - if (kind === 0 || isNumericName(node.properties[i].name)) { + if (kind === 0 || isNumericName(propertyNodes[i + offset].name)) { propTypes.push(getTypeOfSymbol(properties[i])); } } @@ -29785,8 +30152,9 @@ var ts; var patternWithComputedProperties = false; var hasComputedStringProperty = false; var hasComputedNumberProperty = false; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var memberDecl = _a[_i]; + var offset = 0; + for (var i = 0; i < node.properties.length; i++) { + var memberDecl = node.properties[i]; var member = memberDecl.symbol; if (memberDecl.kind === 257 || memberDecl.kind === 258 || @@ -29819,7 +30187,7 @@ var ts; if (impliedProp) { prop.flags |= impliedProp.flags & 536870912; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -29833,6 +30201,9 @@ var ts; member = prop; } else if (memberDecl.kind === 259) { + if (languageVersion < 5) { + checkExternalEmitHelpers(memberDecl, 2); + } if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), true); propertiesArray = []; @@ -29842,11 +30213,12 @@ var ts; typeFlags = 0; } var type = checkExpression(memberDecl.expression); - if (!(type.flags & (32768 | 1))) { + if (!isValidSpreadType(type)) { error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } spread = getSpreadType(spread, type, false); + offset = i + 1; continue; } else { @@ -29867,8 +30239,8 @@ var ts; propertiesArray.push(member); } if (contextualTypeHasPattern) { - for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { - var prop = _c[_b]; + for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { + var prop = _a[_i]; if (!propertiesTable[prop.name]) { if (!(prop.flags & 536870912)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); @@ -29882,14 +30254,16 @@ var ts; if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), true); } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; + if (spread.flags & 32768) { + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; + } return spread; } return createObjectLiteralType(); function createObjectLiteralType() { - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1) : undefined; + var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined; + var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined; var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); @@ -29906,6 +30280,11 @@ var ts; return result; } } + function isValidSpreadType(type) { + return !!(type.flags & (1 | 4096 | 2048) || + type.flags & 32768 && !isGenericMappedType(type) || + type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); + } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; @@ -29980,6 +30359,9 @@ var ts; return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { + if (compilerOptions.jsx === 2) { + checkExternalEmitHelpers(node, 2); + } var type = checkExpression(node.expression); var props = getPropertiesOfType(type); for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { @@ -30431,7 +30813,7 @@ var ts; if (node.kind === 212 && child === node.statement && getForInVariableSymbol(node) === symbol && - hasNumericPropertyNames(checkExpression(node.expression))) { + hasNumericPropertyNames(getTypeOfExpression(node.expression))) { return true; } child = node; @@ -30524,19 +30906,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_9 = signature.declaration && signature.declaration.parent; + var parent_8 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_9 === lastParent) { + if (lastParent && parent_8 === lastParent) { index++; } else { - lastParent = parent_9; + lastParent = parent_8; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_9; + lastParent = parent_8; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -30625,7 +31007,7 @@ var ts; function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { var context = createInferenceContext(signature, true); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -30644,7 +31026,7 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { @@ -30656,7 +31038,7 @@ var ts; var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } if (excludeArgument) { @@ -30664,7 +31046,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -31158,12 +31540,13 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; if (modifiers & 16 && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } if (modifiers & 8) { @@ -31354,7 +31737,7 @@ var ts; for (var i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -31407,7 +31790,7 @@ var ts; assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -31504,7 +31887,7 @@ var ts; if (!node.possiblyExhaustive) { return false; } - var type = checkExpression(node.expression); + var type = getTypeOfExpression(node.expression); if (!isLiteralType(type)) { return false; } @@ -31512,7 +31895,7 @@ var ts; if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { if (!(func.flags & 128)) { @@ -31726,7 +32109,7 @@ var ts; } function checkAwaitExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 524288)) { + if (!(node.flags & 16384)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -31840,32 +32223,32 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 | 340 | 512)) { + if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var p = properties_5[_i]; - checkObjectLiteralDestructuringPropertyAssignment(sourceType, p); + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var p = properties_6[_i]; + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } - function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) { + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { if (property.kind === 257 || property.kind === 258) { - var name_23 = property.name; - if (name_23.kind === 142) { - checkComputedPropertyName(name_23); + var name_22 = property.name; + if (name_22.kind === 142) { + checkComputedPropertyName(name_22); } - if (isComputedNonLiteralName(name_23)) { + if (isComputedNonLiteralName(name_22)) { return undefined; } - var text = ts.getTextOfPropertyName(name_23); + var text = ts.getTextOfPropertyName(name_22); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || @@ -31880,13 +32263,21 @@ var ts; } } else { - error(name_23, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_23)); + error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22)); } } else if (property.kind === 259) { - if (property.expression.kind !== 70) { - error(property.expression, ts.Diagnostics.An_object_rest_element_must_be_an_identifier); + if (languageVersion < 5) { + checkExternalEmitHelpers(property, 4); } + var nonRestNames = []; + if (allProperties) { + for (var i = 0; i < allProperties.length - 1; i++) { + nonRestNames.push(allProperties[i].name); + } + } + var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); + return checkDestructuringAssignment(property.expression, type); } else { error(property, ts.Diagnostics.Property_assignment_expected); @@ -31971,7 +32362,10 @@ var ts; } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) { + var error = target.parent.kind === 259 ? + ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : + ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; + if (checkReferenceExpression(target, error)) { checkTypeAssignableTo(sourceType, targetType, target, undefined); } return sourceType; @@ -32108,7 +32502,7 @@ var ts; resultType = numberType; } else { - if (isTypeOfKind(leftType, 34) || isTypeOfKind(rightType, 34)) { + if (isTypeOfKind(leftType, 262178) || isTypeOfKind(rightType, 262178)) { resultType = stringType; } else if (isTypeAny(leftType) || isTypeAny(rightType)) { @@ -32131,6 +32525,8 @@ var ts; case 29: case 30: if (checkForDisallowedESSymbolOperand(operator)) { + leftType = getBaseTypeOfLiteralType(leftType); + rightType = getBaseTypeOfLiteralType(rightType); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -32224,7 +32620,7 @@ var ts; } function checkYieldExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 131072) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -32304,19 +32700,19 @@ var ts; function checkDeclarationInitializer(declaration) { var type = checkExpressionCached(declaration.initializer); return ts.getCombinedNodeFlags(declaration) & 2 || - ts.getCombinedModifierFlags(declaration) & 64 || + ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } function isLiteralContextualType(contextualType) { if (contextualType) { - if (contextualType.flags & 16384) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); + if (contextualType.flags & 540672) { + var apparentType = getApparentTypeOfTypeVariable(contextualType); if (apparentType.flags & (2 | 4 | 8 | 16)) { return true; } contextualType = apparentType; } - return maybeTypeOfKind(contextualType, 480); + return maybeTypeOfKind(contextualType, (480 | 262144)); } return false; } @@ -32353,6 +32749,16 @@ var ts; } return type; } + function getTypeOfExpression(node) { + if (node.kind === 179 && node.expression.kind !== 96) { + var funcType = checkNonNullExpression(node.expression); + var signature = getSingleCallSignature(funcType); + if (signature && !signature.typeParameters) { + return getReturnTypeOfSignature(signature); + } + } + return checkExpression(node); + } function checkExpression(node, contextualMapper) { var type; if (node.kind === 141) { @@ -32533,9 +32939,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_24 = _a[_i].name; - if (ts.isBindingPattern(name_24) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, parameterName, typePredicate.parameterName)) { + var name_23 = _a[_i].name; + if (ts.isBindingPattern(name_23) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -32555,9 +32961,9 @@ var ts; case 158: case 149: case 148: - var parent_10 = node.parent; - if (node === parent_10.type) { - return parent_10; + var parent_9 = node.parent; + if (node === parent_9.type) { + return parent_9; } } } @@ -32567,15 +32973,15 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_25 = element.name; - if (name_25.kind === 70 && - name_25.text === predicateVariableName) { + var name_24 = element.name; + if (name_24.kind === 70 && + name_24.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_25.kind === 173 || - name_25.kind === 172) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_25, predicateVariableNode, predicateVariableName)) { + else if (name_24.kind === 173 || + name_24.kind === 172) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, predicateVariableNode, predicateVariableName)) { return true; } } @@ -32590,6 +32996,12 @@ var ts; node.kind === 154) { checkGrammarFunctionLikeDeclaration(node); } + if (ts.isAsyncFunctionLike(node) && languageVersion < 4) { + checkExternalEmitHelpers(node, 64); + if (languageVersion < 2) { + checkExternalEmitHelpers(node, 128); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -32806,8 +33218,8 @@ var ts; if (superCallShouldBeFirst) { var statements = node.body.statements; var superCallStatement = void 0; - for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { - var statement = statements_2[_i]; + for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { + var statement = statements_3[_i]; if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; @@ -32949,8 +33361,8 @@ var ts; checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint); + var keyType = constraintType.flags & 540672 ? getApparentTypeOfTypeVariable(constraintType) : constraintType; + checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node); @@ -33194,10 +33606,10 @@ var ts; case 229: return 2097152 | 1048576; case 234: - var result_2 = 0; + var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); }); - return result_2; + ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); + return result_3; default: return 1048576; } @@ -33238,7 +33650,7 @@ var ts; if (thenSignatures.length === 0) { return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288); if (isTypeAny(onfulfilledParameterType)) { return undefined; } @@ -33374,6 +33786,9 @@ var ts; markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } function checkDecorators(node) { if (!node.decorators) { return; @@ -33384,14 +33799,20 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8); + if (node.kind === 144) { + checkExternalEmitHelpers(firstDecorator, 32); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { case 226: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; @@ -33400,11 +33821,13 @@ var ts; case 152: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; case 147: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; case 144: markTypeNodeAsReferenced(node.type); break; @@ -33513,7 +33936,7 @@ var ts; } function checkUnusedLocalsAndParameters(node) { if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_3 = function (key) { + var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) { @@ -33531,10 +33954,17 @@ var ts; } }; for (var key in node.locals) { - _loop_3(key); + _loop_2(key); } } } + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); @@ -33544,7 +33974,9 @@ var ts; return; } } - error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); @@ -33701,14 +34133,14 @@ var ts; } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192) { + if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -33736,8 +34168,8 @@ var ts; container.kind === 230 || container.kind === 261); if (!namesShareScope) { - var name_26 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_26, name_26); + var name_25 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25); } } } @@ -33805,16 +34237,19 @@ var ts; } } if (node.kind === 174) { + if (node.parent.kind === 172 && languageVersion < 5) { + checkExternalEmitHelpers(node, 4); + } if (node.propertyName && node.propertyName.kind === 142) { checkComputedPropertyName(node.propertyName); } - var parent_11 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_11); - var name_27 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_27)); + var parent_10 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_10); + var name_26 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26)); markPropertyAsReferenced(property); - if (parent_11.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + if (parent_10.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { @@ -33975,6 +34410,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); + var rightType = checkNonNullExpression(node.expression); if (node.initializer.kind === 224) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { @@ -33988,15 +34424,14 @@ var ts; if (varExpr.kind === 175 || varExpr.kind === 176) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } - else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34)) { + else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - var rightType = checkNonNullExpression(node.expression); - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -34121,12 +34556,12 @@ var ts; var arrayType = arrayOrStringType; if (arrayOrStringType.flags & 65536) { var arrayTypes = arrayOrStringType.types; - var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 34); }); + var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); }); if (filteredTypes !== arrayTypes) { arrayType = getUnionType(filteredTypes, true); } } - else if (arrayOrStringType.flags & 34) { + else if (arrayOrStringType.flags & 262178) { arrayType = neverType; } var hasStringConstituent = arrayOrStringType !== arrayType; @@ -34151,7 +34586,7 @@ var ts; } var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; if (hasStringConstituent) { - if (arrayElementType.flags & 34) { + if (arrayElementType.flags & 262178) { return stringType; } return getUnionType([arrayElementType, stringType], true); @@ -34214,7 +34649,7 @@ var ts; } function checkWithStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 524288) { + if (node.flags & 16384) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -34460,6 +34895,9 @@ var ts; checkClassForDuplicateDeclarations(node); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2 && !ts.isInAmbientContext(node)) { + checkExternalEmitHelpers(baseTypeNode.parent, 1); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; @@ -34635,8 +35073,8 @@ var ts; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var prop = properties_6[_a]; + for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { + var prop = properties_7[_a]; var existing = seen[prop.name]; if (!existing) { seen[prop.name] = { prop: prop, containingType: base }; @@ -34835,7 +35273,7 @@ var ts; return undefined; } } - enumType_1 = checkExpression(expression); + enumType_1 = getTypeOfExpression(expression); if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) { return undefined; } @@ -35030,9 +35468,9 @@ var ts; break; case 174: case 223: - var name_28 = node.name; - if (ts.isBindingPattern(name_28)) { - for (var _b = 0, _c = name_28.elements; _b < _c.length; _b++) { + var name_27 = node.name; + if (ts.isBindingPattern(name_27)) { + for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } @@ -35770,7 +36208,7 @@ var ts; } } case 96: - var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); + var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; case 167: return getTypeFromTypeNode(node).symbol; @@ -35792,7 +36230,7 @@ var ts; } case 8: if (node.parent.kind === 178 && node.parent.argumentExpression === node) { - var objectType = checkExpression(node.parent.expression); + var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; var apparentType = getApparentType(objectType); @@ -35823,7 +36261,7 @@ var ts; return getTypeFromTypeNode(node); } if (ts.isPartOfExpression(node)) { - return getTypeOfExpression(node); + return getRegularTypeOfExpression(node); } if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; @@ -35861,7 +36299,7 @@ var ts; return checkDestructuringAssignment(expr, iteratedType || unknownType); } if (expr.parent.kind === 192) { - var iteratedType = checkExpression(expr.parent.right); + var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } if (expr.parent.kind === 257) { @@ -35877,11 +36315,11 @@ var ts; var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); } - function getTypeOfExpression(expr) { + function getRegularTypeOfExpression(expr) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } - return getRegularTypeOfLiteralType(checkExpression(expr)); + return getRegularTypeOfLiteralType(getTypeOfExpression(expr)); } function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); @@ -35904,9 +36342,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols_3 = []; - var name_29 = symbol.name; + var name_28 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_29); + var symbol = getPropertyOfType(t, name_28); if (symbol) { symbols_3.push(symbol); } @@ -35959,7 +36397,7 @@ var ts; } function isNameOfModuleOrEnumDeclaration(node) { var parent = node.parent; - return ts.isModuleOrEnumDeclaration(parent) && node === parent.name; + return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name; } function getReferencedExportContainer(node, prefixLocals) { node = ts.getParseTreeNode(node, ts.isIdentifier); @@ -36167,7 +36605,7 @@ var ts; else if (isTypeOfKind(type, 340)) { return ts.TypeReferenceSerializationKind.NumberLikeType; } - else if (isTypeOfKind(type, 34)) { + else if (isTypeOfKind(type, 262178)) { return ts.TypeReferenceSerializationKind.StringLikeType; } else if (isTupleType(type)) { @@ -36198,7 +36636,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getWidenedType(getTypeOfExpression(expr)); + var type = getWidenedType(getRegularTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { @@ -36217,9 +36655,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_12 = reference.parent; - if (ts.isDeclaration(parent_12) && reference === parent_12.name) { - location = getDeclarationContainer(parent_12); + var parent_11 = reference.parent; + if (ts.isDeclaration(parent_11) && reference === parent_11.name) { + location = getDeclarationContainer(parent_11); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -36332,9 +36770,9 @@ var ts; } var current = symbol; while (true) { - var parent_13 = getParentOfSymbol(current); - if (parent_13) { - current = parent_13; + var parent_12 = getParentOfSymbol(current); + if (parent_12) { + current = parent_12; } else { break; @@ -36367,8 +36805,6 @@ var ts; ts.bindSourceFile(file, compilerOptions); } var augmentations; - var requestedExternalEmitHelpers = 0; - var firstFileRequestingExternalHelpers; for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { @@ -36388,15 +36824,6 @@ var ts; } } } - if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) { - var fileRequestedExternalEmitHelpers = file.flags & 64512; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; - } - } - } } if (augmentations) { for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) { @@ -36451,44 +36878,46 @@ var ts; var symbol = getGlobalSymbol("ReadonlyArray", 793064, undefined); globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - var helpersModule = resolveExternalModule(firstFileRequestingExternalHelpers, ts.externalHelpersModuleNameText, ts.Diagnostics.Cannot_find_module_0, undefined); - if (helpersModule) { - var exports_2 = helpersModule.exports; - if (requestedExternalEmitHelpers & 1024 && languageVersion < 2) { - verifyHelperSymbol(exports_2, "__extends", 107455); - } - if (requestedExternalEmitHelpers & 16384 && - (languageVersion < 5 || compilerOptions.jsx === 2)) { - verifyHelperSymbol(exports_2, "__assign", 107455); - } - if (languageVersion < 5 && requestedExternalEmitHelpers & 32768) { - verifyHelperSymbol(exports_2, "__rest", 107455); - } - if (requestedExternalEmitHelpers & 2048) { - verifyHelperSymbol(exports_2, "__decorate", 107455); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports_2, "__metadata", 107455); - } - } - if (requestedExternalEmitHelpers & 4096) { - verifyHelperSymbol(exports_2, "__param", 107455); - } - if (requestedExternalEmitHelpers & 8192) { - verifyHelperSymbol(exports_2, "__awaiter", 107455); - if (languageVersion < 2) { - verifyHelperSymbol(exports_2, "__generator", 107455); + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1; helper <= 128; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name_29 = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_29), 107455); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_29); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols, name, meaning) { - var symbol = getSymbol(symbols, ts.escapeIdentifier(name), meaning); - if (!symbol) { - error(undefined, ts.Diagnostics.Module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + function getHelperName(helper) { + switch (helper) { + case 1: return "__extends"; + case 2: return "__assign"; + case 4: return "__rest"; + case 8: return "__decorate"; + case 16: return "__metadata"; + case 32: return "__param"; + case 64: return "__awaiter"; + case 128: return "__generator"; } } + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; + } + return externalHelpersModule; + } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); if (promiseLikeType !== emptyGenericType) { @@ -37138,6 +37567,9 @@ var ts; else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } @@ -37533,10 +37965,15 @@ var ts; function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } - function reduceEachChild(node, f, initial) { + function reduceNodeArray(nodes, f, initial) { + return nodes ? f(initial, nodes) : initial; + } + function reduceEachChild(node, initial, cbNode, cbNodeArray) { if (node === undefined) { return initial; } + var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; + var cbNodes = cbNodeArray || cbNode; var kind = node.kind; if ((kind > 0 && kind <= 140)) { return initial; @@ -37550,108 +37987,108 @@ var ts; case 206: case 198: case 222: - case 292: + case 293: break; case 142: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 144: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 145: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 147: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 149: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 150: - result = ts.reduceLeft(node.modifiers, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); break; case 151: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 152: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); break; case 172: case 173: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 174: - result = reduceNode(node.propertyName, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 175: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 176: - result = ts.reduceLeft(node.properties, f, result); + result = reduceNodes(node.properties, cbNodes, result); break; case 177: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.name, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 178: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.argumentExpression, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.argumentExpression, cbNode, result); break; case 179: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); - result = ts.reduceLeft(node.arguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); break; case 180: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); - result = ts.reduceLeft(node.arguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); break; case 181: - result = reduceNode(node.tag, f, result); - result = reduceNode(node.template, f, result); + result = reduceNode(node.tag, cbNode, result); + result = reduceNode(node.template, cbNode, result); break; case 184: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 185: - result = ts.reduceLeft(node.modifiers, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 183: case 186: @@ -37661,205 +38098,205 @@ var ts; case 195: case 196: case 201: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 190: case 191: - result = reduceNode(node.operand, f, result); + result = reduceNode(node.operand, cbNode, result); break; case 192: - result = reduceNode(node.left, f, result); - result = reduceNode(node.right, f, result); + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); break; case 193: - result = reduceNode(node.condition, f, result); - result = reduceNode(node.whenTrue, f, result); - result = reduceNode(node.whenFalse, f, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.whenTrue, cbNode, result); + result = reduceNode(node.whenFalse, cbNode, result); break; case 194: - result = reduceNode(node.head, f, result); - result = ts.reduceLeft(node.templateSpans, f, result); + result = reduceNode(node.head, cbNode, result); + result = reduceNodes(node.templateSpans, cbNodes, result); break; case 197: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.heritageClauses, f, result); - result = ts.reduceLeft(node.members, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); break; case 199: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); break; case 202: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.literal, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); break; case 204: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 205: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.declarationList, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.declarationList, cbNode, result); break; case 207: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 208: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.thenStatement, f, result); - result = reduceNode(node.elseStatement, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.thenStatement, cbNode, result); + result = reduceNode(node.elseStatement, cbNode, result); break; case 209: - result = reduceNode(node.statement, f, result); - result = reduceNode(node.expression, f, result); + result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 210: case 217: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 211: - result = reduceNode(node.initializer, f, result); - result = reduceNode(node.condition, f, result); - result = reduceNode(node.incrementor, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.incrementor, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 212: case 213: - result = reduceNode(node.initializer, f, result); - result = reduceNode(node.expression, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 216: case 220: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 218: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.caseBlock, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.caseBlock, cbNode, result); break; case 219: - result = reduceNode(node.label, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.label, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 221: - result = reduceNode(node.tryBlock, f, result); - result = reduceNode(node.catchClause, f, result); - result = reduceNode(node.finallyBlock, f, result); + result = reduceNode(node.tryBlock, cbNode, result); + result = reduceNode(node.catchClause, cbNode, result); + result = reduceNode(node.finallyBlock, cbNode, result); break; case 223: - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 224: - result = ts.reduceLeft(node.declarations, f, result); + result = reduceNodes(node.declarations, cbNodes, result); break; case 225: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 226: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.heritageClauses, f, result); - result = ts.reduceLeft(node.members, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); break; case 232: - result = ts.reduceLeft(node.clauses, f, result); + result = reduceNodes(node.clauses, cbNodes, result); break; case 235: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.importClause, f, result); - result = reduceNode(node.moduleSpecifier, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.importClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); break; case 236: - result = reduceNode(node.name, f, result); - result = reduceNode(node.namedBindings, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); break; case 237: - result = reduceNode(node.name, f, result); + result = reduceNode(node.name, cbNode, result); break; case 238: case 242: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 239: case 243: - result = reduceNode(node.propertyName, f, result); - result = reduceNode(node.name, f, result); + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 240: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.expression, f, result); + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 241: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.exportClause, f, result); - result = reduceNode(node.moduleSpecifier, f, result); + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.exportClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); break; case 246: - result = reduceNode(node.openingElement, f, result); - result = ts.reduceLeft(node.children, f, result); - result = reduceNode(node.closingElement, f, result); + result = reduceNode(node.openingElement, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingElement, cbNode, result); break; case 247: case 248: - result = reduceNode(node.tagName, f, result); - result = ts.reduceLeft(node.attributes, f, result); + result = reduceNode(node.tagName, cbNode, result); + result = reduceNodes(node.attributes, cbNodes, result); break; case 249: - result = reduceNode(node.tagName, f, result); + result = reduceNode(node.tagName, cbNode, result); break; case 250: - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 251: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 252: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 253: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); case 254: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 255: - result = ts.reduceLeft(node.types, f, result); + result = reduceNodes(node.types, cbNodes, result); break; case 256: - result = reduceNode(node.variableDeclaration, f, result); - result = reduceNode(node.block, f, result); + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); break; case 257: - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 258: - result = reduceNode(node.name, f, result); - result = reduceNode(node.objectAssignmentInitializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; case 259: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 261: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; - case 293: - result = reduceNode(node.expression, f, result); + case 294: + result = reduceNode(node.expression, cbNode, result); break; default: var edgeTraversalPath = nodeEdgeTraversalMap[kind]; @@ -37869,8 +38306,8 @@ var ts; var value = node[edge.name]; if (value !== undefined) { result = ts.isArray(value) - ? ts.reduceLeft(value, f, result) - : f(result, value); + ? reduceNodes(value, cbNodes, result) + : cbNode(result, value); } } } @@ -37880,8 +38317,8 @@ var ts; } ts.reduceEachChild = reduceEachChild; function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { - if (node === undefined) { - return undefined; + if (node === undefined || visitor === undefined) { + return node; } aggregateTransformFlags(node); var visited = visitor(node); @@ -37958,6 +38395,35 @@ var ts; return updated || nodes; } ts.visitNodes = visitNodes; + function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) { + context.startLexicalEnvironment(); + statements = visitNodes(statements, visitor, ts.isStatement, start); + if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { + statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements); + } + var declarations = context.endLexicalEnvironment(); + return ts.createNodeArray(ts.concatenate(statements, declarations), statements); + } + ts.visitLexicalEnvironment = visitLexicalEnvironment; + function visitParameterList(nodes, visitor, context) { + context.startLexicalEnvironment(); + var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration); + context.suspendLexicalEnvironment(); + return updated; + } + ts.visitParameterList = visitParameterList; + function visitFunctionBody(node, visitor, context) { + context.resumeLexicalEnvironment(); + var updated = visitNode(node, visitor, ts.isConciseBody); + var declarations = context.endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(updated); + var statements = mergeLexicalEnvironment(block.statements, declarations); + return ts.updateBlock(block, statements); + } + return updated; + } + ts.visitFunctionBody = visitFunctionBody; function visitEachChild(node, visitor, context) { if (node === undefined) { return undefined; @@ -37978,23 +38444,23 @@ var ts; case 142: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); case 144: - return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 147: return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 149: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 150: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 151: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 152: - return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 172: return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 173: return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); case 174: - return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); case 175: return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); case 176: @@ -38012,9 +38478,9 @@ var ts; case 183: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 184: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 185: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, true), context.endLexicalEnvironment())); + return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 186: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 187: @@ -38082,7 +38548,7 @@ var ts; case 224: return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 225: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment())); + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 226: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); case 232: @@ -38134,9 +38600,8 @@ var ts; case 259: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); case 261: - context.startLexicalEnvironment(); - return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements)); - case 293: + return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); + case 294: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; @@ -38164,6 +38629,15 @@ var ts; } } ts.visitEachChild = visitEachChild; + function mergeLexicalEnvironment(statements, declarations) { + if (!ts.some(declarations)) { + return statements; + } + return ts.isNodeArray(statements) + ? ts.createNodeArray(ts.concatenate(statements, declarations), statements) + : ts.addRange(statements, declarations); + } + ts.mergeLexicalEnvironment = mergeLexicalEnvironment; function mergeFunctionBodyLexicalEnvironment(body, declarations) { if (body && declarations !== undefined && declarations.length > 0) { if (ts.isBlock(body)) { @@ -38194,22 +38668,37 @@ var ts; if (node === undefined) { return 0; } - else if (node.transformFlags & 536870912) { + if (node.transformFlags & 536870912) { return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind); } - else { - var subtreeFlags = aggregateTransformFlagsForSubtree(node); - return ts.computeTransformFlagsForNode(node, subtreeFlags); + var subtreeFlags = aggregateTransformFlagsForSubtree(node); + return ts.computeTransformFlagsForNode(node, subtreeFlags); + } + function aggregateTransformFlagsForNodeArray(nodes) { + if (nodes === undefined) { + return 0; } + var subtreeFlags = 0; + var nodeArrayFlags = 0; + for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { + var node = nodes_3[_i]; + subtreeFlags |= aggregateTransformFlagsForNode(node); + nodeArrayFlags |= node.transformFlags & ~536870912; + } + nodes.transformFlags = nodeArrayFlags | 536870912; + return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) { return 0; } - return reduceEachChild(node, aggregateTransformFlagsForChildNode, 0); + return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); } - function aggregateTransformFlagsForChildNode(transformFlags, child) { - return transformFlags | aggregateTransformFlagsForNode(child); + function aggregateTransformFlagsForChildNode(transformFlags, node) { + return transformFlags | aggregateTransformFlagsForNode(node); + } + function aggregateTransformFlagsForChildNodes(transformFlags, nodes) { + return transformFlags | aggregateTransformFlagsForNodeArray(nodes); } var Debug; (function (Debug) { @@ -38219,9 +38708,21 @@ var ts; Debug.failBadSyntaxKind = Debug.shouldAssert(1) ? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); } : ts.noop; + Debug.assertEachNode = Debug.shouldAssert(1) + ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }); } + : ts.noop; Debug.assertNode = Debug.shouldAssert(1) ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); } : ts.noop; + Debug.assertOptionalNode = Debug.shouldAssert(1) + ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); } + : ts.noop; + Debug.assertOptionalToken = Debug.shouldAssert(1) + ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }); } + : ts.noop; + Debug.assertMissingNode = Debug.shouldAssert(1) + ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }); } + : ts.noop; function getFunctionName(func) { if (typeof func !== "function") { return ""; @@ -38240,440 +38741,316 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) { - if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { - var right = node.right; - if (ts.isDestructuringAssignment(right)) { - return flattenDestructuringAssignment(context, right, needsValue, recordTempVariable, visitor); - } - else { - return node.right; - } - } + function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) { var location = node; - var value = node.right; - var expressions = []; - if (needsValue) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment, visitor); + var value; + if (ts.isDestructuringAssignment(node)) { + value = node.right; + while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { + if (ts.isDestructuringAssignment(value)) { + location = node = value; + value = node.right; + } + else { + return value; + } + } } - else if (ts.nodeIsSynthesized(node)) { - location = value; + var expressions; + var flattenContext = { + context: context, + level: level, + hoistTempVariables: true, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern, + createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern, + createArrayBindingOrAssignmentElement: makeAssignmentElement, + visitor: visitor + }; + if (value) { + value = ts.visitNode(value, visitor, ts.isExpression); + if (needsValue) { + value = ensureIdentifier(flattenContext, value, true, location); + } + else if (ts.nodeIsSynthesized(node)) { + location = value; + } } - flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor); - if (needsValue) { + flattenBindingOrAssignmentElement(flattenContext, node, value, location, ts.isDestructuringAssignment(node)); + if (value && needsValue) { + if (!ts.some(expressions)) { + return value; + } expressions.push(value); } - var expression = ts.inlineExpressions(expressions); - ts.aggregateTransformFlags(expression); - return expression; - function emitAssignment(name, value, location) { - var expression = ts.createAssignment(name, value, location); - ts.setEmitFlags(expression, 2048); + return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression(); + function emitExpression(expression) { + ts.setEmitFlags(expression, 64); ts.aggregateTransformFlags(expression); - expressions.push(expression); + expressions = ts.append(expressions, expression); } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - emitAssignment(name, value, location); - return name; - } - function emitRestAssignment(elements, value, location) { - emitAssignment(ts.createObjectLiteral(elements), value, location); + function emitBindingOrAssignment(target, value, location, original) { + ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); + var expression = createAssignmentCallback + ? createAssignmentCallback(target, value, location) + : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location); + expression.original = original; + emitExpression(expression); } } ts.flattenDestructuringAssignment = flattenDestructuringAssignment; - function flattenParameterDestructuring(node, value, visitor, transformRest) { + function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) { + var pendingExpressions; + var pendingDeclarations = []; var declarations = []; - flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor); + var flattenContext = { + context: context, + level: level, + hoistTempVariables: hoistTempVariables, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayBindingPattern, + createObjectBindingOrAssignmentPattern: makeObjectBindingPattern, + createArrayBindingOrAssignmentElement: makeBindingElement, + visitor: visitor + }; + flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer); + if (pendingExpressions) { + var temp = ts.createTempVariable(undefined); + if (hoistTempVariables) { + var value = ts.inlineExpressions(pendingExpressions); + pendingExpressions = undefined; + emitBindingOrAssignment(temp, value, undefined, undefined); + } + else { + context.hoistVariableDeclaration(temp); + var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations); + pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value)); + ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions); + pendingDeclaration.value = temp; + } + } + for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_32 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name_32, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + variable.original = original; + if (ts.isIdentifier(name_32)) { + ts.setEmitFlags(variable, 64); + } + ts.aggregateTransformFlags(variable); + declarations.push(variable); + } return declarations; - function emitAssignment(name, value, location) { - var declaration = ts.createVariableDeclaration(name, undefined, value, location); - ts.setEmitFlags(declaration, 2048); - ts.aggregateTransformFlags(declaration); - declarations.push(declaration); + function emitExpression(value) { + pendingExpressions = ts.append(pendingExpressions, value); } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(undefined); - emitAssignment(name, value, location); - return name; - } - function emitRestAssignment(elements, value, location) { - emitAssignment(ts.createObjectBindingPattern(elements), value, location); + function emitBindingOrAssignment(target, value, location, original) { + ts.Debug.assertNode(target, ts.isBindingName); + if (pendingExpressions) { + value = ts.inlineExpressions(ts.append(pendingExpressions, value)); + pendingExpressions = undefined; + } + pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original }); } } - ts.flattenParameterDestructuring = flattenParameterDestructuring; - function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) { - var declarations = []; - var pendingAssignments; - flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor); - return declarations; - function emitAssignment(name, value, location, original) { - if (pendingAssignments) { - pendingAssignments.push(value); - value = ts.inlineExpressions(pendingAssignments); - pendingAssignments = undefined; - } - var declaration = ts.createVariableDeclaration(name, undefined, value, location); - declaration.original = original; - ts.setEmitFlags(declaration, 2048); - declarations.push(declaration); - ts.aggregateTransformFlags(declaration); - } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - if (recordTempVariable) { - var assignment = ts.createAssignment(name, value, location); - if (pendingAssignments) { - pendingAssignments.push(assignment); - } - else { - pendingAssignments = [assignment]; - } - } - else { - emitAssignment(name, value, location, undefined); - } - return name; - } - function emitRestAssignment(elements, value, location, original) { - emitAssignment(ts.createObjectBindingPattern(elements), value, location, original); - } - } - ts.flattenVariableDestructuring = flattenVariableDestructuring; - function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) { - var pendingAssignments = []; - flattenDestructuring(node, undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, false, visitor); - var expression = ts.inlineExpressions(pendingAssignments); - ts.aggregateTransformFlags(expression); - return expression; - function emitAssignment(name, value, location, original) { - var expression = createAssignmentCallback - ? createAssignmentCallback(name.kind === 70 ? name : emitTempVariableAssignment(name, location), value, location) - : ts.createAssignment(name, value, location); - emitPendingAssignment(expression, original); - } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - emitPendingAssignment(ts.createAssignment(name, value, location), undefined); - return name; - } - function emitRestAssignment(elements, value, location, original) { - emitAssignment(ts.createObjectLiteral(elements), value, location, original); - } - function emitPendingAssignment(expression, original) { - expression.original = original; - ts.setEmitFlags(expression, 2048); - pendingAssignments.push(expression); - } - } - ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression; - function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) { - if (value && visitor) { - value = ts.visitNode(value, visitor, ts.isExpression); - } - if (ts.isBinaryExpression(root)) { - emitDestructuringAssignment(root.left, value, location); - } - else { - emitBindingElement(root, value); - } - function emitDestructuringAssignment(bindingTarget, value, location) { - var target; - if (ts.isShorthandPropertyAssignment(bindingTarget)) { - var initializer = visitor - ? ts.visitNode(bindingTarget.objectAssignmentInitializer, visitor, ts.isExpression) - : bindingTarget.objectAssignmentInitializer; - if (initializer) { - value = createDefaultValueCheck(value, initializer, location); - } - target = bindingTarget.name; - } - else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57) { - var initializer = visitor - ? ts.visitNode(bindingTarget.right, visitor, ts.isExpression) - : bindingTarget.right; - value = createDefaultValueCheck(value, initializer, location); - target = bindingTarget.left; - } - else { - target = bindingTarget; - } - if (target.kind === 176) { - emitObjectLiteralAssignment(target, value, location); - } - else if (target.kind === 175) { - emitArrayLiteralAssignment(target, value, location); - } - else { - var name_32 = ts.getMutableClone(target); - ts.setSourceMapRange(name_32, target); - ts.setCommentRange(name_32, target); - emitAssignment(name_32, value, location, undefined); - } - } - function emitObjectLiteralAssignment(target, value, location) { - var properties = target.properties; - if (properties.length !== 1) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - } - var bindingElements = []; - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; - if (p.kind === 257 || p.kind === 258) { - if (!transformRest || - p.transformFlags & 8388608 || - (p.kind === 257 && p.initializer.transformFlags & 8388608)) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - var propName = p.name; - var bindingTarget = p.kind === 258 ? p : p.initializer || propName; - emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p); - } - else { - bindingElements.push(p); - } - } - else if (i === properties.length - 1 && - p.kind === 259 && - p.expression.kind === 70) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - var propName = p.expression; - var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target); - emitDestructuringAssignment(propName, restCall, p); - } - } - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - } - function emitArrayLiteralAssignment(target, value, location) { - if (transformRest) { - emitESNextArrayLiteralAssignment(target, value, location); - } - else { - emitES2015ArrayLiteralAssignment(target, value, location); - } - } - function emitESNextArrayLiteralAssignment(target, value, location) { - var elements = target.elements; - var numElements = elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - } - var expressions = []; - var spreadContainingExpressions = []; - for (var i = 0; i < numElements; i++) { - var e = elements[i]; - if (e.kind === 198) { - continue; - } - if (e.transformFlags & 8388608 && i < numElements - 1) { - var tmp = ts.createTempVariable(recordTempVariable); - spreadContainingExpressions.push([e, tmp]); - expressions.push(tmp); - } - else { - expressions.push(e); - } - } - emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined); - for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) { - var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1]; - emitDestructuringAssignment(e, tmp, e); - } - } - function emitES2015ArrayLiteralAssignment(target, value, location) { - var elements = target.elements; - var numElements = elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - } - for (var i = 0; i < numElements; i++) { - var e = elements[i]; - if (e.kind !== 198) { - if (e.kind !== 196) { - emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e); - } - else if (i === numElements - 1) { - emitDestructuringAssignment(e.expression, ts.createArraySlice(value, i), e); - } - } - } - } - function createRestCall(value, elements, getPropertyName, location) { - var propertyNames = []; - for (var i = 0; i < elements.length - 1; i++) { - if (ts.isOmittedExpression(elements[i])) { - continue; - } - var str = ts.createSynthesizedNode(9); - str.pos = location.pos; - str.end = location.end; - str.text = ts.getTextOfPropertyName(getPropertyName(elements[i])); - propertyNames.push(str); - } - var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]); - return ts.createCall(ts.createIdentifier("__rest"), undefined, args); - } - function emitBindingElement(target, value) { - var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer; - if (transformRest) { - value = value || initializer; - } - else if (initializer) { - value = value ? createDefaultValueCheck(value, initializer, target) : initializer; + ts.flattenDestructuringBinding = flattenDestructuringBinding; + function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) { + if (!skipInitializer) { + var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression); + if (initializer) { + value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer; } else if (!value) { value = ts.createVoidZero(); } - var name = target.name; - if (!ts.isBindingPattern(name)) { - emitAssignment(name, value, target, target); - } - else { - var numElements = name.elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, numElements !== 0, target, emitTempVariableAssignment); - } - if (name.kind === 173) { - emitArrayBindingElement(name, value); + } + var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element); + if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) { + flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) { + flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else { + flattenContext.emitBindingOrAssignment(bindingTarget, value, location, element); + } + } + function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1) { + var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var computedTempVariables; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element); + if (flattenContext.level >= 1 + && !(element.transformFlags & (524288 | 1048576)) + && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 | 1048576)) + && !ts.isComputedPropertyName(propertyName)) { + bindingElements = ts.append(bindingElements, element); } else { - emitObjectBindingElement(target, value); - } - } - } - function emitArrayBindingElement(name, value) { - if (transformRest) { - emitESNextArrayBindingElement(name, value); - } - else { - emitES2015ArrayBindingElement(name, value); - } - } - function emitES2015ArrayBindingElement(name, value) { - var elements = name.elements; - var numElements = elements.length; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (!element.dotDotDotToken) { - emitBindingElement(element, ts.createElementAccess(value, i)); - } - else if (i === numElements - 1) { - emitBindingElement(element, ts.createArraySlice(value, i)); - } - } - } - function emitESNextArrayBindingElement(name, value) { - var elements = name.elements; - var numElements = elements.length; - var bindingElements = []; - var spreadContainingElements = []; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (element.transformFlags & 8388608 && i < numElements - 1) { - spreadContainingElements.push(element); - bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value)); - } - else { - bindingElements.push(element); - } - } - emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined); - for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) { - var element = spreadContainingElements_1[_i]; - emitBindingElement(element, ts.getGeneratedNameForNode(element)); - } - } - function emitObjectBindingElement(target, value) { - var name = target.name; - var elements = name.elements; - var numElements = elements.length; - var bindingElements = []; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (i === numElements - 1 && element.dotDotDotToken) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; } - var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name); - emitBindingElement(element, restCall); - } - else if (transformRest && !(element.transformFlags & 8388608)) { - bindingElements.push(element); - } - else { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName); + if (ts.isComputedPropertyName(propertyName)) { + computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression); } - var propName = element.propertyName || element.name; - emitBindingElement(element, createDestructuringPropertyAccess(value, propName)); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); } } - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + else if (i === numElements - 1) { + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; + } + var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); } } - function createDefaultValueCheck(value, defaultValue, location) { - value = ensureIdentifier(value, true, location, emitTempVariableAssignment); - return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54), defaultValue, ts.createToken(55), value); + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); } - function createDestructuringPropertyAccess(expression, propertyName) { - if (ts.isComputedPropertyName(propertyName)) { - return ts.createElementAccess(expression, ensureIdentifier(propertyName.expression, false, propertyName, emitTempVariableAssignment)); - } - else if (ts.isLiteralExpression(propertyName)) { - var clone_2 = ts.getSynthesizedClone(propertyName); - clone_2.text = ts.unescapeIdentifier(clone_2.text); - return ts.createElementAccess(expression, clone_2); - } - else { - if (ts.isGeneratedIdentifier(propertyName)) { - var clone_3 = ts.getSynthesizedClone(propertyName); - clone_3.text = ts.unescapeIdentifier(clone_3.text); - return ts.createPropertyAccess(expression, clone_3); + } + function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) { + var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var restContainingElements; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (flattenContext.level >= 1) { + if (element.transformFlags & 1048576) { + var temp = ts.createTempVariable(undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + } + restContainingElements = ts.append(restContainingElements, [temp, element]); + bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp)); } else { - return ts.createPropertyAccess(expression, ts.createIdentifier(ts.unescapeIdentifier(propertyName.text))); + bindingElements = ts.append(bindingElements, element); } } + else if (ts.isOmittedExpression(element)) { + continue; + } + else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var rhsValue = ts.createElementAccess(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); + } + else if (i === numElements - 1) { + var rhsValue = ts.createArraySlice(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); + } + } + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern); + } + if (restContainingElements) { + for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) { + var _a = restContainingElements_1[_i], id = _a[0], element = _a[1]; + flattenBindingOrAssignmentElement(flattenContext, element, id, element); + } } } - function ensureIdentifier(value, reuseIdentifierExpressions, location, emitTempVariableAssignment, visitor) { + function createDefaultValueCheck(flattenContext, value, defaultValue, location) { + value = ensureIdentifier(flattenContext, value, true, location); + return ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value); + } + function createDestructuringPropertyAccess(flattenContext, value, propertyName) { + if (ts.isComputedPropertyName(propertyName)) { + var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, false, propertyName); + return ts.createElementAccess(value, argumentExpression); + } + else if (ts.isStringOrNumericLiteral(propertyName)) { + var argumentExpression = ts.getSynthesizedClone(propertyName); + argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text); + return ts.createElementAccess(value, argumentExpression); + } + else { + var name_33 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name_33); + } + } + function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { if (ts.isIdentifier(value) && reuseIdentifierExpressions) { return value; } else { - if (visitor) { - value = ts.visitNode(value, visitor, ts.isExpression); + var temp = ts.createTempVariable(undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + flattenContext.emitExpression(ts.createAssignment(temp, value, location)); } - return emitTempVariableAssignment(value, location); + else { + flattenContext.emitBindingOrAssignment(temp, value, location, undefined); + } + return temp; } } + function makeArrayBindingPattern(elements) { + ts.Debug.assertEachNode(elements, ts.isArrayBindingElement); + return ts.createArrayBindingPattern(elements); + } + function makeArrayAssignmentPattern(elements) { + return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement)); + } + function makeObjectBindingPattern(elements) { + ts.Debug.assertEachNode(elements, ts.isBindingElement); + return ts.createObjectBindingPattern(elements); + } + function makeObjectAssignmentPattern(elements) { + return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement)); + } + function makeBindingElement(name) { + return ts.createBindingElement(undefined, undefined, name); + } + function makeAssignmentElement(name) { + return name; + } + var restHelper = { + name: "typescript:rest", + scoped: false, + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + }; + function createRestCall(context, value, elements, computedTempVariables, location) { + context.requestEmitHelper(restHelper); + var propertyNames = []; + var computedTempVariableOffset = 0; + for (var i = 0; i < elements.length - 1; i++) { + var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]); + if (propertyName) { + if (ts.isComputedPropertyName(propertyName)) { + var temp = computedTempVariables[computedTempVariableOffset]; + computedTempVariableOffset++; + propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral("")))); + } + else { + propertyNames.push(ts.createLiteral(propertyName)); + } + } + } + return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + } })(ts || (ts = {})); var ts; (function (ts) { var USE_NEW_TYPE_METADATA_FORMAT = false; function transformTypeScript(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); @@ -38689,7 +39066,6 @@ var ts; var currentNamespaceContainerName; var currentScope; var currentScopeFirstDeclarationsOfName; - var currentExternalHelpersModuleName; var enabledSubstitutions; var classAliases; var applicableSubstitutions; @@ -38698,7 +39074,11 @@ var ts; if (ts.isDeclarationFile(node)) { return node; } - return ts.visitNode(node, visitor, ts.isSourceFile); + currentSourceFile = node; + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function saveStateAndInvoke(node, f) { var savedCurrentScope = currentScope; @@ -38711,14 +39091,29 @@ var ts; currentScope = savedCurrentScope; return visited; } + function onBeforeVisitNode(node) { + switch (node.kind) { + case 261: + case 232: + case 231: + case 204: + currentScope = node; + currentScopeFirstDeclarationsOfName = undefined; + break; + case 226: + case 225: + if (ts.hasModifier(node, 2)) { + break; + } + recordEmittedDeclarationInScope(node); + break; + } + } function visitor(node) { return saveStateAndInvoke(node, visitorWorker); } function visitorWorker(node) { - if (node.kind === 261) { - return visitSourceFile(node); - } - else if (node.transformFlags & 1) { + if (node.transformFlags & 1) { return visitTypeScript(node); } else if (node.transformFlags & 2) { @@ -38834,6 +39229,7 @@ var ts; case 145: case 228: case 147: + return undefined; case 150: return visitConstructor(node); case 227: @@ -38886,53 +39282,9 @@ var ts; return ts.visitEachChild(node, visitor, context); } } - function onBeforeVisitNode(node) { - switch (node.kind) { - case 261: - case 232: - case 231: - case 204: - currentScope = node; - currentScopeFirstDeclarationsOfName = undefined; - break; - case 226: - case 225: - if (ts.hasModifier(node, 2)) { - break; - } - recordEmittedDeclarationInScope(node); - break; - } - } function visitSourceFile(node) { - currentSourceFile = node; - if (compilerOptions.alwaysStrict && - !(ts.isExternalModule(node) && (compilerOptions.target >= 2 || compilerOptions.module === ts.ModuleKind.ES2015))) { - node = ts.ensureUseStrict(node); - } - if (node.flags & 64512 - && compilerOptions.importHelpers - && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); - var externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText); - var externalHelpersModuleImport = ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); - externalHelpersModuleImport.parent = node; - externalHelpersModuleImport.flags &= ~8; - statements.push(externalHelpersModuleImport); - currentExternalHelpersModuleName = externalHelpersModuleName; - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); - currentExternalHelpersModuleName = undefined; - node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); - node.externalHelpersModuleName = externalHelpersModuleName; - } - else { - node = ts.visitEachChild(node, sourceElementVisitor, context); - } - ts.setEmitFlags(node, 1 | ts.getEmitFlags(node)); - return node; + var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); + return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict)); } function shouldEmitDecorateCallForClass(node) { if (node.decorators && node.decorators.length > 0) { @@ -38978,7 +39330,7 @@ var ts; } if (statements.length > 1) { statements.push(ts.createEndOfDeclarationMarker(node)); - ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432); + ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152); } return ts.singleOrMany(statements); } @@ -38986,7 +39338,7 @@ var ts; var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node); var emitFlags = ts.getEmitFlags(node); if (hasStaticProperties) { - emitFlags |= 1024; + emitFlags |= 32; } ts.setOriginalNode(classDeclaration, node); ts.setEmitFlags(classDeclaration, emitFlags); @@ -39017,7 +39369,7 @@ var ts; enableSubstitutionForClassAliases(); classAliases[ts.getOriginalNodeId(node)] = ts.getSynthesizedClone(temp); } - ts.setEmitFlags(classExpression, 524288 | ts.getEmitFlags(classExpression)); + ts.setEmitFlags(classExpression, 32768 | ts.getEmitFlags(classExpression)); expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression))); ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp)); expressions.push(ts.startOnNewLine(temp)); @@ -39036,7 +39388,7 @@ var ts; } function transformConstructor(node, hasExtendsClause) { var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty); - var hasParameterPropertyAssignments = node.transformFlags & 4194304; + var hasParameterPropertyAssignments = node.transformFlags & 262144; var constructor = ts.getFirstConstructorWithBody(node); if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) { return ts.visitEachChild(constructor, visitor, context); @@ -39046,14 +39398,13 @@ var ts; return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor)); } function transformConstructorParameters(constructor) { - return constructor - ? ts.visitNodes(constructor.parameters, visitor, ts.isParameter) - : []; + return ts.visitParameterList(constructor && constructor.parameters, visitor, context) + || []; } function transformConstructorBody(node, constructor, hasExtendsClause) { var statements = []; var indexOfFirstStatement = 0; - startLexicalEnvironment(); + resumeLexicalEnvironment(); if (constructor) { indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements); var propertyAssignments = getParametersWithPropertyAssignments(constructor); @@ -39068,7 +39419,7 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement)); } ts.addRange(statements, endLexicalEnvironment()); - return ts.setMultiLine(ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined), true); + return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true); } function addPrologueDirectivesAndInitialSuperCall(ctor, result) { if (ctor.body) { @@ -39097,9 +39448,9 @@ var ts; ts.Debug.assert(ts.isIdentifier(node.name)); var name = node.name; var propertyName = ts.getMutableClone(name); - ts.setEmitFlags(propertyName, 49152 | 1536); + ts.setEmitFlags(propertyName, 1536 | 48); var localName = ts.getMutableClone(name); - ts.setEmitFlags(localName, 49152); + ts.setEmitFlags(localName, 1536); return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1))); } function getInitializedProperties(node, isStatic) { @@ -39117,8 +39468,8 @@ var ts; && member.initializer !== undefined; } function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { - var property = properties_7[_i]; + for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { + var property = properties_8[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -39127,8 +39478,8 @@ var ts; } function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { - var property = properties_8[_i]; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -39201,10 +39552,11 @@ var ts; return undefined; } var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; - if (accessor !== firstAccessor) { + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + var decorators = firstAccessorWithDecorators.decorators; var parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -39229,14 +39581,14 @@ var ts; } return { decorators: decorators }; } - function transformAllDecoratorsOfDeclaration(node, allDecorators) { + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (!allDecorators) { return undefined; } var decoratorExpressions = []; ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } function addClassElementDecorationStatements(statements, node, isStatic) { @@ -39261,7 +39613,7 @@ var ts; } function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -39272,8 +39624,8 @@ var ts; ? ts.createVoidZero() : ts.createNull() : undefined; - var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); - ts.setEmitFlags(helper, 49152); + var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); + ts.setEmitFlags(helper, 1536); return helper; } function addConstructorDecorationStatement(statements, node) { @@ -39284,15 +39636,15 @@ var ts; } function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)]; var localName = ts.getLocalName(node, false, true); - var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName); + var decorate = createDecorateHelper(context, decoratorExpressions, localName); var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate); - ts.setEmitFlags(expression, 49152); + ts.setEmitFlags(expression, 1536); ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node)); return expression; } @@ -39305,48 +39657,48 @@ var ts; expressions = []; for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) { var decorator = decorators_1[_i]; - var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset, decorator.expression); - ts.setEmitFlags(helper, 49152); + var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, decorator.expression); + ts.setEmitFlags(helper, 1536); expressions.push(helper); } } return expressions; } - function addTypeMetadata(node, decoratorExpressions) { + function addTypeMetadata(node, container, decoratorExpressions) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node, decoratorExpressions) { + function addOldTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } } } - function addNewTypeMetadata(node, decoratorExpressions) { + function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node)))); } if (properties) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true))); + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true))); } } } @@ -39361,12 +39713,16 @@ var ts; return node.kind === 149; } function shouldAddParamTypesMetadata(node) { - var kind = node.kind; - return kind === 226 - || kind === 197 - || kind === 149 - || kind === 151 - || kind === 152; + switch (node.kind) { + case 226: + case 197: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 149: + case 151: + case 152: + return true; + } + return false; } function serializeTypeOfNode(node) { switch (node.kind) { @@ -39384,18 +39740,7 @@ var ts; return ts.createVoidZero(); } } - function getRestParameterElementType(node) { - if (node && node.kind === 162) { - return node.elementType; - } - else if (node && node.kind === 157) { - return ts.singleOrUndefined(node.typeArguments); - } - else { - return undefined; - } - } - function serializeParameterTypesOfNode(node) { + function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) @@ -39403,7 +39748,7 @@ var ts; : undefined; var expressions = []; if (valueDeclaration) { - var parameters = valueDeclaration.parameters; + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; @@ -39411,7 +39756,7 @@ var ts; continue; } if (parameter.dotDotDotToken) { - expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type))); + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); } else { expressions.push(serializeTypeOfNode(parameter)); @@ -39420,6 +39765,15 @@ var ts; } return ts.createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 151) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } function serializeReturnTypeOfNode(node) { if (ts.isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); @@ -39515,7 +39869,7 @@ var ts; case ts.TypeReferenceSerializationKind.Unknown: var serialized = serializeEntityNameAsExpression(node.typeName, true); var temp = ts.createTempVariable(hoistVariableDeclaration); - return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictEquality(ts.createTypeOf(ts.createAssignment(temp, serialized)), ts.createLiteral("function")), temp), ts.createIdentifier("Object")); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object")); case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: return serializeEntityNameAsExpression(node.typeName, false); case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType: @@ -39544,14 +39898,14 @@ var ts; function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 70: - var name_33 = ts.getMutableClone(node); - name_33.flags &= ~8; - name_33.original = undefined; - name_33.parent = currentScope; + var name_34 = ts.getMutableClone(node); + name_34.flags &= ~8; + name_34.original = undefined; + name_34.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_33), ts.createLiteral("undefined")), name_33); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_34), ts.createLiteral("undefined")), name_34); } - return name_33; + return name_34; case 141: return serializeQualifiedNameAsExpression(node, useFallback); } @@ -39571,7 +39925,7 @@ var ts; return ts.createPropertyAccess(left, node.right); } function getGlobalSymbolNameWithFallback() { - return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54), ts.createIdentifier("Symbol"), ts.createToken(55), ts.createIdentifier("Object")); + return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object")); } function getExpressionForPropertyName(member, generateNameForComputedPropertyName) { var name = member.name; @@ -39581,7 +39935,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeIdentifier(name.text)); } else { return ts.getSynthesizedClone(name); @@ -39626,11 +39980,12 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setCommentRange(method, node); - ts.setSourceMapRange(method, ts.moveRangePastDecorators(node)); - ts.setOriginalNode(method, node); - return method; + var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + if (updated !== node) { + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } function shouldEmitAccessorDeclaration(node) { return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128)); @@ -39639,86 +39994,46 @@ var ts; if (!shouldEmitAccessorDeclaration(node)) { return undefined; } - var accessor = ts.createGetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node); - ts.setOriginalNode(accessor, node); - ts.setCommentRange(accessor, node); - ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node)); - return accessor; + var updated = ts.updateGetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + if (updated !== node) { + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } function visitSetAccessor(node) { if (!shouldEmitAccessorDeclaration(node)) { return undefined; } - var accessor = ts.createSetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node); - ts.setOriginalNode(accessor, node); - ts.setCommentRange(accessor, node); - ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node)); - return accessor; + var updated = ts.updateSetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + if (updated !== node) { + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } function visitFunctionDeclaration(node) { if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createNotEmittedStatement(node); } - var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); + var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isNamespaceExport(node)) { - var statements = [func]; + var statements = [updated]; addExportMemberAssignment(statements, node); return statements; } - return func; + return updated; } function visitFunctionExpression(node) { if (ts.nodeIsMissing(node.body)) { return ts.createOmittedExpression(); } - var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); - return func; + var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + return updated; } function visitArrowFunction(node) { - var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node); - ts.setOriginalNode(func, node); - return func; - } - function transformFunctionBody(node) { - return transformFunctionBodyWorker(node.body); - } - function transformFunctionBodyWorker(body, start) { - if (start === void 0) { start = 0; } - var savedCurrentScope = currentScope; - var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; - currentScope = body; - currentScopeFirstDeclarationsOfName = ts.createMap(); - startLexicalEnvironment(); - var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start); - var visited = ts.updateBlock(body, statements); - var declarations = endLexicalEnvironment(); - currentScope = savedCurrentScope; - currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - } - function transformConciseBody(node) { - return transformConciseBodyWorker(node.body, false); - } - function transformConciseBodyWorker(body, forceBlockFunctionBody) { - if (ts.isBlock(body)) { - return transformFunctionBodyWorker(body); - } - else { - startLexicalEnvironment(); - var visited = ts.visitNode(body, visitor, ts.isConciseBody); - var declarations = endLexicalEnvironment(); - var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - if (forceBlockFunctionBody && !ts.isBlock(merged)) { - return ts.createBlock([ - ts.createReturn(merged) - ]); - } - else { - return merged; - } - } + var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + return updated; } function visitParameter(node) { if (ts.parameterIsThisKeyword(node)) { @@ -39728,7 +40043,7 @@ var ts; ts.setOriginalNode(parameter, node); ts.setCommentRange(parameter, node); ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); - ts.setEmitFlags(parameter.name, 1024); + ts.setEmitFlags(parameter.name, 32); return parameter; } function visitVariableStatement(node) { @@ -39746,7 +40061,7 @@ var ts; function transformInitializedVariable(node) { var name = node.name; if (ts.isBindingPattern(name)) { - return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor); + return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression); } else { return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node); @@ -39787,10 +40102,10 @@ var ts; return undefined; } var statements = []; - var emitFlags = 64; + var emitFlags = 2; if (addVarForEnumOrModuleDeclaration(statements, node)) { if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= 16384; + emitFlags |= 512; } } var parameterName = getNamespaceParameterName(node); @@ -39861,9 +40176,9 @@ var ts; } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_34 = node.symbol && node.symbol.name; - if (name_34) { - return currentScopeFirstDeclarationsOfName[name_34] === node; + var name_35 = node.symbol && node.symbol.name; + if (name_35) { + return currentScopeFirstDeclarationsOfName[name_35] === node; } } return false; @@ -39882,13 +40197,13 @@ var ts; ts.setSourceMapRange(statement, node); } ts.setCommentRange(statement, node); - ts.setEmitFlags(statement, 32768 | 33554432); + ts.setEmitFlags(statement, 1024 | 2097152); statements.push(statement); return true; } else { var mergeMarker = ts.createMergeDeclarationMarker(statement); - ts.setEmitFlags(mergeMarker, 49152 | 33554432); + ts.setEmitFlags(mergeMarker, 1536 | 2097152); statements.push(mergeMarker); return false; } @@ -39900,10 +40215,10 @@ var ts; ts.Debug.assert(ts.isIdentifier(node.name), "TypeScript module should have an Identifier name."); enableSubstitutionForNamespaceExports(); var statements = []; - var emitFlags = 64; + var emitFlags = 2; if (addVarForEnumOrModuleDeclaration(statements, node)) { if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= 16384; + emitFlags |= 512; } } var parameterName = getNamespaceParameterName(node); @@ -39959,7 +40274,7 @@ var ts; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); if (body.kind !== 231) { - ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152); + ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } @@ -40034,7 +40349,7 @@ var ts; return undefined; } var moduleReference = ts.createExpressionFromEntityName(node.moduleReference); - ts.setEmitFlags(moduleReference, 49152 | 65536); + ts.setEmitFlags(moduleReference, 1536 | 2048); if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node) @@ -40152,14 +40467,14 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2) { - var name_35 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_35); + var name_36 = node.name; + var exportedName = trySubstituteNamespaceExportedName(name_36); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_35, initializer, node); + return ts.createPropertyAssignment(name_36, initializer, node); } - return ts.createPropertyAssignment(name_35, exportedName, node); + return ts.createPropertyAssignment(name_36, exportedName, node); } } return node; @@ -40187,10 +40502,10 @@ var ts; if (declaration) { var classAlias = classAliases[declaration.id]; if (classAlias) { - var clone_4 = ts.getSynthesizedClone(classAlias); - ts.setSourceMapRange(clone_4, node); - ts.setCommentRange(clone_4, node); - return clone_4; + var clone_2 = ts.getSynthesizedClone(classAlias); + ts.setSourceMapRange(clone_2, node); + ts.setCommentRange(clone_2, node); + return clone_2; } } } @@ -40198,7 +40513,7 @@ var ts; return undefined; } function trySubstituteNamespaceExportedName(node) { - if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) { + if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); if (container && container.kind !== 261) { var substitute = (applicableSubstitutions & 2 && container.kind === 230) || @@ -40243,10 +40558,278 @@ var ts; } } ts.transformTypeScript = transformTypeScript; + var paramHelper = { + name: "typescript:param", + scoped: false, + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + }; + function createParamHelper(context, expression, parameterOffset, location) { + context.requestEmitHelper(paramHelper); + return ts.createCall(ts.getHelperName("__param"), undefined, [ + ts.createLiteral(parameterOffset), + expression + ], location); + } + var metadataHelper = { + name: "typescript:metadata", + scoped: false, + priority: 3, + text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" + }; + function createMetadataHelper(context, metadataKey, metadataValue) { + context.requestEmitHelper(metadataHelper); + return ts.createCall(ts.getHelperName("__metadata"), undefined, [ + ts.createLiteral(metadataKey), + metadataValue + ]); + } + var decorateHelper = { + name: "typescript:decorate", + scoped: false, + priority: 2, + text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" + }; + function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { + context.requestEmitHelper(decorateHelper); + var argumentsArray = []; + argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + return ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray, location); + } +})(ts || (ts = {})); +var ts; +(function (ts) { + function transformESNext(context) { + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + function visitor(node) { + return visitorWorker(node, false); + } + function visitorNoDestructuringValue(node) { + return visitorWorker(node, true); + } + function visitorWorker(node, noDestructuringValue) { + if ((node.transformFlags & 8) === 0) { + return node; + } + switch (node.kind) { + case 176: + return visitObjectLiteralExpression(node); + case 192: + return visitBinaryExpression(node, noDestructuringValue); + case 223: + return visitVariableDeclaration(node); + case 213: + return visitForOfStatement(node); + case 211: + return visitForStatement(node); + case 188: + return visitVoidExpression(node); + case 150: + return visitConstructorDeclaration(node); + case 149: + return visitMethodDeclaration(node); + case 151: + return visitGetAccessorDeclaration(node); + case 152: + return visitSetAccessorDeclaration(node); + case 225: + return visitFunctionDeclaration(node); + case 184: + return visitFunctionExpression(node); + case 185: + return visitArrowFunction(node); + case 144: + return visitParameter(node); + case 207: + return visitExpressionStatement(node); + case 183: + return visitParenthesizedExpression(node, noDestructuringValue); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function chunkObjectLiteralElements(elements) { + var chunkObject; + var objects = []; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var e = elements_3[_i]; + if (e.kind === 259) { + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + chunkObject = undefined; + } + var target = e.expression; + objects.push(ts.visitNode(target, visitor, ts.isExpression)); + } + else { + if (!chunkObject) { + chunkObject = []; + } + if (e.kind === 257) { + var p = e; + chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); + } + else { + chunkObject.push(e); + } + } + } + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + } + return objects; + } + function visitObjectLiteralExpression(node) { + if (node.transformFlags & 1048576) { + var objects = chunkObjectLiteralElements(node.properties); + if (objects.length && objects[0].kind !== 176) { + objects.unshift(ts.createObjectLiteral()); + } + return createAssignHelper(context, objects); + } + return ts.visitEachChild(node, visitor, context); + } + function visitExpressionStatement(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + function visitParenthesizedExpression(node, noDestructuringValue) { + return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context); + } + function visitBinaryExpression(node, noDestructuringValue) { + if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) { + return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue); + } + else if (node.operatorToken.kind === 25) { + return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + function visitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576) { + return ts.flattenDestructuringBinding(node, visitor, context, 1); + } + return ts.visitEachChild(node, visitor, context); + } + function visitForStatement(node) { + return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement)); + } + function visitVoidExpression(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + function visitForOfStatement(node) { + var leadingStatements; + var temp; + var initializer = ts.skipParentheses(node.initializer); + if (initializer.transformFlags & 1048576) { + if (ts.isVariableDeclarationList(initializer)) { + temp = ts.createTempVariable(undefined); + var firstDeclaration = ts.firstOrUndefined(initializer.declarations); + var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer); + leadingStatements = ts.append(leadingStatements, statement); + } + } + else if (ts.isAssignmentPattern(initializer)) { + temp = ts.createTempVariable(undefined); + var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1); + leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer)); + } + } + if (temp) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var block = ts.isBlock(statement) + ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements)) + : ts.createBlock(ts.append(leadingStatements, statement), statement, true); + return ts.updateForOf(node, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(temp, undefined, undefined, node.initializer) + ], node.initializer, 1), expression, block); + } + return ts.visitEachChild(node, visitor, context); + } + function visitParameter(node) { + if (node.transformFlags & 1048576) { + return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + function visitConstructorDeclaration(node) { + return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + } + function visitGetAccessorDeclaration(node) { + return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitSetAccessorDeclaration(node) { + return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + } + function visitMethodDeclaration(node) { + return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitFunctionDeclaration(node) { + return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitArrowFunction(node) { + return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function visitFunctionExpression(node) { + return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + } + function transformFunctionBody(node) { + resumeLexicalEnvironment(); + var leadingStatements; + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (parameter.transformFlags & 1048576) { + var temp = ts.getGeneratedNameForNode(parameter); + var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations)); + ts.setEmitFlags(statement, 524288); + leadingStatements = ts.append(leadingStatements, statement); + } + } + } + var body = ts.visitNode(node.body, visitor, ts.isConciseBody); + var trailingStatements = endLexicalEnvironment(); + if (ts.some(leadingStatements) || ts.some(trailingStatements)) { + var block = ts.convertToFunctionBody(body, true); + return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements)); + } + return body; + } + } + ts.transformESNext = transformESNext; + var assignHelper = { + name: "typescript:assign", + scoped: false, + priority: 1, + text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" + }; + function createAssignHelper(context, attributesSegments) { + context.requestEmitHelper(assignHelper); + return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments); + } + ts.createAssignHelper = createAssignHelper; })(ts || (ts = {})); var ts; (function (ts) { - var entities = createEntitiesMap(); function transformJsx(context) { var compilerOptions = context.getCompilerOptions(); var currentSourceFile; @@ -40256,17 +40839,15 @@ var ts; return node; } currentSourceFile = node; - node = ts.visitEachChild(node, visitor, context); + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; - return node; + return visited; } function visitor(node) { if (node.transformFlags & 4) { return visitorWorker(node); } - else if (node.transformFlags & 8) { - return ts.visitEachChild(node, visitor, context); - } else { return node; } @@ -40280,8 +40861,7 @@ var ts; case 252: return visitJsxExpression(node); default: - ts.Debug.failBadSyntaxKind(node); - return undefined; + return ts.visitEachChild(node, visitor, context); } } function transformJsxChildToExpression(node) { @@ -40319,8 +40899,10 @@ var ts; if (ts.isJsxSpreadAttribute(attrs[0])) { segments.unshift(ts.createObjectLiteral()); } - objectProperties = ts.singleOrUndefined(segments) - || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments); + objectProperties = ts.singleOrUndefined(segments); + if (!objectProperties) { + objectProperties = ts.createAssignHelper(context, segments); + } } var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location); if (isChild) { @@ -40413,12 +40995,12 @@ var ts; return getTagName(node.openingElement); } else { - var name_36 = node.tagName; - if (ts.isIdentifier(name_36) && ts.isIntrinsicJsxName(name_36.text)) { - return ts.createLiteral(name_36.text); + var name_37 = node.tagName; + if (ts.isIdentifier(name_37) && ts.isIntrinsicJsxName(name_37.text)) { + return ts.createLiteral(name_37.text); } else { - return ts.createExpressionFromEntityName(name_36); + return ts.createExpressionFromEntityName(name_37); } } } @@ -40436,455 +41018,291 @@ var ts; } } ts.transformJsx = transformJsx; - function createEntitiesMap() { - return ts.createMap({ - "quot": 0x0022, - "amp": 0x0026, - "apos": 0x0027, - "lt": 0x003C, - "gt": 0x003E, - "nbsp": 0x00A0, - "iexcl": 0x00A1, - "cent": 0x00A2, - "pound": 0x00A3, - "curren": 0x00A4, - "yen": 0x00A5, - "brvbar": 0x00A6, - "sect": 0x00A7, - "uml": 0x00A8, - "copy": 0x00A9, - "ordf": 0x00AA, - "laquo": 0x00AB, - "not": 0x00AC, - "shy": 0x00AD, - "reg": 0x00AE, - "macr": 0x00AF, - "deg": 0x00B0, - "plusmn": 0x00B1, - "sup2": 0x00B2, - "sup3": 0x00B3, - "acute": 0x00B4, - "micro": 0x00B5, - "para": 0x00B6, - "middot": 0x00B7, - "cedil": 0x00B8, - "sup1": 0x00B9, - "ordm": 0x00BA, - "raquo": 0x00BB, - "frac14": 0x00BC, - "frac12": 0x00BD, - "frac34": 0x00BE, - "iquest": 0x00BF, - "Agrave": 0x00C0, - "Aacute": 0x00C1, - "Acirc": 0x00C2, - "Atilde": 0x00C3, - "Auml": 0x00C4, - "Aring": 0x00C5, - "AElig": 0x00C6, - "Ccedil": 0x00C7, - "Egrave": 0x00C8, - "Eacute": 0x00C9, - "Ecirc": 0x00CA, - "Euml": 0x00CB, - "Igrave": 0x00CC, - "Iacute": 0x00CD, - "Icirc": 0x00CE, - "Iuml": 0x00CF, - "ETH": 0x00D0, - "Ntilde": 0x00D1, - "Ograve": 0x00D2, - "Oacute": 0x00D3, - "Ocirc": 0x00D4, - "Otilde": 0x00D5, - "Ouml": 0x00D6, - "times": 0x00D7, - "Oslash": 0x00D8, - "Ugrave": 0x00D9, - "Uacute": 0x00DA, - "Ucirc": 0x00DB, - "Uuml": 0x00DC, - "Yacute": 0x00DD, - "THORN": 0x00DE, - "szlig": 0x00DF, - "agrave": 0x00E0, - "aacute": 0x00E1, - "acirc": 0x00E2, - "atilde": 0x00E3, - "auml": 0x00E4, - "aring": 0x00E5, - "aelig": 0x00E6, - "ccedil": 0x00E7, - "egrave": 0x00E8, - "eacute": 0x00E9, - "ecirc": 0x00EA, - "euml": 0x00EB, - "igrave": 0x00EC, - "iacute": 0x00ED, - "icirc": 0x00EE, - "iuml": 0x00EF, - "eth": 0x00F0, - "ntilde": 0x00F1, - "ograve": 0x00F2, - "oacute": 0x00F3, - "ocirc": 0x00F4, - "otilde": 0x00F5, - "ouml": 0x00F6, - "divide": 0x00F7, - "oslash": 0x00F8, - "ugrave": 0x00F9, - "uacute": 0x00FA, - "ucirc": 0x00FB, - "uuml": 0x00FC, - "yacute": 0x00FD, - "thorn": 0x00FE, - "yuml": 0x00FF, - "OElig": 0x0152, - "oelig": 0x0153, - "Scaron": 0x0160, - "scaron": 0x0161, - "Yuml": 0x0178, - "fnof": 0x0192, - "circ": 0x02C6, - "tilde": 0x02DC, - "Alpha": 0x0391, - "Beta": 0x0392, - "Gamma": 0x0393, - "Delta": 0x0394, - "Epsilon": 0x0395, - "Zeta": 0x0396, - "Eta": 0x0397, - "Theta": 0x0398, - "Iota": 0x0399, - "Kappa": 0x039A, - "Lambda": 0x039B, - "Mu": 0x039C, - "Nu": 0x039D, - "Xi": 0x039E, - "Omicron": 0x039F, - "Pi": 0x03A0, - "Rho": 0x03A1, - "Sigma": 0x03A3, - "Tau": 0x03A4, - "Upsilon": 0x03A5, - "Phi": 0x03A6, - "Chi": 0x03A7, - "Psi": 0x03A8, - "Omega": 0x03A9, - "alpha": 0x03B1, - "beta": 0x03B2, - "gamma": 0x03B3, - "delta": 0x03B4, - "epsilon": 0x03B5, - "zeta": 0x03B6, - "eta": 0x03B7, - "theta": 0x03B8, - "iota": 0x03B9, - "kappa": 0x03BA, - "lambda": 0x03BB, - "mu": 0x03BC, - "nu": 0x03BD, - "xi": 0x03BE, - "omicron": 0x03BF, - "pi": 0x03C0, - "rho": 0x03C1, - "sigmaf": 0x03C2, - "sigma": 0x03C3, - "tau": 0x03C4, - "upsilon": 0x03C5, - "phi": 0x03C6, - "chi": 0x03C7, - "psi": 0x03C8, - "omega": 0x03C9, - "thetasym": 0x03D1, - "upsih": 0x03D2, - "piv": 0x03D6, - "ensp": 0x2002, - "emsp": 0x2003, - "thinsp": 0x2009, - "zwnj": 0x200C, - "zwj": 0x200D, - "lrm": 0x200E, - "rlm": 0x200F, - "ndash": 0x2013, - "mdash": 0x2014, - "lsquo": 0x2018, - "rsquo": 0x2019, - "sbquo": 0x201A, - "ldquo": 0x201C, - "rdquo": 0x201D, - "bdquo": 0x201E, - "dagger": 0x2020, - "Dagger": 0x2021, - "bull": 0x2022, - "hellip": 0x2026, - "permil": 0x2030, - "prime": 0x2032, - "Prime": 0x2033, - "lsaquo": 0x2039, - "rsaquo": 0x203A, - "oline": 0x203E, - "frasl": 0x2044, - "euro": 0x20AC, - "image": 0x2111, - "weierp": 0x2118, - "real": 0x211C, - "trade": 0x2122, - "alefsym": 0x2135, - "larr": 0x2190, - "uarr": 0x2191, - "rarr": 0x2192, - "darr": 0x2193, - "harr": 0x2194, - "crarr": 0x21B5, - "lArr": 0x21D0, - "uArr": 0x21D1, - "rArr": 0x21D2, - "dArr": 0x21D3, - "hArr": 0x21D4, - "forall": 0x2200, - "part": 0x2202, - "exist": 0x2203, - "empty": 0x2205, - "nabla": 0x2207, - "isin": 0x2208, - "notin": 0x2209, - "ni": 0x220B, - "prod": 0x220F, - "sum": 0x2211, - "minus": 0x2212, - "lowast": 0x2217, - "radic": 0x221A, - "prop": 0x221D, - "infin": 0x221E, - "ang": 0x2220, - "and": 0x2227, - "or": 0x2228, - "cap": 0x2229, - "cup": 0x222A, - "int": 0x222B, - "there4": 0x2234, - "sim": 0x223C, - "cong": 0x2245, - "asymp": 0x2248, - "ne": 0x2260, - "equiv": 0x2261, - "le": 0x2264, - "ge": 0x2265, - "sub": 0x2282, - "sup": 0x2283, - "nsub": 0x2284, - "sube": 0x2286, - "supe": 0x2287, - "oplus": 0x2295, - "otimes": 0x2297, - "perp": 0x22A5, - "sdot": 0x22C5, - "lceil": 0x2308, - "rceil": 0x2309, - "lfloor": 0x230A, - "rfloor": 0x230B, - "lang": 0x2329, - "rang": 0x232A, - "loz": 0x25CA, - "spades": 0x2660, - "clubs": 0x2663, - "hearts": 0x2665, - "diams": 0x2666 - }); - } -})(ts || (ts = {})); -var ts; -(function (ts) { - function transformESNext(context) { - var hoistVariableDeclaration = context.hoistVariableDeclaration; - var currentSourceFile; - return transformSourceFile; - function transformSourceFile(node) { - currentSourceFile = node; - return ts.visitEachChild(node, visitor, context); - } - function visitor(node) { - if (node.transformFlags & 16) { - return visitorWorker(node); - } - else if (node.transformFlags & 32) { - return ts.visitEachChild(node, visitor, context); - } - else { - return node; - } - } - function visitorWorker(node) { - switch (node.kind) { - case 176: - return visitObjectLiteralExpression(node); - case 192: - return visitBinaryExpression(node); - case 223: - return visitVariableDeclaration(node); - case 213: - return visitForOfStatement(node); - case 172: - case 173: - return node; - case 225: - return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); - case 185: - return visitArrowFunction(node); - case 144: - return visitParameter(node); - default: - ts.Debug.failBadSyntaxKind(node); - return ts.visitEachChild(node, visitor, context); - } - } - function chunkObjectLiteralElements(elements) { - var chunkObject; - var objects = []; - for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { - var e = elements_3[_i]; - if (e.kind === 259) { - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - chunkObject = undefined; - } - var target = e.expression; - objects.push(ts.visitNode(target, visitor, ts.isExpression)); - } - else { - if (!chunkObject) { - chunkObject = []; - } - if (e.kind === 257) { - var p = e; - chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); - } - else { - chunkObject.push(e); - } - } - } - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - } - return objects; - } - function visitObjectLiteralExpression(node) { - var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176) { - objects.unshift(ts.createObjectLiteral()); - } - return ts.createCall(ts.createIdentifier("__assign"), undefined, objects); - } - function visitBinaryExpression(node) { - if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48) { - return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, visitor, true); - } - return ts.visitEachChild(node, visitor, context); - } - function visitVariableDeclaration(node) { - if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48) { - var result = ts.flattenVariableDestructuring(node, undefined, visitor, undefined, true); - return result; - } - return ts.visitEachChild(node, visitor, context); - } - function visitForOfStatement(node) { - var initializer = node.initializer; - if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) { - return ts.visitEachChild(node, visitor, context); - } - return ts.convertForOf(node, undefined, visitor, ts.noop, context, true); - } - function isRestBindingPattern(initializer) { - if (ts.isVariableDeclarationList(initializer)) { - var declaration = ts.firstOrUndefined(initializer.declarations); - return declaration && declaration.name && - declaration.name.kind === 172 && - !!(declaration.name.transformFlags & 8388608); - } - return false; - } - function isRestAssignment(initializer) { - return initializer.kind === 176 && - initializer.transformFlags & 8388608; - } - function visitParameter(node) { - if (isObjectRestParameter(node)) { - return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, node.initializer, node), node); - } - else { - return node; - } - } - function isObjectRestParameter(node) { - return node.name && - node.name.kind === 172 && - !!(node.name.transformFlags & 8388608); - } - function visitFunctionDeclaration(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) : - ts.visitEachChild(node.body, visitor, context); - return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node); - } - function visitArrowFunction(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) : - ts.visitEachChild(node.body, visitor, context); - var func = ts.setOriginalNode(ts.createArrowFunction(undefined, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, body, node), node); - ts.setEmitFlags(func, 256); - return func; - } - function visitFunctionExpression(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) : - ts.visitEachChild(node.body, visitor, context); - return ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node); - } - } - ts.transformESNext = transformESNext; + var entities = ts.createMap({ + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + }); })(ts || (ts = {})); var ts; (function (ts) { function transformES2017(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var resolver = context.getEmitResolver(); var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); - var currentSourceFileExternalHelpersModuleName; + var currentSourceFile; var enabledSubstitutions; - var applicableSubstitutions; var currentSuperContainer; var previousOnEmitNode = context.onEmitNode; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - var currentScope; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } - currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName; - return ts.visitEachChild(node, visitor, context); + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function visitor(node) { - if (node.transformFlags & 64) { - return visitorWorker(node); + if ((node.transformFlags & 16) === 0) { + return node; } - else if (node.transformFlags & 128) { - return ts.visitEachChild(node, visitor, context); - } - return node; - } - function visitorWorker(node) { switch (node.kind) { case 119: return undefined; @@ -40899,68 +41317,37 @@ var ts; case 185: return visitArrowFunction(node); default: - ts.Debug.failBadSyntaxKind(node); - return node; + return ts.visitEachChild(node, visitor, context); } } function visitAwaitExpression(node) { return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node); } function visitMethodDeclaration(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setCommentRange(method, node); - ts.setSourceMapRange(method, ts.moveRangePastDecorators(node)); - ts.setOriginalNode(method, node); - return method; + return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitFunctionDeclaration(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); - return func; + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitFunctionExpression(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } if (ts.nodeIsMissing(node.body)) { return ts.createOmittedExpression(); } - var func = ts.createFunctionExpression(undefined, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node); - ts.setOriginalNode(func, node); - return func; + return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitArrowFunction(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node); - ts.setOriginalNode(func, node); - return func; - } - function transformFunctionBody(node) { - return transformAsyncFunctionBody(node); - } - function transformConciseBody(node) { - return transformAsyncFunctionBody(node); - } - function transformFunctionBodyWorker(body, start) { - if (start === void 0) { start = 0; } - var savedCurrentScope = currentScope; - currentScope = body; - startLexicalEnvironment(); - var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start); - var visited = ts.updateBlock(body, statements); - var declarations = endLexicalEnvironment(); - currentScope = savedCurrentScope; - return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; @@ -40969,52 +41356,49 @@ var ts; if (!isArrowFunction) { var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor); - statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(statements, node.body, true); if (languageVersion >= 2) { if (resolver.getNodeCheckFlags(node) & 4096) { enableSubstitutionForAsyncMethodsWithSuper(); - ts.setEmitFlags(block, 8); + ts.addEmitHelper(block, advancedAsyncSuperHelper); } else if (resolver.getNodeCheckFlags(node) & 2048) { enableSubstitutionForAsyncMethodsWithSuper(); - ts.setEmitFlags(block, 4); + ts.addEmitHelper(block, asyncSuperHelper); } } return block; } else { - return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, true)); + var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(expression); + return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements)); + } + return expression; } } - function transformConciseBodyWorker(body, forceBlockFunctionBody) { + function transformFunctionBodyWorker(body, start) { if (ts.isBlock(body)) { - return transformFunctionBodyWorker(body); + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); } else { startLexicalEnvironment(); - var visited = ts.visitNode(body, visitor, ts.isConciseBody); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); var declarations = endLexicalEnvironment(); - var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - if (forceBlockFunctionBody && !ts.isBlock(merged)) { - return ts.createBlock([ - ts.createReturn(merged) - ]); - } - else { - return merged; - } + return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); } } function getPromiseConstructor(type) { - if (type) { - var typeName = ts.getEntityNameFromTypeNode(type); - if (typeName && ts.isEntityName(typeName)) { - var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); - if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue - || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { - return typeName; - } + var typeName = type && ts.getEntityNameFromTypeNode(type); + if (typeName && ts.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { + return typeName; } } return undefined; @@ -41088,14 +41472,15 @@ var ts; || kind === 152; } function onEmitNode(emitContext, node, emitCallback) { - var savedApplicableSubstitutions = applicableSubstitutions; - var savedCurrentSuperContainer = currentSuperContainer; if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var savedCurrentSuperContainer = currentSuperContainer; currentSuperContainer = node; + previousOnEmitNode(emitContext, node, emitCallback); + currentSuperContainer = savedCurrentSuperContainer; + } + else { + previousOnEmitNode(emitContext, node, emitCallback); } - previousOnEmitNode(emitContext, node, emitCallback); - applicableSubstitutions = savedApplicableSubstitutions; - currentSuperContainer = savedCurrentSuperContainer; } function onSubstituteNode(emitContext, node) { node = previousOnSubstituteNode(emitContext, node); @@ -41118,6 +41503,33 @@ var ts; } } ts.transformES2017 = transformES2017; + function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(awaiterHelper); + var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; + return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ + ts.createThis(), + hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), + promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), + generatorFunc + ]); + } + var awaiterHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };" + }; + var asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: "\n const _super = name => super[name];" + }; + var advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" + }; })(ts || (ts = {})); var ts; (function (ts) { @@ -41131,55 +41543,52 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitor(node) { - if (node.transformFlags & 256) { - return visitorWorker(node); - } - else if (node.transformFlags & 512) { - return ts.visitEachChild(node, visitor, context); - } - else { + if ((node.transformFlags & 32) === 0) { return node; } - } - function visitorWorker(node) { switch (node.kind) { case 192: return visitBinaryExpression(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitBinaryExpression(node) { + switch (node.operatorToken.kind) { + case 61: + return visitExponentiationAssignmentExpression(node); + case 39: + return visitExponentiationExpression(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function visitExponentiationAssignmentExpression(node) { + var target; + var value; var left = ts.visitNode(node.left, visitor, ts.isExpression); var right = ts.visitNode(node.right, visitor, ts.isExpression); - if (node.operatorToken.kind === 61) { - var target = void 0; - var value = void 0; - if (ts.isElementAccessExpression(left)) { - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left); - value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left); - } - else if (ts.isPropertyAccessExpression(left)) { - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left); - value = ts.createPropertyAccess(expressionTemp, left.name, left); - } - else { - target = left; - value = left; - } - return ts.createAssignment(target, ts.createMathPow(value, right, node), node); + if (ts.isElementAccessExpression(left)) { + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left); + value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left); } - else if (node.operatorToken.kind === 39) { - return ts.createMathPow(left, right, node); + else if (ts.isPropertyAccessExpression(left)) { + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left); + value = ts.createPropertyAccess(expressionTemp, left.name, left); } else { - ts.Debug.failBadSyntaxKind(node); - return ts.visitEachChild(node, visitor, context); + target = left; + value = left; } + return ts.createAssignment(target, ts.createMathPow(value, right, node), node); + } + function visitExponentiationExpression(node) { + var left = ts.visitNode(node.left, visitor, ts.isExpression); + var right = ts.visitNode(node.right, visitor, ts.isExpression); + return ts.createMathPow(left, right, node); } } ts.transformES2016 = transformES2016; @@ -41187,7 +41596,7 @@ var ts; var ts; (function (ts) { function transformES2015(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -41213,7 +41622,11 @@ var ts; } currentSourceFile = node; currentText = node.text; - return ts.visitNode(node, visitor, ts.isSourceFile); + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + currentText = undefined; + return visited; } function visitor(node) { return saveStateAndInvoke(node, dispatcher); @@ -41252,6 +41665,38 @@ var ts; currentNode = savedCurrentNode; return visited; } + function onBeforeVisitNode(node) { + if (currentNode) { + if (ts.isBlockScope(currentNode, currentParent)) { + enclosingBlockScopeContainer = currentNode; + enclosingBlockScopeContainerParent = currentParent; + } + if (ts.isFunctionLike(currentNode)) { + enclosingFunction = currentNode; + if (currentNode.kind !== 185) { + enclosingNonArrowFunction = currentNode; + if (!(ts.getEmitFlags(currentNode) & 131072)) { + enclosingNonAsyncFunctionBody = currentNode; + } + } + } + switch (currentNode.kind) { + case 205: + enclosingVariableStatement = currentNode; + break; + case 224: + case 223: + case 174: + case 172: + case 173: + break; + default: + enclosingVariableStatement = undefined; + } + } + currentParent = currentNode; + currentNode = node; + } function returnCapturedThis(node) { return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } @@ -41259,7 +41704,7 @@ var ts; return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression; } function shouldCheckNode(node) { - return (node.transformFlags & 1024) !== 0 || + return (node.transformFlags & 64) !== 0 || node.kind === 219 || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); } @@ -41270,7 +41715,7 @@ var ts; else if (shouldCheckNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 2048 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { + else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { return ts.visitEachChild(node, visitor, context); } else { @@ -41370,14 +41815,14 @@ var ts; return visitTemplateExpression(node); case 195: return visitYieldExpression(node); + case 196: + return visitSpreadElement(node); case 96: return visitSuperKeyword(); case 195: return ts.visitEachChild(node, visitor, context); case 149: return visitMethodDeclaration(node); - case 261: - return visitSourceFileNode(node); case 205: return visitVariableStatement(node); default: @@ -41385,37 +41830,14 @@ var ts; return ts.visitEachChild(node, visitor, context); } } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 2097152)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - switch (currentNode.kind) { - case 205: - enclosingVariableStatement = currentNode; - break; - case 224: - case 223: - case 174: - case 172: - case 173: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; + function visitSourceFile(node) { + var statements = []; + startLexicalEnvironment(); + var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); + addCaptureThisForNodeIfNeeded(statements, node); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + ts.addRange(statements, endLexicalEnvironment()); + return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); } function visitSwitchStatement(node) { ts.Debug.assert(convertedLoopState !== undefined); @@ -41517,9 +41939,9 @@ var ts; statements.push(exportStatement); } var emitFlags = ts.getEmitFlags(node); - if ((emitFlags & 33554432) === 0) { + if ((emitFlags & 2097152) === 0) { statements.push(ts.createEndOfDeclarationMarker(node)); - ts.setEmitFlags(statement, emitFlags | 33554432); + ts.setEmitFlags(statement, emitFlags | 2097152); } return ts.singleOrMany(statements); } @@ -41532,15 +41954,15 @@ var ts; } var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node); var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, "_super")] : [], undefined, transformClassBody(node, extendsClauseElement)); - if (ts.getEmitFlags(node) & 524288) { - ts.setEmitFlags(classFunction, 524288); + if (ts.getEmitFlags(node) & 32768) { + ts.setEmitFlags(classFunction, 32768); } var inner = ts.createPartiallyEmittedExpression(classFunction); inner.end = node.end; - ts.setEmitFlags(inner, 49152); + ts.setEmitFlags(inner, 1536); var outer = ts.createPartiallyEmittedExpression(inner); outer.end = ts.skipTrivia(currentText, node.pos); - ts.setEmitFlags(outer, 49152); + ts.setEmitFlags(outer, 1536); return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)] : [])); @@ -41555,19 +41977,19 @@ var ts; var localName = ts.getLocalName(node); var outer = ts.createPartiallyEmittedExpression(localName); outer.end = closingBraceLocation.end; - ts.setEmitFlags(outer, 49152); + ts.setEmitFlags(outer, 1536); var statement = ts.createReturn(outer); statement.pos = closingBraceLocation.pos; - ts.setEmitFlags(statement, 49152 | 12288); + ts.setEmitFlags(statement, 1536 | 384); statements.push(statement); ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true); - ts.setEmitFlags(block, 49152); + ts.setEmitFlags(block, 1536); return block; } function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { - statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)), extendsClauseElement)); + statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement)); } } function addConstructor(statements, node, extendsClauseElement) { @@ -41575,29 +41997,27 @@ var ts; var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node); if (extendsClauseElement) { - ts.setEmitFlags(constructorFunction, 256); + ts.setEmitFlags(constructorFunction, 8); } statements.push(constructorFunction); } function transformConstructorParameters(constructor, hasSynthesizedSuper) { - if (constructor && !hasSynthesizedSuper) { - return ts.visitNodes(constructor.parameters, visitor, ts.isParameter); - } - return []; + return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) + || []; } function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { var statements = []; - startLexicalEnvironment(); + resumeLexicalEnvironment(); var statementOffset = -1; if (hasSynthesizedSuper) { - statementOffset = 1; + statementOffset = 0; } else if (constructor) { statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor); } if (constructor) { - ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, false); - ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + addDefaultValueAssignmentsIfNeeded(statements, constructor); + addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); @@ -41619,7 +42039,7 @@ var ts; ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true); if (!constructor) { - ts.setEmitFlags(block, 49152); + ts.setEmitFlags(block, 1536); } return block; } @@ -41645,7 +42065,7 @@ var ts; function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { if (!hasExtendsClause) { if (ctor) { - ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis); + addCaptureThisForNodeIfNeeded(statements, ctor); } return 0; } @@ -41654,7 +42074,7 @@ var ts; return 2; } if (hasSynthesizedSuper) { - ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); + captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); enableSubstitutionsForCapturedThis(); return 1; } @@ -41668,11 +42088,19 @@ var ts; superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); } } - if (superCallExpression && statementOffset === ctorStatements.length - 1) { - statements.push(ts.createReturn(superCallExpression)); + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 | 32768))) { + var returnStatement = ts.createReturn(superCallExpression); + if (superCallExpression.kind !== 192 + || superCallExpression.left.kind !== 179) { + ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); + } + ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); + statements.push(returnStatement); return 2; } - ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement); + captureThisForNode(statements, ctor, superCallExpression, firstStatement); if (superCallExpression) { return 1; } @@ -41680,7 +42108,7 @@ var ts; } function createDefaultSuperCallOrThis() { var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 128); + ts.setEmitFlags(actualThis, 4); var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); return ts.createLogicalOr(superCall, actualThis); } @@ -41698,6 +42126,86 @@ var ts; return node; } } + function shouldAddDefaultValueAssignments(node) { + return (node.transformFlags & 131072) !== 0; + } + function addDefaultValueAssignmentsIfNeeded(statements, node) { + if (!shouldAddDefaultValueAssignments(node)) { + return; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + var name_38 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + if (dotDotDotToken) { + continue; + } + if (ts.isBindingPattern(name_38)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name_38, initializer); + } + else if (initializer) { + addDefaultValueAssignmentForInitializer(statements, parameter, name_38, initializer); + } + } + } + function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) { + var temp = ts.getGeneratedNameForNode(parameter); + if (name.elements.length > 0) { + statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, temp))), 524288)); + } + else if (initializer) { + statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288)); + } + } + function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { + initializer = ts.visitNode(initializer, visitor, ts.isExpression); + var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter)) + ], parameter), 1 | 32 | 384), undefined, parameter); + statement.startsOnNewLine = true; + ts.setEmitFlags(statement, 384 | 32 | 524288); + statements.push(statement); + } + function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { + return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper; + } + function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { + var parameter = ts.lastOrUndefined(node.parameters); + if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { + return; + } + var declarationName = ts.getMutableClone(parameter.name); + ts.setEmitFlags(declarationName, 48); + var expressionName = ts.getSynthesizedClone(parameter.name); + var restIndex = node.parameters.length - 1; + var temp = ts.createLoopVariable(); + statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([])) + ]), parameter), 524288)); + var forStatement = ts.createFor(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex)) + ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([ + ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 + ? temp + : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter)) + ])); + ts.setEmitFlags(forStatement, 524288); + ts.startOnNewLine(forStatement); + statements.push(forStatement); + } + function addCaptureThisForNodeIfNeeded(statements, node) { + if (node.transformFlags & 32768 && node.kind !== 185) { + captureThisForNode(statements, node, ts.createThis()); + } + } + function captureThisForNode(statements, node, initializer, originalStatement) { + enableSubstitutionsForCapturedThis(); + var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_this", undefined, initializer) + ]), originalStatement); + ts.setEmitFlags(captureThisStatement, 1536 | 524288); + ts.setSourceMapRange(captureThisStatement, node); + statements.push(captureThisStatement); + } function addClassMembers(statements, node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; @@ -41729,33 +42237,34 @@ var ts; function transformClassMethodDeclarationToStatement(receiver, member) { var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); - var func = transformFunctionLikeToExpression(member, member, undefined); - ts.setEmitFlags(func, 49152); - ts.setSourceMapRange(func, sourceMapRange); - var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name), func), member); + var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name); + var memberFunction = transformFunctionLikeToExpression(member, member, undefined); + ts.setEmitFlags(memberFunction, 1536); + ts.setSourceMapRange(memberFunction, sourceMapRange); + var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); - ts.setEmitFlags(statement, 1536); + ts.setEmitFlags(statement, 48); return statement; } function transformAccessorsToStatement(receiver, accessors) { var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor)); - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); return statement; } function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; var target = ts.getMutableClone(receiver); - ts.setEmitFlags(target, 49152 | 1024); + ts.setEmitFlags(target, 1536 | 32); ts.setSourceMapRange(target, firstAccessor.name); var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName)); - ts.setEmitFlags(propertyName, 49152 | 512); + ts.setEmitFlags(propertyName, 1536 | 16); ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); - ts.setEmitFlags(getterFunction, 16384); + ts.setEmitFlags(getterFunction, 512); var getter = ts.createPropertyAssignment("get", getterFunction); ts.setCommentRange(getter, ts.getCommentRange(getAccessor)); properties.push(getter); @@ -41763,7 +42272,7 @@ var ts; if (setAccessor) { var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); - ts.setEmitFlags(setterFunction, 16384); + ts.setEmitFlags(setterFunction, 512); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); properties.push(setter); @@ -41780,28 +42289,91 @@ var ts; return call; } function visitArrowFunction(node) { - if (node.transformFlags & 262144) { + if (node.transformFlags & 16384) { enableSubstitutionsForCapturedThis(); } - var func = transformFunctionLikeToExpression(node, node, undefined); - ts.setEmitFlags(func, 256); + var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node); + ts.setOriginalNode(func, node); + ts.setEmitFlags(func, 8); return func; } function visitFunctionExpression(node) { - return transformFunctionLikeToExpression(node, node, node.name); + return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + ? transformFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function visitFunctionDeclaration(node) { - return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis), node), node); + return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + ? transformFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function transformFunctionLikeToExpression(node, location, name) { var savedContainingNonArrowFunction = enclosingNonArrowFunction; if (node.kind !== 185) { enclosingNonArrowFunction = node; } - var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location), node); + var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node); enclosingNonArrowFunction = savedContainingNonArrowFunction; return expression; } + function transformFunctionBody(node) { + var multiLine = false; + var singleLine = false; + var statementsLocation; + var closeBraceLocation; + var statements = []; + var body = node.body; + var statementOffset; + resumeLexicalEnvironment(); + if (ts.isBlock(body)) { + statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); + } + addCaptureThisForNodeIfNeeded(statements, node); + addDefaultValueAssignmentsIfNeeded(statements, node); + addRestParameterIfNeeded(statements, node, false); + if (!multiLine && statements.length > 0) { + multiLine = true; + } + if (ts.isBlock(body)) { + statementsLocation = body.statements; + ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); + if (!multiLine && body.multiLine) { + multiLine = true; + } + } + else { + ts.Debug.assert(node.kind === 185); + statementsLocation = ts.moveRangeEnd(body, -1); + var equalsGreaterThanToken = node.equalsGreaterThanToken; + if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { + if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { + singleLine = true; + } + else { + multiLine = true; + } + } + var expression = ts.visitNode(body, visitor, ts.isExpression); + var returnStatement = ts.createReturn(expression, body); + ts.setEmitFlags(returnStatement, 384 | 32 | 1024); + statements.push(returnStatement); + closeBraceLocation = body; + } + var lexicalEnvironment = context.endLexicalEnvironment(); + ts.addRange(statements, lexicalEnvironment); + if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { + multiLine = true; + } + var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine); + if (!multiLine && singleLine) { + ts.setEmitFlags(block, 1); + } + if (closeBraceLocation) { + ts.setTokenSourceMapRange(block, 17, closeBraceLocation); + } + ts.setOriginalNode(block, node.body); + return block; + } function visitExpressionStatement(node) { switch (node.expression.kind) { case 183: @@ -41812,19 +42384,20 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitParenthesizedExpression(node, needsDestructuringValue) { - if (needsDestructuringValue) { + if (!needsDestructuringValue) { switch (node.expression.kind) { case 183: - return ts.createParen(visitParenthesizedExpression(node.expression, true), node); + return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); case 192: - return ts.createParen(visitBinaryExpression(node.expression, true), node); + return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } return ts.visitEachChild(node, visitor, context); } function visitBinaryExpression(node, needsDestructuringValue) { - ts.Debug.assert(ts.isDestructuringAssignment(node)); - return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor); + if (ts.isDestructuringAssignment(node)) { + return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue); + } } function visitVariableStatement(node) { if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) { @@ -41835,7 +42408,7 @@ var ts; if (decl.initializer) { var assignment = void 0; if (ts.isBindingPattern(decl.name)) { - assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, undefined, visitor); + assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0); } else { assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression)); @@ -41862,7 +42435,7 @@ var ts; var declarationList = ts.createVariableDeclarationList(declarations, node); ts.setOriginalNode(declarationList, node); ts.setCommentRange(declarationList, node); - if (node.transformFlags & 67108864 + if (node.transformFlags & 8388608 && (ts.isBindingPattern(node.declarations[0].name) || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { var firstDeclaration = ts.firstOrUndefined(declarations); @@ -41895,17 +42468,17 @@ var ts; return visitVariableDeclaration(node); } if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) { - var clone_5 = ts.getMutableClone(node); - clone_5.initializer = ts.createVoidZero(); - return clone_5; + var clone_3 = ts.getMutableClone(node); + clone_3.initializer = ts.createVoidZero(); + return clone_3; } return ts.visitEachChild(node, visitor, context); } function visitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - var recordTempVariablesInLine = !enclosingVariableStatement - || !ts.hasModifier(enclosingVariableStatement, 1); - return ts.flattenVariableDestructuring(node, undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration); + var hoistTempVariables = enclosingVariableStatement + && ts.hasModifier(enclosingVariableStatement, 1); + return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables); } return ts.visitEachChild(node, visitor, context); } @@ -41944,7 +42517,69 @@ var ts; return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); } function convertForOfToFor(node, convertedLoopBodyStatements) { - return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, false); + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var initializer = node.initializer; + var statements = []; + var counter = ts.createLoopVariable(); + var rhsReference = expression.kind === 70 + ? ts.createUniqueName(expression.text) + : ts.createTempVariable(undefined); + var elementAccess = ts.createElementAccess(rhsReference, counter); + if (ts.isVariableDeclarationList(initializer)) { + if (initializer.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); + if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { + var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess); + var declarationList = ts.createVariableDeclarationList(declarations, initializer); + ts.setOriginalNode(declarationList, initializer); + var firstDeclaration = declarations[0]; + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + statements.push(ts.createVariableStatement(undefined, declarationList)); + } + else { + statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter)) + ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1))); + } + } + else { + var assignment = ts.createAssignment(initializer, elementAccess); + if (ts.isDestructuringAssignment(assignment)) { + statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0))); + } + else { + assignment.end = initializer.end; + statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1))); + } + } + var bodyLocation; + var statementsLocation; + if (convertedLoopBodyStatements) { + ts.addRange(statements, convertedLoopBodyStatements); + } + else { + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + if (ts.isBlock(statement)) { + ts.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; + } + else { + statements.push(statement); + } + } + ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression)); + var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation); + ts.setEmitFlags(body, 48 | 384); + var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)), + ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression) + ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node); + ts.setEmitFlags(forStatement, 256); + return forStatement; } function visitObjectLiteralExpression(node) { var properties = node.properties; @@ -41952,7 +42587,7 @@ var ts; var numInitialProperties = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 134217728 + if (property.transformFlags & 16777216 || property.name.kind === 142) { numInitialProperties = i; break; @@ -41961,7 +42596,7 @@ var ts; ts.Debug.assert(numInitialProperties !== numProperties); var temp = ts.createTempVariable(hoistVariableDeclaration); var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 524288)); + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); if (node.multiLine) { assignment.startsOnNewLine = true; } @@ -42038,30 +42673,35 @@ var ts; convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; } } + startLexicalEnvironment(); var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { - var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, 1, statements_3); - loopBody = ts.createBlock(statements_3, undefined, true); + if (loopOutParameters.length || lexicalEnvironment) { + var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, undefined, true); } if (!ts.isBlock(loopBody)) { loopBody = ts.createBlock([loopBody], undefined, true); } var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152) !== 0 - && (node.statement.transformFlags & 134217728) !== 0; + && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0 + && (node.statement.transformFlags & 16777216) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { - loopBodyFlags |= 256; + loopBodyFlags |= 8; } if (isAsyncBlockContainingAwait) { - loopBodyFlags |= 2097152; + loopBodyFlags |= 131072; } var convertedLoopVariable = ts.createVariableStatement(undefined, ts.setEmitFlags(ts.createVariableDeclarationList([ ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(undefined, isAsyncBlockContainingAwait ? ts.createToken(38) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags)) - ]), 16777216)); + ]), 1048576)); var statements = [convertedLoopVariable]; var extraVariableDeclarations; if (currentState.argumentsName) { @@ -42278,7 +42918,7 @@ var ts; ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); var temp = ts.createTempVariable(undefined); var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenVariableDestructuring(node.variableDeclaration, temp, visitor); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); var destructure = ts.createVariableStatement(undefined, list); return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); @@ -42290,7 +42930,7 @@ var ts; function visitMethodDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined); - ts.setEmitFlags(functionExpression, 16384 | ts.getEmitFlags(functionExpression)); + ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression)); return ts.createPropertyAssignment(node.name, functionExpression, node); } function visitShorthandPropertyAssignment(node) { @@ -42311,10 +42951,10 @@ var ts; function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) { var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; if (node.expression.kind === 96) { - ts.setEmitFlags(thisArg, 128); + ts.setEmitFlags(thisArg, 4); } var resultingCall; - if (node.transformFlags & 8388608) { + if (node.transformFlags & 524288) { resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); } else { @@ -42322,7 +42962,7 @@ var ts; } if (node.expression.kind === 96) { var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 128); + ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); return assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) @@ -42331,7 +42971,7 @@ var ts; return resultingCall; } function visitNewExpression(node) { - ts.Debug.assert((node.transformFlags & 8388608) !== 0); + ts.Debug.assert((node.transformFlags & 524288) !== 0); var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); } @@ -42359,6 +42999,9 @@ var ts; function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine); } + function visitSpreadElement(node) { + return ts.visitNode(node.expression, visitor, ts.isExpression); + } function visitExpressionOfSpread(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); } @@ -42436,18 +43079,6 @@ var ts; ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } - function visitSourceFileNode(node) { - var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1]; - var statements = []; - startLexicalEnvironment(); - ts.addRange(statements, prologue); - ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis); - ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement)); - ts.addRange(statements, endLexicalEnvironment()); - var clone = ts.getMutableClone(node); - clone.statements = ts.createNodeArray(statements, node.statements); - return clone; - } function onEmitNode(emitContext, node, emitCallback) { var savedEnclosingFunction = enclosingFunction; if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) { @@ -42527,7 +43158,7 @@ var ts; function substituteThisKeyword(node) { if (enabledSubstitutions & 1 && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 256) { + && ts.getEmitFlags(enclosingFunction) & 8) { return ts.createIdentifier("_this", node); } return node; @@ -42540,8 +43171,7 @@ var ts; if (!constructor || !hasExtendsClause) { return false; } - var parameter = ts.singleOrUndefined(constructor.parameters); - if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) { + if (ts.some(constructor.parameters)) { return false; } var statement = ts.firstOrUndefined(constructor.body.statements); @@ -42561,10 +43191,23 @@ var ts; return false; } var expression = callArgument.expression; - return ts.isIdentifier(expression) && expression === parameter.name; + return ts.isIdentifier(expression) && expression.text === "arguments"; } } ts.transformES2015 = transformES2015; + function createExtendsHelper(context, name) { + context.requestEmitHelper(extendsHelper); + return ts.createCall(ts.getHelperName("__extends"), undefined, [ + name, + ts.createIdentifier("_super") + ]); + } + var extendsHelper = { + name: "typescript:extends", + scoped: false, + priority: 0, + text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + }; })(ts || (ts = {})); var ts; (function (ts) { @@ -42576,7 +43219,7 @@ var ts; _a[7] = "endfinally", _a)); function transformGenerators(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var resolver = context.getEmitResolver(); @@ -42610,15 +43253,15 @@ var ts; var withBlockStack; return transformSourceFile; function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { + if (ts.isDeclarationFile(node) + || (node.transformFlags & 512) === 0) { return node; } - if (node.transformFlags & 8192) { - currentSourceFile = node; - node = ts.visitEachChild(node, visitor, context); - currentSourceFile = undefined; - } - return node; + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function visitor(node) { var transformFlags = node.transformFlags; @@ -42628,10 +43271,10 @@ var ts; else if (inGeneratorFunctionBody) { return visitJavaScriptInGeneratorFunctionBody(node); } - else if (transformFlags & 4096) { + else if (transformFlags & 256) { return visitGenerator(node); } - else if (transformFlags & 8192) { + else if (transformFlags & 512) { return ts.visitEachChild(node, visitor, context); } else { @@ -42674,10 +43317,10 @@ var ts; case 216: return visitReturnStatement(node); default: - if (node.transformFlags & 134217728) { + if (node.transformFlags & 16777216) { return visitJavaScriptContainingYield(node); } - else if (node.transformFlags & (8192 | 268435456)) { + else if (node.transformFlags & (512 | 33554432)) { return ts.visitEachChild(node, visitor, context); } else { @@ -42719,8 +43362,8 @@ var ts; } } function visitFunctionDeclaration(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -42740,8 +43383,8 @@ var ts; } } function visitFunctionExpression(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) { - node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -42792,7 +43435,7 @@ var ts; operationArguments = undefined; operationLocations = undefined; state = ts.createTempVariable(undefined); - startLexicalEnvironment(); + resumeLexicalEnvironment(); var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); @@ -42814,12 +43457,12 @@ var ts; return ts.createBlock(statements, body, body.multiLine); } function visitVariableStatement(node) { - if (node.transformFlags & 134217728) { + if (node.transformFlags & 16777216) { transformAndEmitVariableDeclarationList(node.declarationList); return undefined; } else { - if (ts.getEmitFlags(node) & 8388608) { + if (ts.getEmitFlags(node) & 524288) { return node; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { @@ -42896,10 +43539,10 @@ var ts; else if (node.operatorToken.kind === 25) { return visitCommaExpression(node); } - var clone_6 = ts.getMutableClone(node); - clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_6; + var clone_4 = ts.getMutableClone(node); + clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_4; } return ts.visitEachChild(node, visitor, context); } @@ -42964,26 +43607,30 @@ var ts; return createGeneratorResume(); } function visitArrayLiteralExpression(node) { - return visitElements(node.elements, node.multiLine); + return visitElements(node.elements, undefined, undefined, node.multiLine); } - function visitElements(elements, _multiLine) { + function visitElements(elements, leadingElement, location, multiLine) { var numInitialElements = countInitialNodesWithoutYield(elements); var temp = declareLocal(); var hasAssignedTemp = false; if (numInitialElements > 0) { - emitAssignment(temp, ts.createArrayLiteral(ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements))); + var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); + emitAssignment(temp, ts.createArrayLiteral(leadingElement + ? [leadingElement].concat(initialElements) : initialElements)); + leadingElement = undefined; hasAssignedTemp = true; } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); return hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)]) - : ts.createArrayLiteral(expressions); + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine); function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { emitAssignment(temp, hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)]) - : ts.createArrayLiteral(expressions)); + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine)); hasAssignedTemp = true; + leadingElement = undefined; expressions = []; } expressions.push(ts.visitNode(element, visitor, ts.isExpression)); @@ -43017,10 +43664,10 @@ var ts; } function visitElementAccessExpression(node) { if (containsYield(node.argumentExpression)) { - var clone_7 = ts.getMutableClone(node); - clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_7; + var clone_5 = ts.getMutableClone(node); + clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -43034,7 +43681,7 @@ var ts; function visitNewExpression(node) { if (ts.forEach(node.arguments, containsYield)) { var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)), undefined, [], node), node); + return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node); } return ts.visitEachChild(node, visitor, context); } @@ -43476,7 +44123,7 @@ var ts; } } function containsYield(node) { - return node && (node.transformFlags & 134217728) !== 0; + return node && (node.transformFlags & 16777216) !== 0; } function countInitialNodesWithoutYield(nodes) { var numNodes = nodes.length; @@ -43506,12 +44153,12 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_37) { - var clone_8 = ts.getMutableClone(name_37); - ts.setSourceMapRange(clone_8, node); - ts.setCommentRange(clone_8, node); - return clone_8; + var name_39 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_39) { + var clone_6 = ts.getMutableClone(name_39); + ts.setSourceMapRange(clone_6, node); + ts.setCommentRange(clone_6, node); + return clone_6; } } } @@ -43902,10 +44549,7 @@ var ts; currentExceptionBlock = undefined; withBlockStack = undefined; var buildResult = buildStatements(); - return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), undefined, [ - ts.createThis(), - ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 4194304) - ]); + return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144)); } function buildStatements() { if (operations) { @@ -44168,6 +44812,16 @@ var ts; } } ts.transformGenerators = transformGenerators; + function createGeneratorHelper(context, body) { + context.requestEmitHelper(generatorHelper); + return ts.createCall(ts.getHelperName("__generator"), undefined, [ts.createThis(), body]); + } + var generatorHelper = { + name: "typescript:generator", + scoped: false, + priority: 6, + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + }; var _a; })(ts || (ts = {})); var ts; @@ -44224,7 +44878,7 @@ var ts; _a[ts.ModuleKind.AMD] = transformAMDModule, _a[ts.ModuleKind.UMD] = transformUMDModule, _a)); - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var host = context.getEmitHost(); @@ -44253,7 +44907,7 @@ var ts; return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver); + currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; var updated = transformModule(node); currentSourceFile = undefined; @@ -44264,12 +44918,13 @@ var ts; startLexicalEnvironment(); var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, false); var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); if (currentModuleInfo.hasExportStarsToExportValues) { - ts.setEmitFlags(updated, 2 | ts.getEmitFlags(node)); + ts.addEmitHelper(updated, exportStarHelper); } return updated; } @@ -44279,8 +44934,7 @@ var ts; return transformAsynchronousModule(node, define, moduleName, true); } function transformUMDModule(node) { - var define = ts.createIdentifier("define"); - ts.setEmitFlags(define, 16); + var define = ts.createRawExpression(umdHelper); return transformAsynchronousModule(node, define, undefined, false); } function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { @@ -44317,7 +44971,7 @@ var ts; var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); if (includeNonAmdDependencies && importAliasName) { - ts.setEmitFlags(importAliasName, 128); + ts.setEmitFlags(importAliasName, 4); aliasedModuleNames.push(externalModuleName); importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName)); } @@ -44331,12 +44985,13 @@ var ts; startLexicalEnvironment(); var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, true); var body = ts.createBlock(statements, undefined, true); if (currentModuleInfo.hasExportStarsToExportValues) { - ts.setEmitFlags(body, 2); + ts.addEmitHelper(body, exportStarHelper); } return body; } @@ -44344,12 +44999,12 @@ var ts; if (currentModuleInfo.exportEquals) { if (emitAsReturn) { var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 12288 | 49152); + ts.setEmitFlags(statement, 384 | 1536); statements.push(statement); } else { var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); statements.push(statement); } } @@ -44370,9 +45025,9 @@ var ts; return visitFunctionDeclaration(node); case 226: return visitClassDeclaration(node); - case 294: - return visitMergeDeclarationMarker(node); case 295: + return visitMergeDeclarationMarker(node); + case 296: return visitEndOfDeclarationMarker(node); default: return node; @@ -44563,7 +45218,7 @@ var ts; } function transformInitializedVariable(node) { if (ts.isBindingPattern(node.name)) { - return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression); + return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression); } else { return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, node.name), node.initializer); @@ -44577,7 +45232,7 @@ var ts; return node; } function hasAssociatedEndOfDeclarationMarker(node) { - return (ts.getEmitFlags(node) & 33554432) !== 0; + return (ts.getEmitFlags(node) & 2097152) !== 0; } function visitEndOfDeclarationMarker(node) { var id = ts.getOriginalNodeId(node); @@ -44697,7 +45352,7 @@ var ts; var statement = ts.createStatement(createExportExpression(name, value), location); ts.startOnNewLine(statement); if (!allowComments) { - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); } return statement; } @@ -44764,6 +45419,13 @@ var ts; return node; } function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + return node; + } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); if (exportContainer && exportContainer.kind === 261) { @@ -44775,8 +45437,8 @@ var ts; return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_38 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), node); + var name_40 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_40), node); } } } @@ -44835,6 +45497,12 @@ var ts; var _a; } ts.transformModule = transformModule; + var exportStarHelper = { + name: "typescript:export-star", + scoped: true, + text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" + }; + var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); var ts; (function (ts) { @@ -44873,22 +45541,25 @@ var ts; var id = ts.getOriginalNodeId(node); currentSourceFile = node; enclosingBlockScopedContainer = node; - moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver); + moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); contextObject = ts.createUniqueName("context"); var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); + var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ ts.createParameter(undefined, undefined, undefined, exportFunction), ts.createParameter(undefined, undefined, undefined, contextObject) - ], undefined, createSystemModuleBody(node, dependencyGroups)); + ], undefined, moduleBodyBlock); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray([ + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.createNodeArray([ ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), undefined, moduleName ? [moduleName, dependencies, moduleBodyFunction] : [dependencies, moduleBodyFunction])) - ], node.statements)); - ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1); + ], node.statements)), 1024); + if (!(compilerOptions.outFile || compilerOptions.out)) { + ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); + } if (noSubstitution) { noSubstitutionMap[id] = noSubstitution; noSubstitution = undefined; @@ -44929,6 +45600,7 @@ var ts; statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) ]))); + ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true); var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); ts.addRange(statements, hoistedStatements); ts.addRange(statements, endLexicalEnvironment()); @@ -44937,9 +45609,7 @@ var ts; ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true))) ]), true))); - var body = ts.createBlock(statements, undefined, true); - ts.setEmitFlags(body, 1); - return body; + return ts.createBlock(statements, undefined, true); } function addExportStarIfNeeded(statements) { if (!moduleInfo.hasExportStarsToExportValues) { @@ -44999,7 +45669,7 @@ var ts; var exports = ts.createIdentifier("exports"); var condition = ts.createStrictInequality(n, ts.createLiteral("default")); if (localNames) { - condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n))); + condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), undefined, [n]))); } return ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(undefined, undefined, undefined, m)], undefined, ts.createBlock([ ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ @@ -45008,7 +45678,7 @@ var ts; ts.createForIn(ts.createVariableDeclarationList([ ts.createVariableDeclaration(n, undefined) ]), m, ts.createBlock([ - ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32) + ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1) ])), ts.createStatement(ts.createCall(exportFunction, undefined, [exports])) ], undefined, true)); @@ -45180,14 +45850,14 @@ var ts; } } function shouldHoistVariableDeclarationList(node) { - return (ts.getEmitFlags(node) & 16777216) === 0 + return (ts.getEmitFlags(node) & 1048576) === 0 && (enclosingBlockScopedContainer.kind === 261 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; return ts.isBindingPattern(node.name) - ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor) + ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, false, createAssignment) : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); } function createExportedVariableAssignment(name, value, location) { @@ -45211,7 +45881,7 @@ var ts; return node; } function hasAssociatedEndOfDeclarationMarker(node) { - return (ts.getEmitFlags(node) & 33554432) !== 0; + return (ts.getEmitFlags(node) & 2097152) !== 0; } function visitEndOfDeclarationMarker(node) { var id = ts.getOriginalNodeId(node); @@ -45328,7 +45998,7 @@ var ts; var statement = ts.createStatement(createExportExpression(name, value)); ts.startOnNewLine(statement); if (!allowComments) { - ts.setEmitFlags(statement, 49152); + ts.setEmitFlags(statement, 1536); } return statement; } @@ -45372,9 +46042,9 @@ var ts; return visitCatchClause(node); case 204: return visitBlock(node); - case 294: - return visitMergeDeclarationMarker(node); case 295: + return visitMergeDeclarationMarker(node); + case 296: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -45464,11 +46134,11 @@ var ts; return node; } function destructuringVisitor(node) { - if (node.transformFlags & 16384 + if (node.transformFlags & 1024 && node.kind === 192) { return visitDestructuringAssignment(node); } - else if (node.transformFlags & 32768) { + else if (node.transformFlags & 2048) { return ts.visitEachChild(node, destructuringVisitor, context); } else { @@ -45477,7 +46147,7 @@ var ts; } function visitDestructuringAssignment(node) { if (hasExportedReferenceInDestructuringTarget(node.left)) { - return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, destructuringVisitor); + return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, true); } return ts.visitEachChild(node, destructuringVisitor, context); } @@ -45559,6 +46229,13 @@ var ts; return node; } function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + return node; + } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { @@ -45646,13 +46323,30 @@ var ts; (function (ts) { function transformES2015Module(context) { var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.enableEmitNotification(261); + context.enableSubstitution(70); + var currentSourceFile; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - return ts.visitEachChild(node, visitor, context); + var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); + if (externalHelpersModuleName) { + var statements = []; + var statementOffset = ts.addPrologueDirectives(statements, node.statements); + ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + } + else { + return ts.visitEachChild(node, visitor, context); + } } return node; } @@ -45668,6 +46362,32 @@ var ts; function visitExportAssignment(node) { return node.isExportEquals ? undefined : node; } + function onEmitNode(emitContext, node, emitCallback) { + if (ts.isSourceFile(node)) { + currentSourceFile = node; + previousOnEmitNode(emitContext, node, emitCallback); + currentSourceFile = undefined; + } + else { + previousOnEmitNode(emitContext, node, emitCallback); + } + } + function onSubstituteNode(emitContext, node) { + node = previousOnSubstituteNode(emitContext, node); + if (ts.isIdentifier(node) && emitContext === 1) { + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + } + return node; + } } ts.transformES2015Module = transformES2015Module; })(ts || (ts = {})); @@ -45711,21 +46431,27 @@ var ts; } ts.getTransformers = getTransformers; function transformFiles(resolver, host, sourceFiles, transformers) { + var enabledSyntaxKindFeatures = new Array(298); + var lexicalEnvironmentDisabled = false; + var lexicalEnvironmentVariableDeclarations; + var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; var lexicalEnvironmentFunctionDeclarationsStack = []; - var enabledSyntaxKindFeatures = new Array(296); var lexicalEnvironmentStackOffset = 0; - var hoistedVariableDeclarations; - var hoistedFunctionDeclarations; - var lexicalEnvironmentDisabled; + var lexicalEnvironmentSuspended = false; + var emitHelpers; var context = { getCompilerOptions: function () { return host.getCompilerOptions(); }, getEmitResolver: function () { return resolver; }, getEmitHost: function () { return host; }, + startLexicalEnvironment: startLexicalEnvironment, + suspendLexicalEnvironment: suspendLexicalEnvironment, + resumeLexicalEnvironment: resumeLexicalEnvironment, + endLexicalEnvironment: endLexicalEnvironment, hoistVariableDeclaration: hoistVariableDeclaration, hoistFunctionDeclaration: hoistFunctionDeclaration, - startLexicalEnvironment: startLexicalEnvironment, - endLexicalEnvironment: endLexicalEnvironment, + requestEmitHelper: requestEmitHelper, + readEmitHelpers: readEmitHelpers, onSubstituteNode: function (_emitContext, node) { return node; }, enableSubstitution: enableSubstitution, isSubstitutionEnabled: isSubstitutionEnabled, @@ -45752,7 +46478,7 @@ var ts; } function isSubstitutionEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0 - && (ts.getEmitFlags(node) & 128) === 0; + && (ts.getEmitFlags(node) & 4) === 0; } function emitNodeWithSubstitution(emitContext, node, emitCallback) { if (node) { @@ -45771,7 +46497,7 @@ var ts; } function isEmitNotificationEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0 - || (ts.getEmitFlags(node) & 64) !== 0; + || (ts.getEmitFlags(node) & 2) !== 0; } function emitNodeWithNotification(emitContext, node, emitCallback) { if (node) { @@ -45786,39 +46512,51 @@ var ts; function hoistVariableDeclaration(name) { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); var decl = ts.createVariableDeclaration(name); - if (!hoistedVariableDeclarations) { - hoistedVariableDeclarations = [decl]; + if (!lexicalEnvironmentVariableDeclarations) { + lexicalEnvironmentVariableDeclarations = [decl]; } else { - hoistedVariableDeclarations.push(decl); + lexicalEnvironmentVariableDeclarations.push(decl); } } function hoistFunctionDeclaration(func) { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = [func]; + if (!lexicalEnvironmentFunctionDeclarations) { + lexicalEnvironmentFunctionDeclarations = [func]; } else { - hoistedFunctionDeclarations.push(func); + lexicalEnvironmentFunctionDeclarations.push(func); } } function startLexicalEnvironment() { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); - lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedVariableDeclarations; - lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedFunctionDeclarations; + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); + lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations; + lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations; lexicalEnvironmentStackOffset++; - hoistedVariableDeclarations = undefined; - hoistedFunctionDeclarations = undefined; + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + } + function suspendLexicalEnvironment() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); + lexicalEnvironmentSuspended = true; + } + function resumeLexicalEnvironment() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); + lexicalEnvironmentSuspended = false; } function endLexicalEnvironment() { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; - if (hoistedVariableDeclarations || hoistedFunctionDeclarations) { - if (hoistedFunctionDeclarations) { - statements = hoistedFunctionDeclarations.slice(); + if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { + if (lexicalEnvironmentFunctionDeclarations) { + statements = lexicalEnvironmentFunctionDeclarations.slice(); } - if (hoistedVariableDeclarations) { - var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(hoistedVariableDeclarations)); + if (lexicalEnvironmentVariableDeclarations) { + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations)); if (!statements) { statements = [statement]; } @@ -45828,10 +46566,25 @@ var ts; } } lexicalEnvironmentStackOffset--; - hoistedVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; - hoistedFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + if (lexicalEnvironmentStackOffset === 0) { + lexicalEnvironmentVariableDeclarationsStack = []; + lexicalEnvironmentFunctionDeclarationsStack = []; + } return statements; } + function requestEmitHelper(helper) { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); + emitHelpers = ts.append(emitHelpers, helper); + } + function readEmitHelpers() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + var helpers = emitHelpers; + emitHelpers = undefined; + return helpers; + } } ts.transformFiles = transformFiles; var _a; @@ -45966,6 +46719,7 @@ var ts; writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -46086,15 +46840,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { - var node = nodes_2[_i]; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { - var node = nodes_3[_i]; + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -46109,7 +46863,7 @@ var ts; } function writeJsDocComments(declaration) { if (declaration) { - var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText); + var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText); ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); ts.emitComments(currentText, currentLineMap, writer, jsDocComments, false, true, newLine, ts.writeCommentRange); } @@ -46296,9 +47050,9 @@ var ts; var count = 0; while (true) { count++; - var name_39 = baseName + "_" + count; - if (!(name_39 in currentIdentifiers)) { - return name_39; + var name_41 = baseName + "_" + count; + if (!(name_41 in currentIdentifiers)) { + return name_41; } } } @@ -46692,6 +47446,9 @@ var ts; case 225: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; + case 228: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; + break; default: ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); } @@ -46785,7 +47542,10 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false); + var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); + if (interfaceExtendsTypes && interfaceExtendsTypes.length) { + emitHeritageClause(interfaceExtendsTypes, false); + } write(" {"); writeLine(); increaseIndent(); @@ -47181,6 +47941,10 @@ var ts; return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 155: + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; case 149: case 148: if (ts.hasModifier(node.parent, 32)) { @@ -47503,12 +48267,12 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 292 - && (emitFlags & 512) === 0 + if (node.kind !== 293 + && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); } - if (emitFlags & 2048) { + if (emitFlags & 64) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -47516,8 +48280,8 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 292 - && (emitFlags & 1024) === 0 + if (node.kind !== 293 + && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); } @@ -47531,13 +48295,13 @@ var ts; var emitFlags = emitNode && emitNode.flags; var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos); - if ((emitFlags & 4096) === 0 && tokenPos >= 0) { + if ((emitFlags & 128) === 0 && tokenPos >= 0) { emitPos(tokenPos); } tokenPos = emitCallback(token, tokenPos); if (range) tokenPos = range.end; - if ((emitFlags & 8192) === 0 && tokenPos >= 0) { + if ((emitFlags & 256) === 0 && tokenPos >= 0) { emitPos(tokenPos); } return tokenPos; @@ -47565,7 +48329,7 @@ var ts; return; } encodeLastRecordedSourceMapSpan(); - return ts.stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, @@ -47647,7 +48411,7 @@ var ts; var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end; var emitFlags = ts.getEmitFlags(node); if ((pos < 0 && end < 0) || (pos === end)) { - if (emitFlags & 65536) { + if (emitFlags & 2048) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -47660,9 +48424,9 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 292; - var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0; - var skipTrailingComments = end < 0 || (emitFlags & 32768) !== 0; + var isEmittedNode = node.kind !== 293; + var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; + var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { emitLeadingComments(pos, isEmittedNode); } @@ -47681,7 +48445,7 @@ var ts; if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & 65536) { + if (emitFlags & 2048) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -47710,15 +48474,15 @@ var ts; } var pos = detachedRange.pos, end = detachedRange.end; var emitFlags = ts.getEmitFlags(node); - var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0; - var skipTrailingComments = disabled || end < 0 || (emitFlags & 32768) !== 0; + var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; + var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { emitDetachedCommentsAndUpdateCommentsInfo(detachedRange); } if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments"); } - if (emitFlags & 65536 && !disabled) { + if (emitFlags & 2048 && !disabled) { disabled = true; emitCallback(node); disabled = false; @@ -47731,6 +48495,9 @@ var ts; } if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); @@ -47879,18 +48646,6 @@ var ts; function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { var delimiters = createDelimiterMap(); var brackets = createBracketsMap(); - var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; - var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; - var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};"; - var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; - var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};"; - var generatorHelper = "\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};"; - var exportStarHelper = "\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}"; - var umdHelper = "\n(function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n})"; - var superHelper = "\nconst _super = name => super[name];"; - var advancedSuperHelper = "\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"; var compilerOptions = host.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); @@ -47912,12 +48667,7 @@ var ts; var currentSourceFile; var currentText; var currentFileIdentifiers; - var extendsEmitted; - var assignEmitted; - var restEmitted; - var decorateEmitted; - var paramEmitted; - var awaiterEmitted; + var bundledHelpers; var isOwnFileEmit; var emitSkipped = false; var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); @@ -47966,11 +48716,12 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNameSet = ts.createMap(); + bundledHelpers = isBundledEmit ? ts.createMap() : undefined; isOwnFileEmit = !isBundledEmit; if (isBundledEmit && moduleKind) { for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { var sourceFile = sourceFiles_5[_a]; - emitEmitHelpers(sourceFile); + emitHelpers(sourceFile, true); } } ts.forEach(sourceFiles, printSourceFile); @@ -47980,23 +48731,18 @@ var ts; write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); } if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false); + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); } if (sourceMapDataList) { sourceMapDataList.push(sourceMap.getSourceMapData()); } - ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM); + ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); sourceMap.reset(); comments.reset(); writer.reset(); tempFlags = 0; currentSourceFile = undefined; currentText = undefined; - extendsEmitted = false; - assignEmitted = false; - decorateEmitted = false; - paramEmitted = false; - awaiterEmitted = false; isOwnFileEmit = false; } function printSourceFile(node) { @@ -48364,8 +49110,10 @@ var ts; return emitJsxElement(node); case 247: return emitJsxSelfClosingElement(node); - case 293: + case 294: return emitPartiallyEmittedExpression(node); + case 297: + return writeLines(node.text); } } function emitNumericLiteral(node) { @@ -48385,12 +49133,7 @@ var ts; } } function emitIdentifier(node) { - if (ts.getEmitFlags(node) & 16) { - writeLines(umdHelper); - } - else { - write(getTextOfNode(node, false)); - } + write(getTextOfNode(node, false)); } function emitQualifiedName(node) { emitEntityName(node.left); @@ -48633,7 +49376,7 @@ var ts; write("{}"); } else { - var indentedFlag = ts.getEmitFlags(node) & 524288; + var indentedFlag = ts.getEmitFlags(node) & 32768; if (indentedFlag) { increaseIndent(); } @@ -48648,7 +49391,7 @@ var ts; function emitPropertyAccessExpression(node) { var indentBeforeDot = false; var indentAfterDot = false; - if (!(ts.getEmitFlags(node) & 1048576)) { + if (!(ts.getEmitFlags(node) & 65536)) { var dotRangeStart = node.expression.end; var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1; var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd }; @@ -48832,7 +49575,7 @@ var ts; } } function emitBlockStatements(node) { - if (ts.getEmitFlags(node) & 32) { + if (ts.getEmitFlags(node) & 1) { emitList(node, node.statements, 384); } else { @@ -49008,11 +49751,11 @@ var ts; var body = node.body; if (body) { if (ts.isBlock(body)) { - var indentedFlag = ts.getEmitFlags(node) & 524288; + var indentedFlag = ts.getEmitFlags(node) & 32768; if (indentedFlag) { increaseIndent(); } - if (ts.getEmitFlags(node) & 4194304) { + if (ts.getEmitFlags(node) & 262144) { emitSignatureHead(node); emitBlockFunctionBody(body); } @@ -49044,7 +49787,7 @@ var ts; emitWithPrefix(": ", node.type); } function shouldEmitBlockFunctionBodyOnSingleLine(body) { - if (ts.getEmitFlags(body) & 32) { + if (ts.getEmitFlags(body) & 1) { return true; } if (body.multiLine) { @@ -49099,7 +49842,7 @@ var ts; emitModifiers(node, node.modifiers); write("class"); emitNodeWithPrefix(" ", node.name, emitIdentifierName); - var indentedFlag = ts.getEmitFlags(node) & 524288; + var indentedFlag = ts.getEmitFlags(node) & 32768; if (indentedFlag) { increaseIndent(); } @@ -49358,7 +50101,7 @@ var ts; emit(node.name); write(": "); var initializer = node.initializer; - if ((ts.getEmitFlags(initializer) & 16384) === 0) { + if ((ts.getEmitFlags(initializer) & 512) === 0) { var commentRange = ts.getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos); } @@ -49412,71 +50155,31 @@ var ts; } return statements.length; } - function emitHelpers(node) { - var emitFlags = ts.getEmitFlags(node); + function emitHelpers(node, isBundle) { + var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile; + var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); + var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit; var helpersEmitted = false; - if (emitFlags & 1) { - helpersEmitted = emitEmitHelpers(currentSourceFile); - } - if (emitFlags & 2) { - writeLines(exportStarHelper); - helpersEmitted = true; - } - if (emitFlags & 4) { - writeLines(superHelper); - helpersEmitted = true; - } - if (emitFlags & 8) { - writeLines(advancedSuperHelper); - helpersEmitted = true; - } - return helpersEmitted; - } - function emitEmitHelpers(node) { - if (compilerOptions.noEmitHelpers) { - return false; - } - if (compilerOptions.importHelpers - && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { - return false; - } - var helpersEmitted = false; - if ((languageVersion < 2) && (!extendsEmitted && node.flags & 1024)) { - writeLines(extendsHelper); - extendsEmitted = true; - helpersEmitted = true; - } - if ((languageVersion < 5 || currentSourceFile.scriptKind === 2 || currentSourceFile.scriptKind === 4) && - compilerOptions.jsx !== 1 && - !assignEmitted && - node.flags & 16384) { - writeLines(assignHelper); - assignEmitted = true; - } - if (languageVersion < 5 && !restEmitted && node.flags & 32768) { - writeLines(restHelper); - restEmitted = true; - } - if (!decorateEmitted && node.flags & 2048) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); + var helpers = ts.getEmitHelpers(node); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + if (shouldSkip) + continue; + if (shouldBundle) { + if (bundledHelpers[helper.name]) { + continue; + } + bundledHelpers[helper.name] = true; + } + } + else if (isBundle) { + continue; + } + writeLines(helper.text); + helpersEmitted = true; } - decorateEmitted = true; - helpersEmitted = true; - } - if (!paramEmitted && node.flags & 4096) { - writeLines(paramHelper); - paramEmitted = true; - helpersEmitted = true; - } - if ((languageVersion < 4) && (!awaiterEmitted && node.flags & 8192)) { - writeLines(awaiterHelper); - if (languageVersion < 2) { - writeLines(generatorHelper); - } - awaiterEmitted = true; - helpersEmitted = true; } if (helpersEmitted) { writeLine(); @@ -49484,9 +50187,10 @@ var ts; return helpersEmitted; } function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); for (var i = 0; i < lines.length; i++) { - var line = lines[i]; + var line = indentation ? lines[i].slice(indentation) : lines[i]; if (line.length) { if (i > 0) { writeLine(); @@ -49495,6 +50199,21 @@ var ts; } } } + function guessIndentation(lines) { + var indentation; + for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { + var line = lines_1[_a]; + for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { + if (!ts.isWhiteSpace(line.charCodeAt(i))) { + if (indentation === undefined || i < indentation) { + indentation = i; + break; + } + } + } + } + return indentation; + } function emitShebang() { var shebang = ts.getShebang(currentText); if (shebang) { @@ -49836,21 +50555,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_40 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_40)) { + var name_42 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_42)) { tempFlags |= flags; - return name_40; + return name_42; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_41 = count < 26 + var name_43 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_41)) { - return name_41; + if (isUniqueName(name_43)) { + return name_43; } } } @@ -49971,7 +50690,6 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.2.0"; var emptyArray = []; function findConfigFile(searchPath, fileExists, configName) { if (configName === void 0) { configName = "tsconfig.json"; } @@ -50187,10 +50905,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_42 = names_1[_i]; - var result = name_42 in cache - ? cache[name_42] - : cache[name_42] = loader(name_42, containingFile); + var name_44 = names_1[_i]; + var result = name_44 in cache + ? cache[name_44] + : cache[name_44] = loader(name_44, containingFile); resolutions.push(result); } return resolutions; @@ -50244,7 +50962,8 @@ var ts; ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host); if (typeReferences.length) { - var containingFilename = ts.combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts"); + var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); + var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts"); var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename); for (var i = 0; i < typeReferences.length; i++) { processTypeReferenceDirective(typeReferences[i], resolutions[i]); @@ -50724,8 +51443,8 @@ var ts; } break; } - for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) { - var node = nodes_4[_b]; + for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { + var node = nodes_6[_b]; walk(node); } } @@ -51307,7 +52026,9 @@ var ts; this.text = text; } StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); }; StringScriptSnapshot.prototype.getLength = function () { return this.text.length; @@ -51758,7 +52479,7 @@ var ts; case 243: case 237: return ts.ScriptElementKind.alias; - case 284: + case 285: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -51973,7 +52694,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 291 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 292 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -52209,11 +52930,11 @@ var ts; } } if (node) { - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - if (jsDocComment.tags) { - for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) { + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + if (jsDoc.tags) { + for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; if (tag.pos <= position && position <= tag.end) { return tag; @@ -52378,6 +53099,7 @@ var ts; writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, + writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName); }, writeSymbol: writeSymbol, writeLine: writeLine, increaseIndent: function () { indent++; }, @@ -52535,7 +53257,7 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - else if (ts.isStringOrNumericLiteral(location.kind) && + else if (ts.isStringOrNumericLiteral(location) && location.parent.kind === 142) { return location.text; } @@ -53618,16 +54340,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 280: + case 281: processJSDocParameterTag(tag); break; - case 283: + case 284: processJSDocTemplateTag(tag); break; - case 282: + case 283: processElement(tag.typeExpression); break; - case 281: + case 282: processElement(tag.typeExpression); break; } @@ -53879,13 +54601,13 @@ var ts; function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var nameTable = ts.getNameTable(sourceFile); - for (var name_43 in nameTable) { - if (nameTable[name_43] === position) { + for (var name_45 in nameTable) { + if (nameTable[name_45] === position) { continue; } - if (!uniqueNames[name_43]) { - uniqueNames[name_43] = name_43; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_43), compilerOptions.target, true); + if (!uniqueNames[name_45]) { + uniqueNames[name_45] = name_45; + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, true); if (displayName) { var entry = { name: displayName, @@ -54307,11 +55029,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_14 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_14) { + var parent_13 = ts.getDirectoryPath(currentDir); + if (currentDir === parent_13) { break; } - currentDir = parent_14; + currentDir = parent_13; } else { break; @@ -54388,10 +55110,10 @@ var ts; function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) { var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_2 = completionData.location; - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_2) === entryName ? s : undefined; }); + var symbols = completionData.symbols, location_3 = completionData.location; + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_2, location_2, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), @@ -54417,8 +55139,8 @@ var ts; function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) { var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_3 = completionData.location; - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; }); + var symbols = completionData.symbols, location_4 = completionData.location; + return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_4) === entryName ? s : undefined; }); } return undefined; } @@ -54443,9 +55165,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 282: - case 280: + case 283: case 281: + case 282: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -54480,13 +55202,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_15 = contextToken.parent, kind = contextToken.kind; + var parent_14 = contextToken.parent, kind = contextToken.kind; if (kind === 22) { - if (parent_15.kind === 177) { + if (parent_14.kind === 177) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_15.kind === 141) { + else if (parent_14.kind === 141) { node = contextToken.parent.left; isRightOfDot = true; } @@ -54783,9 +55505,9 @@ var ts; switch (contextToken.kind) { case 16: case 25: - var parent_16 = contextToken.parent; - if (parent_16 && (parent_16.kind === 176 || parent_16.kind === 172)) { - return parent_16; + var parent_15 = contextToken.parent; + if (parent_15 && (parent_15.kind === 176 || parent_15.kind === 172)) { + return parent_15; } break; } @@ -54808,34 +55530,34 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_17 = contextToken.parent; + var parent_16 = contextToken.parent; switch (contextToken.kind) { case 27: case 40: case 70: case 250: case 251: - if (parent_17 && (parent_17.kind === 247 || parent_17.kind === 248)) { - return parent_17; + if (parent_16 && (parent_16.kind === 247 || parent_16.kind === 248)) { + return parent_16; } - else if (parent_17.kind === 250) { - return parent_17.parent; + else if (parent_16.kind === 250) { + return parent_16.parent; } break; case 9: - if (parent_17 && ((parent_17.kind === 250) || (parent_17.kind === 251))) { - return parent_17.parent; + if (parent_16 && ((parent_16.kind === 250) || (parent_16.kind === 251))) { + return parent_16.parent; } break; case 17: - if (parent_17 && - parent_17.kind === 252 && - parent_17.parent && - (parent_17.parent.kind === 250)) { - return parent_17.parent.parent; + if (parent_16 && + parent_16.kind === 252 && + parent_16.parent && + (parent_16.parent.kind === 250)) { + return parent_16.parent.parent; } - if (parent_17 && parent_17.kind === 251) { - return parent_17.parent; + if (parent_16 && parent_16.kind === 251) { + return parent_16.parent; } break; } @@ -54958,8 +55680,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_44 = element.propertyName || element.name; - existingImportsOrExports[name_44.text] = true; + var name_46 = element.propertyName || element.name; + existingImportsOrExports[name_46.text] = true; } if (!ts.someProperties(existingImportsOrExports)) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); @@ -55256,17 +55978,17 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_18 = child.parent; - if (ts.isFunctionBlock(parent_18) || parent_18.kind === 261) { - return parent_18; + var parent_17 = child.parent; + if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261) { + return parent_17; } - if (parent_18.kind === 221) { - var tryStatement = parent_18; + if (parent_17.kind === 221) { + var tryStatement = parent_17; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_18; + child = parent_17; } return undefined; } @@ -56101,24 +56823,24 @@ var ts; } var containingTypeReference = getContainingTypeReference(refNode); if (containingTypeReference) { - var parent_19 = containingTypeReference.parent; - if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); + var parent_18 = containingTypeReference.parent; + if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); } - else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { - if (parent_19.body.kind === 204) { - ts.forEachReturnStatement(parent_19.body, function (returnStatement) { + else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { + if (parent_18.body.kind === 204) { + ts.forEachReturnStatement(parent_18.body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); } }); } - else if (isImplementationExpression(parent_19.body)) { - maybeAdd(getReferenceEntryFromNode(parent_19.body)); + else if (isImplementationExpression(parent_18.body)) { + maybeAdd(getReferenceEntryFromNode(parent_18.body)); } } - else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_19.expression)); + else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { + maybeAdd(getReferenceEntryFromNode(parent_18.expression)); } } } @@ -56379,8 +57101,8 @@ var ts; if (!node_2 || node_2.kind !== 9) { return; } - var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); - if (type_2 === searchType) { + var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + if (type_1 === searchType) { references.push(getReferenceEntryFromNode(node_2)); } } @@ -56494,9 +57216,9 @@ var ts; return undefined; } } - var result_3 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3, ts.createMap()); - return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result_4 = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, ts.createMap()); + return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); } return undefined; }); @@ -56504,7 +57226,7 @@ var ts; function getNameFromObjectLiteralElement(node) { if (node.name.kind === 142) { var nameExpression = node.name.expression; - if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; } return undefined; @@ -56516,20 +57238,20 @@ var ts; var contextualType = typeChecker.getContextualType(objectLiteral); var name = getNameFromObjectLiteralElement(node); if (name && contextualType) { - var result_4 = []; + var result_5 = []; var symbol_2 = contextualType.getProperty(name); if (symbol_2) { - result_4.push(symbol_2); + result_5.push(symbol_2); } if (contextualType.flags & 65536) { ts.forEach(contextualType.types, function (t) { var symbol = t.getProperty(name); if (symbol) { - result_4.push(symbol); + result_5.push(symbol); } }); } - return result_4; + return result_5; } return undefined; } @@ -56757,13 +57479,13 @@ var ts; return undefined; } if (type.flags & 65536 && !(type.flags & 16)) { - var result_5 = []; + var result_6 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(result_5, getDefinitionFromSymbol(typeChecker, t.symbol, node)); + ts.addRange(result_6, getDefinitionFromSymbol(typeChecker, t.symbol, node)); } }); - return result_5; + return result_6; } if (!type.symbol) { return undefined; @@ -56933,6 +57655,7 @@ var ts; "lends", "link", "memberOf", + "method", "name", "namespace", "param", @@ -56955,7 +57678,7 @@ var ts; function getJsDocCommentsFromDeclarations(declarations) { var documentationComment = []; forEachUnique(declarations, function (declaration) { - var comments = ts.getJSDocComments(declaration, true); + var comments = ts.getCommentsFromJSDoc(declaration); if (!comments) { return; } @@ -57030,13 +57753,19 @@ var ts; var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; for (var i = 0, numParams = parameters.length; i < numParams; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 ? currentName.text : "param" + i; - docParams += indentationStr + " * @param " + paramName + newLine; + if (isJavaScriptFile) { + docParams += indentationStr + " * @param {any} " + paramName + newLine; + } + else { + docParams += indentationStr + " * @param " + paramName + newLine; + } } var preamble = "/**" + newLine + indentationStr + " * "; @@ -57094,10 +57823,10 @@ var ts; return; } var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_45 in nameToDeclarations) { - var declarations = nameToDeclarations[name_45]; + for (var name_47 in nameToDeclarations) { + var declarations = nameToDeclarations[name_47]; if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_45); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_47); if (!matches) { continue; } @@ -57108,14 +57837,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_45); + matches = patternMatcher.getMatches(containers, name_47); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_45, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_47, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -57368,9 +58097,9 @@ var ts; case 174: case 223: var decl = node; - var name_46 = decl.name; - if (ts.isBindingPattern(name_46)) { - addChildrenRecursively(name_46); + var name_48 = decl.name; + if (ts.isBindingPattern(name_48)) { + addChildrenRecursively(name_48); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { addChildrenRecursively(decl.initializer); @@ -57416,9 +58145,9 @@ var ts; addLeafNode(node); break; default: - ts.forEach(node.jsDocComments, function (jsDocComment) { - ts.forEach(jsDocComment.tags, function (tag) { - if (tag.kind === 284) { + ts.forEach(node.jsDoc, function (jsDoc) { + ts.forEach(jsDoc.tags, function (tag) { + if (tag.kind === 285) { addLeafNode(tag); } }); @@ -57534,7 +58263,7 @@ var ts; case 185: case 197: return getFunctionOrClassName(node); - case 284: + case 285: return getJSDocTypedefTagName(node); default: return undefined; @@ -57574,7 +58303,7 @@ var ts; return "()"; case 155: return "[]"; - case 284: + case 285: return getJSDocTypedefTagName(node); default: return ""; @@ -57621,7 +58350,7 @@ var ts; case 230: case 261: case 228: - case 284: + case 285: return true; case 150: case 149: @@ -57834,24 +58563,24 @@ var ts; switch (n.kind) { case 204: if (!ts.isFunctionBlock(n)) { - var parent_20 = n.parent; + var parent_19 = n.parent; var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); - if (parent_20.kind === 209 || - parent_20.kind === 212 || - parent_20.kind === 213 || - parent_20.kind === 211 || - parent_20.kind === 208 || - parent_20.kind === 210 || - parent_20.kind === 217 || - parent_20.kind === 256) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + if (parent_19.kind === 209 || + parent_19.kind === 212 || + parent_19.kind === 213 || + parent_19.kind === 211 || + parent_19.kind === 208 || + parent_19.kind === 210 || + parent_19.kind === 217 || + parent_19.kind === 256) { + addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_20.kind === 221) { - var tryStatement = parent_20; + if (parent_19.kind === 221) { + var tryStatement = parent_19; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -59465,8 +60194,8 @@ var ts; if (declaration.kind !== 223 && declaration.kind !== 225) { return false; } - for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { - if (parent_21.kind === 261 || parent_21.kind === 231) { + for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { + if (parent_20.kind === 261 || parent_20.kind === 231) { return false; } } @@ -59550,7 +60279,7 @@ var ts; return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_4 = function (opt) { + var _loop_3 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -59566,7 +60295,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_4(opt); + _loop_3(opt); } return options; } @@ -59953,7 +60682,7 @@ var ts; function RuleOperationContext() { var funcs = []; for (var _i = 0; _i < arguments.length; _i++) { - funcs[_i - 0] = arguments[_i]; + funcs[_i] = arguments[_i]; } this.customContextChecks = funcs; } @@ -60160,9 +60889,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_47 in o) { - if (o[name_47] === rule) { - return name_47; + for (var name_49 in o) { + if (o[name_49] === rule) { + return name_49; } } throw new Error("Unknown rule"); @@ -61341,11 +62070,23 @@ var ts; else { var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); - if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) { + if (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) { recordReplace(startLinePosition, tokenStart.character, indentationString); } } } + function characterToColumn(startLinePosition, characterInLine) { + var column = 0; + for (var i = 0; i < characterInLine; i++) { + if (sourceFile.text.charCodeAt(startLinePosition + i) === 9) { + column += options.tabSize - column % options.tabSize; + } + else { + column++; + } + } + return column; + } function indentationIsDifferent(indentationString, startLinePosition) { return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); } @@ -62050,6 +62791,579 @@ var ts; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var codefix; + (function (codefix) { + var ModuleSpecifierComparison; + (function (ModuleSpecifierComparison) { + ModuleSpecifierComparison[ModuleSpecifierComparison["Better"] = 0] = "Better"; + ModuleSpecifierComparison[ModuleSpecifierComparison["Equal"] = 1] = "Equal"; + ModuleSpecifierComparison[ModuleSpecifierComparison["Worse"] = 2] = "Worse"; + })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); + var ImportCodeActionMap = (function () { + function ImportCodeActionMap() { + this.symbolIdToActionMap = ts.createMap(); + } + ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { + if (!newAction) { + return; + } + if (!this.symbolIdToActionMap[symbolId]) { + this.symbolIdToActionMap[symbolId] = [newAction]; + return; + } + if (newAction.kind === "CodeChange") { + this.symbolIdToActionMap[symbolId].push(newAction); + return; + } + var updatedNewImports = []; + for (var _i = 0, _a = this.symbolIdToActionMap[symbolId]; _i < _a.length; _i++) { + var existingAction = _a[_i]; + if (existingAction.kind === "CodeChange") { + updatedNewImports.push(existingAction); + continue; + } + switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) { + case ModuleSpecifierComparison.Better: + if (newAction.kind === "NewImport") { + return; + } + case ModuleSpecifierComparison.Equal: + updatedNewImports.push(existingAction); + break; + case ModuleSpecifierComparison.Worse: + continue; + } + } + updatedNewImports.push(newAction); + this.symbolIdToActionMap[symbolId] = updatedNewImports; + }; + ImportCodeActionMap.prototype.addActions = function (symbolId, newActions) { + for (var _i = 0, newActions_1 = newActions; _i < newActions_1.length; _i++) { + var newAction = newActions_1[_i]; + this.addAction(symbolId, newAction); + } + }; + ImportCodeActionMap.prototype.getAllActions = function () { + var result = []; + for (var symbolId in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + } + return result; + }; + ImportCodeActionMap.prototype.compareModuleSpecifiers = function (moduleSpecifier1, moduleSpecifier2) { + if (moduleSpecifier1 === moduleSpecifier2) { + return ModuleSpecifierComparison.Equal; + } + if (moduleSpecifier2.indexOf(moduleSpecifier1) === 0) { + return ModuleSpecifierComparison.Better; + } + if (moduleSpecifier1.indexOf(moduleSpecifier2) === 0) { + return ModuleSpecifierComparison.Worse; + } + if (ts.isExternalModuleNameRelative(moduleSpecifier1) && ts.isExternalModuleNameRelative(moduleSpecifier2)) { + var regex = new RegExp(ts.directorySeparator, "g"); + var moduleSpecifier1LevelCount = (moduleSpecifier1.match(regex) || []).length; + var moduleSpecifier2LevelCount = (moduleSpecifier2.match(regex) || []).length; + return moduleSpecifier1LevelCount < moduleSpecifier2LevelCount + ? ModuleSpecifierComparison.Better + : moduleSpecifier1LevelCount === moduleSpecifier2LevelCount + ? ModuleSpecifierComparison.Equal + : ModuleSpecifierComparison.Worse; + } + return ModuleSpecifierComparison.Equal; + }; + return ImportCodeActionMap; + }()); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var checker = context.program.getTypeChecker(); + var allSourceFiles = context.program.getSourceFiles(); + var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + var name = token.getText(); + var symbolIdActionMap = new ImportCodeActionMap(); + var cachedImportDeclarations = ts.createMap(); + var cachedNewImportInsertPosition; + var allPotentialModules = checker.getAmbientModules(); + for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { + var otherSourceFile = allSourceFiles_1[_i]; + if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) { + allPotentialModules.push(otherSourceFile.symbol); + } + } + var currentTokenMeaning = ts.getMeaningFromLocation(token); + for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { + var moduleSymbol = allPotentialModules_1[_a]; + context.cancellationToken.throwIfCancellationRequested(); + var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); + if (defaultExport) { + var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport); + if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { + var symbolId = getUniqueSymbolId(localSymbol); + symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, true)); + } + } + var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol); + if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) { + var symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName); + symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol)); + } + } + return symbolIdActionMap.getAllActions(); + function getImportDeclarations(moduleSymbol) { + var moduleSymbolId = getUniqueSymbolId(moduleSymbol); + if (cachedImportDeclarations[moduleSymbolId]) { + return cachedImportDeclarations[moduleSymbolId]; + } + var existingDeclarations = []; + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var importModuleSpecifier = _a[_i]; + var importSymbol = checker.getSymbolAtLocation(importModuleSpecifier); + if (importSymbol === moduleSymbol) { + existingDeclarations.push(getImportDeclaration(importModuleSpecifier)); + } + } + cachedImportDeclarations[moduleSymbolId] = existingDeclarations; + return existingDeclarations; + function getImportDeclaration(moduleSpecifier) { + var node = moduleSpecifier; + while (node) { + if (node.kind === 235) { + return node; + } + if (node.kind === 234) { + return node; + } + node = node.parent; + } + return undefined; + } + } + function getUniqueSymbolId(symbol) { + if (symbol.flags & 8388608) { + return ts.getSymbolId(checker.getAliasedSymbol(symbol)); + } + return ts.getSymbolId(symbol); + } + function checkSymbolHasMeaning(symbol, meaning) { + var declarations = symbol.getDeclarations(); + return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; + } + function getCodeActionForImport(moduleSymbol, isDefault) { + var existingDeclarations = getImportDeclarations(moduleSymbol); + if (existingDeclarations.length > 0) { + return getCodeActionsForExistingImport(existingDeclarations); + } + else { + return [getCodeActionForNewImport()]; + } + function getCodeActionsForExistingImport(declarations) { + var actions = []; + var namespaceImportDeclaration; + var namedImportDeclaration; + var existingModuleSpecifier; + for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { + var declaration = declarations_11[_i]; + if (declaration.kind === 235) { + var namedBindings = declaration.importClause && declaration.importClause.namedBindings; + if (namedBindings && namedBindings.kind === 237) { + namespaceImportDeclaration = declaration; + } + else { + namedImportDeclaration = declaration; + } + existingModuleSpecifier = declaration.moduleSpecifier.getText(); + } + else { + namespaceImportDeclaration = declaration; + existingModuleSpecifier = getModuleSpecifierFromImportEqualsDeclaration(declaration); + } + } + if (namespaceImportDeclaration) { + actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); + } + if (namedImportDeclaration && namedImportDeclaration.importClause && + (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { + var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); + var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); + actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); + } + else { + actions.push(getCodeActionForNewImport(existingModuleSpecifier)); + } + return actions; + function getModuleSpecifierFromImportEqualsDeclaration(declaration) { + if (declaration.moduleReference && declaration.moduleReference.kind === 245) { + return declaration.moduleReference.expression.getText(); + } + return declaration.moduleReference.getText(); + } + function getTextChangeForImportClause(importClause) { + var newImportText = isDefault ? "default as " + name : name; + var importList = importClause.namedBindings; + if (!importList && importClause.name) { + var start = importClause.name.getEnd(); + return { + newText: ", { " + newImportText + " }", + span: { start: start, length: 0 } + }; + } + if (importList.elements.length === 0) { + var start = importList.getStart(); + return { + newText: "{ " + newImportText + " }", + span: { start: start, length: importList.getEnd() - start } + }; + } + var insertPoint = importList.elements[importList.elements.length - 1].getEnd(); + var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart()); + var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd()); + var oneImportPerLine = endLine - startLine > importList.elements.length; + return { + newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText, + span: { start: insertPoint, length: 0 } + }; + } + function getCodeActionForNamespaceImport(declaration) { + var namespacePrefix; + if (declaration.kind === 235) { + namespacePrefix = declaration.importClause.namedBindings.name.getText(); + } + else { + namespacePrefix = declaration.name.getText(); + } + namespacePrefix = ts.stripQuotes(namespacePrefix); + return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange"); + } + } + function getCodeActionForNewImport(moduleSpecifier) { + if (!cachedNewImportInsertPosition) { + var lastModuleSpecifierEnd = -1; + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var moduleSpecifier_1 = _a[_i]; + var end = moduleSpecifier_1.getEnd(); + if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) { + lastModuleSpecifierEnd = end; + } + } + cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart(); + } + var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); + var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); + var importStatementText = isDefault + ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" + : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; + var newText = cachedNewImportInsertPosition === sourceFile.getStart() + ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter + : "" + context.newLineCharacter + importStatementText + ";"; + return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes); + function getModuleSpecifierForNewImport() { + var fileName = sourceFile.path; + var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path; + var sourceDirectory = ts.getDirectoryPath(fileName); + var options = context.program.getCompilerOptions(); + return tryGetModuleNameFromAmbientModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || + tryGetModuleNameFromTypeRoots() || + tryGetModuleNameAsNodeModule() || + ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); + function tryGetModuleNameFromAmbientModule() { + if (moduleSymbol.valueDeclaration.kind !== 261) { + return moduleSymbol.name; + } + } + function tryGetModuleNameFromBaseUrl() { + if (!options.baseUrl) { + return undefined; + } + var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName); + var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl); + if (!relativeName) { + return undefined; + } + relativeName = removeExtensionAndIndexPostFix(relativeName); + if (options.paths) { + for (var key in options.paths) { + for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { + var pattern = _a[_i]; + var indexOfStar = pattern.indexOf("*"); + if (indexOfStar === 0 && pattern.length === 1) { + continue; + } + else if (indexOfStar !== -1) { + var prefix = pattern.substr(0, indexOfStar); + var suffix = pattern.substr(indexOfStar + 1); + if (relativeName.length >= prefix.length + suffix.length && + ts.startsWith(relativeName, prefix) && + ts.endsWith(relativeName, suffix)) { + var matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length); + return key.replace("\*", matchedStar); + } + } + else if (pattern === relativeName) { + return key; + } + } + } + } + return relativeName; + } + function tryGetModuleNameFromRootDirs() { + if (options.rootDirs) { + var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, undefined, getCanonicalFileName); }); + var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs); + var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs); + if (normalizedTargetPath !== undefined) { + var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath; + return ts.removeFileExtension(relativePath); + } + } + return undefined; + } + function tryGetModuleNameFromTypeRoots() { + var typeRoots = ts.getEffectiveTypeRoots(options, context.host); + if (typeRoots) { + var normalizedTypeRoots = ts.map(typeRoots, function (typeRoot) { return ts.toPath(typeRoot, undefined, getCanonicalFileName); }); + for (var _i = 0, normalizedTypeRoots_1 = normalizedTypeRoots; _i < normalizedTypeRoots_1.length; _i++) { + var typeRoot = normalizedTypeRoots_1[_i]; + if (ts.startsWith(moduleFileName, typeRoot)) { + var relativeFileName = moduleFileName.substring(typeRoot.length + 1); + return removeExtensionAndIndexPostFix(relativeFileName); + } + } + } + } + function tryGetModuleNameAsNodeModule() { + if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) { + return undefined; + } + var indexOfNodeModules = moduleFileName.indexOf("node_modules"); + if (indexOfNodeModules < 0) { + return undefined; + } + var relativeFileName; + if (sourceDirectory.indexOf(moduleFileName.substring(0, indexOfNodeModules - 1)) === 0) { + relativeFileName = moduleFileName.substring(indexOfNodeModules + 13); + } + else { + relativeFileName = getRelativePath(moduleFileName, sourceDirectory); + } + relativeFileName = ts.removeFileExtension(relativeFileName); + if (ts.endsWith(relativeFileName, "/index")) { + relativeFileName = ts.getDirectoryPath(relativeFileName); + } + else { + try { + var moduleDirectory = ts.getDirectoryPath(moduleFileName); + var packageJsonContent = JSON.parse(context.host.readFile(ts.combinePaths(moduleDirectory, "package.json"))); + if (packageJsonContent) { + var mainFile = packageJsonContent.main || packageJsonContent.typings; + if (mainFile) { + var mainExportFile = ts.toPath(mainFile, moduleDirectory, getCanonicalFileName); + if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(moduleFileName)) { + relativeFileName = ts.getDirectoryPath(relativeFileName); + } + } + } + } + catch (e) { } + } + return relativeFileName; + } + } + function getPathRelativeToRootDirs(path, rootDirs) { + for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) { + var rootDir = rootDirs_2[_i]; + var relativeName = tryRemoveParentDirectoryName(path, rootDir); + if (relativeName !== undefined) { + return relativeName; + } + } + return undefined; + } + function removeExtensionAndIndexPostFix(fileName) { + fileName = ts.removeFileExtension(fileName); + if (ts.endsWith(fileName, "/index")) { + fileName = fileName.substr(0, fileName.length - 6); + } + return fileName; + } + function getRelativePath(path, directoryPath) { + var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); + return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath; + } + function tryRemoveParentDirectoryName(path, parentDirectory) { + var index = path.indexOf(parentDirectory); + if (index === 0) { + return ts.endsWith(parentDirectory, ts.directorySeparator) + ? path.substring(parentDirectory.length) + : path.substring(parentDirectory.length + 1); + } + return undefined; + } + } + } + function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) { + return { + description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)), + changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }], + kind: kind, + moduleSpecifier: moduleSpecifier + }; + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + if (token.kind === 20) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70: + switch (token.parent.kind) { + case 223: + switch (token.parent.parent.parent.kind) { + case 211: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); + } + else { + return removeSingleItem(forInitializer.declarations, token); + } + case 213: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 224) { + var forOfInitializer = forOfStatement.initializer; + return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); + } + break; + case 212: + return undefined; + case 256: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return createCodeFix("", parameter.pos, parameter.end - parameter.pos); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); + } + else { + var declarations = variableStatement.declarationList.declarations; + return removeSingleItem(declarations, token); + } + } + case 143: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); + } + else { + return removeSingleItem(typeParameters, token); + } + case 144: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else { + return removeSingleItem(functionDeclaration.parameters, token); + } + case 234: + var importEquals = findImportDeclaration(token); + return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); + case 239: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + var importSpec = findImportDeclaration(token); + return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); + } + else { + return removeSingleItem(namedImports.elements, token); + } + case 236: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = findImportDeclaration(importClause); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); + } + case 237: + var namespaceImport = token.parent; + if (namespaceImport.name == token && !namespaceImport.parent.name) { + var importDecl = findImportDeclaration(namespaceImport); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + var start_4 = namespaceImport.parent.name.end; + return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); + } + } + break; + case 147: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + case 237: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + if (ts.isDeclarationName(token)) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); + } + else { + return undefined; + } + function findImportDeclaration(token) { + var importDecl = token; + while (importDecl.kind != 235 && importDecl.parent) { + importDecl = importDecl.parent; + } + return importDecl; + } + function createCodeFix(newText, start, length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ newText: newText, span: { start: start, length: length } }] + }] + }]; + } + function removeSingleItem(elements, token) { + if (elements[0] === token.parent) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + else { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + } + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; (function (ts) { ts.servicesVersion = "0.5"; function createNode(kind, pos, end, parent) { @@ -62111,11 +63425,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(291, nodes.pos, nodes.end, this); + var list = createNode(292, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var node = nodes_5[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -62134,7 +63448,7 @@ var ts; ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 290; + var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 291; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -62152,8 +63466,8 @@ var ts; children.push(_this.createSyntaxList(nodes)); pos_3 = nodes.end; }; - if (this.jsDocComments) { - for (var _i = 0, _a = this.jsDocComments; _i < _a.length; _i++) { + if (this.jsDoc) { + for (var _i = 0, _a = this.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; processNode(jsDocComment); } @@ -62373,6 +63687,19 @@ var ts; SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) { return ts.getPositionOfLineAndCharacter(this, line, character); }; + SourceFileObject.prototype.getLineEndOfPosition = function (pos) { + var line = this.getLineAndCharacterOfPosition(pos).line; + var lineStarts = this.getLineStarts(); + var lastCharPos; + if (line + 1 >= lineStarts.length) { + lastCharPos = this.getEnd(); + } + if (!lastCharPos) { + lastCharPos = lineStarts[line + 1] - 1; + } + var fullText = this.getFullText(); + return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos; + }; SourceFileObject.prototype.getNamedDeclarations = function () { if (!this.namedDeclarations) { this.namedDeclarations = this.computeNamedDeclarations(); @@ -62394,9 +63721,9 @@ var ts; } function getDeclarationName(declaration) { if (declaration.name) { - var result_6 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_6 !== undefined) { - return result_6; + var result_7 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_7 !== undefined) { + return result_7; } if (declaration.name.kind === 142) { var expr = declaration.name.expression; @@ -62437,8 +63764,8 @@ var ts; else { declarations.push(functionDeclaration); } - ts.forEachChild(node, visit); } + ts.forEachChild(node, visit); break; case 226: case 197: @@ -62878,6 +64205,7 @@ var ts; return program; } function cleanupSemanticCache() { + program = undefined; } function dispose() { if (program) { @@ -63222,7 +64550,9 @@ var ts; sourceFile: sourceFile, span: span, program: program, - newLineCharacter: newLineChar + newLineCharacter: newLineChar, + host: host, + cancellationToken: cancellationToken }; var fixes = ts.codefix.getFixes(context); if (fixes) { @@ -63239,7 +64569,7 @@ var ts; return false; } var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + if (ts.isInString(sourceFile, position)) { return false; } if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { @@ -63387,10 +64717,10 @@ var ts; break; default: ts.forEachChild(node, walk); - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - ts.forEachChild(jsDocComment, walk); + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + ts.forEachChild(jsDoc, walk); } } } @@ -63418,22 +64748,160 @@ var ts; (function (ts) { var server; (function (server) { + var TextStorage = (function () { + function TextStorage(host, fileName) { + this.host = host; + this.fileName = fileName; + this.svcVersion = 0; + this.textVersion = 0; + } + TextStorage.prototype.getVersion = function () { + return this.svc + ? "SVC-" + this.svcVersion + "-" + this.svc.getSnapshot().version + : "Text-" + this.textVersion; + }; + TextStorage.prototype.hasScriptVersionCache = function () { + return this.svc !== undefined; + }; + TextStorage.prototype.useScriptVersionCache = function (newText) { + this.switchToScriptVersionCache(newText); + }; + TextStorage.prototype.useText = function (newText) { + this.svc = undefined; + this.setText(newText); + }; + TextStorage.prototype.edit = function (start, end, newText) { + this.switchToScriptVersionCache().edit(start, end - start, newText); + }; + TextStorage.prototype.reload = function (text) { + if (this.svc) { + this.svc.reload(text); + } + else { + this.setText(text); + } + }; + TextStorage.prototype.reloadFromFile = function (tempFileName) { + if (this.svc || (tempFileName !== this.fileName)) { + this.reload(this.getFileText(tempFileName)); + } + else { + this.setText(undefined); + } + }; + TextStorage.prototype.getSnapshot = function () { + return this.svc + ? this.svc.getSnapshot() + : ts.ScriptSnapshot.fromString(this.getOrLoadText()); + }; + TextStorage.prototype.getLineInfo = function (line) { + return this.switchToScriptVersionCache().getSnapshot().index.lineNumberToInfo(line); + }; + TextStorage.prototype.lineToTextSpan = function (line) { + if (!this.svc) { + var lineMap = this.getLineMap(); + var start = lineMap[line]; + var end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length; + return ts.createTextSpanFromBounds(start, end); + } + var index = this.svc.getSnapshot().index; + var lineInfo = index.lineNumberToInfo(line + 1); + var len; + if (lineInfo.leaf) { + len = lineInfo.leaf.text.length; + } + else { + var nextLineInfo = index.lineNumberToInfo(line + 2); + len = nextLineInfo.offset - lineInfo.offset; + } + return ts.createTextSpan(lineInfo.offset, len); + }; + TextStorage.prototype.lineOffsetToPosition = function (line, offset) { + if (!this.svc) { + return ts.computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1); + } + var index = this.svc.getSnapshot().index; + var lineInfo = index.lineNumberToInfo(line); + return (lineInfo.offset + offset - 1); + }; + TextStorage.prototype.positionToLineOffset = function (position) { + if (!this.svc) { + var _a = ts.computeLineAndCharacterOfPosition(this.getLineMap(), position), line = _a.line, character = _a.character; + return { line: line + 1, offset: character + 1 }; + } + var index = this.svc.getSnapshot().index; + var lineOffset = index.charOffsetToLineNumberAndPos(position); + return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + }; + TextStorage.prototype.getFileText = function (tempFileName) { + return this.host.readFile(tempFileName || this.fileName) || ""; + }; + TextStorage.prototype.ensureNoScriptVersionCache = function () { + ts.Debug.assert(!this.svc, "ScriptVersionCache should not be set"); + }; + TextStorage.prototype.switchToScriptVersionCache = function (newText) { + if (!this.svc) { + this.svc = server.ScriptVersionCache.fromString(this.host, newText !== undefined ? newText : this.getOrLoadText()); + this.svcVersion++; + this.text = undefined; + } + return this.svc; + }; + TextStorage.prototype.getOrLoadText = function () { + this.ensureNoScriptVersionCache(); + if (this.text === undefined) { + this.setText(this.getFileText()); + } + return this.text; + }; + TextStorage.prototype.getLineMap = function () { + this.ensureNoScriptVersionCache(); + return this.lineMap || (this.lineMap = ts.computeLineStarts(this.getOrLoadText())); + }; + TextStorage.prototype.setText = function (newText) { + this.ensureNoScriptVersionCache(); + if (newText === undefined || this.text !== newText) { + this.text = newText; + this.lineMap = undefined; + this.textVersion++; + } + }; + return TextStorage; + }()); + server.TextStorage = TextStorage; var ScriptInfo = (function () { - function ScriptInfo(host, fileName, content, scriptKind, isOpen, hasMixedContent) { - if (isOpen === void 0) { isOpen = false; } + function ScriptInfo(host, fileName, scriptKind, hasMixedContent) { if (hasMixedContent === void 0) { hasMixedContent = false; } this.host = host; this.fileName = fileName; this.scriptKind = scriptKind; - this.isOpen = isOpen; this.hasMixedContent = hasMixedContent; this.containingProjects = []; this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); - this.svc = server.ScriptVersionCache.fromString(host, content); + this.textStorage = new TextStorage(host, fileName); + if (hasMixedContent) { + this.textStorage.reload(""); + } this.scriptKind = scriptKind ? scriptKind : ts.getScriptKindFromFileName(fileName); } + ScriptInfo.prototype.isScriptOpen = function () { + return this.isOpen; + }; + ScriptInfo.prototype.open = function (newText) { + this.isOpen = true; + this.textStorage.useScriptVersionCache(newText); + this.markContainingProjectsAsDirty(); + }; + ScriptInfo.prototype.close = function () { + this.isOpen = false; + this.textStorage.useText(this.hasMixedContent ? "" : undefined); + this.markContainingProjectsAsDirty(); + }; + ScriptInfo.prototype.getSnapshot = function () { + return this.textStorage.getSnapshot(); + }; ScriptInfo.prototype.getFormatCodeSettings = function () { return this.formatCodeSettings; }; @@ -63487,6 +64955,12 @@ var ts; } return this.containingProjects[0]; }; + ScriptInfo.prototype.registerFileUpdate = function () { + for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) { + var p = _a[_i]; + p.registerFileUpdate(this.path); + } + }; ScriptInfo.prototype.setFormatOptions = function (formatSettings) { if (formatSettings) { if (!this.formatCodeSettings) { @@ -63506,14 +64980,14 @@ var ts; } }; ScriptInfo.prototype.getLatestVersion = function () { - return this.svc.latestVersion().toString(); + return this.textStorage.getVersion(); }; ScriptInfo.prototype.reload = function (script) { - this.svc.reload(script); + this.textStorage.reload(script); this.markContainingProjectsAsDirty(); }; ScriptInfo.prototype.saveTo = function (fileName) { - var snap = this.snap(); + var snap = this.textStorage.getSnapshot(); this.host.writeFile(fileName, snap.getText(0, snap.getLength())); }; ScriptInfo.prototype.reloadFromFile = function (tempFileName) { @@ -63521,19 +64995,15 @@ var ts; this.reload(""); } else { - this.svc.reloadFromFile(tempFileName || this.fileName); + this.textStorage.reloadFromFile(tempFileName); this.markContainingProjectsAsDirty(); } }; - ScriptInfo.prototype.snap = function () { - return this.svc.getSnapshot(); - }; ScriptInfo.prototype.getLineInfo = function (line) { - var snap = this.snap(); - return snap.index.lineNumberToInfo(line); + return this.textStorage.getLineInfo(line); }; ScriptInfo.prototype.editContent = function (start, end, newText) { - this.svc.edit(start, end - start, newText); + this.textStorage.edit(start, end, newText); this.markContainingProjectsAsDirty(); }; ScriptInfo.prototype.markContainingProjectsAsDirty = function () { @@ -63543,27 +65013,13 @@ var ts; } }; ScriptInfo.prototype.lineToTextSpan = function (line) { - var index = this.snap().index; - var lineInfo = index.lineNumberToInfo(line + 1); - var len; - if (lineInfo.leaf) { - len = lineInfo.leaf.text.length; - } - else { - var nextLineInfo = index.lineNumberToInfo(line + 2); - len = nextLineInfo.offset - lineInfo.offset; - } - return ts.createTextSpan(lineInfo.offset, len); + return this.textStorage.lineToTextSpan(line); }; ScriptInfo.prototype.lineOffsetToPosition = function (line, offset) { - var index = this.snap().index; - var lineInfo = index.lineNumberToInfo(line); - return (lineInfo.offset + offset - 1); + return this.textStorage.lineOffsetToPosition(line, offset); }; ScriptInfo.prototype.positionToLineOffset = function (position) { - var index = this.snap().index; - var lineOffset = index.charOffsetToLineNumberAndPos(position); - return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + return this.textStorage.positionToLineOffset(position); }; return ScriptInfo; }()); @@ -63587,7 +65043,7 @@ var ts; this.trace = function (s) { return host.trace(s); }; } this.resolveModuleName = function (moduleName, containingFile, compilerOptions, host) { - var globalCache = _this.project.getTypingOptions().enableAutoDiscovery + var globalCache = _this.project.getTypeAcquisition().enable ? _this.project.projectService.typingsInstaller.globalTypingsCacheLocation : undefined; var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host); @@ -63619,15 +65075,15 @@ var ts; var compilerOptions = this.getCompilationSettings(); var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName; for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { - var name_48 = names_2[_i]; - var resolution = newResolutions[name_48]; + var name_50 = names_2[_i]; + var resolution = newResolutions[name_50]; if (!resolution) { - var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_48]; + var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_50]; if (moduleResolutionIsValid(existingResolution)) { resolution = existingResolution; } else { - newResolutions[name_48] = resolution = loader(name_48, containingFile, compilerOptions, this); + newResolutions[name_50] = resolution = loader(name_50, containingFile, compilerOptions, this); } if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { this.filesWithChangedSetOfUnresolvedImports.push(path); @@ -63692,7 +65148,7 @@ var ts; LSHost.prototype.getScriptSnapshot = function (filename) { var scriptInfo = this.project.getScriptInfoLSHost(filename); if (scriptInfo) { - return scriptInfo.snap(); + return scriptInfo.getSnapshot(); } }; LSHost.prototype.getScriptFileNames = function () { @@ -63789,8 +65245,8 @@ var ts; } return unique === 0; } - function typingOptionsChanged(opt1, opt2) { - return opt1.enableAutoDiscovery !== opt2.enableAutoDiscovery || + function typeAcquisitionChanged(opt1, opt2) { + return opt1.enable !== opt2.enable || !setIsEqualTo(opt1.include, opt2.include) || !setIsEqualTo(opt1.exclude, opt2.exclude); } @@ -63809,32 +65265,32 @@ var ts; this.perProjectCache = ts.createMap(); } TypingsCache.prototype.getTypingsForProject = function (project, unresolvedImports, forceRefresh) { - var typingOptions = project.getTypingOptions(); - if (!typingOptions || !typingOptions.enableAutoDiscovery) { + var typeAcquisition = project.getTypeAcquisition(); + if (!typeAcquisition || !typeAcquisition.enable) { return server.emptyArray; } var entry = this.perProjectCache[project.getProjectName()]; var result = entry ? entry.typings : server.emptyArray; if (forceRefresh || !entry || - typingOptionsChanged(typingOptions, entry.typingOptions) || + typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) || unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) { this.perProjectCache[project.getProjectName()] = { compilerOptions: project.getCompilerOptions(), - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, typings: result, unresolvedImports: unresolvedImports, poisoned: true }; - this.installer.enqueueInstallTypingsRequest(project, typingOptions, unresolvedImports); + this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); } return result; }; - TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typingOptions, unresolvedImports, newTypings) { + TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) { this.perProjectCache[projectName] = { compilerOptions: compilerOptions, - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, typings: server.toSortedReadonlyArray(newTypings), unresolvedImports: unresolvedImports, poisoned: false @@ -63908,10 +65364,15 @@ var ts; function AbstractBuilder(project, ctor) { this.project = project; this.ctor = ctor; - this.fileInfos = ts.createFileMap(); } + AbstractBuilder.prototype.getFileInfos = function () { + return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = ts.createFileMap()); + }; + AbstractBuilder.prototype.clear = function () { + this.fileInfos_doNotAccessDirectly = undefined; + }; AbstractBuilder.prototype.getFileInfo = function (path) { - return this.fileInfos.get(path); + return this.getFileInfos().get(path); }; AbstractBuilder.prototype.getOrCreateFileInfo = function (path) { var fileInfo = this.getFileInfo(path); @@ -63923,16 +65384,16 @@ var ts; return fileInfo; }; AbstractBuilder.prototype.getFileInfoPaths = function () { - return this.fileInfos.getKeys(); + return this.getFileInfos().getKeys(); }; AbstractBuilder.prototype.setFileInfo = function (path, info) { - this.fileInfos.set(path, info); + this.getFileInfos().set(path, info); }; AbstractBuilder.prototype.removeFileInfo = function (path) { - this.fileInfos.remove(path); + this.getFileInfos().remove(path); }; AbstractBuilder.prototype.forEachFileInfo = function (action) { - this.fileInfos.forEachValue(function (_path, value) { return action(value); }); + this.getFileInfos().forEachValue(function (_path, value) { return action(value); }); }; AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) { var fileInfo = this.getFileInfo(scriptInfo.path); @@ -64034,6 +65495,10 @@ var ts; _this.project = project; return _this; } + ModuleBuilder.prototype.clear = function () { + this.projectVersionForDependencyGraph = undefined; + _super.prototype.clear.call(this); + }; ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) { var _this = this; if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { @@ -64231,16 +65696,17 @@ var ts; }()); server.UnresolvedImportsMap = UnresolvedImportsMap; var Project = (function () { - function Project(projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) { + function Project(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) { + this.projectName = projectName; this.projectKind = projectKind; this.projectService = projectService; this.documentRegistry = documentRegistry; - this.languageServiceEnabled = languageServiceEnabled; this.compilerOptions = compilerOptions; this.compileOnSaveEnabled = compileOnSaveEnabled; this.rootFiles = []; this.rootFilesMap = ts.createFileMap(); this.cachedUnresolvedImportsPerFile = new UnresolvedImportsMap(); + this.languageServiceEnabled = true; this.lastReportedVersion = 0; this.projectStructureVersion = 0; this.projectStateVersion = 0; @@ -64253,13 +65719,11 @@ var ts; else if (hasExplicitListOfFiles) { this.compilerOptions.allowNonTsExtensions = true; } - if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { - this.compilerOptions.noEmitForJsFiles = true; - } - if (languageServiceEnabled) { - this.enableLanguageService(); - } - else { + this.setInternalCompilerOptionsForEmittingJsFiles(); + this.lsHost = new server.LSHost(this.projectService.host, this, this.projectService.cancellationToken); + this.lsHost.setCompilationSettings(this.compilerOptions); + this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry); + if (!languageServiceEnabled) { this.disableLanguageService(); } this.builder = server.createBuilder(this); @@ -64276,6 +65740,11 @@ var ts; Project.prototype.getCachedUnresolvedImportsPerFile_TestOnly = function () { return this.cachedUnresolvedImportsPerFile; }; + Project.prototype.setInternalCompilerOptionsForEmittingJsFiles = function () { + if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { + this.compilerOptions.noEmitForJsFiles = true; + } + }; Project.prototype.getProjectErrors = function () { return this.projectErrors; }; @@ -64297,16 +65766,22 @@ var ts; return this.projectStateVersion.toString(); }; Project.prototype.enableLanguageService = function () { - var lsHost = new server.LSHost(this.projectService.host, this, this.projectService.cancellationToken); - lsHost.setCompilationSettings(this.compilerOptions); - this.languageService = ts.createLanguageService(lsHost, this.documentRegistry); - this.lsHost = lsHost; + if (this.languageServiceEnabled) { + return; + } this.languageServiceEnabled = true; + this.projectService.onUpdateLanguageServiceStateForProject(this, true); }; Project.prototype.disableLanguageService = function () { - this.languageService = server.nullLanguageService; - this.lsHost = server.nullLanguageServiceHost; + if (!this.languageServiceEnabled) { + return; + } + this.languageService.cleanupSemanticCache(); this.languageServiceEnabled = false; + this.projectService.onUpdateLanguageServiceStateForProject(this, false); + }; + Project.prototype.getProjectName = function () { + return this.projectName; }; Project.prototype.getSourceFile = function (path) { if (!this.program) { @@ -64352,7 +65827,9 @@ var ts; if (this.rootFiles) { for (var _i = 0, _a = this.rootFiles; _i < _a.length; _i++) { var f = _a[_i]; - result.push(f.fileName); + if (this.languageServiceEnabled || f.isScriptOpen()) { + result.push(f.fileName); + } } if (this.typingFiles) { for (var _b = 0, _c = this.typingFiles; _b < _c.length; _b++) { @@ -64368,6 +65845,9 @@ var ts; }; Project.prototype.getScriptInfos = function () { var _this = this; + if (!this.languageServiceEnabled) { + return this.rootFiles; + } return ts.map(this.program.getSourceFiles(), function (sourceFile) { var scriptInfo = _this.projectService.getScriptInfoForPath(sourceFile.path); if (!scriptInfo) { @@ -64426,7 +65906,7 @@ var ts; }; Project.prototype.containsFile = function (filename, requireOpen) { var info = this.projectService.getScriptInfoForNormalizedPath(filename); - if (info && (info.isOpen || !requireOpen)) { + if (info && (info.isScriptOpen() || !requireOpen)) { return this.containsScriptInfo(info); } }; @@ -64451,6 +65931,9 @@ var ts; } this.markAsDirty(); }; + Project.prototype.registerFileUpdate = function (fileName) { + (this.updatedFileNames || (this.updatedFileNames = ts.createMap()))[fileName] = fileName; + }; Project.prototype.markAsDirty = function () { this.projectStateVersion++; }; @@ -64465,9 +65948,9 @@ var ts; } var unresolvedImports; if (file.resolvedModules) { - for (var name_49 in file.resolvedModules) { - if (!file.resolvedModules[name_49] && !ts.isExternalModuleNameRelative(name_49)) { - var trimmed = name_49.trim(); + for (var name_51 in file.resolvedModules) { + if (!file.resolvedModules[name_51] && !ts.isExternalModuleNameRelative(name_51)) { + var trimmed = name_51.trim(); var i = trimmed.indexOf("/"); if (i !== -1 && trimmed.charCodeAt(0) === 64) { i = trimmed.indexOf("/", i + 1); @@ -64483,9 +65966,6 @@ var ts; this.cachedUnresolvedImportsPerFile.set(file.path, unresolvedImports || server.emptyArray); }; Project.prototype.updateGraph = function () { - if (!this.languageServiceEnabled) { - return true; - } this.lsHost.startRecordingFilesWithChangedResolutions(); var hasChanges = this.updateGraphWorker(); var changedFiles = this.lsHost.finishRecordingFilesWithChangedResolutions() || server.emptyArray; @@ -64507,6 +65987,12 @@ var ts; if (this.setTypings(cachedTypings)) { hasChanges = this.updateGraphWorker() || hasChanges; } + if (this.languageServiceEnabled) { + this.builder.onProjectUpdateGraph(); + } + else { + this.builder.clear(); + } if (hasChanges) { this.projectStructureVersion++; } @@ -64539,7 +66025,6 @@ var ts; } } } - this.builder.onProjectUpdateGraph(); return hasChanges; }; Project.prototype.getScriptInfoLSHost = function (fileName) { @@ -64581,6 +66066,7 @@ var ts; this.lastCachedUnresolvedImportsList = undefined; } this.compilerOptions = compilerOptions; + this.setInternalCompilerOptionsForEmittingJsFiles(); this.lsHost.setCompilationSettings(compilerOptions); this.markAsDirty(); } @@ -64600,16 +66086,20 @@ var ts; projectName: this.getProjectName(), version: this.projectStructureVersion, isInferred: this.projectKind === ProjectKind.Inferred, - options: this.getCompilerOptions() + options: this.getCompilerOptions(), + languageServiceDisabled: !this.languageServiceEnabled }; + var updatedFileNames = this.updatedFileNames; + this.updatedFileNames = undefined; if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) { - if (this.projectStructureVersion == this.lastReportedVersion) { + if (this.projectStructureVersion == this.lastReportedVersion && !updatedFileNames) { return { info: info, projectErrors: this.projectErrors }; } var lastReportedFileNames = this.lastReportedFileNames; var currentFiles = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); var added = []; var removed = []; + var updated = ts.getOwnKeys(updatedFileNames); for (var id in currentFiles) { if (!ts.hasProperty(lastReportedFileNames, id)) { added.push(id); @@ -64622,7 +66112,7 @@ var ts; } this.lastReportedFileNames = currentFiles; this.lastReportedVersion = this.projectStructureVersion; - return { info: info, changes: { added: added, removed: removed }, projectErrors: this.projectErrors }; + return { info: info, changes: { added: added, removed: removed, updated: updated }, projectErrors: this.projectErrors }; } else { var projectFileNames = this.getFileNames(); @@ -64688,16 +66178,11 @@ var ts; server.Project = Project; var InferredProject = (function (_super) { __extends(InferredProject, _super); - function InferredProject(projectService, documentRegistry, languageServiceEnabled, compilerOptions) { - var _this = _super.call(this, ProjectKind.Inferred, projectService, documentRegistry, undefined, languageServiceEnabled, compilerOptions, false) || this; + function InferredProject(projectService, documentRegistry, compilerOptions) { + var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this; _this.directoriesWatchedForTsconfig = []; - _this.inferredProjectName = server.makeInferredProjectName(InferredProject.NextId); - InferredProject.NextId++; return _this; } - InferredProject.prototype.getProjectName = function () { - return this.inferredProjectName; - }; InferredProject.prototype.getProjectRootPath = function () { if (this.projectService.useSingleInferredProject) { return undefined; @@ -64712,45 +66197,52 @@ var ts; this.projectService.stopWatchingDirectory(directory); } }; - InferredProject.prototype.getTypingOptions = function () { + InferredProject.prototype.getTypeAcquisition = function () { return { - enableAutoDiscovery: allRootFilesAreJsOrDts(this), + enable: allRootFilesAreJsOrDts(this), include: [], exclude: [] }; }; return InferredProject; }(Project)); - InferredProject.NextId = 1; + InferredProject.newName = (function () { + var nextId = 1; + return function () { + var id = nextId; + nextId++; + return server.makeInferredProjectName(id); + }; + })(); server.InferredProject = InferredProject; var ConfiguredProject = (function (_super) { __extends(ConfiguredProject, _super); function ConfiguredProject(configFileName, projectService, documentRegistry, hasExplicitListOfFiles, compilerOptions, wildcardDirectories, languageServiceEnabled, compileOnSaveEnabled) { - var _this = _super.call(this, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; - _this.configFileName = configFileName; + var _this = _super.call(this, configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; _this.wildcardDirectories = wildcardDirectories; _this.compileOnSaveEnabled = compileOnSaveEnabled; _this.openRefCount = 0; + _this.canonicalConfigFilePath = server.asNormalizedPath(projectService.toCanonicalFileName(configFileName)); return _this; } + ConfiguredProject.prototype.getConfigFilePath = function () { + return this.getProjectName(); + }; ConfiguredProject.prototype.getProjectRootPath = function () { - return ts.getDirectoryPath(this.configFileName); + return ts.getDirectoryPath(this.getConfigFilePath()); }; ConfiguredProject.prototype.setProjectErrors = function (projectErrors) { this.projectErrors = projectErrors; }; - ConfiguredProject.prototype.setTypingOptions = function (newTypingOptions) { - this.typingOptions = newTypingOptions; + ConfiguredProject.prototype.setTypeAcquisition = function (newTypeAcquisition) { + this.typeAcquisition = newTypeAcquisition; }; - ConfiguredProject.prototype.getTypingOptions = function () { - return this.typingOptions; - }; - ConfiguredProject.prototype.getProjectName = function () { - return this.configFileName; + ConfiguredProject.prototype.getTypeAcquisition = function () { + return this.typeAcquisition; }; ConfiguredProject.prototype.watchConfigFile = function (callback) { var _this = this; - this.projectFileWatcher = this.projectService.host.watchFile(this.configFileName, function (_) { return callback(_this); }); + this.projectFileWatcher = this.projectService.host.watchFile(this.getConfigFilePath(), function (_) { return callback(_this); }); }; ConfiguredProject.prototype.watchTypeRoots = function (callback) { var _this = this; @@ -64768,7 +66260,7 @@ var ts; if (this.directoryWatcher) { return; } - var directoryToWatch = ts.getDirectoryPath(this.configFileName); + var directoryToWatch = ts.getDirectoryPath(this.getConfigFilePath()); this.projectService.logger.info("Add recursive watcher for: " + directoryToWatch); this.directoryWatcher = this.projectService.host.watchDirectory(directoryToWatch, function (path) { return callback(_this, path); }, true); }; @@ -64777,7 +66269,7 @@ var ts; if (!this.wildcardDirectories) { return; } - var configDirectoryPath = ts.getDirectoryPath(this.configFileName); + var configDirectoryPath = ts.getDirectoryPath(this.getConfigFilePath()); this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) { if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) { var recursive = (flag & 1) !== 0; @@ -64827,8 +66319,7 @@ var ts; var ExternalProject = (function (_super) { __extends(ExternalProject, _super); function ExternalProject(externalProjectName, projectService, documentRegistry, compilerOptions, languageServiceEnabled, compileOnSaveEnabled, projectFilePath) { - var _this = _super.call(this, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; - _this.externalProjectName = externalProjectName; + var _this = _super.call(this, externalProjectName, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; _this.compileOnSaveEnabled = compileOnSaveEnabled; _this.projectFilePath = projectFilePath; return _this; @@ -64837,37 +66328,34 @@ var ts; if (this.projectFilePath) { return ts.getDirectoryPath(this.projectFilePath); } - return ts.getDirectoryPath(ts.normalizeSlashes(this.externalProjectName)); + return ts.getDirectoryPath(ts.normalizeSlashes(this.getProjectName())); }; - ExternalProject.prototype.getTypingOptions = function () { - return this.typingOptions; + ExternalProject.prototype.getTypeAcquisition = function () { + return this.typeAcquisition; }; ExternalProject.prototype.setProjectErrors = function (projectErrors) { this.projectErrors = projectErrors; }; - ExternalProject.prototype.setTypingOptions = function (newTypingOptions) { - if (!newTypingOptions) { - newTypingOptions = { - enableAutoDiscovery: allRootFilesAreJsOrDts(this), + ExternalProject.prototype.setTypeAcquisition = function (newTypeAcquisition) { + if (!newTypeAcquisition) { + newTypeAcquisition = { + enable: allRootFilesAreJsOrDts(this), include: [], exclude: [] }; } else { - if (newTypingOptions.enableAutoDiscovery === undefined) { - newTypingOptions.enableAutoDiscovery = allRootFilesAreJsOrDts(this); + if (newTypeAcquisition.enable === undefined) { + newTypeAcquisition.enable = allRootFilesAreJsOrDts(this); } - if (!newTypingOptions.include) { - newTypingOptions.include = []; + if (!newTypeAcquisition.include) { + newTypeAcquisition.include = []; } - if (!newTypingOptions.exclude) { - newTypingOptions.exclude = []; + if (!newTypeAcquisition.exclude) { + newTypeAcquisition.exclude = []; } } - this.typingOptions = newTypingOptions; - }; - ExternalProject.prototype.getProjectName = function () { - return this.externalProjectName; + this.typeAcquisition = newTypeAcquisition; }; return ExternalProject; }(Project)); @@ -64879,6 +66367,9 @@ var ts; var server; (function (server) { server.maxProgramSizeForNonTsFiles = 20 * 1024 * 1024; + server.ContextEvent = "context"; + server.ConfigFileDiagEvent = "configFileDiag"; + server.ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions) { var map = ts.createMap(); for (var _i = 0, commandLineOptions_1 = commandLineOptions; _i < commandLineOptions_1.length; _i++) { @@ -64947,7 +66438,10 @@ var ts; var fileNamePropertyReader = { getFileName: function (x) { return x; }, getScriptKind: function (_) { return undefined; }, - hasMixedContent: function (_) { return false; } + hasMixedContent: function (fileName, extraFileExtensions) { + var mixedContentExtensions = ts.map(ts.filter(extraFileExtensions, function (item) { return item.isMixedContent; }), function (item) { return item.extension; }); + return ts.forEach(mixedContentExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); + } }; var externalFilePropertyReader = { getFileName: function (x) { return x.fileName; }, @@ -65027,7 +66521,8 @@ var ts; this.typingsCache = new server.TypingsCache(this.typingsInstaller); this.hostConfiguration = { formatCodeOptions: server.getDefaultFormatCodeSettings(this.host), - hostInfo: "Unknown host" + hostInfo: "Unknown host", + extraFileExtensions: [] }; this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory()); } @@ -65040,6 +66535,15 @@ var ts; ProjectService.prototype.getCompilerOptionsForInferredProjects = function () { return this.compilerOptionsForInferredProjects; }; + ProjectService.prototype.onUpdateLanguageServiceStateForProject = function (project, languageServiceEnabled) { + if (!this.eventHandler) { + return; + } + this.eventHandler({ + eventName: server.ProjectLanguageServiceStateEvent, + data: { project: project, languageServiceEnabled: languageServiceEnabled } + }); + }; ProjectService.prototype.updateTypingsForProject = function (response) { var project = this.findProject(response.projectName); if (!project) { @@ -65047,7 +66551,7 @@ var ts; } switch (response.kind) { case server.ActionSet: - this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typingOptions, response.unresolvedImports, response.typings); + this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings); break; case server.ActionInvalidate: this.typingsCache.deleteTypingsForProject(response.projectName); @@ -65144,7 +66648,7 @@ var ts; this.handleDeletedFile(info); } else { - if (info && (!info.isOpen)) { + if (info && (!info.isScriptOpen())) { info.reloadFromFile(); this.updateProjectGraphs(info.containingProjects); } @@ -65153,7 +66657,7 @@ var ts; ProjectService.prototype.handleDeletedFile = function (info) { this.logger.info(info.fileName + " deleted"); info.stopWatcher(); - if (!info.isOpen) { + if (!info.isScriptOpen()) { this.filenameToScriptInfo.remove(info.path); this.lastDeletedFile = info; var containingProjects = info.containingProjects.slice(); @@ -65165,7 +66669,10 @@ var ts; } for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { var openFile = _a[_i]; - this.eventHandler({ eventName: "context", data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } }); + this.eventHandler({ + eventName: server.ContextEvent, + data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } + }); } } this.printProjects(); @@ -65173,7 +66680,7 @@ var ts; ProjectService.prototype.onTypeRootFileChanged = function (project, fileName) { var _this = this; this.logger.info("Type root file " + fileName + " changed"); - this.throttledOperations.schedule(project.configFileName + " * type root", 250, function () { + this.throttledOperations.schedule(project.getConfigFilePath() + " * type root", 250, function () { project.updateTypes(); _this.updateConfiguredProject(project); _this.refreshInferredProjects(); @@ -65181,15 +66688,15 @@ var ts; }; ProjectService.prototype.onSourceFileInDirectoryChangedForConfiguredProject = function (project, fileName) { var _this = this; - if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions())) { + if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions(), this.hostConfiguration.extraFileExtensions)) { return; } this.logger.info("Detected source file changes: " + fileName); - this.throttledOperations.schedule(project.configFileName, 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); }); + this.throttledOperations.schedule(project.getConfigFilePath(), 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); }); }; ProjectService.prototype.handleChangeInSourceFileForConfiguredProject = function (project, triggerFile) { var _this = this; - var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; + var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; this.reportConfigFileDiagnostics(project.getProjectName(), configFileErrors, triggerFile); var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); })); var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); })); @@ -65200,8 +66707,10 @@ var ts; } }; ProjectService.prototype.onConfigChangedForConfiguredProject = function (project) { - this.logger.info("Config file changed: " + project.configFileName); - this.updateConfiguredProject(project); + var configFileName = project.getConfigFilePath(); + this.logger.info("Config file changed: " + configFileName); + var configFileErrors = this.updateConfiguredProject(project); + this.reportConfigFileDiagnostics(configFileName, configFileErrors, configFileName); this.refreshInferredProjects(); }; ProjectService.prototype.onConfigFileAddedForInferredProject = function (fileName) { @@ -65278,13 +66787,15 @@ var ts; } }; ProjectService.prototype.closeOpenFile = function (info) { - info.reloadFromFile(); + info.close(); server.removeItemFromSet(this.openFiles, info); - info.isOpen = false; var projectsToRemove; for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) { var p = _a[_i]; if (p.projectKind === server.ProjectKind.Configured) { + if (info.hasMixedContent) { + info.registerFileUpdate(); + } if (p.deleteOpenRef() === 0) { (projectsToRemove || (projectsToRemove = [])).push(p); } @@ -65292,6 +66803,9 @@ var ts; else if (p.projectKind === server.ProjectKind.Inferred && p.isRoot(info)) { (projectsToRemove || (projectsToRemove = [])).push(p); } + if (!p.languageServiceEnabled) { + p.markAsDirty(); + } } if (projectsToRemove) { for (var _b = 0, projectsToRemove_1 = projectsToRemove; _b < projectsToRemove_1.length; _b++) { @@ -65387,7 +66901,13 @@ var ts; } }; ProjectService.prototype.findConfiguredProjectByProjectName = function (configFileName) { - return findProjectByName(configFileName, this.configuredProjects); + configFileName = server.asNormalizedPath(this.toCanonicalFileName(configFileName)); + for (var _i = 0, _a = this.configuredProjects; _i < _a.length; _i++) { + var proj = _a[_i]; + if (proj.canonicalConfigFilePath === configFileName) { + return proj; + } + } }; ProjectService.prototype.findExternalProjectByProjectName = function (projectFileName) { return findProjectByName(projectFileName, this.externalProjects); @@ -65403,7 +66923,7 @@ var ts; config = sanitizedConfig; errors = diagnostics.length ? diagnostics : [result.error]; } - var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename); + var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename, [], this.hostConfiguration.extraFileExtensions); if (parsedCommandLine.errors.length) { errors = ts.concatenate(errors, parsedCommandLine.errors); } @@ -65417,7 +66937,7 @@ var ts; compilerOptions: parsedCommandLine.options, configHasFilesProperty: config["files"] !== undefined, wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories), - typingOptions: parsedCommandLine.typingOptions, + typeAcquisition: parsedCommandLine.typeAcquisition, compileOnSave: parsedCommandLine.compileOnSave }; return { success: true, projectOptions: projectOptions, configFileErrors: errors }; @@ -65440,10 +66960,10 @@ var ts; } return false; }; - ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typingOptions) { + ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typeAcquisition) { var compilerOptions = convertCompilerOptions(options); var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave); - this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typingOptions, undefined); + this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typeAcquisition, undefined); this.externalProjects.push(project); return project; }; @@ -65452,7 +66972,7 @@ var ts; return; } this.eventHandler({ - eventName: "configFileDiag", + eventName: server.ConfigFileDiagEvent, data: { configFileName: configFileName, diagnostics: diagnostics || [], triggerFile: triggerFile } }); }; @@ -65460,7 +66980,7 @@ var ts; var _this = this; var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader); var project = new server.ConfiguredProject(configFileName, this, this.documentRegistry, projectOptions.configHasFilesProperty, projectOptions.compilerOptions, projectOptions.wildcardDirectories, !sizeLimitExceeded, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave); - this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typingOptions, configFileErrors); + this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors); project.watchConfigFile(function (project) { return _this.onConfigChangedForConfiguredProject(project); }); if (!sizeLimitExceeded) { this.watchConfigDirectoryForProject(project, projectOptions); @@ -65476,13 +66996,13 @@ var ts; project.watchConfigDirectory(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); }); } }; - ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typingOptions, configFileErrors) { + ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors) { var errors; for (var _i = 0, files_4 = files; _i < files_4.length; _i++) { var f = files_4[_i]; var rootFilename = propertyReader.getFileName(f); var scriptKind = propertyReader.getScriptKind(f); - var hasMixedContent = propertyReader.hasMixedContent(f); + var hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); if (this.host.fileExists(rootFilename)) { var info = this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(rootFilename), clientFileName == rootFilename, undefined, scriptKind, hasMixedContent); project.addRoot(info); @@ -65492,7 +67012,7 @@ var ts; } } project.setProjectErrors(ts.concatenate(configFileErrors, errors)); - project.setTypingOptions(typingOptions); + project.setTypeAcquisition(typeAcquisition); project.updateGraph(); }; ProjectService.prototype.openConfigFile = function (configFileName, clientFileName) { @@ -65507,7 +67027,7 @@ var ts; errors: project.getProjectErrors() }; }; - ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypingOptions, compileOnSave, configFileErrors) { + ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors) { var oldRootScriptInfos = project.getRootScriptInfos(); var newRootScriptInfos = []; var newRootScriptInfoMap = server.createNormalizedPathMap(); @@ -65526,7 +67046,7 @@ var ts; rootFilesChanged = true; if (!scriptInfo) { var scriptKind = propertyReader.getScriptKind(f); - var hasMixedContent = propertyReader.hasMixedContent(f); + var hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, false, undefined, scriptKind, hasMixedContent); } } @@ -65557,7 +67077,7 @@ var ts; if (toAdd) { for (var _d = 0, toAdd_1 = toAdd; _d < toAdd_1.length; _d++) { var f = toAdd_1[_d]; - if (f.isOpen && isRootFileInInferredProject(f)) { + if (f.isScriptOpen() && isRootFileInInferredProject(f)) { var inferredProject = f.containingProjects[0]; inferredProject.removeFile(f); if (!inferredProject.hasRoots()) { @@ -65569,7 +67089,7 @@ var ts; } } project.setCompilerOptions(newOptions); - project.setTypingOptions(newTypingOptions); + project.setTypeAcquisition(newTypeAcquisition); if (compileOnSave !== undefined) { project.compileOnSaveEnabled = compileOnSave; } @@ -65577,12 +67097,12 @@ var ts; project.updateGraph(); }; ProjectService.prototype.updateConfiguredProject = function (project) { - if (!this.host.fileExists(project.configFileName)) { + if (!this.host.fileExists(project.getConfigFilePath())) { this.logger.info("Config file deleted"); this.removeProject(project); return; } - var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; + var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; if (!success) { this.updateNonInferredProject(project, [], fileNamePropertyReader, {}, {}, false, configFileErrors); return configFileErrors; @@ -65590,25 +67110,24 @@ var ts; if (this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) { project.setCompilerOptions(projectOptions.compilerOptions); if (!project.languageServiceEnabled) { - return; + return configFileErrors; } project.disableLanguageService(); project.stopWatchingDirectory(); } else { - if (!project.languageServiceEnabled) { - project.enableLanguageService(); - } + project.enableLanguageService(); this.watchConfigDirectoryForProject(project, projectOptions); - this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typingOptions, projectOptions.compileOnSave, configFileErrors); + this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors); } + return configFileErrors; }; ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root) { var _this = this; var useExistingProject = this.useSingleInferredProject && this.inferredProjects.length; var project = useExistingProject ? this.inferredProjects[0] - : new server.InferredProject(this, this.documentRegistry, true, this.compilerOptionsForInferredProjects); + : new server.InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects); project.addRoot(root); this.directoryWatchers.startWatchingContainingDirectoriesForFile(root.fileName, project, function (fileName) { return _this.onConfigFileAddedForInferredProject(fileName); }); project.updateGraph(); @@ -65627,29 +67146,30 @@ var ts; var _this = this; var info = this.getScriptInfoForNormalizedPath(fileName); if (!info) { - var content = void 0; - if (this.host.fileExists(fileName)) { - content = fileContent || (hasMixedContent ? "" : this.host.readFile(fileName)); - } - if (!content) { - if (openedByClient) { - content = ""; - } - } - if (content !== undefined) { - info = new server.ScriptInfo(this.host, fileName, content, scriptKind, openedByClient, hasMixedContent); + if (openedByClient || this.host.fileExists(fileName)) { + info = new server.ScriptInfo(this.host, fileName, scriptKind, hasMixedContent); this.filenameToScriptInfo.set(info.path, info); - if (!info.isOpen && !hasMixedContent) { - info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); })); + if (openedByClient) { + if (fileContent === undefined) { + fileContent = this.host.readFile(fileName) || ""; + } + } + else { + if (!hasMixedContent) { + info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); })); + } } } } if (info) { - if (fileContent !== undefined) { - info.reload(fileContent); + if (openedByClient && !info.isScriptOpen()) { + info.open(fileContent); + if (hasMixedContent) { + info.registerFileUpdate(); + } } - if (openedByClient) { - info.isOpen = true; + else if (fileContent !== undefined) { + info.reload(fileContent); } } return info; @@ -65677,6 +67197,10 @@ var ts; server.mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); this.logger.info("Format host information updated"); } + if (args.extraFileExtensions) { + this.hostConfiguration.extraFileExtensions = args.extraFileExtensions; + this.logger.info("Host file extension mappings updated"); + } } }; ProjectService.prototype.closeLog = function () { @@ -65724,30 +67248,39 @@ var ts; return this.openClientFileWithNormalizedPath(server.toNormalizedPath(fileName), fileContent, scriptKind); }; ProjectService.prototype.openClientFileWithNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent) { - var _a = this.findContainingExternalProject(fileName) - ? {} - : this.openOrUpdateConfiguredProjectForFile(fileName), _b = _a.configFileName, configFileName = _b === void 0 ? undefined : _b, _c = _a.configFileErrors, configFileErrors = _c === void 0 ? undefined : _c; + var configFileName; + var configFileErrors; + var project = this.findContainingExternalProject(fileName); + if (!project) { + (_a = this.openOrUpdateConfiguredProjectForFile(fileName), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors); + if (configFileName) { + project = this.findConfiguredProjectByProjectName(configFileName); + } + } + if (project && !project.languageServiceEnabled) { + project.markAsDirty(); + } var info = this.getOrCreateScriptInfoForNormalizedPath(fileName, true, fileContent, scriptKind, hasMixedContent); this.assignScriptInfoToInferredProjectIfNecessary(info, true); this.printProjects(); return { configFileName: configFileName, configFileErrors: configFileErrors }; + var _a; }; ProjectService.prototype.closeClientFile = function (uncheckedFileName) { var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName)); if (info) { this.closeOpenFile(info); - info.isOpen = false; } this.printProjects(); }; ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { - var _loop_5 = function (proj) { + var _loop_4 = function (proj) { var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); }; for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { var proj = currentProjects_1[_i]; - _loop_5(proj); + _loop_4(proj); } }; ProjectService.prototype.synchronizeProjectList = function (knownProjects) { @@ -65763,7 +67296,7 @@ var ts; for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) { var file = openFiles_1[_i]; var scriptInfo = this.getScriptInfo(file.fileName); - ts.Debug.assert(!scriptInfo || !scriptInfo.isOpen); + ts.Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen()); var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName); this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent); } @@ -65830,7 +67363,27 @@ var ts; } } }; - ProjectService.prototype.openExternalProject = function (proj) { + ProjectService.prototype.openExternalProjects = function (projects) { + var projectsToClose = ts.arrayToMap(this.externalProjects, function (p) { return p.getProjectName(); }, function (_) { return true; }); + for (var externalProjectName in this.externalProjectToConfiguredProjectMap) { + projectsToClose[externalProjectName] = true; + } + for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { + var externalProject = projects_4[_i]; + this.openExternalProject(externalProject, true); + delete projectsToClose[externalProject.projectFileName]; + } + for (var externalProjectName in projectsToClose) { + this.closeExternalProject(externalProjectName, true); + } + this.refreshInferredProjects(); + }; + ProjectService.prototype.openExternalProject = function (proj, suppressRefreshOfInferredProjects) { + if (suppressRefreshOfInferredProjects === void 0) { suppressRefreshOfInferredProjects = false; } + if (proj.typingOptions && !proj.typeAcquisition) { + var typeAcquisition = ts.convertEnableAutoDiscoveryToEnable(proj.typingOptions); + proj.typeAcquisition = typeAcquisition; + } var tsConfigFiles; var rootFiles = []; for (var _i = 0, _a = proj.rootFiles; _i < _a.length; _i++) { @@ -65852,7 +67405,14 @@ var ts; var exisingConfigFiles; if (externalProject) { if (!tsConfigFiles) { - this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typingOptions, proj.options.compileOnSave, undefined); + var compilerOptions = convertCompilerOptions(proj.options); + if (this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, proj.rootFiles, externalFilePropertyReader)) { + externalProject.disableLanguageService(); + } + else { + externalProject.enableLanguageService(); + } + this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, undefined); return; } this.closeExternalProject(proj.projectFileName, true); @@ -65902,9 +67462,11 @@ var ts; } else { delete this.externalProjectToConfiguredProjectMap[proj.projectFileName]; - this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typingOptions); + this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); + } + if (!suppressRefreshOfInferredProjects) { + this.refreshInferredProjects(); } - this.refreshInferredProjects(); }; return ProjectService; }()); @@ -66066,14 +67628,11 @@ var ts; this.changeSeq = 0; this.handlers = ts.createMap((_a = {}, _a[CommandNames.OpenExternalProject] = function (request) { - _this.projectService.openExternalProject(request.arguments); + _this.projectService.openExternalProject(request.arguments, false); return _this.requiredResponse(true); }, _a[CommandNames.OpenExternalProjects] = function (request) { - for (var _i = 0, _a = request.arguments.projects; _i < _a.length; _i++) { - var proj = _a[_i]; - _this.projectService.openExternalProject(proj); - } + _this.projectService.openExternalProjects(request.arguments.projects); return _this.requiredResponse(true); }, _a[CommandNames.CloseExternalProject] = function (request) { @@ -66315,14 +67874,22 @@ var ts; Session.prototype.defaultEventHandler = function (event) { var _this = this; switch (event.eventName) { - case "context": + case server.ContextEvent: var _a = event.data, project = _a.project, fileName = _a.fileName; this.projectService.logger.info("got context event, updating diagnostics for " + fileName); this.updateErrorCheck([{ fileName: fileName, project: project }], this.changeSeq, function (n) { return n === _this.changeSeq; }, 100); break; - case "configFileDiag": + case server.ConfigFileDiagEvent: var _b = event.data, triggerFile = _b.triggerFile, configFileName = _b.configFileName, diagnostics = _b.diagnostics; this.configFileDiagnosticEvent(triggerFile, configFileName, diagnostics); + break; + case server.ProjectLanguageServiceStateEvent: + var eventName = "projectLanguageServiceState"; + this.event({ + projectName: event.data.project.getProjectName(), + languageServiceEnabled: event.data.languageServiceEnabled + }, eventName); + break; } }; Session.prototype.logError = function (err, cmd) { @@ -66462,8 +68029,8 @@ var ts; return; } this.logger.info("cleaning " + caption); - for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { - var p = projects_4[_i]; + for (var _i = 0, projects_5 = projects; _i < projects_5.length; _i++) { + var p = projects_5[_i]; p.getLanguageService(false).cleanupSemanticCache(); } }; @@ -66759,7 +68326,7 @@ var ts; var displayString = ts.displayPartsToString(nameInfo.displayParts); var nameSpan = nameInfo.textSpan; var nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset; - var nameText = scriptInfo.snap().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + var nameText = scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); var refs = server.combineProjectOutput(projects, function (project) { var references = project.getLanguageService().getReferencesAtPosition(file, position); if (!references) { @@ -66769,7 +68336,7 @@ var ts; var refScriptInfo = project.getScriptInfo(ref.fileName); var start = refScriptInfo.positionToLineOffset(ref.textSpan.start); var refLineSpan = refScriptInfo.lineToTextSpan(start.line - 1); - var lineText = refScriptInfo.snap().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + var lineText = refScriptInfo.getSnapshot().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); return { file: ref.fileName, start: start, @@ -66972,9 +68539,9 @@ var ts; if (simplifiedResult) { return completions.entries.reduce(function (result, entry) { if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { - var name_50 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; + var name_52 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined; - result.push({ name: name_50, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); + result.push({ name: name_52, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); } return result; }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); @@ -67019,6 +68586,9 @@ var ts; if (!project) { server.Errors.ThrowNoProject(); } + if (!project.languageServiceEnabled) { + return false; + } var scriptInfo = project.getScriptInfo(file); return project.builder.emitFile(scriptInfo, function (path, data, writeByteOrderMark) { return _this.host.writeFile(path, data, writeByteOrderMark); }); }; @@ -67284,7 +68854,7 @@ var ts; highPriorityFiles.push(fileNameInProject); else { var info = this.projectService.getScriptInfo(fileNameInProject); - if (!info.isOpen) { + if (!info.isScriptOpen()) { if (fileNameInProject.indexOf(".d.ts") > 0) veryLowPriorityFiles.push(fileNameInProject); else @@ -67741,8 +69311,9 @@ var ts; } }; LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { - var oldSnap = oldSnapshot; - return this.getTextChangeRangeSinceVersion(oldSnap.version); + if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) { + return this.getTextChangeRangeSinceVersion(oldSnapshot.version); + } }; return LineIndexSnapshot; }()); @@ -68815,7 +70386,7 @@ var ts; if (result.error) { return { options: {}, - typingOptions: {}, + typeAcquisition: {}, files: [], raw: {}, errors: [realizeDiagnostic(result.error, "\r\n")] @@ -68825,7 +70396,7 @@ var ts; var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName); return { options: configFile.options, - typingOptions: configFile.typingOptions, + typeAcquisition: configFile.typeAcquisition, files: configFile.fileNames, raw: configFile.raw, errors: realizeDiagnostics(configFile.errors, "\r\n") @@ -68840,7 +70411,7 @@ var ts; var getCanonicalFileName = ts.createGetCanonicalFileName(false); return this.forwardJSONCall("discoverTypings()", function () { var info = JSON.parse(discoverTypingsJson); - return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.unresolvedImports); + return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports); }); }; return CoreServicesShimObject; diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 2ad7b8ae388..c5cee20bdde 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -317,23 +317,25 @@ declare namespace ts { JSDocThisType = 277, JSDocComment = 278, JSDocTag = 279, - JSDocParameterTag = 280, - JSDocReturnTag = 281, - JSDocTypeTag = 282, - JSDocTemplateTag = 283, - JSDocTypedefTag = 284, - JSDocPropertyTag = 285, - JSDocTypeLiteral = 286, - JSDocLiteralType = 287, - JSDocNullKeyword = 288, - JSDocUndefinedKeyword = 289, - JSDocNeverKeyword = 290, - SyntaxList = 291, - NotEmittedStatement = 292, - PartiallyEmittedExpression = 293, - MergeDeclarationMarker = 294, - EndOfDeclarationMarker = 295, - Count = 296, + JSDocAugmentsTag = 280, + JSDocParameterTag = 281, + JSDocReturnTag = 282, + JSDocTypeTag = 283, + JSDocTemplateTag = 284, + JSDocTypedefTag = 285, + JSDocPropertyTag = 286, + JSDocTypeLiteral = 287, + JSDocLiteralType = 288, + JSDocNullKeyword = 289, + JSDocUndefinedKeyword = 290, + JSDocNeverKeyword = 291, + SyntaxList = 292, + NotEmittedStatement = 293, + PartiallyEmittedExpression = 294, + MergeDeclarationMarker = 295, + EndOfDeclarationMarker = 296, + RawExpression = 297, + Count = 298, FirstAssignment = 57, LastAssignment = 69, FirstCompoundAssignment = 58, @@ -360,9 +362,9 @@ declare namespace ts { LastBinaryOperator = 69, FirstNode = 141, FirstJSDocNode = 262, - LastJSDocNode = 287, + LastJSDocNode = 288, FirstJSDocTagNode = 278, - LastJSDocTagNode = 290, + LastJSDocTagNode = 291, } enum NodeFlags { None = 0, @@ -376,26 +378,20 @@ declare namespace ts { HasImplicitReturn = 128, HasExplicitReturn = 256, GlobalAugmentation = 512, - HasClassExtends = 1024, - HasDecorators = 2048, - HasParamDecorators = 4096, - HasAsyncFunctions = 8192, - HasSpreadAttribute = 16384, - HasRestAttribute = 32768, - DisallowInContext = 65536, - YieldContext = 131072, - DecoratorContext = 262144, - AwaitContext = 524288, - ThisNodeHasError = 1048576, - JavaScriptFile = 2097152, - ThisNodeOrAnySubNodesHasError = 4194304, - HasAggregatedChildData = 8388608, + HasAsyncFunctions = 1024, + DisallowInContext = 2048, + YieldContext = 4096, + DecoratorContext = 8192, + AwaitContext = 16384, + ThisNodeHasError = 32768, + JavaScriptFile = 65536, + ThisNodeOrAnySubNodesHasError = 131072, + HasAggregatedChildData = 262144, BlockScoped = 3, ReachabilityCheckFlags = 384, - EmitHelperFlags = 64512, - ReachabilityAndEmitFlags = 64896, - ContextFlags = 3080192, - TypeExcludesFlags = 655360, + ReachabilityAndEmitFlags = 1408, + ContextFlags = 96256, + TypeExcludesFlags = 20480, } enum ModifierFlags { None = 0, @@ -464,14 +460,14 @@ declare namespace ts { right: Identifier; } type EntityName = Identifier | QualifiedName; - type PropertyName = Identifier | LiteralExpression | ComputedPropertyName; - type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; + type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName; + type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern; interface Declaration extends Node { _declarationBrand: any; name?: DeclarationName; } interface DeclarationStatement extends Declaration, Statement { - name?: Identifier | LiteralExpression; + name?: Identifier | StringLiteral | NumericLiteral; } interface ComputedPropertyName extends Node { kind: SyntaxKind.ComputedPropertyName; @@ -573,18 +569,16 @@ declare namespace ts { interface PropertyLikeDeclaration extends Declaration { name: PropertyName; } - interface BindingPattern extends Node { - elements: NodeArray; - } - interface ObjectBindingPattern extends BindingPattern { + interface ObjectBindingPattern extends Node { kind: SyntaxKind.ObjectBindingPattern; elements: NodeArray; } - type ArrayBindingElement = BindingElement | OmittedExpression; - interface ArrayBindingPattern extends BindingPattern { + interface ArrayBindingPattern extends Node { kind: SyntaxKind.ArrayBindingPattern; elements: NodeArray; } + type BindingPattern = ObjectBindingPattern | ArrayBindingPattern; + type ArrayBindingElement = BindingElement | OmittedExpression; /** * Several node kinds share function-like features such as a signature, * a name, and a body. These nodes should extend FunctionLikeDeclaration. @@ -809,17 +803,25 @@ declare namespace ts { operatorToken: BinaryOperatorToken; right: Expression; } - interface AssignmentExpression extends BinaryExpression { + type AssignmentOperatorToken = Token; + interface AssignmentExpression extends BinaryExpression { left: LeftHandSideExpression; - operatorToken: Token; + operatorToken: TOperator; } - interface ObjectDestructuringAssignment extends AssignmentExpression { + interface ObjectDestructuringAssignment extends AssignmentExpression { left: ObjectLiteralExpression; } - interface ArrayDestructuringAssignment extends AssignmentExpression { + interface ArrayDestructuringAssignment extends AssignmentExpression { left: ArrayLiteralExpression; } type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment; + type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression | Identifier | PropertyAccessExpression | ElementAccessExpression; + type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment; + type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression; + type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression; + type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression; + type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression; + type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern; interface ConditionalExpression extends Expression { kind: SyntaxKind.ConditionalExpression; condition: Expression; @@ -1180,7 +1182,7 @@ declare namespace ts { type ModuleName = Identifier | StringLiteral; interface ModuleDeclaration extends DeclarationStatement { kind: SyntaxKind.ModuleDeclaration; - name: Identifier | LiteralExpression; + name: Identifier | StringLiteral; body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier; } interface NamespaceDeclaration extends ModuleDeclaration { @@ -1332,7 +1334,7 @@ declare namespace ts { type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; interface JSDocRecordMember extends PropertySignature { kind: SyntaxKind.JSDocRecordMember; - name: Identifier | LiteralExpression; + name: Identifier | StringLiteral | NumericLiteral; type?: JSDocType; } interface JSDoc extends Node { @@ -1348,6 +1350,10 @@ declare namespace ts { interface JSDocUnknownTag extends JSDocTag { kind: SyntaxKind.JSDocTag; } + interface JSDocAugmentsTag extends JSDocTag { + kind: SyntaxKind.JSDocAugmentsTag; + typeExpression: JSDocTypeExpression; + } interface JSDocTemplateTag extends JSDocTag { kind: SyntaxKind.JSDocTemplateTag; typeParameters: NodeArray; @@ -1596,6 +1602,7 @@ declare namespace ts { getJsxIntrinsicTagNames(): Symbol[]; isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; + tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; @@ -1616,6 +1623,7 @@ declare namespace ts { writeSpace(text: string): void; writeStringLiteral(text: string): void; writeParameter(text: string): void; + writeProperty(text: string): void; writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; @@ -1761,13 +1769,14 @@ declare namespace ts { Literal = 480, StringOrNumberLiteral = 96, PossiblyFalsy = 7406, - StringLike = 34, + StringLike = 262178, NumberLike = 340, BooleanLike = 136, EnumLike = 272, UnionOrIntersection = 196608, StructuredType = 229376, StructuredOrTypeParameter = 507904, + TypeVariable = 540672, Narrowable = 1033215, NotUnionOrUnit = 33281, } @@ -1837,15 +1846,18 @@ declare namespace ts { elementType: Type; finalArrayType?: Type; } - interface TypeParameter extends Type { + interface TypeVariable extends Type { + } + interface TypeParameter extends TypeVariable { constraint: Type; } - interface IndexType extends Type { - type: TypeParameter; - } - interface IndexedAccessType extends Type { + interface IndexedAccessType extends TypeVariable { objectType: Type; - indexType: TypeParameter; + indexType: Type; + constraint?: Type; + } + interface IndexType extends Type { + type: TypeVariable | UnionOrIntersectionType; } enum SignatureKind { Call = 0, @@ -1865,6 +1877,11 @@ declare namespace ts { isReadonly: boolean; declaration?: SignatureDeclaration; } + interface FileExtensionInfo { + extension: string; + scriptKind: ScriptKind; + isMixedContent: boolean; + } interface DiagnosticMessage { key: string; category: DiagnosticCategory; @@ -1962,12 +1979,13 @@ declare namespace ts { target?: ScriptTarget; traceResolution?: boolean; types?: string[]; - /** Paths used to used to compute primary types search locations */ + /** Paths used to compute primary types search locations */ typeRoots?: string[]; [option: string]: CompilerOptionsValue | undefined; } - interface TypingOptions { + interface TypeAcquisition { enableAutoDiscovery?: boolean; + enable?: boolean; include?: string[]; exclude?: string[]; [option: string]: string[] | boolean | undefined; @@ -1977,7 +1995,7 @@ declare namespace ts { projectRootPath: string; safeListPath: string; packageNameToTypingLocation: Map; - typingOptions: TypingOptions; + typeAcquisition: TypeAcquisition; compilerOptions: CompilerOptions; unresolvedImports: ReadonlyArray; } @@ -2025,7 +2043,7 @@ declare namespace ts { /** Either a parsed command line or a parsed tsconfig.json */ interface ParsedCommandLine { options: CompilerOptions; - typingOptions?: TypingOptions; + typeAcquisition?: TypeAcquisition; fileNames: string[]; raw?: any; errors: Diagnostic[]; @@ -2129,6 +2147,10 @@ declare namespace ts { _children: Node[]; } } +declare namespace ts { + /** The version of the TypeScript compiler release */ + const version = "2.2.0"; +} declare namespace ts { type FileWatcherCallback = (fileName: string, removed?: boolean) => void; type DirectoryWatcherCallback = (fileName: string) => void; @@ -2260,9 +2282,19 @@ declare namespace ts { */ function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; - function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean; + function isParameterPropertyDeclaration(node: Node): boolean; function getCombinedModifierFlags(node: Node): ModifierFlags; function getCombinedNodeFlags(node: Node): NodeFlags; + /** + * Checks to see if the locale is in the appropriate format, + * and if it is, attempts to set the appropriate language. + */ + function validateLocaleAndSetLanguage(locale: string, sys: { + getExecutingFilePath(): string; + resolvePath(path: string): string; + fileExists(fileName: string): boolean; + readFile(fileName: string): string; + }, errors?: Diagnostic[]): void; } declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; @@ -2273,6 +2305,7 @@ declare namespace ts { function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { + function moduleHasNonRelativeName(moduleName: string): boolean; function getEffectiveTypeRoots(options: CompilerOptions, host: { directoryExists?: (directoryName: string) => boolean; getCurrentDirectory?: () => string; @@ -2297,8 +2330,6 @@ declare namespace ts { function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; } declare namespace ts { - /** The version of the TypeScript compiler release */ - const version = "2.2.0"; function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; @@ -2313,6 +2344,7 @@ declare namespace ts { function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare namespace ts { + function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; /** * Read tsconfig.json file * @param fileName The path to the config file @@ -2337,14 +2369,14 @@ declare namespace ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine; + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine; function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; errors: Diagnostic[]; }; - function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { - options: TypingOptions; + function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: TypeAcquisition; errors: Diagnostic[]; }; } @@ -2393,6 +2425,7 @@ declare namespace ts { } interface SourceFile { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineEndOfPosition(pos: number): number; getLineStarts(): number[]; getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; diff --git a/lib/typescript.js b/lib/typescript.js index 59bd352a9d9..7f41e5d07f5 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -333,26 +333,28 @@ var ts; SyntaxKind[SyntaxKind["JSDocThisType"] = 277] = "JSDocThisType"; SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 280] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 281] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 282] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 283] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 284] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 285] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 286] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocLiteralType"] = 287] = "JSDocLiteralType"; - SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 288] = "JSDocNullKeyword"; - SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 289] = "JSDocUndefinedKeyword"; - SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 290] = "JSDocNeverKeyword"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 281] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 282] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 283] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 284] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 285] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 286] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 287] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocLiteralType"] = 288] = "JSDocLiteralType"; + SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 289] = "JSDocNullKeyword"; + SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 290] = "JSDocUndefinedKeyword"; + SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 291] = "JSDocNeverKeyword"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 291] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 292] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 292] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 293] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 294] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 295] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 293] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 294] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 295] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 296] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["RawExpression"] = 297] = "RawExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 296] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 298] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment"; @@ -380,9 +382,9 @@ var ts; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode"; SyntaxKind[SyntaxKind["FirstJSDocNode"] = 262] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 287] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 278] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 290] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 291] = "LastJSDocTagNode"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -397,28 +399,22 @@ var ts; NodeFlags[NodeFlags["HasImplicitReturn"] = 128] = "HasImplicitReturn"; NodeFlags[NodeFlags["HasExplicitReturn"] = 256] = "HasExplicitReturn"; NodeFlags[NodeFlags["GlobalAugmentation"] = 512] = "GlobalAugmentation"; - NodeFlags[NodeFlags["HasClassExtends"] = 1024] = "HasClassExtends"; - NodeFlags[NodeFlags["HasDecorators"] = 2048] = "HasDecorators"; - NodeFlags[NodeFlags["HasParamDecorators"] = 4096] = "HasParamDecorators"; - NodeFlags[NodeFlags["HasAsyncFunctions"] = 8192] = "HasAsyncFunctions"; - NodeFlags[NodeFlags["HasSpreadAttribute"] = 16384] = "HasSpreadAttribute"; - NodeFlags[NodeFlags["HasRestAttribute"] = 32768] = "HasRestAttribute"; - NodeFlags[NodeFlags["DisallowInContext"] = 65536] = "DisallowInContext"; - NodeFlags[NodeFlags["YieldContext"] = 131072] = "YieldContext"; - NodeFlags[NodeFlags["DecoratorContext"] = 262144] = "DecoratorContext"; - NodeFlags[NodeFlags["AwaitContext"] = 524288] = "AwaitContext"; - NodeFlags[NodeFlags["ThisNodeHasError"] = 1048576] = "ThisNodeHasError"; - NodeFlags[NodeFlags["JavaScriptFile"] = 2097152] = "JavaScriptFile"; - NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 4194304] = "ThisNodeOrAnySubNodesHasError"; - NodeFlags[NodeFlags["HasAggregatedChildData"] = 8388608] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["HasAsyncFunctions"] = 1024] = "HasAsyncFunctions"; + NodeFlags[NodeFlags["DisallowInContext"] = 2048] = "DisallowInContext"; + NodeFlags[NodeFlags["YieldContext"] = 4096] = "YieldContext"; + NodeFlags[NodeFlags["DecoratorContext"] = 8192] = "DecoratorContext"; + NodeFlags[NodeFlags["AwaitContext"] = 16384] = "AwaitContext"; + NodeFlags[NodeFlags["ThisNodeHasError"] = 32768] = "ThisNodeHasError"; + NodeFlags[NodeFlags["JavaScriptFile"] = 65536] = "JavaScriptFile"; + NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 131072] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags[NodeFlags["HasAggregatedChildData"] = 262144] = "HasAggregatedChildData"; NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped"; NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags"; - NodeFlags[NodeFlags["EmitHelperFlags"] = 64512] = "EmitHelperFlags"; - NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 64896] = "ReachabilityAndEmitFlags"; + NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 1408] = "ReachabilityAndEmitFlags"; // Parsing context flags - NodeFlags[NodeFlags["ContextFlags"] = 3080192] = "ContextFlags"; + NodeFlags[NodeFlags["ContextFlags"] = 96256] = "ContextFlags"; // Exclude these flags when parsing a Type - NodeFlags[NodeFlags["TypeExcludesFlags"] = 655360] = "TypeExcludesFlags"; + NodeFlags[NodeFlags["TypeExcludesFlags"] = 20480] = "TypeExcludesFlags"; })(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {})); var ModifierFlags; (function (ModifierFlags) { @@ -710,13 +706,14 @@ var ts; TypeFlags[TypeFlags["Intrinsic"] = 16015] = "Intrinsic"; /* @internal */ TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive"; - TypeFlags[TypeFlags["StringLike"] = 34] = "StringLike"; + TypeFlags[TypeFlags["StringLike"] = 262178] = "StringLike"; TypeFlags[TypeFlags["NumberLike"] = 340] = "NumberLike"; TypeFlags[TypeFlags["BooleanLike"] = 136] = "BooleanLike"; TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike"; TypeFlags[TypeFlags["UnionOrIntersection"] = 196608] = "UnionOrIntersection"; TypeFlags[TypeFlags["StructuredType"] = 229376] = "StructuredType"; TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 507904] = "StructuredOrTypeParameter"; + TypeFlags[TypeFlags["TypeVariable"] = 540672] = "TypeVariable"; // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never TypeFlags[TypeFlags["Narrowable"] = 1033215] = "Narrowable"; @@ -974,99 +971,114 @@ var ts; // - Flags used to indicate that a node or subtree contains syntax that requires transformation. TransformFlags[TransformFlags["TypeScript"] = 1] = "TypeScript"; TransformFlags[TransformFlags["ContainsTypeScript"] = 2] = "ContainsTypeScript"; - TransformFlags[TransformFlags["Jsx"] = 4] = "Jsx"; - TransformFlags[TransformFlags["ContainsJsx"] = 8] = "ContainsJsx"; - TransformFlags[TransformFlags["ESNext"] = 16] = "ESNext"; - TransformFlags[TransformFlags["ContainsESNext"] = 32] = "ContainsESNext"; - TransformFlags[TransformFlags["ES2017"] = 64] = "ES2017"; - TransformFlags[TransformFlags["ContainsES2017"] = 128] = "ContainsES2017"; - TransformFlags[TransformFlags["ES2016"] = 256] = "ES2016"; - TransformFlags[TransformFlags["ContainsES2016"] = 512] = "ContainsES2016"; - TransformFlags[TransformFlags["ES2015"] = 1024] = "ES2015"; - TransformFlags[TransformFlags["ContainsES2015"] = 2048] = "ContainsES2015"; - TransformFlags[TransformFlags["Generator"] = 4096] = "Generator"; - TransformFlags[TransformFlags["ContainsGenerator"] = 8192] = "ContainsGenerator"; - TransformFlags[TransformFlags["DestructuringAssignment"] = 16384] = "DestructuringAssignment"; - TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 32768] = "ContainsDestructuringAssignment"; + TransformFlags[TransformFlags["ContainsJsx"] = 4] = "ContainsJsx"; + TransformFlags[TransformFlags["ContainsESNext"] = 8] = "ContainsESNext"; + TransformFlags[TransformFlags["ContainsES2017"] = 16] = "ContainsES2017"; + TransformFlags[TransformFlags["ContainsES2016"] = 32] = "ContainsES2016"; + TransformFlags[TransformFlags["ES2015"] = 64] = "ES2015"; + TransformFlags[TransformFlags["ContainsES2015"] = 128] = "ContainsES2015"; + TransformFlags[TransformFlags["Generator"] = 256] = "Generator"; + TransformFlags[TransformFlags["ContainsGenerator"] = 512] = "ContainsGenerator"; + TransformFlags[TransformFlags["DestructuringAssignment"] = 1024] = "DestructuringAssignment"; + TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 2048] = "ContainsDestructuringAssignment"; // Markers // - Flags used to indicate that a subtree contains a specific transformation. - TransformFlags[TransformFlags["ContainsDecorators"] = 65536] = "ContainsDecorators"; - TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 131072] = "ContainsPropertyInitializer"; - TransformFlags[TransformFlags["ContainsLexicalThis"] = 262144] = "ContainsLexicalThis"; - TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 524288] = "ContainsCapturedLexicalThis"; - TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 1048576] = "ContainsLexicalThisInComputedPropertyName"; - TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 2097152] = "ContainsDefaultValueAssignments"; - TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 4194304] = "ContainsParameterPropertyAssignments"; - TransformFlags[TransformFlags["ContainsSpreadExpression"] = 8388608] = "ContainsSpreadExpression"; - TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 16777216] = "ContainsComputedPropertyName"; - TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 33554432] = "ContainsBlockScopedBinding"; - TransformFlags[TransformFlags["ContainsBindingPattern"] = 67108864] = "ContainsBindingPattern"; - TransformFlags[TransformFlags["ContainsYield"] = 134217728] = "ContainsYield"; - TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 268435456] = "ContainsHoistedDeclarationOrCompletion"; + TransformFlags[TransformFlags["ContainsDecorators"] = 4096] = "ContainsDecorators"; + TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 8192] = "ContainsPropertyInitializer"; + TransformFlags[TransformFlags["ContainsLexicalThis"] = 16384] = "ContainsLexicalThis"; + TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 32768] = "ContainsCapturedLexicalThis"; + TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 65536] = "ContainsLexicalThisInComputedPropertyName"; + TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 131072] = "ContainsDefaultValueAssignments"; + TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 262144] = "ContainsParameterPropertyAssignments"; + TransformFlags[TransformFlags["ContainsSpread"] = 524288] = "ContainsSpread"; + TransformFlags[TransformFlags["ContainsObjectSpread"] = 1048576] = "ContainsObjectSpread"; + TransformFlags[TransformFlags["ContainsRest"] = 524288] = "ContainsRest"; + TransformFlags[TransformFlags["ContainsObjectRest"] = 1048576] = "ContainsObjectRest"; + TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 2097152] = "ContainsComputedPropertyName"; + TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 4194304] = "ContainsBlockScopedBinding"; + TransformFlags[TransformFlags["ContainsBindingPattern"] = 8388608] = "ContainsBindingPattern"; + TransformFlags[TransformFlags["ContainsYield"] = 16777216] = "ContainsYield"; + TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 33554432] = "ContainsHoistedDeclarationOrCompletion"; TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags"; // Assertions // - Bitmasks that are used to assert facts about the syntax of a node and its subtree. TransformFlags[TransformFlags["AssertTypeScript"] = 3] = "AssertTypeScript"; - TransformFlags[TransformFlags["AssertJsx"] = 12] = "AssertJsx"; - TransformFlags[TransformFlags["AssertESNext"] = 48] = "AssertESNext"; - TransformFlags[TransformFlags["AssertES2017"] = 192] = "AssertES2017"; - TransformFlags[TransformFlags["AssertES2016"] = 768] = "AssertES2016"; - TransformFlags[TransformFlags["AssertES2015"] = 3072] = "AssertES2015"; - TransformFlags[TransformFlags["AssertGenerator"] = 12288] = "AssertGenerator"; - TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 49152] = "AssertDestructuringAssignment"; + TransformFlags[TransformFlags["AssertJsx"] = 4] = "AssertJsx"; + TransformFlags[TransformFlags["AssertESNext"] = 8] = "AssertESNext"; + TransformFlags[TransformFlags["AssertES2017"] = 16] = "AssertES2017"; + TransformFlags[TransformFlags["AssertES2016"] = 32] = "AssertES2016"; + TransformFlags[TransformFlags["AssertES2015"] = 192] = "AssertES2015"; + TransformFlags[TransformFlags["AssertGenerator"] = 768] = "AssertGenerator"; + TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 3072] = "AssertDestructuringAssignment"; // Scope Exclusions // - Bitmasks that exclude flags from propagating out of a specific context // into the subtree flags of their container. - TransformFlags[TransformFlags["NodeExcludes"] = 536892757] = "NodeExcludes"; - TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 979719509] = "ArrowFunctionExcludes"; - TransformFlags[TransformFlags["FunctionExcludes"] = 980243797] = "FunctionExcludes"; - TransformFlags[TransformFlags["ConstructorExcludes"] = 975983957] = "ConstructorExcludes"; - TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 975983957] = "MethodOrAccessorExcludes"; - TransformFlags[TransformFlags["ClassExcludes"] = 559895893] = "ClassExcludes"; - TransformFlags[TransformFlags["ModuleExcludes"] = 839734613] = "ModuleExcludes"; + TransformFlags[TransformFlags["NodeExcludes"] = 536872257] = "NodeExcludes"; + TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 601249089] = "ArrowFunctionExcludes"; + TransformFlags[TransformFlags["FunctionExcludes"] = 601281857] = "FunctionExcludes"; + TransformFlags[TransformFlags["ConstructorExcludes"] = 601015617] = "ConstructorExcludes"; + TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 601015617] = "MethodOrAccessorExcludes"; + TransformFlags[TransformFlags["ClassExcludes"] = 539358529] = "ClassExcludes"; + TransformFlags[TransformFlags["ModuleExcludes"] = 574674241] = "ModuleExcludes"; TransformFlags[TransformFlags["TypeExcludes"] = -3] = "TypeExcludes"; - TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 554784085] = "ObjectLiteralExcludes"; - TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 545281365] = "ArrayLiteralOrCallOrNewExcludes"; - TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 604001621] = "VariableDeclarationListExcludes"; - TransformFlags[TransformFlags["ParameterExcludes"] = 604001621] = "ParameterExcludes"; + TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 540087617] = "ObjectLiteralExcludes"; + TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 537396545] = "ArrayLiteralOrCallOrNewExcludes"; + TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 546309441] = "VariableDeclarationListExcludes"; + TransformFlags[TransformFlags["ParameterExcludes"] = 536872257] = "ParameterExcludes"; + TransformFlags[TransformFlags["CatchClauseExcludes"] = 537920833] = "CatchClauseExcludes"; + TransformFlags[TransformFlags["BindingPatternExcludes"] = 537396545] = "BindingPatternExcludes"; // Masks // - Additional bitmasks - TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 4390912] = "TypeScriptClassSyntaxMask"; - TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 2621440] = "ES2015FunctionSyntaxMask"; + TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 274432] = "TypeScriptClassSyntaxMask"; + TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 163840] = "ES2015FunctionSyntaxMask"; })(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {})); /* @internal */ var EmitFlags; (function (EmitFlags) { - EmitFlags[EmitFlags["EmitEmitHelpers"] = 1] = "EmitEmitHelpers"; - EmitFlags[EmitFlags["EmitExportStar"] = 2] = "EmitExportStar"; - EmitFlags[EmitFlags["EmitSuperHelper"] = 4] = "EmitSuperHelper"; - EmitFlags[EmitFlags["EmitAdvancedSuperHelper"] = 8] = "EmitAdvancedSuperHelper"; - EmitFlags[EmitFlags["UMDDefine"] = 16] = "UMDDefine"; - EmitFlags[EmitFlags["SingleLine"] = 32] = "SingleLine"; - EmitFlags[EmitFlags["AdviseOnEmitNode"] = 64] = "AdviseOnEmitNode"; - EmitFlags[EmitFlags["NoSubstitution"] = 128] = "NoSubstitution"; - EmitFlags[EmitFlags["CapturesThis"] = 256] = "CapturesThis"; - EmitFlags[EmitFlags["NoLeadingSourceMap"] = 512] = "NoLeadingSourceMap"; - EmitFlags[EmitFlags["NoTrailingSourceMap"] = 1024] = "NoTrailingSourceMap"; - EmitFlags[EmitFlags["NoSourceMap"] = 1536] = "NoSourceMap"; - EmitFlags[EmitFlags["NoNestedSourceMaps"] = 2048] = "NoNestedSourceMaps"; - EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 4096] = "NoTokenLeadingSourceMaps"; - EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 8192] = "NoTokenTrailingSourceMaps"; - EmitFlags[EmitFlags["NoTokenSourceMaps"] = 12288] = "NoTokenSourceMaps"; - EmitFlags[EmitFlags["NoLeadingComments"] = 16384] = "NoLeadingComments"; - EmitFlags[EmitFlags["NoTrailingComments"] = 32768] = "NoTrailingComments"; - EmitFlags[EmitFlags["NoComments"] = 49152] = "NoComments"; - EmitFlags[EmitFlags["NoNestedComments"] = 65536] = "NoNestedComments"; - EmitFlags[EmitFlags["ExportName"] = 131072] = "ExportName"; - EmitFlags[EmitFlags["LocalName"] = 262144] = "LocalName"; - EmitFlags[EmitFlags["Indented"] = 524288] = "Indented"; - EmitFlags[EmitFlags["NoIndentation"] = 1048576] = "NoIndentation"; - EmitFlags[EmitFlags["AsyncFunctionBody"] = 2097152] = "AsyncFunctionBody"; - EmitFlags[EmitFlags["ReuseTempVariableScope"] = 4194304] = "ReuseTempVariableScope"; - EmitFlags[EmitFlags["CustomPrologue"] = 8388608] = "CustomPrologue"; - EmitFlags[EmitFlags["NoHoisting"] = 16777216] = "NoHoisting"; - EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 33554432] = "HasEndOfDeclarationMarker"; + EmitFlags[EmitFlags["SingleLine"] = 1] = "SingleLine"; + EmitFlags[EmitFlags["AdviseOnEmitNode"] = 2] = "AdviseOnEmitNode"; + EmitFlags[EmitFlags["NoSubstitution"] = 4] = "NoSubstitution"; + EmitFlags[EmitFlags["CapturesThis"] = 8] = "CapturesThis"; + EmitFlags[EmitFlags["NoLeadingSourceMap"] = 16] = "NoLeadingSourceMap"; + EmitFlags[EmitFlags["NoTrailingSourceMap"] = 32] = "NoTrailingSourceMap"; + EmitFlags[EmitFlags["NoSourceMap"] = 48] = "NoSourceMap"; + EmitFlags[EmitFlags["NoNestedSourceMaps"] = 64] = "NoNestedSourceMaps"; + EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 128] = "NoTokenLeadingSourceMaps"; + EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 256] = "NoTokenTrailingSourceMaps"; + EmitFlags[EmitFlags["NoTokenSourceMaps"] = 384] = "NoTokenSourceMaps"; + EmitFlags[EmitFlags["NoLeadingComments"] = 512] = "NoLeadingComments"; + EmitFlags[EmitFlags["NoTrailingComments"] = 1024] = "NoTrailingComments"; + EmitFlags[EmitFlags["NoComments"] = 1536] = "NoComments"; + EmitFlags[EmitFlags["NoNestedComments"] = 2048] = "NoNestedComments"; + EmitFlags[EmitFlags["HelperName"] = 4096] = "HelperName"; + EmitFlags[EmitFlags["ExportName"] = 8192] = "ExportName"; + EmitFlags[EmitFlags["LocalName"] = 16384] = "LocalName"; + EmitFlags[EmitFlags["Indented"] = 32768] = "Indented"; + EmitFlags[EmitFlags["NoIndentation"] = 65536] = "NoIndentation"; + EmitFlags[EmitFlags["AsyncFunctionBody"] = 131072] = "AsyncFunctionBody"; + EmitFlags[EmitFlags["ReuseTempVariableScope"] = 262144] = "ReuseTempVariableScope"; + EmitFlags[EmitFlags["CustomPrologue"] = 524288] = "CustomPrologue"; + EmitFlags[EmitFlags["NoHoisting"] = 1048576] = "NoHoisting"; + EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 2097152] = "HasEndOfDeclarationMarker"; })(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {})); + /** + * Used by the checker, this enum keeps track of external emit helpers that should be type + * checked. + */ + /* @internal */ + var ExternalEmitHelpers; + (function (ExternalEmitHelpers) { + ExternalEmitHelpers[ExternalEmitHelpers["Extends"] = 1] = "Extends"; + ExternalEmitHelpers[ExternalEmitHelpers["Assign"] = 2] = "Assign"; + ExternalEmitHelpers[ExternalEmitHelpers["Rest"] = 4] = "Rest"; + ExternalEmitHelpers[ExternalEmitHelpers["Decorate"] = 8] = "Decorate"; + ExternalEmitHelpers[ExternalEmitHelpers["Metadata"] = 16] = "Metadata"; + ExternalEmitHelpers[ExternalEmitHelpers["Param"] = 32] = "Param"; + ExternalEmitHelpers[ExternalEmitHelpers["Awaiter"] = 64] = "Awaiter"; + ExternalEmitHelpers[ExternalEmitHelpers["Generator"] = 128] = "Generator"; + ExternalEmitHelpers[ExternalEmitHelpers["FirstEmitHelper"] = 1] = "FirstEmitHelper"; + ExternalEmitHelpers[ExternalEmitHelpers["LastEmitHelper"] = 128] = "LastEmitHelper"; + })(ExternalEmitHelpers = ts.ExternalEmitHelpers || (ts.ExternalEmitHelpers = {})); /* @internal */ var EmitContext; (function (EmitContext) { @@ -1172,8 +1184,12 @@ var ts; })(ts || (ts = {})); /// /// -/* @internal */ var ts; +(function (ts) { + /** The version of the TypeScript compiler release */ + ts.version = "2.2.0"; +})(ts || (ts = {})); +/* @internal */ (function (ts) { /** * Ternary values are defined such that @@ -1727,7 +1743,7 @@ var ts; if (value === undefined) return to; if (to === undefined) - to = []; + return [value]; to.push(value); return to; } @@ -1750,6 +1766,17 @@ var ts; return to; } ts.addRange = addRange; + /** + * Stable sort of an array. Elements equal to each other maintain their relative position in the array. + */ + function stableSort(array, comparer) { + if (comparer === void 0) { comparer = compareValues; } + return array + .map(function (_, i) { return i; }) // create array of indices + .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); }) // sort indices by value then position + .map(function (i) { return array[i]; }); // get sorted array + } + ts.stableSort = stableSort; function rangeEquals(array1, array2, pos, end) { while (pos < end) { if (array1[pos] !== array2[pos]) { @@ -1968,6 +1995,15 @@ var ts; } } ts.copyProperties = copyProperties; + function appendProperty(map, key, value) { + if (key === undefined || value === undefined) + return map; + if (map === undefined) + map = createMap(); + map[key] = value; + return map; + } + ts.appendProperty = appendProperty; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -2001,25 +2037,6 @@ var ts; return result; } ts.reduceProperties = reduceProperties; - /** - * Reduce the properties defined on a map-like (but not from its prototype chain). - * - * NOTE: This is intended for use with MapLike objects. For Map objects, use - * reduceProperties instead as it offers better performance. - * - * @param map The map-like to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; /** * Performs a shallow equality comparison of the contents of two map-likes. * @@ -2483,6 +2500,14 @@ var ts; getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS; } ts.getEmitModuleKind = getEmitModuleKind; + function getEmitModuleResolutionKind(compilerOptions) { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + } + return moduleResolution; + } + ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind; /* @internal */ function hasZeroOrOneAsteriskCharacter(str) { var seenAsterisk = false; @@ -2979,8 +3004,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (needAllExtensions || extInfo.scriptKind === 3 /* TS */) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -2991,11 +3027,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -3140,6 +3176,17 @@ var ts; Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); /** Remove an item from an array, moving everything to its right one space left. */ + function orderedRemoveItem(array, item) { + for (var i = 0; i < array.length; i++) { + if (array[i] === item) { + orderedRemoveItemAt(array, i); + return true; + } + } + return false; + } + ts.orderedRemoveItem = orderedRemoveItem; + /** Remove an item by index from an array, moving everything to its right one space left. */ function orderedRemoveItemAt(array, index) { // This seems to be faster than either `array.splice(i, 1)` or `array.copyWithin(i, i+ 1)`. for (var i = index; i < array.length - 1; i++) { @@ -4024,6 +4071,7 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -4067,6 +4115,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -4077,6 +4126,7 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, @@ -4244,7 +4294,7 @@ var ts; Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." }, - Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." }, + Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." }, Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." }, Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." }, Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." }, @@ -4309,7 +4359,8 @@ var ts; An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, - An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." }, + The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, + _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -4380,7 +4431,10 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, @@ -4422,7 +4476,7 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -4583,6 +4637,7 @@ var ts; type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, + Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", message: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, @@ -4593,9 +4648,10 @@ var ts; A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, - Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." }, + Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, - The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." }, + A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, @@ -4607,6 +4663,9 @@ var ts; Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, }; })(ts || (ts = {})); /// @@ -6365,6 +6424,7 @@ var ts; writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, // Completely ignore indentation for string writers. And map newlines to // a single space. @@ -6443,24 +6503,24 @@ var ts; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); - return (node.flags & 4194304 /* ThisNodeOrAnySubNodesHasError */) !== 0; + return (node.flags & 131072 /* ThisNodeOrAnySubNodesHasError */) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.flags & 8388608 /* HasAggregatedChildData */)) { + if (!(node.flags & 262144 /* HasAggregatedChildData */)) { // A node is considered to contain a parse error if: // a) the parser explicitly marked that it had an error // b) any of it's children reported that it had an error. - var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576 /* ThisNodeHasError */) !== 0) || + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768 /* ThisNodeHasError */) !== 0) || ts.forEachChild(node, containsParseError); // If so, mark ourselves accordingly. if (thisNodeOrAnySubNodesHasError) { - node.flags |= 4194304 /* ThisNodeOrAnySubNodesHasError */; + node.flags |= 131072 /* ThisNodeOrAnySubNodesHasError */; } // Also mark that we've propagated the child information to this node. This way we can // always consult the bit directly on this node without needing to check its children // again. - node.flags |= 8388608 /* HasAggregatedChildData */; + node.flags |= 262144 /* HasAggregatedChildData */; } } function getSourceFileOfNode(node) { @@ -6551,7 +6611,7 @@ var ts; return !nodeIsMissing(node); } ts.nodeIsPresent = nodeIsPresent; - function getTokenPosOfNode(node, sourceFile, includeJsDocComment) { + function getTokenPosOfNode(node, sourceFile, includeJsDoc) { // With nodes that have no width (i.e. 'Missing' nodes), we actually *don't* // want to skip trivia because this will launch us forward to the next token. if (nodeIsMissing(node)) { @@ -6560,25 +6620,25 @@ var ts; if (isJSDocNode(node)) { return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); } - if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) { - return getTokenPosOfNode(node.jsDocComments[0]); + if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { + return getTokenPosOfNode(node.jsDoc[0]); } // For a syntax list, it is possible that one of its children has JSDocComment nodes, while // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 291 /* SyntaxList */ && node._children.length > 0) { - return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment); + if (node.kind === 292 /* SyntaxList */ && node._children.length > 0) { + return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 287 /* LastJSDocNode */; + return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 290 /* LastJSDocTagNode */; + return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 291 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -6725,6 +6785,10 @@ var ts; return false; } ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { case 261 /* SourceFile */: @@ -6777,7 +6841,7 @@ var ts; case 8 /* NumericLiteral */: return name.text; case 142 /* ComputedPropertyName */: - if (isStringOrNumericLiteral(name.expression.kind)) { + if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } } @@ -6906,7 +6970,8 @@ var ts; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; + return node.kind === 207 /* ExpressionStatement */ + && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -6917,26 +6982,21 @@ var ts; return ts.getLeadingCommentRanges(text, node.pos); } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; - function getJsDocComments(node, sourceFileOfNode) { - return getJsDocCommentsFromText(node, sourceFileOfNode.text); - } - ts.getJsDocComments = getJsDocComments; - function getJsDocCommentsFromText(node, text) { + function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 144 /* Parameter */ || node.kind === 143 /* TypeParameter */ || node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); - return ts.filter(commentRanges, isJsDocComment); - function isJsDocComment(comment) { - // True if the comment starts with '/**' but not if it is '/**/' + // True if the comment starts with '/**' but not if it is '/**/' + return ts.filter(commentRanges, function (comment) { return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */; - } + }); } - ts.getJsDocCommentsFromText = getJsDocCommentsFromText; + ts.getJSDocCommentRanges = getJSDocCommentRanges; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; @@ -7088,6 +7148,24 @@ var ts; } } ts.forEachYieldExpression = forEachYieldExpression; + /** + * Gets the most likely element type for a TypeNode. This is not an exhaustive test + * as it assumes a rest argument can only be an array type (either T[], or Array). + * + * @param node The type node. + */ + function getRestParameterElementType(node) { + if (node && node.kind === 162 /* ArrayType */) { + return node.elementType; + } + else if (node && node.kind === 157 /* TypeReference */) { + return ts.singleOrUndefined(node.typeArguments); + } + else { + return undefined; + } + } + ts.getRestParameterElementType = getRestParameterElementType; function isVariableLike(node) { if (node) { switch (node.kind) { @@ -7519,6 +7597,7 @@ var ts; case 145 /* Decorator */: case 252 /* JsxExpression */: case 251 /* JsxSpreadAttribute */: + case 259 /* SpreadAssignment */: return true; case 199 /* ExpressionWithTypeArguments */: return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); @@ -7555,7 +7634,7 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.flags & 2097152 /* JavaScriptFile */); + return node && !!(node.flags & 65536 /* JavaScriptFile */); } ts.isInJavaScriptFile = isInJavaScriptFile; /** @@ -7689,127 +7768,98 @@ var ts; node.parameters[0].type.kind === 276 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getJSDocTag(node, kind, checkParentVariableStatement) { - if (!node) { - return undefined; - } - var jsDocTags = getJSDocTags(node, checkParentVariableStatement); - if (!jsDocTags) { - return undefined; - } - for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) { - var tag = jsDocTags_1[_i]; - if (tag.kind === kind) { - return tag; - } - } + function getCommentsFromJSDoc(node) { + return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); } - function append(previous, additional) { - if (additional) { - if (!previous) { - previous = []; - } - for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) { - var x = additional_1[_i]; - previous.push(x); - } - } - return previous; - } - function getJSDocComments(node, checkParentVariableStatement) { - return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); }); - } - ts.getJSDocComments = getJSDocComments; - function getJSDocTags(node, checkParentVariableStatement) { - return getJSDocs(node, checkParentVariableStatement, function (docs) { + ts.getCommentsFromJSDoc = getCommentsFromJSDoc; + function getJSDocTags(node, kind) { + var docs = getJSDocs(node); + if (docs) { var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.tags) { - result.push.apply(result, doc.tags); + if (doc.kind === 281 /* JSDocParameterTag */) { + if (doc.kind === kind) { + result.push(doc); + } + } + else { + result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; })); } } return result; - }, function (tags) { return tags; }); + } } - function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) { - // TODO: Get rid of getJsDocComments and friends (note the lowercase 's' in Js) - // TODO: A lot of this work should be cached, maybe. I guess it's only used in services right now... - var result = undefined; - // prepend documentation from parent sources - if (checkParentVariableStatement) { + function getFirstJSDocTag(node, kind) { + return node && ts.firstOrUndefined(getJSDocTags(node, kind)); + } + function getJSDocs(node) { + var cache = node.jsDocCache; + if (!cache) { + getJSDocsWorker(node); + node.jsDocCache = cache; + } + return cache; + function getJSDocsWorker(node) { + var parent = node.parent; // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement. // /** // * @param {number} name // * @returns {number} // */ // var x = function(name) { return name.length; } - var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) && - (node.parent).initializer === node && - node.parent.parent.parent.kind === 205 /* VariableStatement */; + var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && + parent.initializer === node && + parent.parent.parent.kind === 205 /* VariableStatement */; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - node.parent.parent.kind === 205 /* VariableStatement */; - var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : - isVariableOfVariableDeclarationStatement ? node.parent.parent : + parent.parent.kind === 205 /* VariableStatement */; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : + isVariableOfVariableDeclarationStatement ? parent.parent : undefined; if (variableStatementNode) { - result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags)); - } - if (node.kind === 230 /* ModuleDeclaration */ && - node.parent && node.parent.kind === 230 /* ModuleDeclaration */) { - result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags)); + getJSDocsWorker(variableStatementNode); } // Also recognize when the node is the RHS of an assignment expression - var parent_4 = node.parent; - var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent && - parent_4.kind === 192 /* BinaryExpression */ && - parent_4.operatorToken.kind === 57 /* EqualsToken */ && - parent_4.parent.kind === 207 /* ExpressionStatement */; + var isSourceOfAssignmentExpressionStatement = parent && parent.parent && + parent.kind === 192 /* BinaryExpression */ && + parent.operatorToken.kind === 57 /* EqualsToken */ && + parent.parent.kind === 207 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { - result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags)); + getJSDocsWorker(parent.parent); } - var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 257 /* PropertyAssignment */; - if (isPropertyAssignmentExpression) { - result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags)); + var isModuleDeclaration = node.kind === 230 /* ModuleDeclaration */ && + parent && parent.kind === 230 /* ModuleDeclaration */; + var isPropertyAssignmentExpression = parent && parent.kind === 257 /* PropertyAssignment */; + if (isModuleDeclaration || isPropertyAssignmentExpression) { + getJSDocsWorker(parent); } // Pull parameter comments from declaring function as well if (node.kind === 144 /* Parameter */) { - var paramTags = getJSDocParameterTag(node, checkParentVariableStatement); - if (paramTags) { - result = append(result, getTags(paramTags)); - } + cache = ts.concatenate(cache, getJSDocParameterTags(node)); } - } - if (isVariableLike(node) && node.initializer) { - result = append(result, getJSDocs(node.initializer, /*checkParentVariableStatement*/ false, getDocs, getTags)); - } - if (node.jsDocComments) { - if (result) { - result = append(result, getDocs(node.jsDocComments)); - } - else { - return getDocs(node.jsDocComments); + if (isVariableLike(node) && node.initializer) { + cache = ts.concatenate(cache, node.initializer.jsDoc); } + cache = ts.concatenate(cache, node.jsDoc); } - return result; } - function getJSDocParameterTag(param, checkParentVariableStatement) { + function getJSDocParameterTags(param) { + if (!isParameter(param)) { + return undefined; + } var func = param.parent; - var tags = getJSDocTags(func, checkParentVariableStatement); + var tags = getJSDocTags(func, 281 /* JSDocParameterTag */); if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 /* JSDocParameterTag */; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70 /* Identifier */) { var name_6 = param.name.text; - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); - if (paramTags) { - return paramTags; - } + return ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines @@ -7817,40 +7867,30 @@ var ts; return undefined; } } - function getJSDocTypeTag(node) { - return getJSDocTag(node, 282 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false); + ts.getJSDocParameterTags = getJSDocParameterTags; + function getJSDocType(node) { + var tag = getFirstJSDocTag(node, 283 /* JSDocTypeTag */); + if (!tag && node.kind === 144 /* Parameter */) { + var paramTags = getJSDocParameterTags(node); + if (paramTags) { + tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); + } + } + return tag && tag.typeExpression && tag.typeExpression.type; } - ts.getJSDocTypeTag = getJSDocTypeTag; + ts.getJSDocType = getJSDocType; + function getJSDocAugmentsTag(node) { + return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */); + } + ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 281 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true); + return getFirstJSDocTag(node, 282 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 283 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false); + return getFirstJSDocTag(node, 284 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; - function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 70 /* Identifier */) { - // If it's a parameter, see if the parent has a jsdoc comment with an @param - // annotation. - var parameterName = parameter.name.text; - var jsDocTags = getJSDocTags(parameter.parent, /*checkParentVariableStatement*/ true); - if (!jsDocTags) { - return undefined; - } - for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) { - var tag = jsDocTags_2[_i]; - if (tag.kind === 280 /* JSDocParameterTag */) { - var parameterTag = tag; - if (parameterTag.parameterName.text === parameterName) { - return parameterTag; - } - } - } - } - return undefined; - } - ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; function hasRestParameter(s) { return isRestParameter(ts.lastOrUndefined(s.parameters)); } @@ -7860,14 +7900,11 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 2097152 /* JavaScriptFile */)) { - if (node.type && node.type.kind === 275 /* JSDocVariadicType */) { + if (node && (node.flags & 65536 /* JavaScriptFile */)) { + if (node.type && node.type.kind === 275 /* JSDocVariadicType */ || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275 /* JSDocVariadicType */; })) { return true; } - var paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 275 /* JSDocVariadicType */; - } } return isDeclaredRestParam(node); } @@ -8114,8 +8151,10 @@ var ts; return isFunctionLike(node) && hasModifier(node, 256 /* Async */) && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; - function isStringOrNumericLiteral(kind) { - return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */; + function isStringOrNumericLiteral(node) { + var kind = node.kind; + return kind === 9 /* StringLiteral */ + || kind === 8 /* NumericLiteral */; } ts.isStringOrNumericLiteral = isStringOrNumericLiteral; /** @@ -8131,7 +8170,7 @@ var ts; ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { return name.kind === 142 /* ComputedPropertyName */ && - !isStringOrNumericLiteral(name.expression.kind) && + !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } ts.isDynamicName = isDynamicName; @@ -8355,6 +8394,7 @@ var ts; case 194 /* TemplateExpression */: case 183 /* ParenthesizedExpression */: case 198 /* OmittedExpression */: + case 297 /* RawExpression */: return 19; case 181 /* TaggedTemplateExpression */: case 177 /* PropertyAccessExpression */: @@ -9225,19 +9265,19 @@ var ts; } } ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments; - function isAssignmentExpression(node) { + function isAssignmentExpression(node, excludeCompoundAssignment) { return isBinaryExpression(node) - && isAssignmentOperator(node.operatorToken.kind) + && (excludeCompoundAssignment + ? node.operatorToken.kind === 57 /* EqualsToken */ + : isAssignmentOperator(node.operatorToken.kind)) && isLeftHandSideExpression(node.left); } ts.isAssignmentExpression = isAssignmentExpression; function isDestructuringAssignment(node) { - if (isBinaryExpression(node)) { - if (node.operatorToken.kind === 57 /* EqualsToken */) { - var kind = node.left.kind; - return kind === 176 /* ObjectLiteralExpression */ - || kind === 175 /* ArrayLiteralExpression */; - } + if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { + var kind = node.left.kind; + return kind === 176 /* ObjectLiteralExpression */ + || kind === 175 /* ArrayLiteralExpression */; } return false; } @@ -9327,47 +9367,6 @@ var ts; } return output; } - /** - * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph - * as the fallback implementation does not check for circular references by default. - */ - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - /** - * Serialize an object graph into a JSON string. - */ - function stringifyFallback(value) { - // JSON.stringify returns `undefined` here, instead of the string "undefined". - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; - } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; - } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; - } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); - } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; /** * Converts a string to a base-64 encoded ASCII string. @@ -9631,135 +9630,6 @@ var ts; return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos); } ts.getStartPositionOfRange = getStartPositionOfRange; - function collectExternalModuleInfo(sourceFile, resolver) { - var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); - var uniqueExports = ts.createMap(); - var hasExportDefault = false; - var exportEquals = undefined; - var hasExportStarsToExportValues = false; - for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { - var node = _a[_i]; - switch (node.kind) { - case 235 /* ImportDeclaration */: - // import "mod" - // import x from "mod" - // import * as x from "mod" - // import { x, y } from "mod" - externalImports.push(node); - break; - case 234 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { - // import x = require("mod") - externalImports.push(node); - } - break; - case 241 /* ExportDeclaration */: - if (node.moduleSpecifier) { - if (!node.exportClause) { - // export * from "mod" - externalImports.push(node); - hasExportStarsToExportValues = true; - } - else { - // export { x, y } from "mod" - externalImports.push(node); - } - } - else { - // export { x, y } - for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { - var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_8 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_8.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_8) - || resolver.getReferencedValueDeclaration(name_8); - if (decl) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name); - } - uniqueExports[specifier.name.text] = specifier.name; - } - } - } - break; - case 240 /* ExportAssignment */: - if (node.isExportEquals && !exportEquals) { - // export = x - exportEquals = node; - } - break; - case 205 /* VariableStatement */: - if (hasModifier(node, 1 /* Export */)) { - for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { - var decl = _e[_d]; - collectExportedVariableInfo(decl, uniqueExports); - } - } - break; - case 225 /* FunctionDeclaration */: - if (hasModifier(node, 1 /* Export */)) { - if (hasModifier(node, 512 /* Default */)) { - // export default function() { } - if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); - hasExportDefault = true; - } - } - else { - // export function x() { } - var name_9 = node.name; - if (!uniqueExports[name_9.text]) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_9); - uniqueExports[name_9.text] = name_9; - } - } - } - break; - case 226 /* ClassDeclaration */: - if (hasModifier(node, 1 /* Export */)) { - if (hasModifier(node, 512 /* Default */)) { - // export default class { } - if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); - hasExportDefault = true; - } - } - else { - // export class x { } - var name_10 = node.name; - if (!uniqueExports[name_10.text]) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_10); - uniqueExports[name_10.text] = name_10; - } - } - } - break; - } - } - var exportedNames; - for (var key in uniqueExports) { - exportedNames = ts.append(exportedNames, uniqueExports[key]); - } - return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames }; - } - ts.collectExternalModuleInfo = collectExternalModuleInfo; - function collectExportedVariableInfo(decl, uniqueExports) { - if (isBindingPattern(decl.name)) { - for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (!isOmittedExpression(element)) { - collectExportedVariableInfo(element, uniqueExports); - } - } - } - else if (!isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = decl.name; - } - } - } /** * Determines whether a name was originally the declaration name of an enum or namespace * declaration. @@ -9963,6 +9833,14 @@ var ts; } ts.isTypeNode = isTypeNode; // Binding patterns + function isArrayBindingPattern(node) { + return node.kind === 173 /* ArrayBindingPattern */; + } + ts.isArrayBindingPattern = isArrayBindingPattern; + function isObjectBindingPattern(node) { + return node.kind === 172 /* ObjectBindingPattern */; + } + ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; @@ -9972,6 +9850,12 @@ var ts; return false; } ts.isBindingPattern = isBindingPattern; + function isAssignmentPattern(node) { + var kind = node.kind; + return kind === 175 /* ArrayLiteralExpression */ + || kind === 176 /* ObjectLiteralExpression */; + } + ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { return node.kind === 174 /* BindingElement */; } @@ -9982,6 +9866,51 @@ var ts; || kind === 198 /* OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; + /** + * Determines whether the BindingOrAssignmentElement is a BindingElement-like declaration + */ + function isDeclarationBindingElement(bindingElement) { + switch (bindingElement.kind) { + case 223 /* VariableDeclaration */: + case 144 /* Parameter */: + case 174 /* BindingElement */: + return true; + } + return false; + } + ts.isDeclarationBindingElement = isDeclarationBindingElement; + /** + * Determines whether a node is a BindingOrAssignmentPattern + */ + function isBindingOrAssignmentPattern(node) { + return isObjectBindingOrAssignmentPattern(node) + || isArrayBindingOrAssignmentPattern(node); + } + ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; + /** + * Determines whether a node is an ObjectBindingOrAssignmentPattern + */ + function isObjectBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 172 /* ObjectBindingPattern */: + case 176 /* ObjectLiteralExpression */: + return true; + } + return false; + } + ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; + /** + * Determines whether a node is an ArrayBindingOrAssignmentPattern + */ + function isArrayBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 173 /* ArrayBindingPattern */: + case 175 /* ArrayLiteralExpression */: + return true; + } + return false; + } + ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; // Expression function isArrayLiteralExpression(node) { return node.kind === 175 /* ArrayLiteralExpression */; @@ -10049,7 +9978,8 @@ var ts; || kind === 98 /* ThisKeyword */ || kind === 100 /* TrueKeyword */ || kind === 96 /* SuperKeyword */ - || kind === 201 /* NonNullExpression */; + || kind === 201 /* NonNullExpression */ + || kind === 297 /* RawExpression */; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); @@ -10077,6 +10007,7 @@ var ts; || kind === 196 /* SpreadElement */ || kind === 200 /* AsExpression */ || kind === 198 /* OmittedExpression */ + || kind === 297 /* RawExpression */ || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10090,11 +10021,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 293 /* PartiallyEmittedExpression */; + return node.kind === 294 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 292 /* NotEmittedStatement */; + return node.kind === 293 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10208,7 +10139,7 @@ var ts; || kind === 228 /* TypeAliasDeclaration */ || kind === 143 /* TypeParameter */ || kind === 223 /* VariableDeclaration */ - || kind === 284 /* JSDocTypedefTag */; + || kind === 285 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { return kind === 225 /* FunctionDeclaration */ @@ -10243,9 +10174,9 @@ var ts; || kind === 205 /* VariableStatement */ || kind === 210 /* WhileStatement */ || kind === 217 /* WithStatement */ - || kind === 292 /* NotEmittedStatement */ - || kind === 295 /* EndOfDeclarationMarker */ - || kind === 294 /* MergeDeclarationMarker */; + || kind === 293 /* NotEmittedStatement */ + || kind === 296 /* EndOfDeclarationMarker */ + || kind === 295 /* MergeDeclarationMarker */; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10640,6 +10571,60 @@ var ts; return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; + /** + * Checks to see if the locale is in the appropriate format, + * and if it is, attempts to set the appropriate language. + */ + function validateLocaleAndSetLanguage(locale, sys, errors) { + var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); + if (!matchResult) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); + } + return; + } + var language = matchResult[1]; + var territory = matchResult[3]; + // First try the entire locale, then fall back to just language if that's all we have. + // Either ways do not fail, and fallback to the English diagnostic strings. + if (!trySetLanguageAndTerritory(language, territory, errors)) { + trySetLanguageAndTerritory(language, /*territory*/ undefined, errors); + } + function trySetLanguageAndTerritory(language, territory, errors) { + var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath()); + var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath); + var filePath = ts.combinePaths(containingDirectoryPath, language); + if (territory) { + filePath = filePath + "-" + territory; + } + filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")); + if (!sys.fileExists(filePath)) { + return false; + } + // TODO: Add codePage support for readFile? + var fileContents = ""; + try { + fileContents = sys.readFile(filePath); + } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)); + } + return false; + } + try { + ts.localizedDiagnosticMessages = JSON.parse(fileContents); + } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)); + } + return false; + } + return true; + } + } + ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; })(ts || (ts = {})); /// /// @@ -10857,9 +10842,9 @@ var ts; return node; } ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node); + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) { + return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node); } return node; } @@ -10994,9 +10979,9 @@ var ts; return node; } ts.createBindingElement = createBindingElement; - function updateBindingElement(node, propertyName, name, initializer) { - if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) { - return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node); + function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { + if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) { + return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node); } return node; } @@ -11037,7 +11022,7 @@ var ts; function createPropertyAccess(expression, name, location, flags) { var node = createNode(177 /* PropertyAccessExpression */, location, flags); node.expression = parenthesizeForAccess(expression); - (node.emitNode || (node.emitNode = {})).flags |= 1048576 /* NoIndentation */; + (node.emitNode || (node.emitNode = {})).flags |= 65536 /* NoIndentation */; node.name = typeof name === "string" ? createIdentifier(name) : name; return node; } @@ -11259,13 +11244,23 @@ var ts; return node; } ts.updateBinary = updateBinary; - function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) { - var node = createNode(193 /* ConditionalExpression */, location); - node.condition = condition; - node.questionToken = questionToken; - node.whenTrue = whenTrue; - node.colonToken = colonToken; - node.whenFalse = whenFalse; + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { + var node = createNode(193 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation); + node.condition = parenthesizeForConditionalHead(condition); + if (whenFalse) { + // second overload + node.questionToken = questionTokenOrWhenTrue; + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); + node.colonToken = colonTokenOrLocation; + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); + } + else { + // first overload + node.questionToken = createToken(54 /* QuestionToken */); + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); + node.colonToken = createToken(55 /* ColonToken */); + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); + } return node; } ts.createConditional = createConditional; @@ -12081,8 +12076,6 @@ var ts; updated.imports = node.imports; if (node.moduleAugmentations !== undefined) updated.moduleAugmentations = node.moduleAugmentations; - if (node.externalHelpersModuleName !== undefined) - updated.externalHelpersModuleName = node.externalHelpersModuleName; return updateNode(updated, node); } return node; @@ -12096,7 +12089,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createNode(292 /* NotEmittedStatement */, /*location*/ original); + var node = createNode(293 /* NotEmittedStatement */, /*location*/ original); node.original = original; return node; } @@ -12106,7 +12099,7 @@ var ts; * order to properly emit exports. */ function createEndOfDeclarationMarker(original) { - var node = createNode(295 /* EndOfDeclarationMarker */); + var node = createNode(296 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12117,7 +12110,7 @@ var ts; * order to properly emit exports. */ function createMergeDeclarationMarker(original) { - var node = createNode(294 /* MergeDeclarationMarker */); + var node = createNode(295 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12132,7 +12125,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(293 /* PartiallyEmittedExpression */, /*location*/ location || original); + var node = createNode(294 /* PartiallyEmittedExpression */, /*location*/ location || original); node.expression = expression; node.original = original; return node; @@ -12145,6 +12138,19 @@ var ts; return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; + /** + * Creates a node that emits a string of raw text in an expression position. Raw text is never + * transformed, should be ES3 compliant, and should have the same precedence as + * PrimaryExpression. + * + * @param text The raw text of the node. + */ + function createRawExpression(text) { + var node = createNode(297 /* RawExpression */); + node.text = text; + return node; + } + ts.createRawExpression = createRawExpression; // Compound nodes function createComma(left, right) { return createBinary(left, 25 /* CommaToken */, right); @@ -12194,13 +12200,19 @@ var ts; return createVoid(createLiteral(0)); } ts.createVoidZero = createVoidZero; + function createTypeCheck(value, tag) { + return tag === "undefined" + ? createStrictEquality(value, createVoidZero()) + : createStrictEquality(createTypeOf(value), createLiteral(tag)); + } + ts.createTypeCheck = createTypeCheck; function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) { return createElementAccess(target, memberName.expression, location); } else { var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - (expression.emitNode || (expression.emitNode = {})).flags |= 2048 /* NoNestedSourceMaps */; + (expression.emitNode || (expression.emitNode = {})).flags |= 64 /* NoNestedSourceMaps */; return expression; } } @@ -12244,14 +12256,17 @@ var ts; // flag and setting a parent node. var react = createIdentifier(reactNamespace || "React"); react.flags &= ~8 /* Synthesized */; - // Set the parent that is in parse tree + // Set the parent that is in parse tree // this makes sure that parent chain is intact for checker to traverse complete scope tree react.parent = ts.getParseTreeNode(parent); return react; } function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { - return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536 /* NoSourceMap */)); + var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); + var right = createSynthesizedNode(70 /* Identifier */); + right.text = jsxFactory.right.text; + return createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); @@ -12307,170 +12322,10 @@ var ts; } ts.createConstDeclarationList = createConstDeclarationList; // Helpers - function createHelperName(externalHelpersModuleName, name) { - return externalHelpersModuleName - ? createPropertyAccess(externalHelpersModuleName, name) - : createIdentifier(name); + function getHelperName(name) { + return setEmitFlags(createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); } - ts.createHelperName = createHelperName; - function createExtendsHelper(externalHelpersModuleName, name) { - return createCall(createHelperName(externalHelpersModuleName, "__extends"), - /*typeArguments*/ undefined, [ - name, - createIdentifier("_super") - ]); - } - ts.createExtendsHelper = createExtendsHelper; - function createAssignHelper(externalHelpersModuleName, attributesSegments) { - return createCall(createHelperName(externalHelpersModuleName, "__assign"), - /*typeArguments*/ undefined, attributesSegments); - } - ts.createAssignHelper = createAssignHelper; - function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) { - return createCall(createHelperName(externalHelpersModuleName, "__param"), - /*typeArguments*/ undefined, [ - createLiteral(parameterOffset), - expression - ], location); - } - ts.createParamHelper = createParamHelper; - function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) { - return createCall(createHelperName(externalHelpersModuleName, "__metadata"), - /*typeArguments*/ undefined, [ - createLiteral(metadataKey), - metadataValue - ]); - } - ts.createMetadataHelper = createMetadataHelper; - function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) { - var argumentsArray = []; - argumentsArray.push(createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); - } - } - return createCall(createHelperName(externalHelpersModuleName, "__decorate"), /*typeArguments*/ undefined, argumentsArray, location); - } - ts.createDecorateHelper = createDecorateHelper; - function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) { - var generatorFunc = createFunctionExpression( - /*modifiers*/ undefined, createToken(38 /* AsteriskToken */), - /*name*/ undefined, - /*typeParameters*/ undefined, - /*parameters*/ [], - /*type*/ undefined, body); - // Mark this node as originally an async function - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152 /* AsyncFunctionBody */; - return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), - /*typeArguments*/ undefined, [ - createThis(), - hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(), - promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(), - generatorFunc - ]); - } - ts.createAwaiterHelper = createAwaiterHelper; - function createHasOwnProperty(target, propertyName) { - return createCall(createPropertyAccess(target, "hasOwnProperty"), - /*typeArguments*/ undefined, [propertyName]); - } - ts.createHasOwnProperty = createHasOwnProperty; - function createObjectCreate(prototype) { - return createCall(createPropertyAccess(createIdentifier("Object"), "create"), - /*typeArguments*/ undefined, [prototype]); - } - function createGeti(target) { - // name => super[name] - return createArrowFunction( - /*modifiers*/ undefined, - /*typeParameters*/ undefined, [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name")], - /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createElementAccess(target, createIdentifier("name"))); - } - function createSeti(target) { - // (name, value) => super[name] = value - return createArrowFunction( - /*modifiers*/ undefined, - /*typeParameters*/ undefined, [ - createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name"), - createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "value") - ], - /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value"))); - } - function createAdvancedAsyncSuperHelper() { - // const _super = (function (geti, seti) { - // const cache = Object.create(null); - // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); - // })(name => super[name], (name, value) => super[name] = value); - // const cache = Object.create(null); - var createCache = createVariableStatement( - /*modifiers*/ undefined, createConstDeclarationList([ - createVariableDeclaration("cache", - /*type*/ undefined, createObjectCreate(createNull())) - ])); - // get value() { return geti(name); } - var getter = createGetAccessor( - /*decorators*/ undefined, - /*modifiers*/ undefined, "value", - /*parameters*/ [], - /*type*/ undefined, createBlock([ - createReturn(createCall(createIdentifier("geti"), - /*typeArguments*/ undefined, [createIdentifier("name")])) - ])); - // set value(v) { seti(name, v); } - var setter = createSetAccessor( - /*decorators*/ undefined, - /*modifiers*/ undefined, "value", [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "v")], createBlock([ - createStatement(createCall(createIdentifier("seti"), - /*typeArguments*/ undefined, [ - createIdentifier("name"), - createIdentifier("v") - ])) - ])); - // return name => cache[name] || ... - var getOrCreateAccessorsForName = createReturn(createArrowFunction( - /*modifiers*/ undefined, - /*typeParameters*/ undefined, [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name")], - /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([ - getter, - setter - ])))))); - // const _super = (function (geti, seti) { - // const cache = Object.create(null); - // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); - // })(name => super[name], (name, value) => super[name] = value); - return createVariableStatement( - /*modifiers*/ undefined, createConstDeclarationList([ - createVariableDeclaration("_super", - /*type*/ undefined, createCall(createParen(createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, [ - createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "geti"), - createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "seti") - ], - /*type*/ undefined, createBlock([ - createCache, - getOrCreateAccessorsForName - ]))), - /*typeArguments*/ undefined, [ - createGeti(createSuper()), - createSeti(createSuper()) - ])) - ])); - } - ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper; - function createSimpleAsyncSuperHelper() { - return createVariableStatement( - /*modifiers*/ undefined, createConstDeclarationList([ - createVariableDeclaration("_super", - /*type*/ undefined, createGeti(createSuper())) - ])); - } - ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper; + ts.getHelperName = getHelperName; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12656,14 +12511,14 @@ var ts; * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. */ function getLocalName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 262144 /* LocalName */); + return getName(node, allowComments, allowSourceMaps, 16384 /* LocalName */); } ts.getLocalName = getLocalName; /** * Gets whether an identifier should only be referred to by its local name. */ function isLocalName(node) { - return (getEmitFlags(node) & 262144 /* LocalName */) !== 0; + return (getEmitFlags(node) & 16384 /* LocalName */) !== 0; } ts.isLocalName = isLocalName; /** @@ -12677,7 +12532,7 @@ var ts; * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. */ function getExportName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 131072 /* ExportName */); + return getName(node, allowComments, allowSourceMaps, 8192 /* ExportName */); } ts.getExportName = getExportName; /** @@ -12685,7 +12540,7 @@ var ts; * name points to an exported symbol. */ function isExportName(node) { - return (getEmitFlags(node) & 131072 /* ExportName */) !== 0; + return (getEmitFlags(node) & 8192 /* ExportName */) !== 0; } ts.isExportName = isExportName; /** @@ -12701,15 +12556,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_11 = getMutableClone(node.name); + var name_8 = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) - emitFlags |= 1536 /* NoSourceMap */; + emitFlags |= 48 /* NoSourceMap */; if (!allowComments) - emitFlags |= 49152 /* NoComments */; + emitFlags |= 1536 /* NoComments */; if (emitFlags) - setEmitFlags(name_11, emitFlags); - return name_11; + setEmitFlags(name_8, emitFlags); + return name_8; } return getGeneratedNameForNode(node); } @@ -12743,15 +12598,18 @@ var ts; var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), /*location*/ name); var emitFlags; if (!allowSourceMaps) - emitFlags |= 1536 /* NoSourceMap */; + emitFlags |= 48 /* NoSourceMap */; if (!allowComments) - emitFlags |= 49152 /* NoComments */; + emitFlags |= 1536 /* NoComments */; if (emitFlags) setEmitFlags(qualifiedName, emitFlags); return qualifiedName; } ts.getNamespaceMemberName = getNamespaceMemberName; - // Utilities + function convertToFunctionBody(node, multiLine) { + return ts.isBlock(node) ? node : createBlock([createReturn(node, /*location*/ node)], /*location*/ node, multiLine); + } + ts.convertToFunctionBody = convertToFunctionBody; function isUseStrictPrologue(node) { return node.expression.text === "use strict"; } @@ -12789,7 +12647,7 @@ var ts; } while (statementOffset < numStatements) { var statement = source[statementOffset]; - if (getEmitFlags(statement) & 8388608 /* CustomPrologue */) { + if (getEmitFlags(statement) & 524288 /* CustomPrologue */) { target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); } else { @@ -12800,15 +12658,22 @@ var ts; return statementOffset; } ts.addPrologueDirectives = addPrologueDirectives; + function startsWithUseStrict(statements) { + var firstStatement = ts.firstOrUndefined(statements); + return firstStatement !== undefined + && ts.isPrologueDirective(firstStatement) + && isUseStrictPrologue(firstStatement); + } + ts.startsWithUseStrict = startsWithUseStrict; /** * Ensures "use strict" directive is added * - * @param node source file + * @param statements An array of statements */ - function ensureUseStrict(node) { + function ensureUseStrict(statements) { var foundUseStrict = false; - for (var _i = 0, _a = node.statements; _i < _a.length; _i++) { - var statement = _a[_i]; + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; if (ts.isPrologueDirective(statement)) { if (isUseStrictPrologue(statement)) { foundUseStrict = true; @@ -12820,12 +12685,11 @@ var ts; } } if (!foundUseStrict) { - var statements = []; - statements.push(startOnNewLine(createStatement(createLiteral("use strict")))); - // add "use strict" as the first statement - return updateSourceFileNode(node, statements.concat(node.statements)); + return createNodeArray([ + startOnNewLine(createStatement(createLiteral("use strict"))) + ].concat(statements), statements); } - return node; + return statements; } ts.ensureUseStrict = ensureUseStrict; /** @@ -12986,6 +12850,24 @@ var ts; } return 0 /* Unknown */; } + function parenthesizeForConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(193 /* ConditionalExpression */, 54 /* QuestionToken */); + var emittedCondition = skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { + return createParen(condition); + } + return condition; + } + ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; + function parenthesizeSubexpressionOfConditionalExpression(e) { + // per ES grammar both 'whenTrue' and 'whenFalse' parts of conditional expression are assignment expressions + // so in case when comma expression is introduced as a part of previous transformations + // if should be wrapped in parens since comma operator has the lowest precedence + return e.kind === 192 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */ + ? createParen(e) + : e; + } /** * Wraps an expression in parentheses if it is needed in order to use the expression * as the expression of a NewExpression node. @@ -13117,7 +12999,7 @@ var ts; case 177 /* PropertyAccessExpression */: node = node.expression; continue; - case 293 /* PartiallyEmittedExpression */: + case 294 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -13172,7 +13054,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 293 /* PartiallyEmittedExpression */) { + while (node.kind === 294 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -13194,8 +13076,8 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges; - if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges)) + var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) destEmitNode = {}; if (flags) destEmitNode.flags = flags; @@ -13205,6 +13087,10 @@ var ts; destEmitNode.sourceMapRange = sourceMapRange; if (tokenSourceMapRanges) destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -13257,6 +13143,7 @@ var ts; } return node.emitNode; } + ts.getOrCreateEmitNode = getOrCreateEmitNode; /** * Gets flags that control emit behavior of a node. * @@ -13278,6 +13165,16 @@ var ts; return node; } ts.setEmitFlags = setEmitFlags; + /** + * Gets a custom text range to use when emitting source maps. + * + * @param node The node. + */ + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; /** * Sets a custom text range to use when emitting source maps. * @@ -13289,6 +13186,18 @@ var ts; return node; } ts.setSourceMapRange = setSourceMapRange; + /** + * Gets the TextRange to use for source maps for a token of a node. + * + * @param node The node. + * @param token The token. + */ + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; /** * Sets the TextRange to use for source maps for a token of a node. * @@ -13303,14 +13212,6 @@ var ts; return node; } ts.setTokenSourceMapRange = setTokenSourceMapRange; - /** - * Sets a custom text range to use when emitting comments. - */ - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; /** * Gets a custom text range to use when emitting comments. * @@ -13322,27 +13223,13 @@ var ts; } ts.getCommentRange = getCommentRange; /** - * Gets a custom text range to use when emitting source maps. - * - * @param node The node. + * Sets a custom text range to use when emitting comments. */ - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; } - ts.getSourceMapRange = getSourceMapRange; - /** - * Gets the TextRange to use for source maps for a token of a node. - * - * @param node The node. - * @param token The token. - */ - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; + ts.setCommentRange = setCommentRange; /** * Gets the constant value to emit for an expression. */ @@ -13360,6 +13247,118 @@ var ts; return node; } ts.setConstantValue = setConstantValue; + function getExternalHelpersModuleName(node) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = parseNode && parseNode.emitNode; + return emitNode && emitNode.externalHelpersModuleName; + } + ts.getExternalHelpersModuleName = getExternalHelpersModuleName; + function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) { + if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { + var externalHelpersModuleName = getExternalHelpersModuleName(node); + if (externalHelpersModuleName) { + return externalHelpersModuleName; + } + var helpers = getEmitHelpers(node); + if (helpers) { + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!helper.scoped) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText)); + } + } + } + } + } + ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; + /** + * Adds an EmitHelper to a node. + */ + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + /** + * Adds an EmitHelper to a node. + */ + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + /** + * Removes an EmitHelper from a node. + */ + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + /** + * Gets the EmitHelpers of a node. + */ + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + /** + * Moves matching emit helpers from a source node to a target node. + */ + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + function compareEmitHelpers(x, y) { + if (x === y) + return 0 /* EqualTo */; + if (x.priority === y.priority) + return 0 /* EqualTo */; + if (x.priority === undefined) + return 1 /* GreaterThan */; + if (y.priority === undefined) + return -1 /* LessThan */; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; function setTextRange(node, location) { if (location) { node.pos = location.pos; @@ -13389,8 +13388,8 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_12 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_12) ? name_12 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name_9 = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } if (node.kind === 235 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); @@ -13453,362 +13452,390 @@ var ts; return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); } /** - * Transforms the body of a function-like node. - * - * @param node A function-like node. + * Gets the initializer of an BindingOrAssignmentElement. */ - function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) { - var multiLine = false; // indicates whether the block *must* be emitted as multiple lines - var singleLine = false; // indicates whether the block *may* be emitted as a single line - var statementsLocation; - var closeBraceLocation; - var statements = []; - var body = node.body; - var statementOffset; - context.startLexicalEnvironment(); - if (ts.isBlock(body)) { - // ensureUseStrict is false because no new prologue-directive should be added. - // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array - statementOffset = addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); + function getInitializerOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + // `1` in `let { a = 1 } = ...` + // `1` in `let { a: b = 1 } = ...` + // `1` in `let { a: {b} = 1 } = ...` + // `1` in `let { a: [b] = 1 } = ...` + // `1` in `let [a = 1] = ...` + // `1` in `let [{a} = 1] = ...` + // `1` in `let [[a] = 1] = ...` + return bindingElement.initializer; } - addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis); - addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest); - addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false); - // If we added any generated statements, this must be a multi-line block. - if (!multiLine && statements.length > 0) { - multiLine = true; + if (ts.isPropertyAssignment(bindingElement)) { + // `1` in `({ a: b = 1 } = ...)` + // `1` in `({ a: {b} = 1 } = ...)` + // `1` in `({ a: [b] = 1 } = ...)` + return ts.isAssignmentExpression(bindingElement.initializer, /*excludeCompoundAssignment*/ true) + ? bindingElement.initializer.right + : undefined; } - if (ts.isBlock(body)) { - statementsLocation = body.statements; - ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); - // If the original body was a multi-line block, this must be a multi-line block. - if (!multiLine && body.multiLine) { - multiLine = true; + if (ts.isShorthandPropertyAssignment(bindingElement)) { + // `1` in `({ a = 1 } = ...)` + return bindingElement.objectAssignmentInitializer; + } + if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) { + // `1` in `[a = 1] = ...` + // `1` in `[{a} = 1] = ...` + // `1` in `[[a] = 1] = ...` + return bindingElement.right; + } + if (ts.isSpreadExpression(bindingElement)) { + // Recovery consistent with existing emit. + return getInitializerOfBindingOrAssignmentElement(bindingElement.expression); + } + } + ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement; + /** + * Gets the name of an BindingOrAssignmentElement. + */ + function getTargetOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + // `a` in `let { a } = ...` + // `a` in `let { a = 1 } = ...` + // `b` in `let { a: b } = ...` + // `b` in `let { a: b = 1 } = ...` + // `a` in `let { ...a } = ...` + // `{b}` in `let { a: {b} } = ...` + // `{b}` in `let { a: {b} = 1 } = ...` + // `[b]` in `let { a: [b] } = ...` + // `[b]` in `let { a: [b] = 1 } = ...` + // `a` in `let [a] = ...` + // `a` in `let [a = 1] = ...` + // `a` in `let [...a] = ...` + // `{a}` in `let [{a}] = ...` + // `{a}` in `let [{a} = 1] = ...` + // `[a]` in `let [[a]] = ...` + // `[a]` in `let [[a] = 1] = ...` + return bindingElement.name; + } + if (ts.isObjectLiteralElementLike(bindingElement)) { + switch (bindingElement.kind) { + case 257 /* PropertyAssignment */: + // `b` in `({ a: b } = ...)` + // `b` in `({ a: b = 1 } = ...)` + // `{b}` in `({ a: {b} } = ...)` + // `{b}` in `({ a: {b} = 1 } = ...)` + // `[b]` in `({ a: [b] } = ...)` + // `[b]` in `({ a: [b] = 1 } = ...)` + // `b.c` in `({ a: b.c } = ...)` + // `b.c` in `({ a: b.c = 1 } = ...)` + // `b[0]` in `({ a: b[0] } = ...)` + // `b[0]` in `({ a: b[0] = 1 } = ...)` + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); + case 258 /* ShorthandPropertyAssignment */: + // `a` in `({ a } = ...)` + // `a` in `({ a = 1 } = ...)` + return bindingElement.name; + case 259 /* SpreadAssignment */: + // `a` in `({ ...a } = ...)` + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + // no target + return undefined; + } + if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) { + // `a` in `[a = 1] = ...` + // `{a}` in `[{a} = 1] = ...` + // `[a]` in `[[a] = 1] = ...` + // `a.b` in `[a.b = 1] = ...` + // `a[0]` in `[a[0] = 1] = ...` + return getTargetOfBindingOrAssignmentElement(bindingElement.left); + } + if (ts.isSpreadExpression(bindingElement)) { + // `a` in `[...a] = ...` + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + // `a` in `[a] = ...` + // `{a}` in `[{a}] = ...` + // `[a]` in `[[a]] = ...` + // `a.b` in `[a.b] = ...` + // `a[0]` in `[a[0]] = ...` + return bindingElement; + } + ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; + /** + * Determines whether an BindingOrAssignmentElement is a rest element. + */ + function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 144 /* Parameter */: + case 174 /* BindingElement */: + // `...` in `let [...a] = ...` + return bindingElement.dotDotDotToken; + case 196 /* SpreadElement */: + case 259 /* SpreadAssignment */: + // `...` in `[...a] = ...` + return bindingElement; + } + return undefined; + } + ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; + /** + * Gets the property name of a BindingOrAssignmentElement + */ + function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 174 /* BindingElement */: + // `a` in `let { a: b } = ...` + // `[a]` in `let { [a]: b } = ...` + // `"a"` in `let { "a": b } = ...` + // `1` in `let { 1: b } = ...` + if (bindingElement.propertyName) { + var propertyName = bindingElement.propertyName; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 257 /* PropertyAssignment */: + // `a` in `({ a: b } = ...)` + // `[a]` in `({ [a]: b } = ...)` + // `"a"` in `({ "a": b } = ...)` + // `1` in `({ 1: b } = ...)` + if (bindingElement.name) { + var propertyName = bindingElement.name; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 259 /* SpreadAssignment */: + // `a` in `({ ...a } = ...)` + return bindingElement.name; + } + var target = getTargetOfBindingOrAssignmentElement(bindingElement); + if (target && ts.isPropertyName(target)) { + return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression) + ? target.expression + : target; + } + ts.Debug.fail("Invalid property name for binding element."); + } + ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; + /** + * Gets the elements of a BindingOrAssignmentPattern + */ + function getElementsOfBindingOrAssignmentPattern(name) { + switch (name.kind) { + case 172 /* ObjectBindingPattern */: + case 173 /* ArrayBindingPattern */: + case 175 /* ArrayLiteralExpression */: + // `a` in `{a}` + // `a` in `[a]` + return name.elements; + case 176 /* ObjectLiteralExpression */: + // `a` in `{a}` + return name.properties; + } + } + ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern; + function convertToArrayAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createSpread(element.name, element), element); + } + var expression = convertToAssignmentElementTarget(element.name); + return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression; + } + ts.Debug.assertNode(element, ts.isExpression); + return element; + } + ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement; + function convertToObjectAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createSpreadAssignment(element.name, element), element); + } + if (element.propertyName) { + var expression = convertToAssignmentElementTarget(element.name); + return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element); + } + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element); + } + ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); + return element; + } + ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; + function convertToAssignmentPattern(node) { + switch (node.kind) { + case 173 /* ArrayBindingPattern */: + case 175 /* ArrayLiteralExpression */: + return convertToArrayAssignmentPattern(node); + case 172 /* ObjectBindingPattern */: + case 176 /* ObjectLiteralExpression */: + return convertToObjectAssignmentPattern(node); + } + } + ts.convertToAssignmentPattern = convertToAssignmentPattern; + function convertToObjectAssignmentPattern(node) { + if (ts.isObjectBindingPattern(node)) { + return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node); + } + ts.Debug.assertNode(node, ts.isObjectLiteralExpression); + return node; + } + ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; + function convertToArrayAssignmentPattern(node) { + if (ts.isArrayBindingPattern(node)) { + return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node); + } + ts.Debug.assertNode(node, ts.isArrayLiteralExpression); + return node; + } + ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern; + function convertToAssignmentElementTarget(node) { + if (ts.isBindingPattern(node)) { + return convertToAssignmentPattern(node); + } + ts.Debug.assertNode(node, ts.isExpression); + return node; + } + ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; + function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { + var externalImports = []; + var exportSpecifiers = ts.createMap(); + var exportedBindings = ts.createMap(); + var uniqueExports = ts.createMap(); + var exportedNames; + var hasExportDefault = false; + var exportEquals = undefined; + var hasExportStarsToExportValues = false; + var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions); + var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, createImportClause(/*name*/ undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText)); + if (externalHelpersImportDeclaration) { + externalImports.push(externalHelpersImportDeclaration); + } + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 235 /* ImportDeclaration */: + // import "mod" + // import x from "mod" + // import * as x from "mod" + // import { x, y } from "mod" + externalImports.push(node); + break; + case 234 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { + // import x = require("mod") + externalImports.push(node); + } + break; + case 241 /* ExportDeclaration */: + if (node.moduleSpecifier) { + if (!node.exportClause) { + // export * from "mod" + externalImports.push(node); + hasExportStarsToExportValues = true; + } + else { + // export { x, y } from "mod" + externalImports.push(node); + } + } + else { + // export { x, y } + for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { + var specifier = _c[_b]; + if (!uniqueExports[specifier.name.text]) { + var name_10 = specifier.propertyName || specifier.name; + ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name_10) + || resolver.getReferencedValueDeclaration(name_10); + if (decl) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + } + uniqueExports[specifier.name.text] = true; + exportedNames = ts.append(exportedNames, specifier.name); + } + } + } + break; + case 240 /* ExportAssignment */: + if (node.isExportEquals && !exportEquals) { + // export = x + exportEquals = node; + } + break; + case 205 /* VariableStatement */: + if (ts.hasModifier(node, 1 /* Export */)) { + for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { + var decl = _e[_d]; + exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames); + } + } + break; + case 225 /* FunctionDeclaration */: + if (ts.hasModifier(node, 1 /* Export */)) { + if (ts.hasModifier(node, 512 /* Default */)) { + // export default function() { } + if (!hasExportDefault) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + // export function x() { } + var name_11 = node.name; + if (!uniqueExports[name_11.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11); + uniqueExports[name_11.text] = true; + exportedNames = ts.append(exportedNames, name_11); + } + } + } + break; + case 226 /* ClassDeclaration */: + if (ts.hasModifier(node, 1 /* Export */)) { + if (ts.hasModifier(node, 512 /* Default */)) { + // export default class { } + if (!hasExportDefault) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + // export class x { } + var name_12 = node.name; + if (!uniqueExports[name_12.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); + uniqueExports[name_12.text] = true; + exportedNames = ts.append(exportedNames, name_12); + } + } + } + break; } } - else { - ts.Debug.assert(node.kind === 185 /* ArrowFunction */); - // To align with the old emitter, we use a synthetic end position on the location - // for the statement list we synthesize when we down-level an arrow function with - // an expression function body. This prevents both comments and source maps from - // being emitted for the end position only. - statementsLocation = ts.moveRangeEnd(body, -1); - var equalsGreaterThanToken = node.equalsGreaterThanToken; - if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { - if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { - singleLine = true; - } - else { - multiLine = true; + return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration }; + } + ts.collectExternalModuleInfo = collectExternalModuleInfo; + function collectExportedVariableInfo(decl, uniqueExports, exportedNames) { + if (ts.isBindingPattern(decl.name)) { + for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames); } } - var expression = ts.visitNode(body, visitor, ts.isExpression); - var returnStatement = createReturn(expression, /*location*/ body); - setEmitFlags(returnStatement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 32768 /* NoTrailingComments */); - statements.push(returnStatement); - // To align with the source map emit for the old emitter, we set a custom - // source map location for the close brace. - closeBraceLocation = body; } - var lexicalEnvironment = context.endLexicalEnvironment(); - ts.addRange(statements, lexicalEnvironment); - // If we added any final generated statements, this must be a multi-line block - if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { - multiLine = true; - } - var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine); - if (!multiLine && singleLine) { - setEmitFlags(block, 32 /* SingleLine */); - } - if (closeBraceLocation) { - setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation); - } - setOriginalNode(block, node.body); - return block; - } - ts.transformFunctionBody = transformFunctionBody; - /** - * Adds a statement to capture the `this` of a function declaration if it is needed. - * - * @param statements The statements for the new function body. - * @param node A node. - */ - function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) { - if (node.transformFlags & 524288 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) { - captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis); - } - } - ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded; - function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) { - enableSubstitutionsForCapturedThis(); - var captureThisStatement = createVariableStatement( - /*modifiers*/ undefined, createVariableDeclarationList([ - createVariableDeclaration("_this", - /*type*/ undefined, initializer) - ]), originalStatement); - setEmitFlags(captureThisStatement, 49152 /* NoComments */ | 8388608 /* CustomPrologue */); - setSourceMapRange(captureThisStatement, node); - statements.push(captureThisStatement); - } - ts.captureThisForNode = captureThisForNode; - /** - * Gets a value indicating whether we need to add default value assignments for a - * function-like node. - * - * @param node A function-like node. - */ - function shouldAddDefaultValueAssignments(node) { - return (node.transformFlags & 2097152 /* ContainsDefaultValueAssignments */) !== 0; - } - /** - * Adds statements to the body of a function-like node if it contains parameters with - * binding patterns or initializers. - * - * @param statements The statements for the new function body. - * @param node A function-like node. - */ - function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) { - if (!shouldAddDefaultValueAssignments(node)) { - return; - } - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var parameter = _a[_i]; - var name_13 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; - // A rest parameter cannot have a binding pattern or an initializer, - // so let's just ignore it. - if (dotDotDotToken) { - continue; - } - if (ts.isBindingPattern(name_13)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_13, initializer, visitor, convertObjectRest); - } - else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_13, initializer, visitor); + else if (!ts.isGeneratedIdentifier(decl.name)) { + if (!uniqueExports[decl.name.text]) { + uniqueExports[decl.name.text] = true; + exportedNames = ts.append(exportedNames, decl.name); } } + return exportedNames; } - ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded; - /** - * Adds statements to the body of a function-like node for parameters with binding patterns - * - * @param statements The statements for the new function body. - * @param parameter The parameter for the function. - * @param name The name of the parameter. - * @param initializer The initializer for the parameter. - */ - function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) { - var temp = getGeneratedNameForNode(parameter); - // In cases where a binding pattern is simply '[]' or '{}', - // we usually don't want to emit a var declaration; however, in the presence - // of an initializer, we must emit that expression to preserve side effects. - if (name.elements.length > 0) { - statements.push(setEmitFlags(createVariableStatement( - /*modifiers*/ undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608 /* CustomPrologue */)); - } - else if (initializer) { - statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608 /* CustomPrologue */)); - } - } - /** - * Adds statements to the body of a function-like node for parameters with initializers. - * - * @param statements The statements for the new function body. - * @param parameter The parameter for the function. - * @param name The name of the parameter. - * @param initializer The initializer for the parameter. - */ - function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) { - initializer = ts.visitNode(initializer, visitor, ts.isExpression); - var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([ - createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536 /* NoSourceMap */), setEmitFlags(initializer, 1536 /* NoSourceMap */ | getEmitFlags(initializer)), - /*location*/ parameter)) - ], /*location*/ parameter), 32 /* SingleLine */ | 1024 /* NoTrailingSourceMap */ | 12288 /* NoTokenSourceMaps */), - /*elseStatement*/ undefined, - /*location*/ parameter); - statement.startsOnNewLine = true; - setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 8388608 /* CustomPrologue */); - statements.push(statement); - } - /** - * Gets a value indicating whether we need to add statements to handle a rest parameter. - * - * @param node A ParameterDeclaration node. - * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is - * part of a constructor declaration with a - * synthesized call to `super` - */ - function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { - return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper; - } - /** - * Adds statements to the body of a function-like node if it contains a rest parameter. - * - * @param statements The statements for the new function body. - * @param node A function-like node. - * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is - * part of a constructor declaration with a - * synthesized call to `super` - */ - function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { - var parameter = ts.lastOrUndefined(node.parameters); - if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { - return; - } - // `declarationName` is the name of the local declaration for the parameter. - var declarationName = getMutableClone(parameter.name); - setEmitFlags(declarationName, 1536 /* NoSourceMap */); - // `expressionName` is the name of the parameter used in expressions. - var expressionName = getSynthesizedClone(parameter.name); - var restIndex = node.parameters.length - 1; - var temp = createLoopVariable(); - // var param = []; - statements.push(setEmitFlags(createVariableStatement( - /*modifiers*/ undefined, createVariableDeclarationList([ - createVariableDeclaration(declarationName, - /*type*/ undefined, createArrayLiteral([])) - ]), - /*location*/ parameter), 8388608 /* CustomPrologue */)); - // for (var _i = restIndex; _i < arguments.length; _i++) { - // param[_i - restIndex] = arguments[_i]; - // } - var forStatement = createFor(createVariableDeclarationList([ - createVariableDeclaration(temp, /*type*/ undefined, createLiteral(restIndex)) - ], /*location*/ parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"), - /*location*/ parameter), createPostfixIncrement(temp, /*location*/ parameter), createBlock([ - startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)), - /*location*/ parameter)) - ])); - setEmitFlags(forStatement, 8388608 /* CustomPrologue */); - startOnNewLine(forStatement); - statements.push(forStatement); - } - ts.addRestParameterIfNeeded = addRestParameterIfNeeded; - function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (var _i = 0, _a = expr; _i < _a.length; _i++) { - // var v = _a[_i]; - // } - // - // where _a and _i are temps emitted to capture the RHS and the counter, - // respectively. - // When the left hand side is an expression instead of a let declaration, - // the "let v" is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var initializer = node.initializer; - var statements = []; - // In the case where the user wrote an identifier as the RHS, like this: - // - // for (let v of arr) { } - // - // we don't want to emit a temporary variable for the RHS, just use it directly. - var counter = convertObjectRest ? undefined : createLoopVariable(); - var rhsReference = expression.kind === 70 /* Identifier */ - ? createUniqueName(expression.text) - : createTempVariable(/*recordTempVariable*/ undefined); - var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter); - // Initialize LHS - // var v = _a[_i]; - if (ts.isVariableDeclarationList(initializer)) { - if (initializer.flags & 3 /* BlockScoped */) { - enableSubstitutionsForBlockScopedBindings(); - } - var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); - if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { - // This works whether the declaration is a var, let, or const. - // It will use rhsIterationValue _a[_i] as the initializer. - var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor, - /*recordTempVariable*/ undefined, convertObjectRest); - var declarationList = createVariableDeclarationList(declarations, /*location*/ initializer); - setOriginalNode(declarationList, initializer); - // Adjust the source map range for the first declaration to align with the old - // emitter. - var firstDeclaration = declarations[0]; - var lastDeclaration = ts.lastOrUndefined(declarations); - setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - statements.push(createVariableStatement( - /*modifiers*/ undefined, declarationList)); - } - else { - // The following call does not include the initializer, so we have - // to emit it separately. - statements.push(createVariableStatement( - /*modifiers*/ undefined, setOriginalNode(createVariableDeclarationList([ - createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(/*recordTempVariable*/ undefined), - /*type*/ undefined, createElementAccess(rhsReference, counter)) - ], /*location*/ ts.moveRangePos(initializer, -1)), initializer), - /*location*/ ts.moveRangeEnd(initializer, -1))); - } - } - else { - // Initializer is an expression. Emit the expression in the body, so that it's - // evaluated on every iteration. - var assignment = createAssignment(initializer, elementAccess); - if (ts.isDestructuringAssignment(assignment)) { - // This is a destructuring pattern, so we flatten the destructuring instead. - statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment, - /*needsValue*/ false, context.hoistVariableDeclaration, visitor, convertObjectRest))); - } - else { - // Currently there is not way to check that assignment is binary expression of destructing assignment - // so we have to cast never type to binaryExpression - assignment.end = initializer.end; - statements.push(createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1))); - } - } - var bodyLocation; - var statementsLocation; - if (convertedLoopBodyStatements) { - ts.addRange(statements, convertedLoopBodyStatements); - } - else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); - if (ts.isBlock(statement)) { - ts.addRange(statements, statement.statements); - bodyLocation = statement; - statementsLocation = statement.statements; - } - else { - statements.push(statement); - } - } - // The old emitter does not emit source maps for the expression - setEmitFlags(expression, 1536 /* NoSourceMap */ | getEmitFlags(expression)); - // The old emitter does not emit source maps for the block. - // We add the location to preserve comments. - var body = createBlock(createNodeArray(statements, /*location*/ statementsLocation), - /*location*/ bodyLocation); - setEmitFlags(body, 1536 /* NoSourceMap */ | 12288 /* NoTokenSourceMaps */); - var forStatement; - if (convertObjectRest) { - forStatement = createForOf(createVariableDeclarationList([ - createVariableDeclaration(rhsReference, /*type*/ undefined, /*initializer*/ undefined, /*location*/ node.expression) - ], /*location*/ node.expression), node.expression, body, - /*location*/ node); - } - else { - forStatement = createFor(setEmitFlags(createVariableDeclarationList([ - createVariableDeclaration(counter, /*type*/ undefined, createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)), - createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression) - ], /*location*/ node.expression), 16777216 /* NoHoisting */), createLessThan(counter, createPropertyAccess(rhsReference, "length"), - /*location*/ node.expression), createPostfixIncrement(counter, /*location*/ node.expression), body, - /*location*/ node); - } - // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. - setEmitFlags(forStatement, 8192 /* NoTokenTrailingSourceMaps */); - return forStatement; - } - ts.convertForOf = convertForOf; })(ts || (ts = {})); /// /// @@ -14216,29 +14243,31 @@ var ts; visitNode(cbNode, node.type); case 278 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 280 /* JSDocParameterTag */: + case 281 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 281 /* JSDocReturnTag */: + case 282 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 282 /* JSDocTypeTag */: + case 283 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 283 /* JSDocTemplateTag */: + case 280 /* JSDocAugmentsTag */: + return visitNode(cbNode, node.typeExpression); + case 284 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 286 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 285 /* JSDocPropertyTag */: + case 286 /* JSDocPropertyTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 293 /* PartiallyEmittedExpression */: + case 294 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); - case 287 /* JSDocLiteralType */: + case 288 /* JSDocLiteralType */: return visitNode(cbNode, node.literal); } } @@ -14298,7 +14327,7 @@ var ts; // Share a single scanner across all calls to parse a source file. This helps speed things // up by avoiding the cost of creating/compiling scanners over and over again. var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ true); - var disallowInAndDecoratorContext = 65536 /* DisallowInContext */ | 262144 /* DecoratorContext */; + var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks var NodeConstructor; var TokenConstructor; @@ -14422,7 +14451,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 2097152 /* JavaScriptFile */ : 0 /* None */; + contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 65536 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); @@ -14461,7 +14490,7 @@ var ts; return sourceFile; } function addJSDocComment(node) { - var comments = ts.getJsDocCommentsFromText(node, sourceFile.text); + var comments = ts.getJSDocCommentRanges(node, sourceFile.text); if (comments) { for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { var comment = comments_2[_i]; @@ -14469,10 +14498,10 @@ var ts; if (!jsDoc) { continue; } - if (!node.jsDocComments) { - node.jsDocComments = []; + if (!node.jsDoc) { + node.jsDoc = []; } - node.jsDocComments.push(jsDoc); + node.jsDoc.push(jsDoc); } } return node; @@ -14494,12 +14523,12 @@ var ts; var saveParent = parent; parent = n; forEachChild(n, visitNode); - if (n.jsDocComments) { - for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - jsDocComment.parent = n; - parent = jsDocComment; - forEachChild(jsDocComment, visitNode); + if (n.jsDoc) { + for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + jsDoc.parent = n; + parent = jsDoc; + forEachChild(jsDoc, visitNode); } } parent = saveParent; @@ -14530,16 +14559,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 65536 /* DisallowInContext */); + setContextFlag(val, 2048 /* DisallowInContext */); } function setYieldContext(val) { - setContextFlag(val, 131072 /* YieldContext */); + setContextFlag(val, 4096 /* YieldContext */); } function setDecoratorContext(val) { - setContextFlag(val, 262144 /* DecoratorContext */); + setContextFlag(val, 8192 /* DecoratorContext */); } function setAwaitContext(val) { - setContextFlag(val, 524288 /* AwaitContext */); + setContextFlag(val, 16384 /* AwaitContext */); } function doOutsideOfContext(context, func) { // contextFlagsToClear will contain only the context flags that are @@ -14580,40 +14609,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(65536 /* DisallowInContext */, func); + return doOutsideOfContext(2048 /* DisallowInContext */, func); } function disallowInAnd(func) { - return doInsideOfContext(65536 /* DisallowInContext */, func); + return doInsideOfContext(2048 /* DisallowInContext */, func); } function doInYieldContext(func) { - return doInsideOfContext(131072 /* YieldContext */, func); + return doInsideOfContext(4096 /* YieldContext */, func); } function doInDecoratorContext(func) { - return doInsideOfContext(262144 /* DecoratorContext */, func); + return doInsideOfContext(8192 /* DecoratorContext */, func); } function doInAwaitContext(func) { - return doInsideOfContext(524288 /* AwaitContext */, func); + return doInsideOfContext(16384 /* AwaitContext */, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(524288 /* AwaitContext */, func); + return doOutsideOfContext(16384 /* AwaitContext */, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(131072 /* YieldContext */ | 524288 /* AwaitContext */, func); + return doInsideOfContext(4096 /* YieldContext */ | 16384 /* AwaitContext */, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(131072 /* YieldContext */); + return inContext(4096 /* YieldContext */); } function inDisallowInContext() { - return inContext(65536 /* DisallowInContext */); + return inContext(2048 /* DisallowInContext */); } function inDecoratorContext() { - return inContext(262144 /* DecoratorContext */); + return inContext(8192 /* DecoratorContext */); } function inAwaitContext() { - return inContext(524288 /* AwaitContext */); + return inContext(16384 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -14817,7 +14846,7 @@ var ts; // flag so that we don't mark any subsequent nodes. if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 1048576 /* ThisNodeHasError */; + node.flags |= 32768 /* ThisNodeHasError */; } return node; } @@ -15211,7 +15240,7 @@ var ts; // differently depending on what mode it is in. // // This also applies to all our other context flags as well. - var nodeContextFlags = node.flags & 3080192 /* ContextFlags */; + var nodeContextFlags = node.flags & 96256 /* ContextFlags */; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -16066,6 +16095,8 @@ var ts; case 16 /* OpenBraceToken */: case 20 /* OpenBracketToken */: case 26 /* LessThanToken */: + case 48 /* BarToken */: + case 47 /* AmpersandToken */: case 93 /* NewKeyword */: case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -16120,6 +16151,7 @@ var ts; return parseArrayTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { var types = createNodeArray([type], type.pos); @@ -16213,7 +16245,7 @@ var ts; function parseType() { // The rules about 'yield' only apply to actual code/expression contexts. They don't // apply to 'type' contexts. So we disable these parameters here before moving on. - return doOutsideOfContext(655360 /* TypeExcludesFlags */, parseTypeWorker); + return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { @@ -18323,7 +18355,7 @@ var ts; // The checker may still error in the static case to explicitly disallow the yield expression. property.initializer = ts.hasModifier(property, 32 /* Static */) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(131072 /* YieldContext */ | 65536 /* DisallowInContext */, parseNonParameterInitializer); + : doOutsideOfContext(4096 /* YieldContext */ | 2048 /* DisallowInContext */, parseNonParameterInitializer); parseSemicolon(); return addJSDocComment(finishNode(property)); } @@ -18523,8 +18555,8 @@ var ts; } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_14 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_14, /*questionToken*/ undefined); + var name_13 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -19275,7 +19307,7 @@ var ts; return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(287 /* JSDocLiteralType */); + var result = createNode(288 /* JSDocLiteralType */); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -19401,7 +19433,7 @@ var ts; break; case 38 /* AsteriskToken */: var asterisk = scanner.getTokenText(); - if (state === 1 /* SawAsterisk */) { + if (state === 1 /* SawAsterisk */ || state === 2 /* SavingComments */) { // If we've already seen an asterisk, then we can no longer parse a tag on this line state = 2 /* SavingComments */; pushComment(asterisk); @@ -19422,7 +19454,10 @@ var ts; case 5 /* WhitespaceTrivia */: // only collect whitespace if we're already saving comments or have just crossed the comment indent margin var whitespace = scanner.getTokenText(); - if (state === 2 /* SavingComments */ || margin !== undefined && indent + whitespace.length > margin) { + if (state === 2 /* SavingComments */) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -19430,6 +19465,8 @@ var ts; case 1 /* EndOfFileToken */: break; default: + // anything other than whitespace or asterisk at the beginning of the line starts the comment text + state = 2 /* SavingComments */; pushComment(scanner.getTokenText()); break; } @@ -19485,6 +19522,9 @@ var ts; var tag; if (tagName) { switch (tagName.text) { + case "augments": + tag = parseAugmentsTag(atToken, tagName); + break; case "param": tag = parseParamTag(atToken, tagName); break; @@ -19632,7 +19672,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(280 /* JSDocParameterTag */, atToken.pos); + var result = createNode(281 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -19643,20 +19683,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(281 /* JSDocReturnTag */, atToken.pos); + var result = createNode(282 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282 /* JSDocTypeTag */, atToken.pos); + var result = createNode(283 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -19671,17 +19711,25 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(285 /* JSDocPropertyTag */, atToken.pos); + var result = createNode(286 /* JSDocPropertyTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; result.typeExpression = typeExpression; return finishNode(result); } + function parseAugmentsTag(atToken, tagName) { + var typeExpression = tryParseTypeExpression(); + var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + result.typeExpression = typeExpression; + return finishNode(result); + } function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(284 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(285 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); @@ -19698,8 +19746,8 @@ var ts; if (typeExpression.type.kind === 272 /* JSDocTypeReference */) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70 /* Identifier */) { - var name_15 = jsDocTypeReference.name; - if (name_15.text === "Object") { + var name_14 = jsDocTypeReference.name; + if (name_14.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -19713,7 +19761,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(286 /* JSDocTypeLiteral */, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -19800,20 +19848,20 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } // Type parameter list looks like '@template T,U,V' var typeParameters = createNodeArray(); while (true) { - var name_16 = parseJSDocIdentifierName(); + var name_15 = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_16) { + if (!name_15) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143 /* TypeParameter */, name_16.pos); - typeParameter.name = name_16; + var typeParameter = createNode(143 /* TypeParameter */, name_15.pos); + typeParameter.name = name_15; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25 /* CommaToken */) { @@ -19824,7 +19872,7 @@ var ts; break; } } - var result = createNode(283 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(284 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -19951,8 +19999,8 @@ var ts; ts.Debug.assert(text === newText.substring(node.pos, node.end)); } forEachChild(node, visitNode, visitArray); - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; forEachChild(jsDocComment, visitNode, visitArray); } @@ -20529,7 +20577,7 @@ var ts; if (node.name.kind === 142 /* ComputedPropertyName */) { var nameExpression = node.name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal - if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; } ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); @@ -20579,7 +20627,7 @@ var ts; var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; if (parentNode && parentNode.kind === 205 /* VariableStatement */) { @@ -20712,7 +20760,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - var isJSDocTypedefInJSDocNamespace = node.kind === 284 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 285 /* JSDocTypedefTag */ && node.name && node.name.kind === 70 /* Identifier */ && node.name.isInJSDocNamespace; @@ -20793,8 +20841,7 @@ var ts; hasExplicitReturn = false; bindChildren(node); // Reset all reachability check related flags on node (for incremental scenarios) - // Reset all emit helper flags on node (for incremental scenarios) - node.flags &= ~64896 /* ReachabilityAndEmitFlags */; + node.flags &= ~1408 /* ReachabilityAndEmitFlags */; if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && ts.nodeIsPresent(node.body)) { node.flags |= 128 /* HasImplicitReturn */; if (hasExplicitReturn) @@ -20844,15 +20891,38 @@ var ts; subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags); } } + function bindEach(nodes) { + if (nodes === undefined) { + return; + } + if (skipTransformFlagAggregation) { + ts.forEach(nodes, bind); + } + else { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0 /* None */; + var nodeArrayFlags = 0 /* None */; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; + bind(node); + nodeArrayFlags |= node.transformFlags & ~536870912 /* HasComputedFlags */; + } + nodes.transformFlags = nodeArrayFlags | 536870912 /* HasComputedFlags */; + subtreeTransformFlags |= savedSubtreeTransformFlags; + } + } + function bindEachChild(node) { + ts.forEachChild(node, bind, bindEach); + } function bindChildrenWorker(node) { // Binding of JsDocComment should be done before the current block scope container changes. // because the scope of JsDocComment should not be affected by whether the current node is a // container or not. - if (ts.isInJavaScriptFile(node) && node.jsDocComments) { - ts.forEach(node.jsDocComments, bind); + if (ts.isInJavaScriptFile(node) && node.jsDoc) { + ts.forEach(node.jsDoc, bind); } if (checkUnreachable(node)) { - ts.forEachChild(node, bind); + bindEachChild(node); return; } switch (node.kind) { @@ -20917,7 +20987,7 @@ var ts; bindCallExpressionFlow(node); break; default: - ts.forEachChild(node, bind); + bindEachChild(node); break; } } @@ -21223,7 +21293,7 @@ var ts; } return undefined; } - function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { + function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { var flowLabel = node.kind === 215 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); @@ -21236,11 +21306,11 @@ var ts; var activeLabel = findActiveLabel(node.label.text); if (activeLabel) { activeLabel.referenced = true; - bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); } } else { - bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); } } function bindTryStatement(node) { @@ -21302,6 +21372,8 @@ var ts; currentFlow = finishFlowLabel(postSwitchLabel); } function bindCaseBlock(node) { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0; var clauses = node.clauses; var fallthroughFlow = unreachableFlow; for (var i = 0; i < clauses.length; i++) { @@ -21321,13 +21393,15 @@ var ts; errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); } } + clauses.transformFlags = subtreeTransformFlags | 536870912 /* HasComputedFlags */; + subtreeTransformFlags |= savedSubtreeTransformFlags; } function bindCaseClause(node) { var saveCurrentFlow = currentFlow; currentFlow = preSwitchCaseFlow; bind(node.expression); currentFlow = saveCurrentFlow; - ts.forEach(node.statements, bind); + bindEach(node.statements); } function pushActiveLabel(name, breakTarget, continueTarget) { var activeLabel = { @@ -21414,19 +21488,19 @@ var ts; var saveTrueTarget = currentTrueTarget; currentTrueTarget = currentFalseTarget; currentFalseTarget = saveTrueTarget; - ts.forEachChild(node, bind); + bindEachChild(node); currentFalseTarget = currentTrueTarget; currentTrueTarget = saveTrueTarget; } else { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) { bindAssignmentTargetFlow(node.operand); } } } function bindPostfixUnaryExpressionFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) { bindAssignmentTargetFlow(node.operand); } @@ -21444,7 +21518,7 @@ var ts; } } else { - ts.forEachChild(node, bind); + bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); if (operator === 57 /* EqualsToken */ && node.left.kind === 178 /* ElementAccessExpression */) { @@ -21457,7 +21531,7 @@ var ts; } } function bindDeleteExpressionFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.expression.kind === 177 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } @@ -21490,7 +21564,7 @@ var ts; } } function bindVariableDeclarationFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.initializer || node.parent.parent.kind === 212 /* ForInStatement */ || node.parent.parent.kind === 213 /* ForOfStatement */) { bindInitializedVariableFlow(node); } @@ -21504,12 +21578,12 @@ var ts; expr = expr.expression; } if (expr.kind === 184 /* FunctionExpression */ || expr.kind === 185 /* ArrowFunction */) { - ts.forEach(node.typeArguments, bind); - ts.forEach(node.arguments, bind); + bindEach(node.typeArguments); + bindEach(node.arguments); bind(node.expression); } else { - ts.forEachChild(node, bind); + bindEachChild(node); } if (node.expression.kind === 177 /* PropertyAccessExpression */) { var propertyAccess = node.expression; @@ -21525,7 +21599,7 @@ var ts; case 229 /* EnumDeclaration */: case 176 /* ObjectLiteralExpression */: case 161 /* TypeLiteral */: - case 286 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: case 270 /* JSDocRecordType */: return 1 /* IsContainer */; case 227 /* InterfaceDeclaration */: @@ -21615,7 +21689,7 @@ var ts; case 176 /* ObjectLiteralExpression */: case 227 /* InterfaceDeclaration */: case 270 /* JSDocRecordType */: - case 286 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the @@ -21989,8 +22063,8 @@ var ts; } function updateStrictModeStatementList(statements) { if (!inStrictMode) { - for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { - var statement = statements_1[_i]; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; if (!ts.isPrologueDirective(statement)) { return; } @@ -22017,7 +22091,7 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 284 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 285 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); @@ -22080,15 +22154,12 @@ var ts; return bindParameter(node); case 223 /* VariableDeclaration */: case 174 /* BindingElement */: - if (node.dotDotDotToken && node.parent.kind === 172 /* ObjectBindingPattern */) { - emitFlags |= 32768 /* HasRestAttribute */; - } return bindVariableDeclarationOrBindingElement(node); case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 271 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); - case 285 /* JSDocPropertyTag */: + case 286 /* JSDocPropertyTag */: return bindJSDocProperty(node); case 257 /* PropertyAssignment */: case 258 /* ShorthandPropertyAssignment */: @@ -22109,7 +22180,6 @@ var ts; } root = root.parent; } - emitFlags |= hasRest ? 32768 /* HasRestAttribute */ : 16384 /* HasSpreadAttribute */; return; case 153 /* CallSignature */: case 154 /* ConstructSignature */: @@ -22136,7 +22206,7 @@ var ts; return bindFunctionOrConstructorType(node); case 161 /* TypeLiteral */: case 170 /* MappedType */: - case 286 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: case 270 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); case 176 /* ObjectLiteralExpression */: @@ -22157,7 +22227,7 @@ var ts; return bindClassLikeDeclaration(node); case 227 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */); - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: if (!node.fullName || node.fullName.kind === 70 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); } @@ -22237,12 +22307,12 @@ var ts; return; } else { - var parent_5 = node.parent; - if (!ts.isExternalModule(parent_5)) { + var parent_4 = node.parent; + if (!ts.isExternalModule(parent_4)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_5.isDeclarationFile) { + if (!parent_4.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -22335,14 +22405,6 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 1024 /* HasClassExtends */; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048 /* HasDecorators */; - } - } if (node.kind === 226 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } @@ -22405,11 +22467,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (2048 /* HasDecorators */ | 4096 /* HasParamDecorators */); - } if (inStrictMode) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -22431,7 +22488,7 @@ var ts; function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; + emitFlags |= 1024 /* HasAsyncFunctions */; } } checkStrictModeFunctionName(node); @@ -22446,7 +22503,7 @@ var ts; function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; + emitFlags |= 1024 /* HasAsyncFunctions */; } } if (currentFlow) { @@ -22459,10 +22516,7 @@ var ts; function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048 /* HasDecorators */; + emitFlags |= 1024 /* HasAsyncFunctions */; } } if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -22590,14 +22644,14 @@ var ts; if (node.typeArguments) { transformFlags |= 3 /* AssertTypeScript */; } - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */ + if (subtreeFlags & 524288 /* ContainsSpread */ || isSuperOrSuperProperty(expression, expressionKind)) { // If the this node contains a SpreadExpression, or is a super call, then it is an ES6 // node. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~545281365 /* ArrayLiteralOrCallOrNewExcludes */; + return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */; } function isSuperOrSuperProperty(node, kind) { switch (kind) { @@ -22616,13 +22670,13 @@ var ts; if (node.typeArguments) { transformFlags |= 3 /* AssertTypeScript */; } - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { + if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadElementExpression then it is an ES6 // node. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~545281365 /* ArrayLiteralOrCallOrNewExcludes */; + return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */; } function computeBinaryExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22631,19 +22685,19 @@ var ts; if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ObjectLiteralExpression */) { // Destructuring object assignments with are ES2015 syntax // and possibly ESNext if they contain rest - transformFlags |= 48 /* AssertESNext */ | 3072 /* AssertES2015 */ | 49152 /* AssertDestructuringAssignment */; + transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ArrayLiteralExpression */) { // Destructuring assignments are ES2015 syntax. - transformFlags |= 3072 /* AssertES2015 */ | 49152 /* AssertDestructuringAssignment */; + transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } else if (operatorTokenKind === 39 /* AsteriskAsteriskToken */ || operatorTokenKind === 61 /* AsteriskAsteriskEqualsToken */) { // Exponentiation is ES2016 syntax. - transformFlags |= 768 /* AssertES2016 */; + transformFlags |= 32 /* AssertES2016 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeParameter(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22655,25 +22709,25 @@ var ts; // syntax. if (node.questionToken || node.type - || subtreeFlags & 65536 /* ContainsDecorators */ + || subtreeFlags & 4096 /* ContainsDecorators */ || ts.isThisIdentifier(name)) { transformFlags |= 3 /* AssertTypeScript */; } // If a parameter has an accessibility modifier, then it is TypeScript syntax. if (modifierFlags & 92 /* ParameterPropertyModifier */) { - transformFlags |= 3 /* AssertTypeScript */ | 4194304 /* ContainsParameterPropertyAssignments */; + transformFlags |= 3 /* AssertTypeScript */ | 262144 /* ContainsParameterPropertyAssignments */; } // parameters with object rest destructuring are ES Next syntax - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { - transformFlags |= 48 /* AssertESNext */; + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; } // If a parameter has an initializer, a binding pattern or a dotDotDot token, then // it is ES6 syntax and its container must emit default value assignments or parameter destructuring downlevel. - if (subtreeFlags & 67108864 /* ContainsBindingPattern */ || initializer || dotDotDotToken) { - transformFlags |= 3072 /* AssertES2015 */ | 2097152 /* ContainsDefaultValueAssignments */; + if (subtreeFlags & 8388608 /* ContainsBindingPattern */ || initializer || dotDotDotToken) { + transformFlags |= 192 /* AssertES2015 */ | 131072 /* ContainsDefaultValueAssignments */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~604001621 /* ParameterExcludes */; + return transformFlags & ~536872257 /* ParameterExcludes */; } function computeParenthesizedExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22689,11 +22743,11 @@ var ts; } // If the expression of a ParenthesizedExpression is a destructuring assignment, // then the ParenthesizedExpression is a destructuring assignment. - if (expressionTransformFlags & 16384 /* DestructuringAssignment */) { - transformFlags |= 16384 /* DestructuringAssignment */; + if (expressionTransformFlags & 1024 /* DestructuringAssignment */) { + transformFlags |= 1024 /* DestructuringAssignment */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeClassDeclaration(node, subtreeFlags) { var transformFlags; @@ -22704,47 +22758,47 @@ var ts; } else { // A ClassDeclaration is ES6 syntax. - transformFlags = subtreeFlags | 3072 /* AssertES2015 */; + transformFlags = subtreeFlags | 192 /* AssertES2015 */; // A class with a parameter property assignment, property initializer, or decorator is // TypeScript syntax. // An exported declaration may be TypeScript syntax, but is handled by the visitor // for a namespace declaration. - if ((subtreeFlags & 4390912 /* TypeScriptClassSyntaxMask */) + if ((subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */) || node.typeParameters) { transformFlags |= 3 /* AssertTypeScript */; } - if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) { + if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) { // A computed property name containing `this` might need to be rewritten, // so propagate the ContainsLexicalThis flag upward. - transformFlags |= 262144 /* ContainsLexicalThis */; + transformFlags |= 16384 /* ContainsLexicalThis */; } } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~559895893 /* ClassExcludes */; + return transformFlags & ~539358529 /* ClassExcludes */; } function computeClassExpression(node, subtreeFlags) { // A ClassExpression is ES6 syntax. - var transformFlags = subtreeFlags | 3072 /* AssertES2015 */; + var transformFlags = subtreeFlags | 192 /* AssertES2015 */; // A class with a parameter property assignment, property initializer, or decorator is // TypeScript syntax. - if (subtreeFlags & 4390912 /* TypeScriptClassSyntaxMask */ + if (subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */ || node.typeParameters) { transformFlags |= 3 /* AssertTypeScript */; } - if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) { + if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) { // A computed property name containing `this` might need to be rewritten, // so propagate the ContainsLexicalThis flag upward. - transformFlags |= 262144 /* ContainsLexicalThis */; + transformFlags |= 16384 /* ContainsLexicalThis */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~559895893 /* ClassExcludes */; + return transformFlags & ~539358529 /* ClassExcludes */; } function computeHeritageClause(node, subtreeFlags) { var transformFlags = subtreeFlags; switch (node.token) { case 84 /* ExtendsKeyword */: // An `extends` HeritageClause is ES6 syntax. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; break; case 107 /* ImplementsKeyword */: // An `implements` HeritageClause is TypeScript syntax. @@ -22755,27 +22809,27 @@ var ts; break; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeCatchClause(node, subtreeFlags) { var transformFlags = subtreeFlags; if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) { - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~537920833 /* CatchClauseExcludes */; } function computeExpressionWithTypeArguments(node, subtreeFlags) { // An ExpressionWithTypeArguments is ES6 syntax, as it is used in the // extends clause of a class. - var transformFlags = subtreeFlags | 3072 /* AssertES2015 */; + var transformFlags = subtreeFlags | 192 /* AssertES2015 */; // If an ExpressionWithTypeArguments contains type arguments, then it // is TypeScript syntax. if (node.typeArguments) { transformFlags |= 3 /* AssertTypeScript */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeConstructor(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22784,12 +22838,16 @@ var ts; || !node.body) { transformFlags |= 3 /* AssertTypeScript */; } + // function declarations with object rest destructuring are ES Next syntax + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; + } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~975983957 /* ConstructorExcludes */; + return transformFlags & ~601015617 /* ConstructorExcludes */; } function computeMethod(node, subtreeFlags) { // A MethodDeclaration is ES6 syntax. - var transformFlags = subtreeFlags | 3072 /* AssertES2015 */; + var transformFlags = subtreeFlags | 192 /* AssertES2015 */; // Decorators, TypeScript-specific modifiers, type parameters, type annotations, and // overloads are TypeScript syntax. if (node.decorators @@ -22799,16 +22857,20 @@ var ts; || !node.body) { transformFlags |= 3 /* AssertTypeScript */; } + // function declarations with object rest destructuring are ES Next syntax + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; + } // An async method declaration is ES2017 syntax. if (ts.hasModifier(node, 256 /* Async */)) { - transformFlags |= 192 /* AssertES2017 */; + transformFlags |= 16 /* AssertES2017 */; } // Currently, we only support generators that were originally async function bodies. - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) { - transformFlags |= 12288 /* AssertGenerator */; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + transformFlags |= 768 /* AssertGenerator */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~975983957 /* MethodOrAccessorExcludes */; + return transformFlags & ~601015617 /* MethodOrAccessorExcludes */; } function computeAccessor(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22820,8 +22882,12 @@ var ts; || !node.body) { transformFlags |= 3 /* AssertTypeScript */; } + // function declarations with object rest destructuring are ES Next syntax + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; + } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~975983957 /* MethodOrAccessorExcludes */; + return transformFlags & ~601015617 /* MethodOrAccessorExcludes */; } function computePropertyDeclaration(node, subtreeFlags) { // A PropertyDeclaration is TypeScript syntax. @@ -22829,10 +22895,10 @@ var ts; // If the PropertyDeclaration has an initializer, we need to inform its ancestor // so that it handle the transformation. if (node.initializer) { - transformFlags |= 131072 /* ContainsPropertyInitializer */; + transformFlags |= 8192 /* ContainsPropertyInitializer */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeFunctionDeclaration(node, subtreeFlags) { var transformFlags; @@ -22844,7 +22910,7 @@ var ts; transformFlags = 3 /* AssertTypeScript */; } else { - transformFlags = subtreeFlags | 268435456 /* ContainsHoistedDeclarationOrCompletion */; + transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */; // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript // syntax. if (modifierFlags & 2270 /* TypeScriptModifier */ @@ -22854,29 +22920,29 @@ var ts; } // An async function declaration is ES2017 syntax. if (modifierFlags & 256 /* Async */) { - transformFlags |= 192 /* AssertES2017 */; + transformFlags |= 16 /* AssertES2017 */; } // function declarations with object rest destructuring are ES Next syntax - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { - transformFlags |= 48 /* AssertESNext */; + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; } // If a FunctionDeclaration's subtree has marked the container as needing to capture the // lexical this, or the function contains parameters with initializers, then this node is // ES6 syntax. - if (subtreeFlags & 2621440 /* ES2015FunctionSyntaxMask */) { - transformFlags |= 3072 /* AssertES2015 */; + if (subtreeFlags & 163840 /* ES2015FunctionSyntaxMask */) { + transformFlags |= 192 /* AssertES2015 */; } // If a FunctionDeclaration is generator function and is the body of a // transformed async function, then this node can be transformed to a // down-level generator. // Currently we do not support transforming any other generator fucntions // down level. - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) { - transformFlags |= 12288 /* AssertGenerator */; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + transformFlags |= 768 /* AssertGenerator */; } } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~980243797 /* FunctionExcludes */; + return transformFlags & ~601281857 /* FunctionExcludes */; } function computeFunctionExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22889,32 +22955,32 @@ var ts; } // An async function expression is ES2017 syntax. if (ts.hasModifier(node, 256 /* Async */)) { - transformFlags |= 192 /* AssertES2017 */; + transformFlags |= 16 /* AssertES2017 */; } // function expressions with object rest destructuring are ES Next syntax - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { - transformFlags |= 48 /* AssertESNext */; + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; } // If a FunctionExpression's subtree has marked the container as needing to capture the // lexical this, or the function contains parameters with initializers, then this node is // ES6 syntax. - if (subtreeFlags & 2621440 /* ES2015FunctionSyntaxMask */) { - transformFlags |= 3072 /* AssertES2015 */; + if (subtreeFlags & 163840 /* ES2015FunctionSyntaxMask */) { + transformFlags |= 192 /* AssertES2015 */; } // If a FunctionExpression is generator function and is the body of a // transformed async function, then this node can be transformed to a // down-level generator. // Currently we do not support transforming any other generator fucntions // down level. - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) { - transformFlags |= 12288 /* AssertGenerator */; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + transformFlags |= 768 /* AssertGenerator */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~980243797 /* FunctionExcludes */; + return transformFlags & ~601281857 /* FunctionExcludes */; } function computeArrowFunction(node, subtreeFlags) { // An ArrowFunction is ES6 syntax, and excludes markers that should not escape the scope of an ArrowFunction. - var transformFlags = subtreeFlags | 3072 /* AssertES2015 */; + var transformFlags = subtreeFlags | 192 /* AssertES2015 */; // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript // syntax. if (ts.hasModifier(node, 2270 /* TypeScriptModifier */) @@ -22924,18 +22990,18 @@ var ts; } // An async arrow function is ES2017 syntax. if (ts.hasModifier(node, 256 /* Async */)) { - transformFlags |= 192 /* AssertES2017 */; + transformFlags |= 16 /* AssertES2017 */; } // arrow functions with object rest destructuring are ES Next syntax - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { - transformFlags |= 48 /* AssertESNext */; + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; } // If an ArrowFunction contains a lexical this, its container must capture the lexical this. - if (subtreeFlags & 262144 /* ContainsLexicalThis */) { - transformFlags |= 524288 /* ContainsCapturedLexicalThis */; + if (subtreeFlags & 16384 /* ContainsLexicalThis */) { + transformFlags |= 32768 /* ContainsCapturedLexicalThis */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~979719509 /* ArrowFunctionExcludes */; + return transformFlags & ~601249089 /* ArrowFunctionExcludes */; } function computePropertyAccess(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22944,28 +23010,24 @@ var ts; // If a PropertyAccessExpression starts with a super keyword, then it is // ES6 syntax, and requires a lexical `this` binding. if (expressionKind === 96 /* SuperKeyword */) { - transformFlags |= 262144 /* ContainsLexicalThis */; + transformFlags |= 16384 /* ContainsLexicalThis */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeVariableDeclaration(node, subtreeFlags) { var transformFlags = subtreeFlags; - var nameKind = node.name.kind; - // A VariableDeclaration with an object binding pattern is ES2015 syntax - // and possibly ESNext syntax if it contains an object binding pattern - if (nameKind === 172 /* ObjectBindingPattern */) { - transformFlags |= 48 /* AssertESNext */ | 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */; - } - else if (nameKind === 173 /* ArrayBindingPattern */) { - transformFlags |= 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */; + transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; + // A VariableDeclaration containing ObjectRest is ESNext syntax + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; } // Type annotations are TypeScript syntax. if (node.type) { transformFlags |= 3 /* AssertTypeScript */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeVariableStatement(node, subtreeFlags) { var transformFlags; @@ -22977,22 +23039,22 @@ var ts; } else { transformFlags = subtreeFlags; - if (declarationListTransformFlags & 67108864 /* ContainsBindingPattern */) { - transformFlags |= 3072 /* AssertES2015 */; + if (declarationListTransformFlags & 8388608 /* ContainsBindingPattern */) { + transformFlags |= 192 /* AssertES2015 */; } } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeLabeledStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; // A labeled statement containing a block scoped binding *may* need to be transformed from ES6. - if (subtreeFlags & 33554432 /* ContainsBlockScopedBinding */ + if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */ && ts.isIterationStatement(node, /*lookInLabeledStatements*/ true)) { - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeImportEquals(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -23001,18 +23063,18 @@ var ts; transformFlags |= 3 /* AssertTypeScript */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeExpressionStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; // If the expression of an expression statement is a destructuring assignment, // then we treat the statement as ES6 so that we can indicate that we do not // need to hold on to the right-hand side. - if (node.expression.transformFlags & 16384 /* DestructuringAssignment */) { - transformFlags |= 3072 /* AssertES2015 */; + if (node.expression.transformFlags & 1024 /* DestructuringAssignment */) { + transformFlags |= 192 /* AssertES2015 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeModuleDeclaration(node, subtreeFlags) { var transformFlags = 3 /* AssertTypeScript */; @@ -23021,29 +23083,29 @@ var ts; transformFlags |= subtreeFlags; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~839734613 /* ModuleExcludes */; + return transformFlags & ~574674241 /* ModuleExcludes */; } function computeVariableDeclarationList(node, subtreeFlags) { - var transformFlags = subtreeFlags | 268435456 /* ContainsHoistedDeclarationOrCompletion */; - if (subtreeFlags & 67108864 /* ContainsBindingPattern */) { - transformFlags |= 3072 /* AssertES2015 */; + var transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */; + if (subtreeFlags & 8388608 /* ContainsBindingPattern */) { + transformFlags |= 192 /* AssertES2015 */; } // If a VariableDeclarationList is `let` or `const`, then it is ES6 syntax. if (node.flags & 3 /* BlockScoped */) { - transformFlags |= 3072 /* AssertES2015 */ | 33554432 /* ContainsBlockScopedBinding */; + transformFlags |= 192 /* AssertES2015 */ | 4194304 /* ContainsBlockScopedBinding */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~604001621 /* VariableDeclarationListExcludes */; + return transformFlags & ~546309441 /* VariableDeclarationListExcludes */; } function computeOther(node, kind, subtreeFlags) { // Mark transformations needed for each node var transformFlags = subtreeFlags; - var excludeFlags = 536892757 /* NodeExcludes */; + var excludeFlags = 536872257 /* NodeExcludes */; switch (kind) { case 119 /* AsyncKeyword */: case 189 /* AwaitExpression */: // async/await is ES2017 syntax - transformFlags |= 192 /* AssertES2017 */; + transformFlags |= 16 /* AssertES2017 */; break; case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: @@ -23069,11 +23131,11 @@ var ts; case 251 /* JsxSpreadAttribute */: case 252 /* JsxExpression */: // These nodes are Jsx syntax. - transformFlags |= 12 /* AssertJsx */; + transformFlags |= 4 /* AssertJsx */; break; case 213 /* ForOfStatement */: // for-of might be ESNext if it has a rest destructuring - transformFlags |= 48 /* AssertESNext */; + transformFlags |= 8 /* AssertESNext */; // FALLTHROUGH case 12 /* NoSubstitutionTemplateLiteral */: case 13 /* TemplateHead */: @@ -23084,11 +23146,11 @@ var ts; case 258 /* ShorthandPropertyAssignment */: case 114 /* StaticKeyword */: // These nodes are ES6 syntax. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; break; case 195 /* YieldExpression */: // This node is ES6 syntax. - transformFlags |= 3072 /* AssertES2015 */ | 134217728 /* ContainsYield */; + transformFlags |= 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; break; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: @@ -23129,8 +23191,8 @@ var ts; // Even though computed property names are ES6, we don't treat them as such. // This is so that they can flow through PropertyName transforms unaffected. // Instead, we mark the container as ES6, so that it can properly handle the transform. - transformFlags |= 16777216 /* ContainsComputedPropertyName */; - if (subtreeFlags & 262144 /* ContainsLexicalThis */) { + transformFlags |= 2097152 /* ContainsComputedPropertyName */; + if (subtreeFlags & 16384 /* ContainsLexicalThis */) { // A computed method name like `[this.getName()](x: string) { ... }` needs to // distinguish itself from the normal case of a method body containing `this`: // `this` inside a method doesn't need to be rewritten (the method provides `this`), @@ -23139,66 +23201,69 @@ var ts; // `_this = this; () => class K { [_this.getName()]() { ... } }` // To make this distinction, use ContainsLexicalThisInComputedPropertyName // instead of ContainsLexicalThis for computed property names - transformFlags |= 1048576 /* ContainsLexicalThisInComputedPropertyName */; + transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */; } break; case 196 /* SpreadElement */: - case 259 /* SpreadAssignment */: - // This node is ES6 or ES next syntax, but is handled by a containing node. - transformFlags |= 8388608 /* ContainsSpreadExpression */; + transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; + break; + case 259 /* SpreadAssignment */: + transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; - case 174 /* BindingElement */: - if (node.dotDotDotToken) { - // this node is ES2015 or ES next syntax, but is handled by a containing node. - transformFlags |= 8388608 /* ContainsSpreadExpression */; - } case 96 /* SuperKeyword */: // This node is ES6 syntax. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; break; case 98 /* ThisKeyword */: // Mark this node and its ancestors as containing a lexical `this` keyword. - transformFlags |= 262144 /* ContainsLexicalThis */; + transformFlags |= 16384 /* ContainsLexicalThis */; break; case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - // These nodes are ES2015 or ES Next syntax. - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { - transformFlags |= 48 /* AssertESNext */ | 67108864 /* ContainsBindingPattern */; + transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; + if (subtreeFlags & 524288 /* ContainsRest */) { + transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */; } - else { - transformFlags |= 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */; + excludeFlags = 537396545 /* BindingPatternExcludes */; + break; + case 173 /* ArrayBindingPattern */: + transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; + excludeFlags = 537396545 /* BindingPatternExcludes */; + break; + case 174 /* BindingElement */: + transformFlags |= 192 /* AssertES2015 */; + if (node.dotDotDotToken) { + transformFlags |= 524288 /* ContainsRest */; } break; case 145 /* Decorator */: // This node is TypeScript syntax, and marks its container as also being TypeScript syntax. - transformFlags |= 3 /* AssertTypeScript */ | 65536 /* ContainsDecorators */; + transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */; break; case 176 /* ObjectLiteralExpression */: - excludeFlags = 554784085 /* ObjectLiteralExcludes */; - if (subtreeFlags & 16777216 /* ContainsComputedPropertyName */) { + excludeFlags = 540087617 /* ObjectLiteralExcludes */; + if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) { // If an ObjectLiteralExpression contains a ComputedPropertyName, then it // is an ES6 node. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } - if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) { + if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) { // A computed property name containing `this` might need to be rewritten, // so propagate the ContainsLexicalThis flag upward. - transformFlags |= 262144 /* ContainsLexicalThis */; + transformFlags |= 16384 /* ContainsLexicalThis */; } - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { + if (subtreeFlags & 1048576 /* ContainsObjectSpread */) { // If an ObjectLiteralExpression contains a spread element, then it // is an ES next node. - transformFlags |= 48 /* AssertESNext */; + transformFlags |= 8 /* AssertESNext */; } break; case 175 /* ArrayLiteralExpression */: case 180 /* NewExpression */: - excludeFlags = 545281365 /* ArrayLiteralOrCallOrNewExcludes */; - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { + excludeFlags = 537396545 /* ArrayLiteralOrCallOrNewExcludes */; + if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadExpression, then it is an ES6 // node. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } break; case 209 /* DoStatement */: @@ -23206,19 +23271,19 @@ var ts; case 211 /* ForStatement */: case 212 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. - if (subtreeFlags & 33554432 /* ContainsBlockScopedBinding */) { - transformFlags |= 3072 /* AssertES2015 */; + if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { + transformFlags |= 192 /* AssertES2015 */; } break; case 261 /* SourceFile */: - if (subtreeFlags & 524288 /* ContainsCapturedLexicalThis */) { - transformFlags |= 3072 /* AssertES2015 */; + if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { + transformFlags |= 192 /* AssertES2015 */; } break; case 216 /* ReturnStatement */: case 214 /* ContinueStatement */: case 215 /* BreakStatement */: - transformFlags |= 268435456 /* ContainsHoistedDeclarationOrCompletion */; + transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; @@ -23240,27 +23305,27 @@ var ts; case 179 /* CallExpression */: case 180 /* NewExpression */: case 175 /* ArrayLiteralExpression */: - return 545281365 /* ArrayLiteralOrCallOrNewExcludes */; + return 537396545 /* ArrayLiteralOrCallOrNewExcludes */; case 230 /* ModuleDeclaration */: - return 839734613 /* ModuleExcludes */; + return 574674241 /* ModuleExcludes */; case 144 /* Parameter */: - return 604001621 /* ParameterExcludes */; + return 536872257 /* ParameterExcludes */; case 185 /* ArrowFunction */: - return 979719509 /* ArrowFunctionExcludes */; + return 601249089 /* ArrowFunctionExcludes */; case 184 /* FunctionExpression */: case 225 /* FunctionDeclaration */: - return 980243797 /* FunctionExcludes */; + return 601281857 /* FunctionExcludes */; case 224 /* VariableDeclarationList */: - return 604001621 /* VariableDeclarationListExcludes */; + return 546309441 /* VariableDeclarationListExcludes */; case 226 /* ClassDeclaration */: case 197 /* ClassExpression */: - return 559895893 /* ClassExcludes */; + return 539358529 /* ClassExcludes */; case 150 /* Constructor */: - return 975983957 /* ConstructorExcludes */; + return 601015617 /* ConstructorExcludes */; case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - return 975983957 /* MethodOrAccessorExcludes */; + return 601015617 /* MethodOrAccessorExcludes */; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: @@ -23278,9 +23343,14 @@ var ts; case 228 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; case 176 /* ObjectLiteralExpression */: - return 554784085 /* ObjectLiteralExcludes */; + return 540087617 /* ObjectLiteralExcludes */; + case 256 /* CatchClause */: + return 537920833 /* CatchClauseExcludes */; + case 172 /* ObjectBindingPattern */: + case 173 /* ArrayBindingPattern */: + return 537396545 /* BindingPatternExcludes */; default: - return 536892757 /* NodeExcludes */; + return 536872257 /* NodeExcludes */; } } ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions; @@ -23331,6 +23401,7 @@ var ts; function moduleHasNonRelativeName(moduleName) { return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } + ts.moduleHasNonRelativeName = moduleHasNonRelativeName; function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { @@ -24037,6 +24108,8 @@ var ts; // is because diagnostics can be quite expensive, and we want to allow hosts to bail out if // they no longer need the information (for example, if the user started editing again). var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); @@ -24099,6 +24172,7 @@ var ts; getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, isOptionalParameter: isOptionalParameter, + tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { // we deliberately exclude augmentations // since we are only interested in declarations of the module itself @@ -24110,6 +24184,7 @@ var ts; var intersectionTypes = ts.createMap(); var stringLiteralTypes = ts.createMap(); var numericLiteralTypes = ts.createMap(); + var indexedAccessTypes = ts.createMap(); var evolvingArrayTypes = []; var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); @@ -24129,7 +24204,6 @@ var ts; var voidType = createIntrinsicType(1024 /* Void */, "void"); var neverType = createIntrinsicType(8192 /* Never */, "never"); var silentNeverType = createIntrinsicType(8192 /* Never */, "never"); - var stringOrNumberType = getUnionType([stringType, numberType]); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); @@ -24431,9 +24505,7 @@ var ts; // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -24852,6 +24924,7 @@ var ts; if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && + !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } @@ -24950,6 +25023,16 @@ var ts; return undefined; } } + function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) { + if (meaning === 1920 /* Namespace */) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 /* Type */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name); + return true; + } + } + return false; + } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { if (meaning & (107455 /* Value */ & ~1024 /* NamespaceModule */)) { var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 /* Type */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)); @@ -24996,7 +25079,7 @@ var ts; } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { @@ -25078,31 +25161,31 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_17 = specifier.propertyName || specifier.name; - if (name_17.text) { + var name_16 = specifier.propertyName || specifier.name; + if (name_16.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; // First check if module was specified with "export=". If so, get the member from the resolved type if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_17.text); + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_17.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text); } // if symbolFromVariable is export - get its final target symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_17.text); + var symbolFromModule = getExportOfModule(targetSymbol, name_16.text); // If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default - if (!symbolFromModule && allowSyntheticDefaultImports && name_17.text === "default") { + if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_17, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_17)); + error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16)); } return symbol; } @@ -25306,9 +25389,8 @@ var ts; // May be an untyped module. If so, ignore resolutionDiagnostic. if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - ts.Debug.assert(!!moduleNotFoundError); var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } else if (compilerOptions.noImplicitAny && moduleNotFoundError) { error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); @@ -25356,6 +25438,12 @@ var ts; function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function tryGetMemberInModuleExports(memberName, moduleSymbol) { + var symbolTable = getExportsOfModule(moduleSymbol); + if (symbolTable) { + return symbolTable[memberName]; + } + } function getExportsOfSymbol(symbol) { return symbol.flags & 1536 /* Module */ ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; } @@ -25557,6 +25645,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { @@ -25575,31 +25673,33 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - // Check if symbol is any of the alias - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 /* Alias */ - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) { - if (!useOnlyExternalAliasing || - // Is this external alias, then use it to name - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain - // but only if the symbolFromSymbolTable can be qualified - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + // If symbol is directly available by its name in the symbol table + if (isAccessible(symbols[symbol.name])) { + return [symbol]; + } + // Check if symbol is any of the alias + return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 /* Alias */ + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) { + if (!useOnlyExternalAliasing || + // Is this external alias, then use it to name + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain + // but only if the symbolFromSymbolTable can be qualified + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -25966,9 +26066,9 @@ var ts; if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { // Go up and add our parent. - var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_6) { - walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); + var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent_5) { + walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); } } if (accessibleSymbolChain) { @@ -26118,14 +26218,14 @@ var ts; while (i < length_1) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); writePunctuation(writer, 22 /* DotToken */); } } @@ -26416,7 +26516,7 @@ var ts; } ts.Debug.assert(bindingElement.kind === 174 /* BindingElement */); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); } @@ -26564,14 +26664,14 @@ var ts; if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_8 = getDeclarationContainer(node); + var parent_7 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_8.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_8))) { - return isGlobalSourceFile(parent_8); + !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_7.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_7))) { + return isGlobalSourceFile(parent_7); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_8); + return isDeclarationVisible(parent_7); case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 151 /* GetAccessor */: @@ -26756,15 +26856,21 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false); } function isComputedNonLiteralName(name) { - return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { - ts.Debug.assert(!!(source.flags & 32768 /* Object */), "Rest types only support object types right now."); + source = filterType(source, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (source.flags & 8192 /* Never */) { + return emptyObjectType; + } + if (source.flags & 65536 /* Union */) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_18 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_18)] = true; + var name_17 = properties_2[_i]; + names[ts.getTextOfPropertyName(name_17)] = true; } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; @@ -26800,14 +26906,14 @@ var ts; var type; if (pattern.kind === 172 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & 32768 /* Object */)) { + if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } var literalMembers = []; for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198 /* OmittedExpression */ && !element.dotDotDotToken) { + if (!element.dotDotDotToken) { literalMembers.push(element.propertyName || element.name); } } @@ -26815,8 +26921,8 @@ var ts; } else { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) - var name_19 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_19)) { + var name_18 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_18)) { // computed properties with non-literal names are treated as 'any' return anyType; } @@ -26825,12 +26931,12 @@ var ts; } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - var text = ts.getTextOfPropertyName(name_19); + var text = ts.getTextOfPropertyName(name_18); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); if (!type) { - error(name_19, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_19)); + error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18)); return unknownType; } } @@ -26871,33 +26977,9 @@ var ts; type; } function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { - var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); - if (jsDocType) { - return getTypeFromTypeNode(jsDocType); - } - } - function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) { - // First, see if this node has an @type annotation on it directly. - var typeTag = ts.getJSDocTypeTag(declaration); - if (typeTag && typeTag.typeExpression) { - return typeTag.typeExpression.type; - } - if (declaration.kind === 223 /* VariableDeclaration */ && - declaration.parent.kind === 224 /* VariableDeclarationList */ && - declaration.parent.parent.kind === 205 /* VariableStatement */) { - // @type annotation might have been on the variable statement, try that instead. - var annotation = ts.getJSDocTypeTag(declaration.parent.parent); - if (annotation && annotation.typeExpression) { - return annotation.typeExpression.type; - } - } - else if (declaration.kind === 144 /* Parameter */) { - // If it's a parameter, see if the parent has a jsdoc comment with an @param - // annotation. - var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type; - } + var jsdocType = ts.getJSDocType(declaration); + if (jsdocType) { + return getTypeFromTypeNode(jsdocType); } return undefined; } @@ -26914,7 +26996,7 @@ var ts; } // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { // If this is a variable in a JavaScript file, then use the JSDoc type (if it has // one as its type), otherwise fallback to the below standard TS codepaths to // try to figure it out. @@ -26923,9 +27005,11 @@ var ts; return type; } } - // A variable declared in a for..in statement is always of type string + // A variable declared in a for..in statement is of type string, or of type keyof T when the + // right hand expression is of a type parameter type. if (declaration.parent.parent.kind === 212 /* ForInStatement */) { - return stringType; + var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); + return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType; } if (declaration.parent.parent.kind === 213 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was @@ -26941,9 +27025,11 @@ var ts; if (declaration.type) { return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality); } - if (declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + if ((compilerOptions.noImplicitAny || declaration.flags & 65536 /* JavaScriptFile */) && + declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) { - // Use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no + // If --noImplicitAny is on or the declaration is in a Javascript file, + // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no // initializer or a 'null' or 'undefined' initializer. if (!(ts.getCombinedNodeFlags(declaration) & 2 /* Const */) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -27016,14 +27102,19 @@ var ts; // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { - // do not include computed properties or rests in the implied type + if (isComputedNonLiteralName(name)) { + // do not include computed properties in the implied type hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); + return; + } var text = ts.getTextOfPropertyName(name); var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); var symbol = createSymbol(flags, text); @@ -27031,7 +27122,7 @@ var ts; symbol.bindingElement = e; members[symbol.name] = symbol; }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -27122,7 +27213,7 @@ var ts; if (declaration.kind === 240 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 2097152 /* JavaScriptFile */ && declaration.kind === 285 /* JSDocPropertyTag */ && declaration.typeExpression) { + if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 286 /* JSDocPropertyTag */ && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } // Handle variable, parameter or property @@ -27138,10 +27229,10 @@ var ts; if (declaration.kind === 192 /* BinaryExpression */ || declaration.kind === 177 /* PropertyAccessExpression */ && declaration.parent.kind === 192 /* BinaryExpression */) { // Use JS Doc type if present on parent expression statement - if (declaration.flags & 2097152 /* JavaScriptFile */) { - var typeTag = ts.getJSDocTypeTag(declaration.parent); - if (typeTag && typeTag.typeExpression) { - return links.type = getTypeFromTypeNode(typeTag.typeExpression.type); + if (declaration.flags & 65536 /* JavaScriptFile */) { + var jsdocType = ts.getJSDocType(declaration.parent); + if (jsdocType) { + return links.type = getTypeFromTypeNode(jsdocType); } } var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 /* BinaryExpression */ ? @@ -27153,18 +27244,7 @@ var ts; type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - // Variable has type annotation that circularly references the variable itself - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - // Variable has initializer that circularly references the variable itself - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -27194,7 +27274,7 @@ var ts; if (!links.type) { var getter = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); var setter = ts.getDeclarationOfKind(symbol, 152 /* SetAccessor */); - if (getter && getter.flags & 2097152 /* JavaScriptFile */) { + if (getter && getter.flags & 65536 /* JavaScriptFile */) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; @@ -27284,10 +27364,29 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!pushTypeResolution(symbol, 0 /* Type */)) { + return unknownType; + } + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; } return links.type; } + function reportCircularityError(symbol) { + // Check if variable has type annotation that circularly references the variable itself + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + // Otherwise variable has initializer that circularly references the variable itself + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { if (symbol.flags & 16777216 /* Instantiated */) { return getTypeOfInstantiatedSymbol(symbol); @@ -27476,6 +27575,14 @@ var ts; } baseType = getReturnTypeOfSignature(constructors[0]); } + // In a JS file, you can use the @augments jsdoc tag to specify a base type with type parameters + var valueDecl = type.symbol.valueDeclaration; + if (valueDecl && ts.isInJavaScriptFile(valueDecl)) { + var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration); + if (augTag) { + baseType = getTypeFromTypeNode(augTag.typeExpression.type); + } + } if (baseType === unknownType) { return; } @@ -27484,7 +27591,7 @@ var ts; return; } if (type === baseType || hasBaseType(baseType, type)) { - error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */)); + error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */)); return; } if (type.resolvedBaseTypes === emptyArray) { @@ -27598,7 +27705,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 284 /* JSDocTypedefTag */); + var declaration = ts.getDeclarationOfKind(symbol, 285 /* JSDocTypedefTag */); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -28121,49 +28228,54 @@ var ts; function resolveMappedTypeMembers(type) { var members = ts.createMap(); var stringIndexInfo; - var numberIndexInfo; + // Resolve upfront such that recursive references see an empty object type. + setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); // In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type, // and T as the template type. var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var isReadonly = !!type.declaration.readonlyToken; - var isOptional = !!type.declaration.questionToken; - // First, if the constraint type is a type parameter, obtain the base constraint. Then, - // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. - // Finally, iterate over the constituents of the resulting iteration type. - var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentType(constraintType) : constraintType; - var iterationType = keyType.flags & 262144 /* Index */ ? getIndexType(getApparentType(keyType.type)) : keyType; - forEachType(iterationType, function (t) { + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 168 /* TypeOperator */) { + // We have a { [P in keyof T]: X } + forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + if (getIndexInfoOfType(modifiersType, 0 /* String */)) { + addMemberForKeyType(stringType); + } + } + else { + // First, if the constraint type is a type parameter, obtain the base constraint. Then, + // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. + // Finally, iterate over the constituents of the resulting iteration type. + var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 /* Index */ ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t) { // Create a mapper from T to the current iteration type constituent. Then, if the // mapped type is itself an instantiated type, combine the iteration mapper with the // instantiation mapper. var iterationMapper = createUnaryTypeMapper(typeParameter, t); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); - // If the current iteration type constituent is a literal type, create a property. - // Otherwise, for type string create a string index signature and for type number - // create a numeric index signature. - if (t.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */)) { + // If the current iteration type constituent is a string literal type, create a property. + // Otherwise, for type string create a string index signature. + if (t.flags & 32 /* StringLiteral */) { var propName = t.text; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 536870912 /* Optional */); var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | (isOptional ? 536870912 /* Optional */ : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; + prop.type = propType; + prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); members[propName] = prop; } else if (t.flags & 2 /* String */) { - stringIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } - else if (t.flags & 4 /* Number */) { - numberIndexInfo = createIndexInfo(propType, isReadonly); - } - }); - // If we created both a string and a numeric string index signature, and if the two index - // signatures have identical types, discard the redundant numeric index signature. - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeParameterFromMappedType(type) { return type.typeParameter || @@ -28176,13 +28288,37 @@ var ts; function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 168 /* TypeOperator */) { + // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check + // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves + // 'keyof T' to a literal union type and we can't recover T from that type. + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + // Otherwise, get the declared constraint type, and if the constraint type is a type parameter, + // get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T', + // the modifiers type is T. Otherwise, the modifiers type is {}. + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint.flags & 262144 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; + } + function getErasedTemplateTypeFromMappedType(type) { + return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + } function isGenericMappedType(type) { if (getObjectFlags(type) & 32 /* Mapped */) { var constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (16384 /* TypeParameter */ | 262144 /* Index */)); + return maybeTypeOfKind(constraintType, 540672 /* TypeVariable */ | 262144 /* Index */); } return false; } @@ -28266,11 +28402,11 @@ var ts; * The apparent type of a type parameter is the base constraint instantiated with the type parameter * as the type argument for the 'this' type. */ - function getApparentTypeOfTypeParameter(type) { + function getApparentTypeOfTypeVariable(type) { if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); + var constraintType = getConstraintOfTypeVariable(type); while (constraintType && constraintType.flags & 16384 /* TypeParameter */) { - constraintType = getConstraintOfTypeParameter(constraintType); + constraintType = getConstraintOfTypeVariable(constraintType); } type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); } @@ -28282,13 +28418,12 @@ var ts; * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type) { - var t = type.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(type) : type; - return t.flags & 34 /* StringLike */ ? globalStringType : + var t = type.flags & 540672 /* TypeVariable */ ? getApparentTypeOfTypeVariable(type) : type; + return t.flags & 262178 /* StringLike */ ? globalStringType : t.flags & 340 /* NumberLike */ ? globalNumberType : t.flags & 136 /* BooleanLike */ ? globalBooleanType : t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() : - t.flags & 262144 /* Index */ ? stringOrNumberType : - t; + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; @@ -28452,7 +28587,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -28482,17 +28617,20 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 2097152 /* JavaScriptFile */) { + if (node.flags & 65536 /* JavaScriptFile */) { if (node.type && node.type.kind === 273 /* JSDocOptionalType */) { return true; } - var paramTag = ts.getCorrespondingJSDocParameterTag(node); - if (paramTag) { - if (paramTag.isBracketed) { - return true; - } - if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */; + var paramTags = ts.getJSDocParameterTags(node); + if (paramTags) { + for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) { + var paramTag = paramTags_1[_i]; + if (paramTag.isBracketed) { + return true; + } + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */; + } } } } @@ -28615,7 +28753,7 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; @@ -28816,6 +28954,11 @@ var ts; } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } + function getConstraintOfTypeVariable(type) { + return type.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : + type.flags & 524288 /* IndexedAccess */ ? type.constraint : + undefined; + } function getParentSymbolOfTypeParameter(typeParameter) { return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143 /* TypeParameter */).parent); } @@ -29327,6 +29470,9 @@ var ts; typeSet.containsAny = true; } else if (!(type.flags & 8192 /* Never */) && (strictNullChecks || !(type.flags & 6144 /* Nullable */)) && !ts.contains(typeSet, type)) { + if (type.flags & 65536 /* Union */ && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } typeSet.push(type); } } @@ -29352,18 +29498,6 @@ var ts; if (types.length === 0) { return emptyObjectType; } - var _loop_2 = function (i) { - var type_1 = types[i]; - if (type_1.flags & 65536 /* Union */) { - return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }), - /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments) }; - } - }; - for (var i = 0; i < types.length; i++) { - var state_2 = _loop_2(i); - if (typeof state_2 === "object") - return state_2.value; - } var typeSet = []; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { @@ -29372,6 +29506,14 @@ var ts; if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of + // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), + /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { @@ -29390,7 +29532,7 @@ var ts; } return links.resolvedType; } - function getIndexTypeForTypeParameter(type) { + function getIndexTypeForGenericType(type) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(262144 /* Index */); type.resolvedIndexType.type = type; @@ -29406,11 +29548,15 @@ var ts; return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); } function getIndexType(type) { - return type.flags & 16384 /* TypeParameter */ ? getIndexTypeForTypeParameter(type) : - type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringOrNumberType : - getIndexInfoOfType(type, 1 /* Number */) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) : + return maybeTypeOfKind(type, 540672 /* TypeVariable */) ? getIndexTypeForGenericType(type) : + getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) : + type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromPropertyNames(type); } + function getIndexTypeOrString(type) { + var indexType = getIndexType(type); + return indexType !== neverType ? indexType : stringType; + } function getTypeFromTypeOperatorNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -29422,12 +29568,26 @@ var ts; var type = createType(524288 /* IndexedAccess */); type.objectType = objectType; type.indexType = indexType; + // We eagerly compute the constraint of the indexed access type such that circularity + // errors are immediately caught and reported. For example, class C { x: this["x"] } + // becomes an error only when the constraint is eagerly computed. + if (type.objectType.flags & 229376 /* StructuredType */) { + // The constraint of T[K], where T is an object, union, or intersection type, + // is the type of the string index signature of T, if any. + type.constraint = getIndexTypeOfType(type.objectType, 0 /* String */); + } + else if (type.objectType.flags & 540672 /* TypeVariable */) { + // The constraint of T[K], where T is a type variable, is A[K], where A is the + // apparent type of T. + var apparentType = getApparentTypeOfTypeVariable(type.objectType); + if (apparentType !== emptyObjectType) { + type.constraint = isTypeOfKind(type.indexType, 262178 /* StringLike */) ? + getIndexedAccessType(apparentType, type.indexType) : + getIndexTypeOfType(apparentType, 0 /* String */); + } + } return type; } - function getIndexedAccessTypeForTypeParameter(objectType, indexType) { - var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []); - return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType)); - } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; var propName = indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */) ? @@ -29450,7 +29610,7 @@ var ts; return getTypeOfSymbol(prop); } } - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) { + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) { if (isTypeAny(objectType)) { return anyType; } @@ -29490,20 +29650,53 @@ var ts; } return unknownType; } - function getIndexedAccessType(objectType, indexType, accessNode) { - if (indexType.flags & 16384 /* TypeParameter */) { - if (accessNode && !isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - return getIndexedAccessTypeForTypeParameter(objectType, indexType); + function getIndexedAccessForMappedType(type, indexType, accessNode) { + var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; + if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { + error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); + return unknownType; } - var apparentType = getApparentType(objectType); + var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); + } + function getIndexedAccessType(objectType, indexType, accessNode) { + // If the index type is generic, if the object type is generic and doesn't originate in an expression, + // or if the object type is a mapped type with a generic constraint, we are performing a higher-order + // index access where we cannot meaningfully access the properties of the object type. Note that for a + // generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to + // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved + // eagerly using the constraint type of 'this' at the given location. + if (maybeTypeOfKind(indexType, 540672 /* TypeVariable */ | 262144 /* Index */) || + maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && !(accessNode && accessNode.kind === 178 /* ElementAccessExpression */) || + isGenericMappedType(objectType)) { + if (objectType.flags & 1 /* Any */) { + return objectType; + } + // We first check that the index type is assignable to 'keyof T' for the object type. + if (accessNode) { + if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return unknownType; + } + } + // If the object type is a mapped type { [P in K]: E }, we instantiate E using a mapper that substitutes + // the index type for P. For example, for an index access { [P in K]: Box }[X], we construct the + // type Box. + if (isGenericMappedType(objectType)) { + return getIndexedAccessForMappedType(objectType, indexType, accessNode); + } + // Otherwise we defer the operation by creating an indexed access type. + var id = objectType.id + "," + indexType.id; + return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + } + // In the following we resolve T[K] to the type of the property in T selected by K. + var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 /* Union */ && !(indexType.flags & 8190 /* Primitive */)) { var propTypes = []; for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) { var t = _a[_i]; - var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, /*cacheSymbol*/ false); + var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false); if (propType === unknownType) { return unknownType; } @@ -29511,7 +29704,7 @@ var ts; } return getUnionType(propTypes); } - return getPropertyTypeForIndexType(apparentType, indexType, accessNode, /*cacheSymbol*/ true); + return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true); } function getTypeFromIndexedAccessTypeNode(node) { var links = getNodeLinks(node); @@ -29528,6 +29721,9 @@ var ts; type.aliasSymbol = getAliasSymbolForTypeNode(node); type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); links.resolvedType = type; + // Eagerly resolve the constraint type which forces an error if the constraint type circularly + // references itself through one or more type aliases. + getConstraintTypeFromMappedType(type); } return links.resolvedType; } @@ -29561,10 +29757,23 @@ var ts; * and right = the new element to be spread. */ function getSpreadType(left, right, isFromObjectLiteral) { - ts.Debug.assert(!!(left.flags & (32768 /* Object */ | 1 /* Any */)) && !!(right.flags & (32768 /* Object */ | 1 /* Any */)), "Only object types may be spread."); if (left.flags & 1 /* Any */ || right.flags & 1 /* Any */) { return anyType; } + left = filterType(left, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (left.flags & 8192 /* Never */) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (right.flags & 8192 /* Never */) { + return left; + } + if (left.flags & 65536 /* Union */) { + return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + } + if (right.flags & 65536 /* Union */) { + return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); var stringIndexInfo; @@ -29704,18 +29913,18 @@ var ts; return nullType; case 129 /* NeverKeyword */: return neverType; - case 288 /* JSDocNullKeyword */: + case 289 /* JSDocNullKeyword */: return nullType; - case 289 /* JSDocUndefinedKeyword */: + case 290 /* JSDocUndefinedKeyword */: return undefinedType; - case 290 /* JSDocNeverKeyword */: + case 291 /* JSDocNeverKeyword */: return neverType; case 167 /* ThisType */: case 98 /* ThisKeyword */: return getTypeFromThisTypeNode(node); case 171 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 287 /* JSDocLiteralType */: + case 288 /* JSDocLiteralType */: return getTypeFromLiteralTypeNode(node.literal); case 157 /* TypeReference */: case 272 /* JSDocTypeReference */: @@ -29748,7 +29957,7 @@ var ts; case 158 /* FunctionType */: case 159 /* ConstructorType */: case 161 /* TypeLiteral */: - case 286 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: case 274 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 168 /* TypeOperator */: @@ -29919,6 +30128,33 @@ var ts; return result; } function instantiateMappedType(type, mapper) { + // Check if we have a homomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some + // type variable T. If so, the mapped type is distributive over a union type and when T is instantiated + // to a union type A | B, we produce { [P in keyof A]: X } | { [P in keyof B]: X }. Furthermore, for + // homomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a + // union type A | undefined, we produce { [P in keyof A]: X } | undefined. + var constraintType = getConstraintTypeFromMappedType(type); + if (constraintType.flags & 262144 /* Index */) { + var typeVariable_1 = constraintType.type; + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } + } + return instantiateMappedObjectType(type, mapper); + } + function isMappableType(type) { + return type.flags & (16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */); + } + function instantiateMappedObjectType(type, mapper) { var result = createObjectType(32 /* Mapped */ | 64 /* Instantiated */, type.symbol); result.declaration = type.declaration; result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; @@ -30336,7 +30572,7 @@ var ts; return false; if (target.flags & 1 /* Any */ || source.flags & 8192 /* Never */) return true; - if (source.flags & 34 /* StringLike */ && target.flags & 2 /* String */) + if (source.flags & 262178 /* StringLike */ && target.flags & 2 /* String */) return true; if (source.flags & 340 /* NumberLike */ && target.flags & 4 /* Number */) return true; @@ -30455,6 +30691,25 @@ var ts; reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608 /* UnionOrIntersection */)) { + return false; + } + // at this point we know that this is union or intersection type possibly with nullable constituents. + // check if we still will have compound type if we ignore nullable components. + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144 /* Nullable */) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } // Compare two types and return // Ternary.True if they are related with no assumptions, // Ternary.Maybe if they are related with assumptions of other relationships, or @@ -30475,12 +30730,6 @@ var ts; } if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return -1 /* True */; - if (source.flags & 262144 /* Index */) { - // A keyof T is related to a union type containing both string and number - if (maybeTypeOfKind(target, 2 /* String */) && maybeTypeOfKind(target, 4 /* Number */)) { - return -1 /* True */; - } - } if (getObjectFlags(source) & 128 /* ObjectLiteral */ && source.flags & 1048576 /* FreshLiteral */) { if (hasExcessProperties(source, target, reportErrors)) { if (reportErrors) { @@ -30492,7 +30741,7 @@ var ts; // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - if (target.flags & 196608 /* UnionOrIntersection */) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -30539,13 +30788,25 @@ var ts; return result; } } - if (target.flags & 16384 /* TypeParameter */) { - // Given a type parameter K with a constraint keyof T, a type S is - // assignable to K if S is assignable to keyof T. - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144 /* Index */) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; + else if (target.flags & 16384 /* TypeParameter */) { + // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P]. + if (getObjectFlags(source) & 32 /* Mapped */ && getConstraintTypeFromMappedType(source) === getIndexType(target)) { + if (!source.declaration.questionToken) { + var templateType = getTemplateTypeFromMappedType(source); + var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); + if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { + return result; + } + } + } + else { + // Given a type parameter K with a constraint keyof T, a type S is + // assignable to K if S is assignable to keyof T. + var constraint = getConstraintOfTypeParameter(target); + if (constraint && constraint.flags & 262144 /* Index */) { + if (result = isRelatedTo(source, constraint, reportErrors)) { + return result; + } } } } @@ -30556,27 +30817,67 @@ var ts; return result; } } - // Given a type parameter T with a constraint C, a type S is assignable to + // Given a type variable T with a constraint C, a type S is assignable to // keyof T if S is assignable to keyof C. - var constraint = getConstraintOfTypeParameter(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + if (target.type.flags & 540672 /* TypeVariable */) { + var constraint = getConstraintOfTypeVariable(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } + } + } + else if (target.flags & 524288 /* IndexedAccess */) { + // if we have indexed access types with identical index types, see if relationship holds for + // the two object types. + if (source.flags & 524288 /* IndexedAccess */ && source.indexType === target.indexType) { + if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { + return result; + } + } + // A type S is related to a type T[K] if S is related to A[K], where K is string-like and + // A is the apparent type of S. + if (target.constraint) { + if (result = isRelatedTo(source, target.constraint, reportErrors)) { + errorInfo = saveErrorInfo; return result; } } } if (source.flags & 16384 /* TypeParameter */) { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1 /* Any */) { - constraint = emptyObjectType; + // A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X. + if (getObjectFlags(target) & 32 /* Mapped */ && getConstraintTypeFromMappedType(target) === getIndexType(source)) { + var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } - // The constraint may need to be further instantiated with its 'this' type. - constraint = getTypeWithThisArgument(constraint, source); - // Report constraint errors only if the constraint is not the empty object type - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; - return result; + else { + var constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & 1 /* Any */) { + constraint = emptyObjectType; + } + // The constraint may need to be further instantiated with its 'this' type. + constraint = getTypeWithThisArgument(constraint, source); + // Report constraint errors only if the constraint is not the empty object type + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + else if (source.flags & 524288 /* IndexedAccess */) { + // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and + // A is the apparent type of S. + if (source.constraint) { + if (result = isRelatedTo(source.constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } else { @@ -30586,29 +30887,18 @@ var ts; return result; } } - if (isGenericMappedType(target)) { - // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. - if (isGenericMappedType(source)) { - if ((result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) && - (result = isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors))) { - return result; - } - } - } - else { - // Even if relationship doesn't hold for unions, intersections, or generic type references, - // it may hold in a structural comparison. - var apparentSource = getApparentType(source); - // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates - // to X. Failing both of those we want to check if the aggregation of A and B's members structurally - // relates to X. Thus, we include intersection types on the source side here. - if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) { - // Report structural errors only if we haven't reported any errors yet - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */); - if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { - errorInfo = saveErrorInfo; - return result; - } + // Even if relationship doesn't hold for unions, intersections, or generic type references, + // it may hold in a structural comparison. + var apparentSource = getApparentType(source); + // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates + // to X. Failing both of those we want to check if the aggregation of A and B's members structurally + // relates to X. Thus, we include intersection types on the source side here. + if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) { + // Report structural errors only if we haven't reported any errors yet + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + errorInfo = saveErrorInfo; + return result; } } } @@ -30831,6 +31121,9 @@ var ts; if (expandingFlags === 3) { result = 1 /* Maybe */; } + else if (isGenericMappedType(source) || isGenericMappedType(target)) { + result = mappedTypeRelatedTo(source, target, reportErrors); + } else { result = propertiesRelatedTo(source, target, reportErrors); if (result) { @@ -30861,6 +31154,34 @@ var ts; } return result; } + // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. + function mappedTypeRelatedTo(source, target, reportErrors) { + if (isGenericMappedType(target)) { + if (isGenericMappedType(source)) { + var result_2; + if (relation === identityRelation) { + var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; + var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; + if (readonlyMatches && optionalMatches) { + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); + } + } + } + else { + if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + } + } + } + } + } + else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { + return -1 /* True */; + } + return 0 /* False */; + } function propertiesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { return propertiesIdenticalTo(source, target); @@ -31400,7 +31721,7 @@ var ts; return type; } var types = [type]; - if (flags & 34 /* StringLike */) + if (flags & 262178 /* StringLike */) types.push(emptyStringType); if (flags & 340 /* NumberLike */) types.push(zeroType); @@ -31628,25 +31949,73 @@ var ts; // Return true if the given type could possibly reference a type parameter for which // we perform type inference (i.e. a type parameter of a generic function). We cache // results for union and intersection types for performance reasons. - function couldContainTypeParameters(type) { + function couldContainTypeVariables(type) { var objectFlags = getObjectFlags(type); - return !!(type.flags & 16384 /* TypeParameter */ || - objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeParameters) || + return !!(type.flags & 540672 /* TypeVariable */ || + objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) || objectFlags & 32 /* Mapped */ || - type.flags & 196608 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & 196608 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || type.flags & 196608 /* UnionOrIntersection */ && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); } - function inferTypes(context, originalSource, originalTarget) { - var typeParameters = context.signature.typeParameters; + // Infer a suitable input type for a homomorphic mapped type { [P in keyof T]: X }. We construct + // an object type with the same set of properties as the source type, where the type of each + // property is computed by inferring from the source property type to X for the type + // variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for). + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0 /* String */); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 536870912 /* Optional */; + var members = createSymbolTable(properties); + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var prop = properties_4[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 /* Property */ | 67108864 /* Transient */ | prop.flags & optionalMask, prop.name); + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); + members[prop.name] = inferredProp; + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, /*subtypeReduction*/ true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; @@ -31662,7 +32031,7 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -31714,7 +32083,7 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384 /* TypeParameter */) { + if (target.flags & 540672 /* TypeVariable */) { // If target is a type parameter, make an inference, unless the source type contains // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). // Because the anyFunctionType is internal, it should not be exposed to the user by adding @@ -31724,9 +32093,9 @@ var ts; if (source.flags & 8388608 /* ContainsAnyFunctionType */) { return; } - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { // Any inferences that are made to a type parameter in a union type are inferior // to inferences made to a flat (non-union) type. This is because if we infer to @@ -31740,7 +32109,7 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & 16384 /* TypeParameter */ && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -31759,25 +32128,25 @@ var ts; } else if (target.flags & 196608 /* UnionOrIntersection */) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; - // First infer to each type in union or intersection that isn't a type parameter + var typeVariableCount = 0; + var typeVariable = void 0; + // First infer to each type in union or intersection that isn't a type variable for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { var t = targetTypes_2[_d]; - if (t.flags & 16384 /* TypeParameter */ && ts.contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + if (t.flags & 540672 /* TypeVariable */ && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - // Next, if target containings a single naked type parameter, make a secondary inference to that type - // parameter. This gives meaningful results for union types in co-variant positions and intersection + // Next, if target containings a single naked type variable, make a secondary inference to that type + // variable. This gives meaningful results for union types in co-variant positions and intersection // types in contra-variant positions (such as callback parameters). - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -31790,19 +32159,6 @@ var ts; } } else { - if (getObjectFlags(target) & 32 /* Mapped */) { - var constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & 32 /* Mapped */) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); - return; - } - if (constraintType.flags & 16384 /* TypeParameter */) { - inferFromTypes(getIndexType(source), constraintType); - inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); - return; - } - } source = getApparentType(source); if (source.flags & 32768 /* Object */) { if (isInProcess(source, target)) { @@ -31823,18 +32179,47 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; depth++; - inferFromProperties(source, target); - inferFromSignatures(source, target, 0 /* Call */); - inferFromSignatures(source, target, 1 /* Construct */); - inferFromIndexTypes(source, target); + inferFromObjectTypes(source, target); depth--; } } } + function inferFromObjectTypes(source, target) { + if (getObjectFlags(target) & 32 /* Mapped */) { + var constraintType = getConstraintTypeFromMappedType(target); + if (constraintType.flags & 262144 /* Index */) { + // We're inferring from some source type S to a homomorphic mapped type { [P in keyof T]: X }, + // where T is a type variable. Use inferTypeForHomomorphicMappedType to infer a suitable source + // type and then make a secondary inference from that type to T. We make a secondary inference + // such that direct inferences to T get priority over inferences to Partial, for example. + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } + return; + } + if (constraintType.flags & 16384 /* TypeParameter */) { + // We're inferring from some source type S to a mapped type { [P in T]: X }, where T is a type + // parameter. Infer from 'keyof S' to T and infer from a union of each property type in S to X. + inferFromTypes(getIndexType(source), constraintType); + inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); + return; + } + } + inferFromProperties(source, target); + inferFromSignatures(source, target, 0 /* Call */); + inferFromSignatures(source, target, 1 /* Construct */); + inferFromIndexTypes(source, target); + } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var targetProp = properties_5[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -32199,7 +32584,7 @@ var ts; } function getTypeWithDefault(type, defaultExpression) { if (defaultExpression) { - var defaultType = checkExpression(defaultExpression); + var defaultType = getTypeOfExpression(defaultExpression); return getUnionType([getTypeWithFacts(type, 131072 /* NEUndefined */), defaultType]); } return type; @@ -32222,7 +32607,7 @@ var ts; function getAssignedTypeOfBinaryExpression(node) { return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 257 /* PropertyAssignment */ ? getTypeWithDefault(getAssignedType(node), node.right) : - checkExpression(node.right); + getTypeOfExpression(node.right); } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); @@ -32273,7 +32658,7 @@ var ts; // from its initializer, we'll already have cached the type. Otherwise we compute it now // without caching such that transient types are reflected. var links = getNodeLinks(node); - return links.resolvedType || checkExpression(node); + return links.resolvedType || getTypeOfExpression(node); } function getInitialTypeOfVariableDeclaration(node) { if (node.initializer) { @@ -32326,7 +32711,7 @@ var ts; } function getTypeOfSwitchClause(clause) { if (clause.kind === 253 /* CaseClause */) { - var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression)); + var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } return neverType; @@ -32418,7 +32803,7 @@ var ts; // we defer subtype reduction until the evolving array type is finalized into a manifest // array type. function addEvolvingArrayElementType(evolvingArrayType, node) { - var elementType = getBaseTypeOfLiteralType(checkExpression(node)); + var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { @@ -32472,7 +32857,7 @@ var ts; parent.parent.operatorToken.kind === 57 /* EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && - isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 /* NumberLike */ | 2048 /* Undefined */); + isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 /* NumberLike */ | 2048 /* Undefined */); return isLengthPushOrUnshift || isElementAssignment; } function maybeTypePredicateCall(node) { @@ -32629,7 +33014,7 @@ var ts; } } else { - var indexType = checkExpression(node.left.argumentExpression); + var indexType = getTypeOfExpression(node.left.argumentExpression); if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */ | 2048 /* Undefined */)) { evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right); } @@ -32847,7 +33232,7 @@ var ts; if (operator === 32 /* ExclamationEqualsToken */ || operator === 34 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } - var valueType = checkExpression(value); + var valueType = getTypeOfExpression(value); if (valueType.flags & 6144 /* Nullable */) { if (!strictNullChecks) { return type; @@ -32929,7 +33314,7 @@ var ts; return type; } // Check that right operand is a function type with a prototype property - var rightType = checkExpression(expr.right); + var rightType = getTypeOfExpression(expr.right); if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } @@ -32960,18 +33345,18 @@ var ts; } } if (targetType) { - return getNarrowedType(type, targetType, assumeTrue); + return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf); } return type; } - function getNarrowedType(type, candidate, assumeTrue) { + function getNarrowedType(type, candidate, assumeTrue, isRelated) { if (!assumeTrue) { - return filterType(type, function (t) { return !isTypeInstanceOf(t, candidate); }); + return filterType(type, function (t) { return !isRelated(t, candidate); }); } // If the current type is a union type, remove all constituents that couldn't be instances of // the candidate type. If one or more constituents remain, return a union of those. if (type.flags & 65536 /* Union */) { - var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); }); + var assignableType = filterType(type, function (t) { return isRelated(t, candidate); }); if (!(assignableType.flags & 8192 /* Never */)) { return assignableType; } @@ -33004,7 +33389,7 @@ var ts; var predicateArgument = callExpression.arguments[predicate.parameterIndex]; if (predicateArgument) { if (isMatchingReference(reference, predicateArgument)) { - return getNarrowedType(type, predicate.type, assumeTrue); + return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } if (containsMatchingReference(reference, predicateArgument)) { return declaredType; @@ -33017,7 +33402,7 @@ var ts; var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { - return getNarrowedType(type, predicate.type, assumeTrue); + return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } if (containsMatchingReference(reference, possibleReference)) { return declaredType; @@ -33059,7 +33444,7 @@ var ts; location = location.parent; } if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) { - var type = checkExpression(location); + var type = getTypeOfExpression(location); if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { return type; } @@ -33143,7 +33528,7 @@ var ts; error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } - if (node.flags & 524288 /* AwaitContext */) { + if (node.flags & 16384 /* AwaitContext */) { getNodeLinks(container).flags |= 8192 /* CaptureArguments */; } return getTypeOfSymbol(symbol); @@ -33157,8 +33542,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (languageVersion === 2 /* ES2015 */ - && declaration_1.kind === 226 /* ClassDeclaration */ + if (declaration_1.kind === 226 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -33374,30 +33758,33 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + // If a containing class does not have extends clause or the class extends null + // skip checking whether super statement is called before "this" accessing. + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + // We should give an error in the following cases: + // - No super-call + // - "this" is accessing before super-call. + // i.e super(this) + // this.x; super(); + // We want to make sure that super-call is done before accessing "this" so that + // "this" is not accessed as a parameter of the super-call. + if (!superCall || superCall.end > node.pos) { + // In ES6, super inside constructor of class-declaration has to precede "this" accessing + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; if (container.kind === 150 /* Constructor */) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - // If a containing class does not have extends clause or the class extends null - // skip checking whether super statement is called before "this" accessing. - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - // We should give an error in the following cases: - // - No super-call - // - "this" is accessing before super-call. - // i.e super(this) - // this.x; super(); - // We want to make sure that super-call is done before accessing "this" so that - // "this" is not accessed as a parameter of the super-call. - if (!superCall || superCall.end > node.pos) { - // In ES6, super inside constructor of class-declaration has to precede "this" accessing - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. if (container.kind === 185 /* ArrowFunction */) { @@ -33473,9 +33860,9 @@ var ts; return anyType; } function getTypeForThisExpressionFromJSDoc(node) { - var typeTag = ts.getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 274 /* JSDocFunctionType */) { - var jsDocFunctionType = typeTag.typeExpression.type; + var jsdocType = ts.getJSDocType(node); + if (jsdocType && jsdocType.kind === 274 /* JSDocFunctionType */) { + var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277 /* JSDocThisType */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } @@ -33526,6 +33913,9 @@ var ts; } return unknownType; } + if (!isCallExpression && container.kind === 150 /* Constructor */) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } if ((ts.getModifierFlags(container) & 32 /* Static */) || isCallExpression) { nodeCheckFlag = 512 /* SuperStatic */; } @@ -33745,11 +34135,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_20 = declaration.propertyName || declaration.name; + var name_19 = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_20)) { - var text = ts.getTextOfPropertyName(name_20); + !ts.isBindingPattern(name_19)) { + var text = ts.getTextOfPropertyName(name_19); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -33835,7 +34225,7 @@ var ts; } // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { - return checkExpression(binaryExpression.left); + return getTypeOfExpression(binaryExpression.left); } } else if (operator === 53 /* BarBarToken */) { @@ -33843,7 +34233,7 @@ var ts; // expression has no contextual type, the right operand is contextually typed by the type of the left operand. var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { - type = checkExpression(binaryExpression.left); + type = getTypeOfExpression(binaryExpression.left); } return type; } @@ -34134,13 +34524,7 @@ var ts; return mapper && mapper.context; } function checkSpreadExpression(node, contextualMapper) { - // It is usually not safe to call checkExpressionCached if we can be contextually typing. - // You can tell that we are contextually typing because of the contextualMapper parameter. - // While it is true that a spread element can have a contextual type, it does not do anything - // with this type. It is neither affected by it, nor does it propagate it to its operand. - // So the fact that contextualMapper is passed is not important, because the operand of a spread - // element is not contextually typed. - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); + var arrayOrIterableType = checkExpression(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { @@ -34261,7 +34645,7 @@ var ts; links.resolvedType = checkExpression(node.expression); // This will allow types number, string, symbol or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). - if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 /* NumberLike */ | 34 /* StringLike */ | 512 /* ESSymbol */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 /* NumberLike */ | 262178 /* StringLike */ | 512 /* ESSymbol */)) { error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { @@ -34270,10 +34654,10 @@ var ts; } return links.resolvedType; } - function getObjectLiteralIndexInfo(node, properties, kind) { + function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) { var propTypes = []; for (var i = 0; i < properties.length; i++) { - if (kind === 0 /* String */ || isNumericName(node.properties[i].name)) { + if (kind === 0 /* String */ || isNumericName(propertyNodes[i + offset].name)) { propTypes.push(getTypeOfSymbol(properties[i])); } } @@ -34295,8 +34679,9 @@ var ts; var patternWithComputedProperties = false; var hasComputedStringProperty = false; var hasComputedNumberProperty = false; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var memberDecl = _a[_i]; + var offset = 0; + for (var i = 0; i < node.properties.length; i++) { + var memberDecl = node.properties[i]; var member = memberDecl.symbol; if (memberDecl.kind === 257 /* PropertyAssignment */ || memberDecl.kind === 258 /* ShorthandPropertyAssignment */ || @@ -34333,7 +34718,7 @@ var ts; if (impliedProp) { prop.flags |= impliedProp.flags & 536870912 /* Optional */; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0 /* String */)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -34347,6 +34732,9 @@ var ts; member = prop; } else if (memberDecl.kind === 259 /* SpreadAssignment */) { + if (languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(memberDecl, 2 /* Assign */); + } if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); propertiesArray = []; @@ -34356,11 +34744,12 @@ var ts; typeFlags = 0; } var type = checkExpression(memberDecl.expression); - if (!(type.flags & (32768 /* Object */ | 1 /* Any */))) { + if (!isValidSpreadType(type)) { error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false); + offset = i + 1; continue; } else { @@ -34388,8 +34777,8 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. if (contextualTypeHasPattern) { - for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { - var prop = _c[_b]; + for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { + var prop = _a[_i]; if (!propertiesTable[prop.name]) { if (!(prop.flags & 536870912 /* Optional */)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); @@ -34403,14 +34792,17 @@ var ts; if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; + if (spread.flags & 32768 /* Object */) { + // only set the symbol and flags if this is a (fresh) object type + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; + } return spread; } return createObjectLiteralType(); function createObjectLiteralType() { - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0 /* String */) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1 /* Number */) : undefined; + var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0 /* String */) : undefined; + var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1 /* Number */) : undefined; var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshLiteral */; result.flags |= 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */); @@ -34427,6 +34819,11 @@ var ts; return result; } } + function isValidSpreadType(type) { + return !!(type.flags & (1 /* Any */ | 4096 /* Null */ | 2048 /* Undefined */) || + type.flags & 32768 /* Object */ && !isGenericMappedType(type) || + type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); + } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; @@ -34516,6 +34913,9 @@ var ts; return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { + if (compilerOptions.jsx === 2 /* React */) { + checkExternalEmitHelpers(node, 2 /* Assign */); + } var type = checkExpression(node.expression); var props = getPropertiesOfType(type); for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { @@ -35085,7 +35485,7 @@ var ts; if (node.kind === 212 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && - hasNumericPropertyNames(checkExpression(node.expression))) { + hasNumericPropertyNames(getTypeOfExpression(node.expression))) { return true; } child = node; @@ -35191,13 +35591,13 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_9 = signature.declaration && signature.declaration.parent; + var parent_8 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_9 === lastParent) { + if (lastParent && parent_8 === lastParent) { index++; } else { - lastParent = parent_9; + lastParent = parent_8; index = cutoffIndex; } } @@ -35205,7 +35605,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_9; + lastParent = parent_8; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -35317,7 +35717,7 @@ var ts; var context = createInferenceContext(signature, /*inferUnionTypes*/ true); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { // Type parameters from outer context referenced by source type are fixed by instantiation of the source type - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -35348,7 +35748,7 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } // We perform two passes over the arguments. In the first pass we infer from all arguments, but use // wildcards for all context sensitive function expressions. @@ -35367,7 +35767,7 @@ var ts; var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } // In the second pass we visit only context sensitive arguments, and only those that aren't excluded, this @@ -35381,7 +35781,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -36112,12 +36512,13 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; if (modifiers & 16 /* Protected */ && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } if (modifiers & 8 /* Private */) { @@ -36342,7 +36743,7 @@ var ts; for (var i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -36427,7 +36828,7 @@ var ts; // T in the second overload so that we do not infer Base as a candidate for T // (inferring Base would make type argument inference inconsistent between the two // overloads). - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -36537,7 +36938,7 @@ var ts; if (!node.possiblyExhaustive) { return false; } - var type = checkExpression(node.expression); + var type = getTypeOfExpression(node.expression); if (!isLiteralType(type)) { return false; } @@ -36545,7 +36946,7 @@ var ts; if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { if (!(func.flags & 128 /* HasImplicitReturn */)) { @@ -36813,7 +37214,7 @@ var ts; function checkAwaitExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.flags & 524288 /* AwaitContext */)) { + if (!(node.flags & 16384 /* AwaitContext */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -36944,32 +37345,33 @@ var ts; // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. - if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) { + if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 /* NumberLike */ | 512 /* ESSymbol */))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var p = properties_5[_i]; - checkObjectLiteralDestructuringPropertyAssignment(sourceType, p); + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var p = properties_6[_i]; + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } - function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) { + /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { if (property.kind === 257 /* PropertyAssignment */ || property.kind === 258 /* ShorthandPropertyAssignment */) { - var name_21 = property.name; - if (name_21.kind === 142 /* ComputedPropertyName */) { - checkComputedPropertyName(name_21); + var name_20 = property.name; + if (name_20.kind === 142 /* ComputedPropertyName */) { + checkComputedPropertyName(name_20); } - if (isComputedNonLiteralName(name_21)) { + if (isComputedNonLiteralName(name_20)) { return undefined; } - var text = ts.getTextOfPropertyName(name_21); + var text = ts.getTextOfPropertyName(name_20); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || @@ -36985,13 +37387,21 @@ var ts; } } else { - error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_21)); + error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); } } else if (property.kind === 259 /* SpreadAssignment */) { - if (property.expression.kind !== 70 /* Identifier */) { - error(property.expression, ts.Diagnostics.An_object_rest_element_must_be_an_identifier); + if (languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(property, 4 /* Rest */); } + var nonRestNames = []; + if (allProperties) { + for (var i = 0; i < allProperties.length - 1; i++) { + nonRestNames.push(allProperties[i].name); + } + } + var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); + return checkDestructuringAssignment(property.expression, type); } else { error(property, ts.Diagnostics.Property_assignment_expected); @@ -37083,7 +37493,10 @@ var ts; } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) { + var error = target.parent.kind === 259 /* SpreadAssignment */ ? + ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : + ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; + if (checkReferenceExpression(target, error)) { checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined); } return sourceType; @@ -37246,7 +37659,7 @@ var ts; resultType = numberType; } else { - if (isTypeOfKind(leftType, 34 /* StringLike */) || isTypeOfKind(rightType, 34 /* StringLike */)) { + if (isTypeOfKind(leftType, 262178 /* StringLike */) || isTypeOfKind(rightType, 262178 /* StringLike */)) { // If one or both operands are of the String primitive type, the result is of the String primitive type. resultType = stringType; } @@ -37273,6 +37686,8 @@ var ts; case 29 /* LessThanEqualsToken */: case 30 /* GreaterThanEqualsToken */: if (checkForDisallowedESSymbolOperand(operator)) { + leftType = getBaseTypeOfLiteralType(leftType); + rightType = getBaseTypeOfLiteralType(rightType); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -37375,7 +37790,7 @@ var ts; function checkYieldExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.flags & 131072 /* YieldContext */) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096 /* YieldContext */) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -37469,13 +37884,13 @@ var ts; function checkDeclarationInitializer(declaration) { var type = checkExpressionCached(declaration.initializer); return ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || - ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ || + ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } function isLiteralContextualType(contextualType) { if (contextualType) { - if (contextualType.flags & 16384 /* TypeParameter */) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); + if (contextualType.flags & 540672 /* TypeVariable */) { + var apparentType = getApparentTypeOfTypeVariable(contextualType); // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. @@ -37484,7 +37899,7 @@ var ts; } contextualType = apparentType; } - return maybeTypeOfKind(contextualType, 480 /* Literal */); + return maybeTypeOfKind(contextualType, (480 /* Literal */ | 262144 /* Index */)); } return false; } @@ -37528,6 +37943,23 @@ var ts; } return type; } + // Returns the type of an expression. Unlike checkExpression, this function is simply concerned + // with computing the type and may not fully check all contained sub-expressions for errors. + function getTypeOfExpression(node) { + // Optimize for the common case of a call to a function with a single non-generic call + // signature where we can just fetch the return type without checking the arguments. + if (node.kind === 179 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) { + var funcType = checkNonNullExpression(node.expression); + var signature = getSingleCallSignature(funcType); + if (signature && !signature.typeParameters) { + return getReturnTypeOfSignature(signature); + } + } + // Otherwise simply call checkExpression. Ideally, the entire family of checkXXX functions + // should have a parameter that indicates whether full error checking is required such that + // we can perform the optimizations locally. + return checkExpression(node); + } // Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When // contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the // expression is being inferentially typed (section 4.15.2 in spec) and provides the type mapper to use in @@ -37730,9 +38162,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_22 = _a[_i].name; - if (ts.isBindingPattern(name_22) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, parameterName, typePredicate.parameterName)) { + var name_21 = _a[_i].name; + if (ts.isBindingPattern(name_21) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -37752,9 +38184,9 @@ var ts; case 158 /* FunctionType */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: - var parent_10 = node.parent; - if (node === parent_10.type) { - return parent_10; + var parent_9 = node.parent; + if (node === parent_9.type) { + return parent_9; } } } @@ -37764,15 +38196,15 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_23 = element.name; - if (name_23.kind === 70 /* Identifier */ && - name_23.text === predicateVariableName) { + var name_22 = element.name; + if (name_22.kind === 70 /* Identifier */ && + name_22.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_23.kind === 173 /* ArrayBindingPattern */ || - name_23.kind === 172 /* ObjectBindingPattern */) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, predicateVariableNode, predicateVariableName)) { + else if (name_22.kind === 173 /* ArrayBindingPattern */ || + name_22.kind === 172 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) { return true; } } @@ -37788,6 +38220,12 @@ var ts; node.kind === 154 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } + if (ts.isAsyncFunctionLike(node) && languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 64 /* Awaiter */); + if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(node, 128 /* Generator */); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -38040,8 +38478,8 @@ var ts; if (superCallShouldBeFirst) { var statements = node.body.statements; var superCallStatement = void 0; - for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { - var statement = statements_2[_i]; + for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { + var statement = statements_3[_i]; if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; @@ -38193,8 +38631,8 @@ var ts; checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint); + var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentTypeOfTypeVariable(constraintType) : constraintType; + checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node); @@ -38475,10 +38913,10 @@ var ts; case 229 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; case 234 /* ImportEqualsDeclaration */: - var result_2 = 0; + var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); }); - return result_2; + ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); + return result_3; default: return 1048576 /* ExportValue */; } @@ -38533,7 +38971,7 @@ var ts; if (thenSignatures.length === 0) { return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072 /* NEUndefined */); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288 /* NEUndefinedOrNull */); if (isTypeAny(onfulfilledParameterType)) { return undefined; } @@ -38775,6 +39213,9 @@ var ts; markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } /** Check the decorators of a node */ function checkDecorators(node) { if (!node.decorators) { @@ -38788,7 +39229,13 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */); + if (node.kind === 144 /* Parameter */) { + checkExternalEmitHelpers(firstDecorator, 32 /* Param */); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { case 226 /* ClassDeclaration */: @@ -38796,7 +39243,7 @@ var ts; if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; @@ -38805,11 +39252,13 @@ var ts; case 152 /* SetAccessor */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; case 147 /* PropertyDeclaration */: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; case 144 /* Parameter */: markTypeNodeAsReferenced(node.type); break; @@ -38939,7 +39388,7 @@ var ts; } function checkUnusedLocalsAndParameters(node) { if (node.parent.kind !== 227 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_3 = function (key) { + var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144 /* Parameter */) { @@ -38957,10 +39406,17 @@ var ts; } }; for (var key in node.locals) { - _loop_3(key); + _loop_2(key); } } } + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); @@ -38970,7 +39426,9 @@ var ts; return; } } - error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 /* Identifier */ ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); @@ -39141,7 +39599,7 @@ var ts; } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 /* ES2017 */ || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } // Uninstantiated modules shouldnt do this check @@ -39150,7 +39608,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192 /* HasAsyncFunctions */) { + if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -39211,8 +39669,8 @@ var ts; // otherwise if variable has an initializer - show error that initialization will fail // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { - var name_24 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_24, name_24); + var name_23 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23); } } } @@ -39298,18 +39756,21 @@ var ts; } } if (node.kind === 174 /* BindingElement */) { + if (node.parent.kind === 172 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(node, 4 /* Rest */); + } // check computed properties inside property names of binding elements if (node.propertyName && node.propertyName.kind === 142 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access - var parent_11 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_11); - var name_25 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_25)); + var parent_10 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_10); + var name_24 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); markPropertyAsReferenced(property); - if (parent_11.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + if (parent_10.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); } } // For a binding pattern, check contained binding elements @@ -39501,6 +39962,7 @@ var ts; function checkForInStatement(node) { // Grammar checking checkGrammarForInOrForOfStatement(node); + var rightType = checkNonNullExpression(node.expression); // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form // for (let VarDecl in Expr) Statement @@ -39523,7 +39985,7 @@ var ts; if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } - else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 /* StringLike */)) { + else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -39531,10 +39993,9 @@ var ts; checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - var rightType = checkNonNullExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -39719,17 +40180,17 @@ var ts; */ function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { ts.Debug.assert(languageVersion < 2 /* ES2015 */); - // After we remove all types that are StringLike, we will know if there was a string constituent - // based on whether the remaining type is the same as the initial type. var arrayType = arrayOrStringType; if (arrayOrStringType.flags & 65536 /* Union */) { + // After we remove all types that are StringLike, we will know if there was a string constituent + // based on whether the result of filter is a new array. var arrayTypes = arrayOrStringType.types; - var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 34 /* StringLike */); }); + var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178 /* StringLike */); }); if (filteredTypes !== arrayTypes) { arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true); } } - else if (arrayOrStringType.flags & 34 /* StringLike */) { + else if (arrayOrStringType.flags & 262178 /* StringLike */) { arrayType = neverType; } var hasStringConstituent = arrayOrStringType !== arrayType; @@ -39761,7 +40222,7 @@ var ts; var arrayElementType = getIndexTypeOfType(arrayType, 1 /* Number */) || unknownType; if (hasStringConstituent) { // This is just an optimization for the case where arrayOrStringType is string | string[] - if (arrayElementType.flags & 34 /* StringLike */) { + if (arrayElementType.flags & 262178 /* StringLike */) { return stringType; } return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true); @@ -39836,7 +40297,7 @@ var ts; function checkWithStatement(node) { // Grammar checking for withStatement if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 524288 /* AwaitContext */) { + if (node.flags & 16384 /* AwaitContext */) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -40107,6 +40568,9 @@ var ts; checkClassForDuplicateDeclarations(node); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2 /* ES2015 */ && !ts.isInAmbientContext(node)) { + checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; @@ -40316,8 +40780,8 @@ var ts; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var prop = properties_6[_a]; + for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { + var prop = properties_7[_a]; var existing = seen[prop.name]; if (!existing) { seen[prop.name] = { prop: prop, containingType: base }; @@ -40532,7 +40996,7 @@ var ts; return undefined; } } - enumType_1 = checkExpression(expression); + enumType_1 = getTypeOfExpression(expression); // allow references to constant members of other enums if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384 /* Enum */))) { return undefined; @@ -40753,9 +41217,9 @@ var ts; break; case 174 /* BindingElement */: case 223 /* VariableDeclaration */: - var name_26 = node.name; - if (ts.isBindingPattern(name_26)) { - for (var _b = 0, _c = name_26.elements; _b < _c.length; _b++) { + var name_25 = node.name; + if (ts.isBindingPattern(name_25)) { + for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); @@ -41587,7 +42051,7 @@ var ts; } // fallthrough case 96 /* SuperKeyword */: - var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); + var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; case 167 /* ThisType */: return getTypeFromTypeNode(node).symbol; @@ -41613,7 +42077,7 @@ var ts; case 8 /* NumericLiteral */: // index access if (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { - var objectType = checkExpression(node.parent.expression); + var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; var apparentType = getApparentType(objectType); @@ -41649,7 +42113,7 @@ var ts; return getTypeFromTypeNode(node); } if (ts.isPartOfExpression(node)) { - return getTypeOfExpression(node); + return getRegularTypeOfExpression(node); } if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { // A SyntaxKind.ExpressionWithTypeArguments is considered a type node, except when it occurs in the @@ -41702,7 +42166,7 @@ var ts; // If this is from "for" initializer // for ({a } = elems[0];.....) { } if (expr.parent.kind === 192 /* BinaryExpression */) { - var iteratedType = checkExpression(expr.parent.right); + var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern @@ -41729,11 +42193,11 @@ var ts; var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); } - function getTypeOfExpression(expr) { + function getRegularTypeOfExpression(expr) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } - return getRegularTypeOfLiteralType(checkExpression(expr)); + return getRegularTypeOfLiteralType(getTypeOfExpression(expr)); } /** * Gets either the static or instance type of a class element, based on @@ -41762,9 +42226,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456 /* SyntheticProperty */) { var symbols_3 = []; - var name_27 = symbol.name; + var name_26 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_27); + var symbol = getPropertyOfType(t, name_26); if (symbol) { symbols_3.push(symbol); } @@ -41823,7 +42287,7 @@ var ts; } function isNameOfModuleOrEnumDeclaration(node) { var parent = node.parent; - return ts.isModuleOrEnumDeclaration(parent) && node === parent.name; + return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name; } // When resolved as an expression identifier, if the given node references an exported entity, return the declaration // node of the exported entity's container. Otherwise, return undefined. @@ -42084,7 +42548,7 @@ var ts; else if (isTypeOfKind(type, 340 /* NumberLike */)) { return ts.TypeReferenceSerializationKind.NumberLikeType; } - else if (isTypeOfKind(type, 34 /* StringLike */)) { + else if (isTypeOfKind(type, 262178 /* StringLike */)) { return ts.TypeReferenceSerializationKind.StringLikeType; } else if (isTupleType(type)) { @@ -42116,7 +42580,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getWidenedType(getTypeOfExpression(expr)); + var type = getWidenedType(getRegularTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { @@ -42137,9 +42601,9 @@ var ts; if (startInDeclarationContainer) { // When resolving the name of a declaration as a value, we need to start resolution // at a point outside of the declaration. - var parent_12 = reference.parent; - if (ts.isDeclaration(parent_12) && reference === parent_12.name) { - location = getDeclarationContainer(parent_12); + var parent_11 = reference.parent; + if (ts.isDeclaration(parent_11) && reference === parent_11.name) { + location = getDeclarationContainer(parent_11); } } return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -42268,9 +42732,9 @@ var ts; // external modules cannot define or contribute to type declaration files var current = symbol; while (true) { - var parent_13 = getParentOfSymbol(current); - if (parent_13) { - current = parent_13; + var parent_12 = getParentOfSymbol(current); + if (parent_12) { + current = parent_12; } else { break; @@ -42306,8 +42770,6 @@ var ts; } // Initialize global symbol table var augmentations; - var requestedExternalEmitHelpers = 0; - var firstFileRequestingExternalHelpers; for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { @@ -42328,15 +42790,6 @@ var ts; } } } - if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) { - var fileRequestedExternalEmitHelpers = file.flags & 64512 /* EmitHelperFlags */; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; - } - } - } } if (augmentations) { // merge module augmentations. @@ -42395,50 +42848,46 @@ var ts; var symbol = getGlobalSymbol("ReadonlyArray", 793064 /* Type */, /*diagnostic*/ undefined); globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; - // If we have specified that we are importing helpers, we should report global - // errors if we cannot resolve the helpers external module, or if it does not have - // the necessary helpers exported. - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - // Find the first reference to the helpers module. - var helpersModule = resolveExternalModule(firstFileRequestingExternalHelpers, ts.externalHelpersModuleNameText, ts.Diagnostics.Cannot_find_module_0, - /*errorNode*/ undefined); - // If we found the module, report errors if it does not have the necessary exports. - if (helpersModule) { - var exports = helpersModule.exports; - if (requestedExternalEmitHelpers & 1024 /* HasClassExtends */ && languageVersion < 2 /* ES2015 */) { - verifyHelperSymbol(exports, "__extends", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 16384 /* HasSpreadAttribute */ && - (languageVersion < 5 /* ESNext */ || compilerOptions.jsx === 2 /* React */)) { - verifyHelperSymbol(exports, "__assign", 107455 /* Value */); - } - if (languageVersion < 5 /* ESNext */ && requestedExternalEmitHelpers & 32768 /* HasRestAttribute */) { - verifyHelperSymbol(exports, "__rest", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 2048 /* HasDecorators */) { - verifyHelperSymbol(exports, "__decorate", 107455 /* Value */); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports, "__metadata", 107455 /* Value */); - } - } - if (requestedExternalEmitHelpers & 4096 /* HasParamDecorators */) { - verifyHelperSymbol(exports, "__param", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 8192 /* HasAsyncFunctions */) { - verifyHelperSymbol(exports, "__awaiter", 107455 /* Value */); - if (languageVersion < 2 /* ES2015 */) { - verifyHelperSymbol(exports, "__generator", 107455 /* Value */); + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1 /* FirstEmitHelper */; helper <= 128 /* LastEmitHelper */; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name_27 = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_27), 107455 /* Value */); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_27); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols, name, meaning) { - var symbol = getSymbol(symbols, ts.escapeIdentifier(name), meaning); - if (!symbol) { - error(/*location*/ undefined, ts.Diagnostics.Module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + function getHelperName(helper) { + switch (helper) { + case 1 /* Extends */: return "__extends"; + case 2 /* Assign */: return "__assign"; + case 4 /* Rest */: return "__rest"; + case 8 /* Decorate */: return "__decorate"; + case 16 /* Metadata */: return "__metadata"; + case 32 /* Param */: return "__param"; + case 64 /* Awaiter */: return "__awaiter"; + case 128 /* Generator */: return "__generator"; } } + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; + } + return externalHelpersModule; + } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); if (promiseLikeType !== emptyGenericType) { @@ -43120,6 +43569,9 @@ var ts; else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128 /* Abstract */)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128 /* Abstract */) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } @@ -43577,19 +44029,24 @@ var ts; function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } + function reduceNodeArray(nodes, f, initial) { + return nodes ? f(initial, nodes) : initial; + } /** * Similar to `reduceLeft`, performs a reduction against each child of a node. * NOTE: Unlike `forEachChild`, this does *not* visit every node. Only nodes added to the * `nodeEdgeTraversalMap` above will be visited. * * @param node The node containing the children to reduce. - * @param f The callback function * @param initial The initial value to supply to the reduction. + * @param f The callback function */ - function reduceEachChild(node, f, initial) { + function reduceEachChild(node, initial, cbNode, cbNodeArray) { if (node === undefined) { return initial; } + var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; + var cbNodes = cbNodeArray || cbNode; var kind = node.kind; // No need to visit nodes with no children. if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { @@ -43606,114 +44063,114 @@ var ts; case 206 /* EmptyStatement */: case 198 /* OmittedExpression */: case 222 /* DebuggerStatement */: - case 292 /* NotEmittedStatement */: + case 293 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names case 142 /* ComputedPropertyName */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; // Signature elements case 144 /* Parameter */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 145 /* Decorator */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; // Type member case 147 /* PropertyDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 149 /* MethodDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 150 /* Constructor */: - result = ts.reduceLeft(node.modifiers, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); break; case 151 /* GetAccessor */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 152 /* SetAccessor */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); break; // Binding patterns case 172 /* ObjectBindingPattern */: case 173 /* ArrayBindingPattern */: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 174 /* BindingElement */: - result = reduceNode(node.propertyName, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; // Expression case 175 /* ArrayLiteralExpression */: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 176 /* ObjectLiteralExpression */: - result = ts.reduceLeft(node.properties, f, result); + result = reduceNodes(node.properties, cbNodes, result); break; case 177 /* PropertyAccessExpression */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.name, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 178 /* ElementAccessExpression */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.argumentExpression, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.argumentExpression, cbNode, result); break; case 179 /* CallExpression */: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); - result = ts.reduceLeft(node.arguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); break; case 180 /* NewExpression */: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); - result = ts.reduceLeft(node.arguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); break; case 181 /* TaggedTemplateExpression */: - result = reduceNode(node.tag, f, result); - result = reduceNode(node.template, f, result); + result = reduceNode(node.tag, cbNode, result); + result = reduceNode(node.template, cbNode, result); break; case 184 /* FunctionExpression */: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 185 /* ArrowFunction */: - result = ts.reduceLeft(node.modifiers, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 183 /* ParenthesizedExpression */: case 186 /* DeleteExpression */: @@ -43723,212 +44180,212 @@ var ts; case 195 /* YieldExpression */: case 196 /* SpreadElement */: case 201 /* NonNullExpression */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 190 /* PrefixUnaryExpression */: case 191 /* PostfixUnaryExpression */: - result = reduceNode(node.operand, f, result); + result = reduceNode(node.operand, cbNode, result); break; case 192 /* BinaryExpression */: - result = reduceNode(node.left, f, result); - result = reduceNode(node.right, f, result); + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); break; case 193 /* ConditionalExpression */: - result = reduceNode(node.condition, f, result); - result = reduceNode(node.whenTrue, f, result); - result = reduceNode(node.whenFalse, f, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.whenTrue, cbNode, result); + result = reduceNode(node.whenFalse, cbNode, result); break; case 194 /* TemplateExpression */: - result = reduceNode(node.head, f, result); - result = ts.reduceLeft(node.templateSpans, f, result); + result = reduceNode(node.head, cbNode, result); + result = reduceNodes(node.templateSpans, cbNodes, result); break; case 197 /* ClassExpression */: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.heritageClauses, f, result); - result = ts.reduceLeft(node.members, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); break; case 199 /* ExpressionWithTypeArguments */: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); break; // Misc case 202 /* TemplateSpan */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.literal, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); break; // Element case 204 /* Block */: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 205 /* VariableStatement */: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.declarationList, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.declarationList, cbNode, result); break; case 207 /* ExpressionStatement */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 208 /* IfStatement */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.thenStatement, f, result); - result = reduceNode(node.elseStatement, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.thenStatement, cbNode, result); + result = reduceNode(node.elseStatement, cbNode, result); break; case 209 /* DoStatement */: - result = reduceNode(node.statement, f, result); - result = reduceNode(node.expression, f, result); + result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 210 /* WhileStatement */: case 217 /* WithStatement */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 211 /* ForStatement */: - result = reduceNode(node.initializer, f, result); - result = reduceNode(node.condition, f, result); - result = reduceNode(node.incrementor, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.incrementor, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 212 /* ForInStatement */: case 213 /* ForOfStatement */: - result = reduceNode(node.initializer, f, result); - result = reduceNode(node.expression, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 216 /* ReturnStatement */: case 220 /* ThrowStatement */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 218 /* SwitchStatement */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.caseBlock, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.caseBlock, cbNode, result); break; case 219 /* LabeledStatement */: - result = reduceNode(node.label, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.label, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 221 /* TryStatement */: - result = reduceNode(node.tryBlock, f, result); - result = reduceNode(node.catchClause, f, result); - result = reduceNode(node.finallyBlock, f, result); + result = reduceNode(node.tryBlock, cbNode, result); + result = reduceNode(node.catchClause, cbNode, result); + result = reduceNode(node.finallyBlock, cbNode, result); break; case 223 /* VariableDeclaration */: - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 224 /* VariableDeclarationList */: - result = ts.reduceLeft(node.declarations, f, result); + result = reduceNodes(node.declarations, cbNodes, result); break; case 225 /* FunctionDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 226 /* ClassDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.heritageClauses, f, result); - result = ts.reduceLeft(node.members, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); break; case 232 /* CaseBlock */: - result = ts.reduceLeft(node.clauses, f, result); + result = reduceNodes(node.clauses, cbNodes, result); break; case 235 /* ImportDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.importClause, f, result); - result = reduceNode(node.moduleSpecifier, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.importClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); break; case 236 /* ImportClause */: - result = reduceNode(node.name, f, result); - result = reduceNode(node.namedBindings, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); break; case 237 /* NamespaceImport */: - result = reduceNode(node.name, f, result); + result = reduceNode(node.name, cbNode, result); break; case 238 /* NamedImports */: case 242 /* NamedExports */: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 239 /* ImportSpecifier */: case 243 /* ExportSpecifier */: - result = reduceNode(node.propertyName, f, result); - result = reduceNode(node.name, f, result); + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 240 /* ExportAssignment */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.expression, f, result); + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 241 /* ExportDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.exportClause, f, result); - result = reduceNode(node.moduleSpecifier, f, result); + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.exportClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); break; // JSX case 246 /* JsxElement */: - result = reduceNode(node.openingElement, f, result); - result = ts.reduceLeft(node.children, f, result); - result = reduceNode(node.closingElement, f, result); + result = reduceNode(node.openingElement, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingElement, cbNode, result); break; case 247 /* JsxSelfClosingElement */: case 248 /* JsxOpeningElement */: - result = reduceNode(node.tagName, f, result); - result = ts.reduceLeft(node.attributes, f, result); + result = reduceNode(node.tagName, cbNode, result); + result = reduceNodes(node.attributes, cbNodes, result); break; case 249 /* JsxClosingElement */: - result = reduceNode(node.tagName, f, result); + result = reduceNode(node.tagName, cbNode, result); break; case 250 /* JsxAttribute */: - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 251 /* JsxSpreadAttribute */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 252 /* JsxExpression */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; // Clauses case 253 /* CaseClause */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); // fall-through case 254 /* DefaultClause */: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 255 /* HeritageClause */: - result = ts.reduceLeft(node.types, f, result); + result = reduceNodes(node.types, cbNodes, result); break; case 256 /* CatchClause */: - result = reduceNode(node.variableDeclaration, f, result); - result = reduceNode(node.block, f, result); + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); break; // Property assignments case 257 /* PropertyAssignment */: - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 258 /* ShorthandPropertyAssignment */: - result = reduceNode(node.name, f, result); - result = reduceNode(node.objectAssignmentInitializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; case 259 /* SpreadAssignment */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; // Top-level nodes case 261 /* SourceFile */: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; - case 293 /* PartiallyEmittedExpression */: - result = reduceNode(node.expression, f, result); + case 294 /* PartiallyEmittedExpression */: + result = reduceNode(node.expression, cbNode, result); break; default: var edgeTraversalPath = nodeEdgeTraversalMap[kind]; @@ -43938,8 +44395,8 @@ var ts; var value = node[edge.name]; if (value !== undefined) { result = ts.isArray(value) - ? ts.reduceLeft(value, f, result) - : f(result, value); + ? reduceNodes(value, cbNodes, result) + : cbNode(result, value); } } } @@ -43949,8 +44406,8 @@ var ts; } ts.reduceEachChild = reduceEachChild; function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { - if (node === undefined) { - return undefined; + if (node === undefined || visitor === undefined) { + return node; } aggregateTransformFlags(node); var visited = visitor(node); @@ -44034,6 +44491,43 @@ var ts; return updated || nodes; } ts.visitNodes = visitNodes; + /** + * Starts a new lexical environment and visits a statement list, ending the lexical environment + * and merging hoisted declarations upon completion. + */ + function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) { + context.startLexicalEnvironment(); + statements = visitNodes(statements, visitor, ts.isStatement, start); + if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { + statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements); + } + var declarations = context.endLexicalEnvironment(); + return ts.createNodeArray(ts.concatenate(statements, declarations), statements); + } + ts.visitLexicalEnvironment = visitLexicalEnvironment; + /** + * Starts a new lexical environment and visits a parameter list, suspending the lexical + * environment upon completion. + */ + function visitParameterList(nodes, visitor, context) { + context.startLexicalEnvironment(); + var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration); + context.suspendLexicalEnvironment(); + return updated; + } + ts.visitParameterList = visitParameterList; + function visitFunctionBody(node, visitor, context) { + context.resumeLexicalEnvironment(); + var updated = visitNode(node, visitor, ts.isConciseBody); + var declarations = context.endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(updated); + var statements = mergeLexicalEnvironment(block.statements, declarations); + return ts.updateBlock(block, statements); + } + return updated; + } + ts.visitFunctionBody = visitFunctionBody; function visitEachChild(node, visitor, context) { if (node === undefined) { return undefined; @@ -44059,25 +44553,25 @@ var ts; return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); // Signature elements case 144 /* Parameter */: - return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); + return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); // Type member case 147 /* PropertyDeclaration */: return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); case 149 /* MethodDeclaration */: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); case 150 /* Constructor */: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 151 /* GetAccessor */: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); case 152 /* SetAccessor */: - return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); // Binding patterns case 172 /* ObjectBindingPattern */: return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 173 /* ArrayBindingPattern */: return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); case 174 /* BindingElement */: - return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); + return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); // Expression case 175 /* ArrayLiteralExpression */: return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); @@ -44096,9 +44590,9 @@ var ts; case 183 /* ParenthesizedExpression */: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 184 /* FunctionExpression */: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); case 185 /* ArrowFunction */: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); case 186 /* DeleteExpression */: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 187 /* TypeOfExpression */: @@ -44168,7 +44662,7 @@ var ts; case 224 /* VariableDeclarationList */: return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 225 /* FunctionDeclaration */: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); case 226 /* ClassDeclaration */: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); case 232 /* CaseBlock */: @@ -44224,10 +44718,9 @@ var ts; return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Top-level nodes case 261 /* SourceFile */: - context.startLexicalEnvironment(); - return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements)); + return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 293 /* PartiallyEmittedExpression */: + case 294 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; @@ -44256,6 +44749,15 @@ var ts; // return node; } ts.visitEachChild = visitEachChild; + function mergeLexicalEnvironment(statements, declarations) { + if (!ts.some(declarations)) { + return statements; + } + return ts.isNodeArray(statements) + ? ts.createNodeArray(ts.concatenate(statements, declarations), statements) + : ts.addRange(statements, declarations); + } + ts.mergeLexicalEnvironment = mergeLexicalEnvironment; function mergeFunctionBodyLexicalEnvironment(body, declarations) { if (body && declarations !== undefined && declarations.length > 0) { if (ts.isBlock(body)) { @@ -44308,13 +44810,25 @@ var ts; if (node === undefined) { return 0 /* None */; } - else if (node.transformFlags & 536870912 /* HasComputedFlags */) { + if (node.transformFlags & 536870912 /* HasComputedFlags */) { return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind); } - else { - var subtreeFlags = aggregateTransformFlagsForSubtree(node); - return ts.computeTransformFlagsForNode(node, subtreeFlags); + var subtreeFlags = aggregateTransformFlagsForSubtree(node); + return ts.computeTransformFlagsForNode(node, subtreeFlags); + } + function aggregateTransformFlagsForNodeArray(nodes) { + if (nodes === undefined) { + return 0 /* None */; } + var subtreeFlags = 0 /* None */; + var nodeArrayFlags = 0 /* None */; + for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { + var node = nodes_3[_i]; + subtreeFlags |= aggregateTransformFlagsForNode(node); + nodeArrayFlags |= node.transformFlags & ~536870912 /* HasComputedFlags */; + } + nodes.transformFlags = nodeArrayFlags | 536870912 /* HasComputedFlags */; + return subtreeFlags; } /** * Aggregates the transform flags for the subtree of a node. @@ -44326,14 +44840,17 @@ var ts; return 0 /* None */; } // Aggregate the transform flags of each child. - return reduceEachChild(node, aggregateTransformFlagsForChildNode, 0 /* None */); + return reduceEachChild(node, 0 /* None */, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); } /** * Aggregates the TransformFlags of a child node with the TransformFlags of its * siblings. */ - function aggregateTransformFlagsForChildNode(transformFlags, child) { - return transformFlags | aggregateTransformFlagsForNode(child); + function aggregateTransformFlagsForChildNode(transformFlags, node) { + return transformFlags | aggregateTransformFlagsForNode(node); + } + function aggregateTransformFlagsForChildNodes(transformFlags, nodes) { + return transformFlags | aggregateTransformFlagsForNodeArray(nodes); } var Debug; (function (Debug) { @@ -44343,9 +44860,21 @@ var ts; Debug.failBadSyntaxKind = Debug.shouldAssert(1 /* Normal */) ? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); } : ts.noop; + Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */) + ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }); } + : ts.noop; Debug.assertNode = Debug.shouldAssert(1 /* Normal */) ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); } : ts.noop; + Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */) + ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); } + : ts.noop; + Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */) + ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }); } + : ts.noop; + Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */) + ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }); } + : ts.noop; function getFunctionName(func) { if (typeof func !== "function") { return ""; @@ -44367,504 +44896,348 @@ var ts; /*@internal*/ var ts; (function (ts) { + var FlattenLevel; + (function (FlattenLevel) { + FlattenLevel[FlattenLevel["All"] = 0] = "All"; + FlattenLevel[FlattenLevel["ObjectRest"] = 1] = "ObjectRest"; + })(FlattenLevel = ts.FlattenLevel || (ts.FlattenLevel = {})); /** - * Flattens a destructuring assignment expression. + * Flattens a DestructuringAssignment or a VariableDeclaration to an expression. * - * @param root The destructuring assignment expression. - * @param needsValue Indicates whether the value from the right-hand-side of the - * destructuring assignment is needed as part of a larger expression. - * @param recordTempVariable A callback used to record new temporary variables. - * @param visitor An optional visitor to use to visit expressions. + * @param node The node to flatten. + * @param visitor An optional visitor used to visit initializers. + * @param context The transformation context. + * @param level Indicates the extent to which flattening should occur. + * @param needsValue An optional value indicating whether the value from the right-hand-side of + * the destructuring assignment is needed as part of a larger expression. + * @param createAssignmentCallback An optional callback used to create the assignment expression. */ - function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) { - if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { - var right = node.right; - if (ts.isDestructuringAssignment(right)) { - return flattenDestructuringAssignment(context, right, needsValue, recordTempVariable, visitor); - } - else { - return node.right; - } - } + function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) { var location = node; - var value = node.right; - var expressions = []; - if (needsValue) { - // If the right-hand value of the destructuring assignment needs to be preserved (as - // is the case when the destructuring assignmen) is part of a larger expression), - // then we need to cache the right-hand value. - // - // The source map location for the assignment should point to the entire binary - // expression. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment, visitor); + var value; + if (ts.isDestructuringAssignment(node)) { + value = node.right; + while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { + if (ts.isDestructuringAssignment(value)) { + location = node = value; + value = node.right; + } + else { + return value; + } + } } - else if (ts.nodeIsSynthesized(node)) { - // Generally, the source map location for a destructuring assignment is the root - // expression. - // - // However, if the root expression is synthesized (as in the case - // of the initializer when transforming a ForOfStatement), then the source map - // location should point to the right-hand value of the expression. - location = value; + var expressions; + var flattenContext = { + context: context, + level: level, + hoistTempVariables: true, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern, + createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern, + createArrayBindingOrAssignmentElement: makeAssignmentElement, + visitor: visitor + }; + if (value) { + value = ts.visitNode(value, visitor, ts.isExpression); + if (needsValue) { + // If the right-hand value of the destructuring assignment needs to be preserved (as + // is the case when the destructuring assignment is part of a larger expression), + // then we need to cache the right-hand value. + // + // The source map location for the assignment should point to the entire binary + // expression. + value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location); + } + else if (ts.nodeIsSynthesized(node)) { + // Generally, the source map location for a destructuring assignment is the root + // expression. + // + // However, if the root expression is synthesized (as in the case + // of the initializer when transforming a ForOfStatement), then the source map + // location should point to the right-hand value of the expression. + location = value; + } } - flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor); - if (needsValue) { + flattenBindingOrAssignmentElement(flattenContext, node, value, location, /*skipInitializer*/ ts.isDestructuringAssignment(node)); + if (value && needsValue) { + if (!ts.some(expressions)) { + return value; + } expressions.push(value); } - var expression = ts.inlineExpressions(expressions); - ts.aggregateTransformFlags(expression); - return expression; - function emitAssignment(name, value, location) { - var expression = ts.createAssignment(name, value, location); + return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression(); + function emitExpression(expression) { // NOTE: this completely disables source maps, but aligns with the behavior of // `emitAssignment` in the old emitter. - ts.setEmitFlags(expression, 2048 /* NoNestedSourceMaps */); + ts.setEmitFlags(expression, 64 /* NoNestedSourceMaps */); ts.aggregateTransformFlags(expression); - expressions.push(expression); + expressions = ts.append(expressions, expression); } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - emitAssignment(name, value, location); - return name; - } - function emitRestAssignment(elements, value, location) { - emitAssignment(ts.createObjectLiteral(elements), value, location); + function emitBindingOrAssignment(target, value, location, original) { + ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); + var expression = createAssignmentCallback + ? createAssignmentCallback(target, value, location) + : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location); + expression.original = original; + emitExpression(expression); } } ts.flattenDestructuringAssignment = flattenDestructuringAssignment; /** - * Flattens binding patterns in a parameter declaration. + * Flattens a VariableDeclaration or ParameterDeclaration to one or more variable declarations. * - * @param node The ParameterDeclaration to flatten. - * @param value The rhs value for the binding pattern. - * @param visitor An optional visitor to use to visit expressions. + * @param node The node to flatten. + * @param visitor An optional visitor used to visit initializers. + * @param context The transformation context. + * @param boundValue The value bound to the declaration. + * @param skipInitializer A value indicating whether to ignore the initializer of `node`. + * @param hoistTempVariables Indicates whether temporary variables should not be recorded in-line. + * @param level Indicates the extent to which flattening should occur. */ - function flattenParameterDestructuring(node, value, visitor, transformRest) { + function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) { + var pendingExpressions; + var pendingDeclarations = []; var declarations = []; - flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor); + var flattenContext = { + context: context, + level: level, + hoistTempVariables: hoistTempVariables, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayBindingPattern, + createObjectBindingOrAssignmentPattern: makeObjectBindingPattern, + createArrayBindingOrAssignmentElement: makeBindingElement, + visitor: visitor + }; + flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer); + if (pendingExpressions) { + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + if (hoistTempVariables) { + var value = ts.inlineExpressions(pendingExpressions); + pendingExpressions = undefined; + emitBindingOrAssignment(temp, value, /*location*/ undefined, /*original*/ undefined); + } + else { + context.hoistVariableDeclaration(temp); + var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations); + pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value)); + ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions); + pendingDeclaration.value = temp; + } + } + for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_30 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name_30, + /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + variable.original = original; + if (ts.isIdentifier(name_30)) { + ts.setEmitFlags(variable, 64 /* NoNestedSourceMaps */); + } + ts.aggregateTransformFlags(variable); + declarations.push(variable); + } return declarations; - function emitAssignment(name, value, location) { - var declaration = ts.createVariableDeclaration(name, /*type*/ undefined, value, location); - // NOTE: this completely disables source maps, but aligns with the behavior of - // `emitAssignment` in the old emitter. - ts.setEmitFlags(declaration, 2048 /* NoNestedSourceMaps */); - ts.aggregateTransformFlags(declaration); - declarations.push(declaration); + function emitExpression(value) { + pendingExpressions = ts.append(pendingExpressions, value); } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(/*recordTempVariable*/ undefined); - emitAssignment(name, value, location); - return name; - } - function emitRestAssignment(elements, value, location) { - emitAssignment(ts.createObjectBindingPattern(elements), value, location); + function emitBindingOrAssignment(target, value, location, original) { + ts.Debug.assertNode(target, ts.isBindingName); + if (pendingExpressions) { + value = ts.inlineExpressions(ts.append(pendingExpressions, value)); + pendingExpressions = undefined; + } + pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original }); } } - ts.flattenParameterDestructuring = flattenParameterDestructuring; + ts.flattenDestructuringBinding = flattenDestructuringBinding; /** - * Flattens binding patterns in a variable declaration. + * Flattens a BindingOrAssignmentElement into zero or more bindings or assignments. * - * @param node The VariableDeclaration to flatten. - * @param value An optional rhs value for the binding pattern. - * @param visitor An optional visitor to use to visit expressions. + * @param flattenContext Options used to control flattening. + * @param element The element to flatten. + * @param value The current RHS value to assign to the element. + * @param location The location to use for source maps and comments. + * @param skipInitializer An optional value indicating whether to include the initializer + * for the element. */ - function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) { - var declarations = []; - var pendingAssignments; - flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor); - return declarations; - function emitAssignment(name, value, location, original) { - if (pendingAssignments) { - pendingAssignments.push(value); - value = ts.inlineExpressions(pendingAssignments); - pendingAssignments = undefined; - } - var declaration = ts.createVariableDeclaration(name, /*type*/ undefined, value, location); - declaration.original = original; - // NOTE: this completely disables source maps, but aligns with the behavior of - // `emitAssignment` in the old emitter. - ts.setEmitFlags(declaration, 2048 /* NoNestedSourceMaps */); - declarations.push(declaration); - ts.aggregateTransformFlags(declaration); - } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - if (recordTempVariable) { - var assignment = ts.createAssignment(name, value, location); - if (pendingAssignments) { - pendingAssignments.push(assignment); - } - else { - pendingAssignments = [assignment]; - } - } - else { - emitAssignment(name, value, location, /*original*/ undefined); - } - return name; - } - function emitRestAssignment(elements, value, location, original) { - emitAssignment(ts.createObjectBindingPattern(elements), value, location, original); - } - } - ts.flattenVariableDestructuring = flattenVariableDestructuring; - /** - * Flattens binding patterns in a variable declaration and transforms them into an expression. - * - * @param node The VariableDeclaration to flatten. - * @param recordTempVariable A callback used to record new temporary variables. - * @param createAssignmentCallback An optional callback used to create assignment expressions - * for non-temporary variables. - * @param visitor An optional visitor to use to visit expressions. - */ - function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) { - var pendingAssignments = []; - flattenDestructuring(node, /*value*/ undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, /*transformRest*/ false, visitor); - var expression = ts.inlineExpressions(pendingAssignments); - ts.aggregateTransformFlags(expression); - return expression; - function emitAssignment(name, value, location, original) { - var expression = createAssignmentCallback - ? createAssignmentCallback(name.kind === 70 /* Identifier */ ? name : emitTempVariableAssignment(name, location), value, location) - : ts.createAssignment(name, value, location); - emitPendingAssignment(expression, original); - } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - emitPendingAssignment(ts.createAssignment(name, value, location), /*original*/ undefined); - return name; - } - function emitRestAssignment(elements, value, location, original) { - emitAssignment(ts.createObjectLiteral(elements), value, location, original); - } - function emitPendingAssignment(expression, original) { - expression.original = original; - // NOTE: this completely disables source maps, but aligns with the behavior of - // `emitAssignment` in the old emitter. - ts.setEmitFlags(expression, 2048 /* NoNestedSourceMaps */); - pendingAssignments.push(expression); - } - } - ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression; - function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) { - if (value && visitor) { - value = ts.visitNode(value, visitor, ts.isExpression); - } - if (ts.isBinaryExpression(root)) { - emitDestructuringAssignment(root.left, value, location); - } - else { - emitBindingElement(root, value); - } - function emitDestructuringAssignment(bindingTarget, value, location) { - // When emitting target = value use source map node to highlight, including any temporary assignments needed for this - var target; - if (ts.isShorthandPropertyAssignment(bindingTarget)) { - var initializer = visitor - ? ts.visitNode(bindingTarget.objectAssignmentInitializer, visitor, ts.isExpression) - : bindingTarget.objectAssignmentInitializer; - if (initializer) { - value = createDefaultValueCheck(value, initializer, location); - } - target = bindingTarget.name; - } - else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57 /* EqualsToken */) { - var initializer = visitor - ? ts.visitNode(bindingTarget.right, visitor, ts.isExpression) - : bindingTarget.right; - value = createDefaultValueCheck(value, initializer, location); - target = bindingTarget.left; - } - else { - target = bindingTarget; - } - if (target.kind === 176 /* ObjectLiteralExpression */) { - emitObjectLiteralAssignment(target, value, location); - } - else if (target.kind === 175 /* ArrayLiteralExpression */) { - emitArrayLiteralAssignment(target, value, location); - } - else { - var name_30 = ts.getMutableClone(target); - ts.setSourceMapRange(name_30, target); - ts.setCommentRange(name_30, target); - emitAssignment(name_30, value, location, /*original*/ undefined); - } - } - function emitObjectLiteralAssignment(target, value, location) { - var properties = target.properties; - if (properties.length !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - // When doing so we want to hightlight the passed in source map node since thats the one needing this temp assignment - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment); - } - var bindingElements = []; - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; - if (p.kind === 257 /* PropertyAssignment */ || p.kind === 258 /* ShorthandPropertyAssignment */) { - if (!transformRest || - p.transformFlags & 8388608 /* ContainsSpreadExpression */ || - (p.kind === 257 /* PropertyAssignment */ && p.initializer.transformFlags & 8388608 /* ContainsSpreadExpression */)) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - var propName = p.name; - var bindingTarget = p.kind === 258 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; - // Assignment for bindingTarget = value.propName should highlight whole property, hence use p as source map node - emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p); - } - else { - bindingElements.push(p); - } - } - else if (i === properties.length - 1 && - p.kind === 259 /* SpreadAssignment */ && - p.expression.kind === 70 /* Identifier */) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - var propName = p.expression; - var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target); - emitDestructuringAssignment(propName, restCall, p); - } - } - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - } - function emitArrayLiteralAssignment(target, value, location) { - if (transformRest) { - emitESNextArrayLiteralAssignment(target, value, location); - } - else { - emitES2015ArrayLiteralAssignment(target, value, location); - } - } - function emitESNextArrayLiteralAssignment(target, value, location) { - var elements = target.elements; - var numElements = elements.length; - if (numElements !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - // When doing so we want to highlight the passed-in source map node since thats the one needing this temp assignment - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment); - } - var expressions = []; - var spreadContainingExpressions = []; - for (var i = 0; i < numElements; i++) { - var e = elements[i]; - if (e.kind === 198 /* OmittedExpression */) { - continue; - } - if (e.transformFlags & 8388608 /* ContainsSpreadExpression */ && i < numElements - 1) { - var tmp = ts.createTempVariable(recordTempVariable); - spreadContainingExpressions.push([e, tmp]); - expressions.push(tmp); - } - else { - expressions.push(e); - } - } - emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined); - for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) { - var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1]; - emitDestructuringAssignment(e, tmp, e); - } - } - function emitES2015ArrayLiteralAssignment(target, value, location) { - var elements = target.elements; - var numElements = elements.length; - if (numElements !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - // When doing so we want to highlight the passed-in source map node since thats the one needing this temp assignment - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment); - } - for (var i = 0; i < numElements; i++) { - var e = elements[i]; - if (e.kind !== 198 /* OmittedExpression */) { - // Assignment for target = value.propName should highligh whole property, hence use e as source map node - if (e.kind !== 196 /* SpreadElement */) { - emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e); - } - else if (i === numElements - 1) { - emitDestructuringAssignment(e.expression, ts.createArraySlice(value, i), e); - } - } - } - } - /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement - * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/ - function createRestCall(value, elements, getPropertyName, location) { - var propertyNames = []; - for (var i = 0; i < elements.length - 1; i++) { - if (ts.isOmittedExpression(elements[i])) { - continue; - } - var str = ts.createSynthesizedNode(9 /* StringLiteral */); - str.pos = location.pos; - str.end = location.end; - str.text = ts.getTextOfPropertyName(getPropertyName(elements[i])); - propertyNames.push(str); - } - var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]); - return ts.createCall(ts.createIdentifier("__rest"), undefined, args); - } - function emitBindingElement(target, value) { - // Any temporary assignments needed to emit target = value should point to target - var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer; - if (transformRest) { - value = value || initializer; - } - else if (initializer) { + function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) { + if (!skipInitializer) { + var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression); + if (initializer) { // Combine value and initializer - value = value ? createDefaultValueCheck(value, initializer, target) : initializer; + value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer; } else if (!value) { // Use 'void 0' in absence of value and initializer value = ts.createVoidZero(); } - var name = target.name; - if (!ts.isBindingPattern(name)) { - emitAssignment(name, value, target, target); - } - else { - var numElements = name.elements.length; - if (numElements !== 1) { - // For anything other than a single-element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. Additionally, if we have zero elements - // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, - // so in that case, we'll intentionally create that temporary. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0, target, emitTempVariableAssignment); - } - if (name.kind === 173 /* ArrayBindingPattern */) { - emitArrayBindingElement(name, value); + } + var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element); + if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) { + flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) { + flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else { + flattenContext.emitBindingOrAssignment(bindingTarget, value, location, /*original*/ element); + } + } + /** + * Flattens an ObjectBindingOrAssignmentPattern into zero or more bindings or assignments. + * + * @param flattenContext Options used to control flattening. + * @param parent The parent element of the pattern. + * @param pattern The ObjectBindingOrAssignmentPattern to flatten. + * @param value The current RHS value to assign to the element. + * @param location The location to use for source maps and comments. + */ + function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1) { + // For anything other than a single-element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. Additionally, if we have zero elements + // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, + // so in that case, we'll intentionally create that temporary. + var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var computedTempVariables; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element); + if (flattenContext.level >= 1 /* ObjectRest */ + && !(element.transformFlags & (524288 /* ContainsRest */ | 1048576 /* ContainsObjectRest */)) + && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 /* ContainsRest */ | 1048576 /* ContainsObjectRest */)) + && !ts.isComputedPropertyName(propertyName)) { + bindingElements = ts.append(bindingElements, element); } else { - emitObjectBindingElement(target, value); - } - } - } - function emitArrayBindingElement(name, value) { - if (transformRest) { - emitESNextArrayBindingElement(name, value); - } - else { - emitES2015ArrayBindingElement(name, value); - } - } - function emitES2015ArrayBindingElement(name, value) { - var elements = name.elements; - var numElements = elements.length; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (!element.dotDotDotToken) { - // Rewrite element to a declaration that accesses array element at index i - emitBindingElement(element, ts.createElementAccess(value, i)); - } - else if (i === numElements - 1) { - emitBindingElement(element, ts.createArraySlice(value, i)); - } - } - } - function emitESNextArrayBindingElement(name, value) { - var elements = name.elements; - var numElements = elements.length; - var bindingElements = []; - var spreadContainingElements = []; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (element.transformFlags & 8388608 /* ContainsSpreadExpression */ && i < numElements - 1) { - spreadContainingElements.push(element); - bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value)); - } - else { - bindingElements.push(element); - } - } - emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined); - for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) { - var element = spreadContainingElements_1[_i]; - emitBindingElement(element, ts.getGeneratedNameForNode(element)); - } - } - function emitObjectBindingElement(target, value) { - var name = target.name; - var elements = name.elements; - var numElements = elements.length; - var bindingElements = []; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (i === numElements - 1 && element.dotDotDotToken) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; } - var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name); - emitBindingElement(element, restCall); - } - else if (transformRest && !(element.transformFlags & 8388608 /* ContainsSpreadExpression */)) { - // do not emit until we have a complete bundle of ES2015 syntax - bindingElements.push(element); - } - else { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName); + if (ts.isComputedPropertyName(propertyName)) { + computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression); } - // Rewrite element to a declaration with an initializer that fetches property - var propName = element.propertyName || element.name; - emitBindingElement(element, createDestructuringPropertyAccess(value, propName)); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element); } } - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + else if (i === numElements - 1) { + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; + } + var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); } } - function createDefaultValueCheck(value, defaultValue, location) { - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment); - return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54 /* QuestionToken */), defaultValue, ts.createToken(55 /* ColonToken */), value); + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); } - /** - * Creates either a PropertyAccessExpression or an ElementAccessExpression for the - * right-hand side of a transformed destructuring assignment. - * - * @param expression The right-hand expression that is the source of the property. - * @param propertyName The destructuring property name. - */ - function createDestructuringPropertyAccess(expression, propertyName) { - if (ts.isComputedPropertyName(propertyName)) { - return ts.createElementAccess(expression, ensureIdentifier(propertyName.expression, /*reuseIdentifierExpressions*/ false, /*location*/ propertyName, emitTempVariableAssignment)); - } - else if (ts.isLiteralExpression(propertyName)) { - var clone_2 = ts.getSynthesizedClone(propertyName); - clone_2.text = ts.unescapeIdentifier(clone_2.text); - return ts.createElementAccess(expression, clone_2); - } - else { - if (ts.isGeneratedIdentifier(propertyName)) { - var clone_3 = ts.getSynthesizedClone(propertyName); - clone_3.text = ts.unescapeIdentifier(clone_3.text); - return ts.createPropertyAccess(expression, clone_3); + } + /** + * Flattens an ArrayBindingOrAssignmentPattern into zero or more bindings or assignments. + * + * @param flattenContext Options used to control flattening. + * @param parent The parent element of the pattern. + * @param pattern The ArrayBindingOrAssignmentPattern to flatten. + * @param value The current RHS value to assign to the element. + * @param location The location to use for source maps and comments. + */ + function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1 && (flattenContext.level < 1 /* ObjectRest */ || numElements === 0)) { + // For anything other than a single-element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. Additionally, if we have zero elements + // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, + // so in that case, we'll intentionally create that temporary. + var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var restContainingElements; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (flattenContext.level >= 1 /* ObjectRest */) { + // If an array pattern contains an ObjectRest, we must cache the result so that we + // can perform the ObjectRest destructuring in a different declaration + if (element.transformFlags & 1048576 /* ContainsObjectRest */) { + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + } + restContainingElements = ts.append(restContainingElements, [temp, element]); + bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp)); } else { - return ts.createPropertyAccess(expression, ts.createIdentifier(ts.unescapeIdentifier(propertyName.text))); + bindingElements = ts.append(bindingElements, element); } } + else if (ts.isOmittedExpression(element)) { + continue; + } + else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var rhsValue = ts.createElementAccess(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element); + } + else if (i === numElements - 1) { + var rhsValue = ts.createArraySlice(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element); + } + } + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern); + } + if (restContainingElements) { + for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) { + var _a = restContainingElements_1[_i], id = _a[0], element = _a[1]; + flattenBindingOrAssignmentElement(flattenContext, element, id, element); + } + } + } + /** + * Creates an expression used to provide a default value if a value is `undefined` at runtime. + * + * @param flattenContext Options used to control flattening. + * @param value The RHS value to test. + * @param defaultValue The default value to use if `value` is `undefined` at runtime. + * @param location The location to use for source maps and comments. + */ + function createDefaultValueCheck(flattenContext, value, defaultValue, location) { + value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location); + return ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value); + } + /** + * Creates either a PropertyAccessExpression or an ElementAccessExpression for the + * right-hand side of a transformed destructuring assignment. + * + * @link https://tc39.github.io/ecma262/#sec-runtime-semantics-keyeddestructuringassignmentevaluation + * + * @param flattenContext Options used to control flattening. + * @param value The RHS value that is the source of the property. + * @param propertyName The destructuring property name. + */ + function createDestructuringPropertyAccess(flattenContext, value, propertyName) { + if (ts.isComputedPropertyName(propertyName)) { + var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, /*reuseIdentifierExpressions*/ false, /*location*/ propertyName); + return ts.createElementAccess(value, argumentExpression); + } + else if (ts.isStringOrNumericLiteral(propertyName)) { + var argumentExpression = ts.getSynthesizedClone(propertyName); + argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text); + return ts.createElementAccess(value, argumentExpression); + } + else { + var name_31 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name_31); } } /** @@ -44872,24 +45245,75 @@ var ts; * This function is useful to ensure that the expression's value can be read from in subsequent expressions. * Unless 'reuseIdentifierExpressions' is false, 'value' will be returned if it is just an identifier. * + * @param flattenContext Options used to control flattening. * @param value the expression whose value needs to be bound. * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; - * false if it is necessary to always emit an identifier. + * false if it is necessary to always emit an identifier. * @param location The location to use for source maps and comments. - * @param emitTempVariableAssignment A callback used to emit a temporary variable. - * @param visitor An optional callback used to visit the value. */ - function ensureIdentifier(value, reuseIdentifierExpressions, location, emitTempVariableAssignment, visitor) { + function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { if (ts.isIdentifier(value) && reuseIdentifierExpressions) { return value; } else { - if (visitor) { - value = ts.visitNode(value, visitor, ts.isExpression); + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + flattenContext.emitExpression(ts.createAssignment(temp, value, location)); } - return emitTempVariableAssignment(value, location); + else { + flattenContext.emitBindingOrAssignment(temp, value, location, /*original*/ undefined); + } + return temp; } } + function makeArrayBindingPattern(elements) { + ts.Debug.assertEachNode(elements, ts.isArrayBindingElement); + return ts.createArrayBindingPattern(elements); + } + function makeArrayAssignmentPattern(elements) { + return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement)); + } + function makeObjectBindingPattern(elements) { + ts.Debug.assertEachNode(elements, ts.isBindingElement); + return ts.createObjectBindingPattern(elements); + } + function makeObjectAssignmentPattern(elements) { + return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement)); + } + function makeBindingElement(name) { + return ts.createBindingElement(/*propertyName*/ undefined, /*dotDotDotToken*/ undefined, name); + } + function makeAssignmentElement(name) { + return name; + } + var restHelper = { + name: "typescript:rest", + scoped: false, + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + }; + /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement + * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/ + function createRestCall(context, value, elements, computedTempVariables, location) { + context.requestEmitHelper(restHelper); + var propertyNames = []; + var computedTempVariableOffset = 0; + for (var i = 0; i < elements.length - 1; i++) { + var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]); + if (propertyName) { + if (ts.isComputedPropertyName(propertyName)) { + var temp = computedTempVariables[computedTempVariableOffset]; + computedTempVariableOffset++; + // typeof _tmp === "symbol" ? _tmp : _tmp + "" + propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral("")))); + } + else { + propertyNames.push(ts.createLiteral(propertyName)); + } + } + } + return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + } })(ts || (ts = {})); /// /// @@ -44911,7 +45335,7 @@ var ts; TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NonQualifiedEnumMembers"] = 8] = "NonQualifiedEnumMembers"; })(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {})); function transformTypeScript(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); @@ -44931,7 +45355,6 @@ var ts; var currentNamespaceContainerName; var currentScope; var currentScopeFirstDeclarationsOfName; - var currentExternalHelpersModuleName; /** * Keeps track of whether expression substitution has been enabled for specific edge cases. * They are persisted between each SourceFile transformation and should not be reset. @@ -44957,7 +45380,11 @@ var ts; if (ts.isDeclarationFile(node)) { return node; } - return ts.visitNode(node, visitor, ts.isSourceFile); + currentSourceFile = node; + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } /** * Visits a node, saving and restoring state variables on the stack. @@ -44978,6 +45405,29 @@ var ts; currentScope = savedCurrentScope; return visited; } + /** + * Performs actions that should always occur immediately before visiting a node. + * + * @param node The node to visit. + */ + function onBeforeVisitNode(node) { + switch (node.kind) { + case 261 /* SourceFile */: + case 232 /* CaseBlock */: + case 231 /* ModuleBlock */: + case 204 /* Block */: + currentScope = node; + currentScopeFirstDeclarationsOfName = undefined; + break; + case 226 /* ClassDeclaration */: + case 225 /* FunctionDeclaration */: + if (ts.hasModifier(node, 2 /* Ambient */)) { + break; + } + recordEmittedDeclarationInScope(node); + break; + } + } /** * General-purpose node visitor. * @@ -44992,10 +45442,7 @@ var ts; * @param node The node to visit. */ function visitorWorker(node) { - if (node.kind === 261 /* SourceFile */) { - return visitSourceFile(node); - } - else if (node.transformFlags & 1 /* TypeScript */) { + if (node.transformFlags & 1 /* TypeScript */) { // This node is explicitly marked as TypeScript, so we should transform the node. return visitTypeScript(node); } @@ -45164,7 +45611,8 @@ var ts; case 228 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. case 147 /* PropertyDeclaration */: - // TypeScript property declarations are elided. + // TypeScript property declarations are elided. + return undefined; case 150 /* Constructor */: return visitConstructor(node); case 227 /* InterfaceDeclaration */: @@ -45265,67 +45713,9 @@ var ts; return ts.visitEachChild(node, visitor, context); } } - /** - * Performs actions that should always occur immediately before visiting a node. - * - * @param node The node to visit. - */ - function onBeforeVisitNode(node) { - switch (node.kind) { - case 261 /* SourceFile */: - case 232 /* CaseBlock */: - case 231 /* ModuleBlock */: - case 204 /* Block */: - currentScope = node; - currentScopeFirstDeclarationsOfName = undefined; - break; - case 226 /* ClassDeclaration */: - case 225 /* FunctionDeclaration */: - if (ts.hasModifier(node, 2 /* Ambient */)) { - break; - } - recordEmittedDeclarationInScope(node); - break; - } - } function visitSourceFile(node) { - currentSourceFile = node; - // ensure "use strict" is emitted in all scenarios in alwaysStrict mode - // There is no need to emit "use strict" in the following cases: - // 1. The file is an external module and target is es2015 or higher - // or 2. The file is an external module and module-kind is es6 or es2015 as such value is not allowed when targeting es5 or lower - if (compilerOptions.alwaysStrict && - !(ts.isExternalModule(node) && (compilerOptions.target >= 2 /* ES2015 */ || compilerOptions.module === ts.ModuleKind.ES2015))) { - node = ts.ensureUseStrict(node); - } - // If the source file requires any helpers and is an external module, and - // the importHelpers compiler option is enabled, emit a synthesized import - // statement for the helpers library. - if (node.flags & 64512 /* EmitHelperFlags */ - && compilerOptions.importHelpers - && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); - var externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText); - var externalHelpersModuleImport = ts.createImportDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); - externalHelpersModuleImport.parent = node; - externalHelpersModuleImport.flags &= ~8 /* Synthesized */; - statements.push(externalHelpersModuleImport); - currentExternalHelpersModuleName = externalHelpersModuleName; - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); - currentExternalHelpersModuleName = undefined; - node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); - node.externalHelpersModuleName = externalHelpersModuleName; - } - else { - node = ts.visitEachChild(node, sourceElementVisitor, context); - } - ts.setEmitFlags(node, 1 /* EmitEmitHelpers */ | ts.getEmitFlags(node)); - return node; + var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); + return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict)); } /** * Tests whether we should emit a __decorate call for a class declaration. @@ -45402,7 +45792,7 @@ var ts; if (statements.length > 1) { // Add a DeclarationMarker as a marker for the end of the declaration statements.push(ts.createEndOfDeclarationMarker(node)); - ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432 /* HasEndOfDeclarationMarker */); + ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152 /* HasEndOfDeclarationMarker */); } return ts.singleOrMany(statements); } @@ -45425,7 +45815,7 @@ var ts; // To better align with the old emitter, we should not emit a trailing source map // entry if the class has static properties. if (hasStaticProperties) { - emitFlags |= 1024 /* NoTrailingSourceMap */; + emitFlags |= 32 /* NoTrailingSourceMap */; } ts.setOriginalNode(classDeclaration, node); ts.setEmitFlags(classDeclaration, emitFlags); @@ -45570,7 +45960,7 @@ var ts; } // To preserve the behavior of the old emitter, we explicitly indent // the body of a class with static initializers. - ts.setEmitFlags(classExpression, 524288 /* Indented */ | ts.getEmitFlags(classExpression)); + ts.setEmitFlags(classExpression, 32768 /* Indented */ | ts.getEmitFlags(classExpression)); expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression))); ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp)); expressions.push(ts.startOnNewLine(temp)); @@ -45604,7 +45994,7 @@ var ts; // If there is a property assignment, we need to emit constructor whether users define it or not // If there is no property assignment, we can omit constructor if users do not define it var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty); - var hasParameterPropertyAssignments = node.transformFlags & 4194304 /* ContainsParameterPropertyAssignments */; + var hasParameterPropertyAssignments = node.transformFlags & 262144 /* ContainsParameterPropertyAssignments */; var constructor = ts.getFirstConstructorWithBody(node); // If the class does not contain nodes that require a synthesized constructor, // accept the current constructor if it exists. @@ -45644,9 +46034,8 @@ var ts; // downlevel the '...args' portion less efficiently by naively copying the contents of 'arguments' to an array. // Instead, we'll avoid using a rest parameter and spread into the super call as // 'super(...arguments)' instead of 'super(...args)', as you can see in "transformConstructorBody". - return constructor - ? ts.visitNodes(constructor.parameters, visitor, ts.isParameter) - : []; + return ts.visitParameterList(constructor && constructor.parameters, visitor, context) + || []; } /** * Transforms (or creates) a constructor body for a class with parameter property @@ -45659,8 +46048,7 @@ var ts; function transformConstructorBody(node, constructor, hasExtendsClause) { var statements = []; var indexOfFirstStatement = 0; - // The body of a constructor is a new lexical environment - startLexicalEnvironment(); + resumeLexicalEnvironment(); if (constructor) { indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements); // Add parameters with property assignments. Transforms this: @@ -45704,9 +46092,10 @@ var ts; } // End the lexical environment. ts.addRange(statements, endLexicalEnvironment()); - return ts.setMultiLine(ts.createBlock(ts.createNodeArray(statements, + return ts.createBlock(ts.createNodeArray(statements, /*location*/ constructor ? constructor.body.statements : node.members), - /*location*/ constructor ? constructor.body : undefined), true); + /*location*/ constructor ? constructor.body : undefined, + /*multiLine*/ true); } /** * Adds super call and preceding prologue directives into the list of statements. @@ -45758,9 +46147,9 @@ var ts; ts.Debug.assert(ts.isIdentifier(node.name)); var name = node.name; var propertyName = ts.getMutableClone(name); - ts.setEmitFlags(propertyName, 49152 /* NoComments */ | 1536 /* NoSourceMap */); + ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 48 /* NoSourceMap */); var localName = ts.getMutableClone(name); - ts.setEmitFlags(localName, 49152 /* NoComments */); + ts.setEmitFlags(localName, 1536 /* NoComments */); return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, /*location*/ node.name), localName), /*location*/ ts.moveRangePos(node, -1))); @@ -45808,8 +46197,8 @@ var ts; * @param receiver The receiver on which each property should be assigned. */ function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { - var property = properties_7[_i]; + for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { + var property = properties_8[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -45824,8 +46213,8 @@ var ts; */ function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { - var property = properties_8[_i]; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -45954,10 +46343,11 @@ var ts; return undefined; } var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; - if (accessor !== firstAccessor) { + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + var decorators = firstAccessorWithDecorators.decorators; var parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -45998,14 +46388,14 @@ var ts; * @param node The declaration node. * @param allDecorators An object containing all of the decorators for the declaration. */ - function transformAllDecoratorsOfDeclaration(node, allDecorators) { + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (!allDecorators) { return undefined; } var decoratorExpressions = []; ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } /** @@ -46052,7 +46442,7 @@ var ts; */ function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -46072,13 +46462,13 @@ var ts; // __metadata("design:type", Function), // __metadata("design:paramtypes", [Object]), // __metadata("design:returntype", void 0) - // ], C.prototype, "method", undefined); + // ], C.prototype, "method", null); // // The emit for an accessor is: // // __decorate([ // dec - // ], C.prototype, "accessor", undefined); + // ], C.prototype, "accessor", null); // // The emit for a property is: // @@ -46093,8 +46483,8 @@ var ts; ? ts.createVoidZero() : ts.createNull() : undefined; - var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); - ts.setEmitFlags(helper, 49152 /* NoComments */); + var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); + ts.setEmitFlags(helper, 1536 /* NoComments */); return helper; } /** @@ -46115,15 +46505,15 @@ var ts; */ function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)]; var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); - var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName); + var decorate = createDecorateHelper(context, decoratorExpressions, localName); var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate); - ts.setEmitFlags(expression, 49152 /* NoComments */); + ts.setEmitFlags(expression, 1536 /* NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node)); return expression; } @@ -46147,9 +46537,9 @@ var ts; expressions = []; for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) { var decorator = decorators_1[_i]; - var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset, + var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, /*location*/ decorator.expression); - ts.setEmitFlags(helper, 49152 /* NoComments */); + ts.setEmitFlags(helper, 1536 /* NoComments */); expressions.push(helper); } } @@ -46161,41 +46551,41 @@ var ts; * @param node The declaration node. * @param decoratorExpressions The destination array to which to add new decorator expressions. */ - function addTypeMetadata(node, decoratorExpressions) { + function addTypeMetadata(node, container, decoratorExpressions) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node, decoratorExpressions) { + function addOldTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } } } - function addNewTypeMetadata(node, decoratorExpressions) { + function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeReturnTypeOfNode(node)))); } if (properties) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true))); + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true))); } } } @@ -46231,12 +46621,16 @@ var ts; * @param node The node to test. */ function shouldAddParamTypesMetadata(node) { - var kind = node.kind; - return kind === 226 /* ClassDeclaration */ - || kind === 197 /* ClassExpression */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */; + switch (node.kind) { + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return true; + } + return false; } /** * Serializes the type of a node for use with decorator type metadata. @@ -46259,29 +46653,12 @@ var ts; return ts.createVoidZero(); } } - /** - * Gets the most likely element type for a TypeNode. This is not an exhaustive test - * as it assumes a rest argument can only be an array type (either T[], or Array). - * - * @param node The type node. - */ - function getRestParameterElementType(node) { - if (node && node.kind === 162 /* ArrayType */) { - return node.elementType; - } - else if (node && node.kind === 157 /* TypeReference */) { - return ts.singleOrUndefined(node.typeArguments); - } - else { - return undefined; - } - } /** * Serializes the types of the parameters of a node for use with decorator type metadata. * * @param node The node that should have its parameter types serialized. */ - function serializeParameterTypesOfNode(node) { + function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) @@ -46289,7 +46666,7 @@ var ts; : undefined; var expressions = []; if (valueDeclaration) { - var parameters = valueDeclaration.parameters; + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; @@ -46297,7 +46674,7 @@ var ts; continue; } if (parameter.dotDotDotToken) { - expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type))); + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); } else { expressions.push(serializeTypeOfNode(parameter)); @@ -46306,6 +46683,15 @@ var ts; } return ts.createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 151 /* GetAccessor */) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } /** * Serializes the return type of a node for use with decorator type metadata. * @@ -46435,7 +46821,7 @@ var ts; case ts.TypeReferenceSerializationKind.Unknown: var serialized = serializeEntityNameAsExpression(node.typeName, /*useFallback*/ true); var temp = ts.createTempVariable(hoistVariableDeclaration); - return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictEquality(ts.createTypeOf(ts.createAssignment(temp, serialized)), ts.createLiteral("function")), temp), ts.createIdentifier("Object")); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object")); case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: return serializeEntityNameAsExpression(node.typeName, /*useFallback*/ false); case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType: @@ -46473,14 +46859,14 @@ var ts; case 70 /* Identifier */: // Create a clone of the name with a new parent, and treat it as if it were // a source tree node for the purposes of the checker. - var name_31 = ts.getMutableClone(node); - name_31.flags &= ~8 /* Synthesized */; - name_31.original = undefined; - name_31.parent = currentScope; + var name_32 = ts.getMutableClone(node); + name_32.flags &= ~8 /* Synthesized */; + name_32.original = undefined; + name_32.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_31), ts.createLiteral("undefined")), name_31); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_32), ts.createLiteral("undefined")), name_32); } - return name_31; + return name_32; case 141 /* QualifiedName */: return serializeQualifiedNameAsExpression(node, useFallback); } @@ -46511,7 +46897,7 @@ var ts; * available. */ function getGlobalSymbolNameWithFallback() { - return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54 /* QuestionToken */), ts.createIdentifier("Symbol"), ts.createToken(55 /* ColonToken */), ts.createIdentifier("Object")); + return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object")); } /** * Gets an expression that represents a property name. For a computed property, a @@ -46527,7 +46913,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeIdentifier(name.text)); } else { return ts.getSynthesizedClone(name); @@ -46613,17 +46999,17 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - var method = ts.createMethod( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - // While we emit the source map for the node after skipping decorators and modifiers, - // we need to emit the comments for the original range. - ts.setCommentRange(method, node); - ts.setSourceMapRange(method, ts.moveRangePastDecorators(node)); - ts.setOriginalNode(method, node); - return method; + var updated = ts.updateMethod(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context)); + if (updated !== node) { + // While we emit the source map for the node after skipping decorators and modifiers, + // we need to emit the comments for the original range. + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } /** * Determines whether to emit an accessor declaration. We should not emit the @@ -46647,16 +47033,16 @@ var ts; if (!shouldEmitAccessorDeclaration(node)) { return undefined; } - var accessor = ts.createGetAccessor( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), - /*location*/ node); - // While we emit the source map for the node after skipping decorators and modifiers, - // we need to emit the comments for the original range. - ts.setOriginalNode(accessor, node); - ts.setCommentRange(accessor, node); - ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node)); - return accessor; + var updated = ts.updateGetAccessor(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + if (updated !== node) { + // While we emit the source map for the node after skipping decorators and modifiers, + // we need to emit the comments for the original range. + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } /** * Visits a set accessor declaration of a class. @@ -46671,15 +47057,15 @@ var ts; if (!shouldEmitAccessorDeclaration(node)) { return undefined; } - var accessor = ts.createSetAccessor( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), - /*location*/ node); - // While we emit the source map for the node after skipping decorators and modifiers, - // we need to emit the comments for the original range. - ts.setOriginalNode(accessor, node); - ts.setCommentRange(accessor, node); - ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node)); - return accessor; + var updated = ts.updateSetAccessor(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + if (updated !== node) { + // While we emit the source map for the node after skipping decorators and modifiers, + // we need to emit the comments for the original range. + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } /** * Visits a function declaration. @@ -46695,18 +47081,16 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createNotEmittedStatement(node); } - var func = ts.createFunctionDeclaration( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); + var updated = ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isNamespaceExport(node)) { - var statements = [func]; + var statements = [updated]; addExportMemberAssignment(statements, node); return statements; } - return func; + return updated; } /** * Visits a function expression node. @@ -46720,12 +47104,10 @@ var ts; if (ts.nodeIsMissing(node.body)) { return ts.createOmittedExpression(); } - var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); - return func; + var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context)); + return updated; } /** * @remarks @@ -46733,51 +47115,10 @@ var ts; * - The node has type annotations */ function visitArrowFunction(node) { - var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, node.equalsGreaterThanToken, transformConciseBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); - return func; - } - function transformFunctionBody(node) { - return transformFunctionBodyWorker(node.body); - } - function transformFunctionBodyWorker(body, start) { - if (start === void 0) { start = 0; } - var savedCurrentScope = currentScope; - var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; - currentScope = body; - currentScopeFirstDeclarationsOfName = ts.createMap(); - startLexicalEnvironment(); - var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start); - var visited = ts.updateBlock(body, statements); - var declarations = endLexicalEnvironment(); - currentScope = savedCurrentScope; - currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - } - function transformConciseBody(node) { - return transformConciseBodyWorker(node.body, /*forceBlockFunctionBody*/ false); - } - function transformConciseBodyWorker(body, forceBlockFunctionBody) { - if (ts.isBlock(body)) { - return transformFunctionBodyWorker(body); - } - else { - startLexicalEnvironment(); - var visited = ts.visitNode(body, visitor, ts.isConciseBody); - var declarations = endLexicalEnvironment(); - var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - if (forceBlockFunctionBody && !ts.isBlock(merged)) { - return ts.createBlock([ - ts.createReturn(merged) - ]); - } - else { - return merged; - } - } + var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context)); + return updated; } /** * Visits a parameter declaration node. @@ -46804,7 +47145,7 @@ var ts; ts.setOriginalNode(parameter, node); ts.setCommentRange(parameter, node); ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); - ts.setEmitFlags(parameter.name, 1024 /* NoTrailingSourceMap */); + ts.setEmitFlags(parameter.name, 32 /* NoTrailingSourceMap */); return parameter; } /** @@ -46830,7 +47171,8 @@ var ts; function transformInitializedVariable(node) { var name = node.name; if (ts.isBindingPattern(name)) { - return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor); + return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, + /*needsValue*/ false, createNamespaceExportExpression); } else { return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), @@ -46910,14 +47252,14 @@ var ts; var statements = []; // We request to be advised when the printer is about to print this node. This allows // us to set up the correct state for later substitutions. - var emitFlags = 64 /* AdviseOnEmitNode */; + var emitFlags = 2 /* AdviseOnEmitNode */; // If needed, we should emit a variable declaration for the enum. If we emit // a leading variable declaration, we should not emit leading comments for the // enum body. if (addVarForEnumOrModuleDeclaration(statements, node)) { // We should still emit the comments if we are emitting a system module. if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= 16384 /* NoLeadingComments */; + emitFlags |= 512 /* NoLeadingComments */; } } // `parameterName` is the declaration name used inside of the enum. @@ -47050,9 +47392,9 @@ var ts; */ function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_32 = node.symbol && node.symbol.name; - if (name_32) { - return currentScopeFirstDeclarationsOfName[name_32] === node; + var name_33 = node.symbol && node.symbol.name; + if (name_33) { + return currentScopeFirstDeclarationsOfName[name_33] === node; } } return false; @@ -47094,7 +47436,7 @@ var ts; // })(m1 || (m1 = {})); // trailing comment module // ts.setCommentRange(statement, node); - ts.setEmitFlags(statement, 32768 /* NoTrailingComments */ | 33554432 /* HasEndOfDeclarationMarker */); + ts.setEmitFlags(statement, 1024 /* NoTrailingComments */ | 2097152 /* HasEndOfDeclarationMarker */); statements.push(statement); return true; } @@ -47104,7 +47446,7 @@ var ts; // begin/end semantics of the declararation and to properly handle exports // we wrap the leading variable declaration in a `MergeDeclarationMarker`. var mergeMarker = ts.createMergeDeclarationMarker(statement); - ts.setEmitFlags(mergeMarker, 49152 /* NoComments */ | 33554432 /* HasEndOfDeclarationMarker */); + ts.setEmitFlags(mergeMarker, 1536 /* NoComments */ | 2097152 /* HasEndOfDeclarationMarker */); statements.push(mergeMarker); return false; } @@ -47125,14 +47467,14 @@ var ts; var statements = []; // We request to be advised when the printer is about to print this node. This allows // us to set up the correct state for later substitutions. - var emitFlags = 64 /* AdviseOnEmitNode */; + var emitFlags = 2 /* AdviseOnEmitNode */; // If needed, we should emit a variable declaration for the module. If we emit // a leading variable declaration, we should not emit leading comments for the // module body. if (addVarForEnumOrModuleDeclaration(statements, node)) { // We should still emit the comments if we are emitting a system module. if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= 16384 /* NoLeadingComments */; + emitFlags |= 512 /* NoLeadingComments */; } } // `parameterName` is the declaration name used inside of the namespace. @@ -47235,7 +47577,7 @@ var ts; // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. if (body.kind !== 231 /* ModuleBlock */) { - ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152 /* NoComments */); + ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } @@ -47384,7 +47726,7 @@ var ts; return undefined; } var moduleReference = ts.createExpressionFromEntityName(node.moduleReference); - ts.setEmitFlags(moduleReference, 49152 /* NoComments */ | 65536 /* NoNestedComments */); + ts.setEmitFlags(moduleReference, 1536 /* NoComments */ | 2048 /* NoNestedComments */); if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { // export var ${name} = ${moduleReference}; // var ${name} = ${moduleReference}; @@ -47560,16 +47902,16 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2 /* NamespaceExports */) { - var name_33 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_33); + var name_34 = node.name; + var exportedName = trySubstituteNamespaceExportedName(name_34); if (exportedName) { // A shorthand property with an assignment initializer is probably part of a // destructuring assignment if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_33, initializer, /*location*/ node); + return ts.createPropertyAssignment(name_34, initializer, /*location*/ node); } - return ts.createPropertyAssignment(name_33, exportedName, /*location*/ node); + return ts.createPropertyAssignment(name_34, exportedName, /*location*/ node); } } return node; @@ -47602,10 +47944,10 @@ var ts; if (declaration) { var classAlias = classAliases[declaration.id]; if (classAlias) { - var clone_4 = ts.getSynthesizedClone(classAlias); - ts.setSourceMapRange(clone_4, node); - ts.setCommentRange(clone_4, node); - return clone_4; + var clone_2 = ts.getSynthesizedClone(classAlias); + ts.setSourceMapRange(clone_2, node); + ts.setCommentRange(clone_2, node); + return clone_2; } } } @@ -47614,7 +47956,7 @@ var ts; } function trySubstituteNamespaceExportedName(node) { // If this is explicitly a local name, do not substitute. - if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) { + if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); @@ -47661,13 +48003,335 @@ var ts; } } ts.transformTypeScript = transformTypeScript; + var paramHelper = { + name: "typescript:param", + scoped: false, + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + }; + function createParamHelper(context, expression, parameterOffset, location) { + context.requestEmitHelper(paramHelper); + return ts.createCall(ts.getHelperName("__param"), + /*typeArguments*/ undefined, [ + ts.createLiteral(parameterOffset), + expression + ], location); + } + var metadataHelper = { + name: "typescript:metadata", + scoped: false, + priority: 3, + text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" + }; + function createMetadataHelper(context, metadataKey, metadataValue) { + context.requestEmitHelper(metadataHelper); + return ts.createCall(ts.getHelperName("__metadata"), + /*typeArguments*/ undefined, [ + ts.createLiteral(metadataKey), + metadataValue + ]); + } + var decorateHelper = { + name: "typescript:decorate", + scoped: false, + priority: 2, + text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" + }; + function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { + context.requestEmitHelper(decorateHelper); + var argumentsArray = []; + argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + return ts.createCall(ts.getHelperName("__decorate"), /*typeArguments*/ undefined, argumentsArray, location); + } })(ts || (ts = {})); /// /// /*@internal*/ var ts; (function (ts) { - var entities = createEntitiesMap(); + function transformESNext(context) { + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + function visitor(node) { + return visitorWorker(node, /*noDestructuringValue*/ false); + } + function visitorNoDestructuringValue(node) { + return visitorWorker(node, /*noDestructuringValue*/ true); + } + function visitorWorker(node, noDestructuringValue) { + if ((node.transformFlags & 8 /* ContainsESNext */) === 0) { + return node; + } + switch (node.kind) { + case 176 /* ObjectLiteralExpression */: + return visitObjectLiteralExpression(node); + case 192 /* BinaryExpression */: + return visitBinaryExpression(node, noDestructuringValue); + case 223 /* VariableDeclaration */: + return visitVariableDeclaration(node); + case 213 /* ForOfStatement */: + return visitForOfStatement(node); + case 211 /* ForStatement */: + return visitForStatement(node); + case 188 /* VoidExpression */: + return visitVoidExpression(node); + case 150 /* Constructor */: + return visitConstructorDeclaration(node); + case 149 /* MethodDeclaration */: + return visitMethodDeclaration(node); + case 151 /* GetAccessor */: + return visitGetAccessorDeclaration(node); + case 152 /* SetAccessor */: + return visitSetAccessorDeclaration(node); + case 225 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 184 /* FunctionExpression */: + return visitFunctionExpression(node); + case 185 /* ArrowFunction */: + return visitArrowFunction(node); + case 144 /* Parameter */: + return visitParameter(node); + case 207 /* ExpressionStatement */: + return visitExpressionStatement(node); + case 183 /* ParenthesizedExpression */: + return visitParenthesizedExpression(node, noDestructuringValue); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function chunkObjectLiteralElements(elements) { + var chunkObject; + var objects = []; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var e = elements_3[_i]; + if (e.kind === 259 /* SpreadAssignment */) { + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + chunkObject = undefined; + } + var target = e.expression; + objects.push(ts.visitNode(target, visitor, ts.isExpression)); + } + else { + if (!chunkObject) { + chunkObject = []; + } + if (e.kind === 257 /* PropertyAssignment */) { + var p = e; + chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); + } + else { + chunkObject.push(e); + } + } + } + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + } + return objects; + } + function visitObjectLiteralExpression(node) { + if (node.transformFlags & 1048576 /* ContainsObjectSpread */) { + // spread elements emit like so: + // non-spread elements are chunked together into object literals, and then all are passed to __assign: + // { a, ...o, b } => __assign({a}, o, {b}); + // If the first element is a spread element, then the first argument to __assign is {}: + // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) + var objects = chunkObjectLiteralElements(node.properties); + if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) { + objects.unshift(ts.createObjectLiteral()); + } + return createAssignHelper(context, objects); + } + return ts.visitEachChild(node, visitor, context); + } + function visitExpressionStatement(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + function visitParenthesizedExpression(node, noDestructuringValue) { + return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context); + } + /** + * Visits a BinaryExpression that contains a destructuring assignment. + * + * @param node A BinaryExpression node. + */ + function visitBinaryExpression(node, noDestructuringValue) { + if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576 /* ContainsObjectRest */) { + return ts.flattenDestructuringAssignment(node, visitor, context, 1 /* ObjectRest */, !noDestructuringValue); + } + else if (node.operatorToken.kind === 25 /* CommaToken */) { + return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + /** + * Visits a VariableDeclaration node with a binding pattern. + * + * @param node A VariableDeclaration node. + */ + function visitVariableDeclaration(node) { + // If we are here it is because the name contains a binding pattern with a rest somewhere in it. + if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576 /* ContainsObjectRest */) { + return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */); + } + return ts.visitEachChild(node, visitor, context); + } + function visitForStatement(node) { + return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement)); + } + function visitVoidExpression(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + /** + * Visits a ForOfStatement and converts it into a ES2015-compatible ForOfStatement. + * + * @param node A ForOfStatement. + */ + function visitForOfStatement(node) { + var leadingStatements; + var temp; + var initializer = ts.skipParentheses(node.initializer); + if (initializer.transformFlags & 1048576 /* ContainsObjectRest */) { + if (ts.isVariableDeclarationList(initializer)) { + temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + var firstDeclaration = ts.firstOrUndefined(initializer.declarations); + var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1 /* ObjectRest */, temp, + /*doNotRecordTempVariablesInLine*/ false, + /*skipInitializer*/ true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.updateVariableDeclarationList(initializer, declarations), + /*location*/ initializer); + leadingStatements = ts.append(leadingStatements, statement); + } + } + else if (ts.isAssignmentPattern(initializer)) { + temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, /*location*/ node.initializer)), visitor, context, 1 /* ObjectRest */); + leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, /*location*/ node.initializer)); + } + } + if (temp) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var block = ts.isBlock(statement) + ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements)) + : ts.createBlock(ts.append(leadingStatements, statement), statement, /*multiLine*/ true); + return ts.updateForOf(node, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(temp, /*type*/ undefined, /*initializer*/ undefined, node.initializer) + ], node.initializer, 1 /* Let */), expression, block); + } + return ts.visitEachChild(node, visitor, context); + } + function visitParameter(node) { + if (node.transformFlags & 1048576 /* ContainsObjectRest */) { + // Binding patterns are converted into a generated name and are + // evaluated inside the function body. + return ts.updateParameter(node, + /*decorators*/ undefined, + /*modifiers*/ undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), + /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + function visitConstructorDeclaration(node) { + return ts.updateConstructor(node, + /*decorators*/ undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + } + function visitGetAccessorDeclaration(node) { + return ts.updateGetAccessor(node, + /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node)); + } + function visitSetAccessorDeclaration(node) { + return ts.updateSetAccessor(node, + /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + } + function visitMethodDeclaration(node) { + return ts.updateMethod(node, + /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node)); + } + function visitFunctionDeclaration(node) { + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, node.modifiers, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node)); + } + function visitArrowFunction(node) { + return ts.updateArrowFunction(node, node.modifiers, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node)); + } + function visitFunctionExpression(node) { + return ts.updateFunctionExpression(node, node.modifiers, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node)); + } + function transformFunctionBody(node) { + resumeLexicalEnvironment(); + var leadingStatements; + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (parameter.transformFlags & 1048576 /* ContainsObjectRest */) { + var temp = ts.getGeneratedNameForNode(parameter); + var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1 /* ObjectRest */, temp, + /*doNotRecordTempVariablesInLine*/ false, + /*skipInitializer*/ true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList(declarations)); + ts.setEmitFlags(statement, 524288 /* CustomPrologue */); + leadingStatements = ts.append(leadingStatements, statement); + } + } + } + var body = ts.visitNode(node.body, visitor, ts.isConciseBody); + var trailingStatements = endLexicalEnvironment(); + if (ts.some(leadingStatements) || ts.some(trailingStatements)) { + var block = ts.convertToFunctionBody(body, /*multiLine*/ true); + return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements)); + } + return body; + } + } + ts.transformESNext = transformESNext; + var assignHelper = { + name: "typescript:assign", + scoped: false, + priority: 1, + text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" + }; + function createAssignHelper(context, attributesSegments) { + context.requestEmitHelper(assignHelper); + return ts.createCall(ts.getHelperName("__assign"), + /*typeArguments*/ undefined, attributesSegments); + } + ts.createAssignHelper = createAssignHelper; +})(ts || (ts = {})); +/// +/// +/// +/*@internal*/ +var ts; +(function (ts) { function transformJsx(context) { var compilerOptions = context.getCompilerOptions(); var currentSourceFile; @@ -47682,17 +48346,15 @@ var ts; return node; } currentSourceFile = node; - node = ts.visitEachChild(node, visitor, context); + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; - return node; + return visited; } function visitor(node) { - if (node.transformFlags & 4 /* Jsx */) { + if (node.transformFlags & 4 /* ContainsJsx */) { return visitorWorker(node); } - else if (node.transformFlags & 8 /* ContainsJsx */) { - return ts.visitEachChild(node, visitor, context); - } else { return node; } @@ -47706,8 +48368,7 @@ var ts; case 252 /* JsxExpression */: return visitJsxExpression(node); default: - ts.Debug.failBadSyntaxKind(node); - return undefined; + return ts.visitEachChild(node, visitor, context); } } function transformJsxChildToExpression(node) { @@ -47752,8 +48413,10 @@ var ts; } // Either emit one big object literal (no spread attribs), or // a call to the __assign helper. - objectProperties = ts.singleOrUndefined(segments) - || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments); + objectProperties = ts.singleOrUndefined(segments); + if (!objectProperties) { + objectProperties = ts.createAssignHelper(context, segments); + } } var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location); if (isChild) { @@ -47863,12 +48526,12 @@ var ts; return getTagName(node.openingElement); } else { - var name_34 = node.tagName; - if (ts.isIdentifier(name_34) && ts.isIntrinsicJsxName(name_34.text)) { - return ts.createLiteral(name_34.text); + var name_35 = node.tagName; + if (ts.isIdentifier(name_35) && ts.isIntrinsicJsxName(name_35.text)) { + return ts.createLiteral(name_35.text); } else { - return ts.createExpressionFromEntityName(name_34); + return ts.createExpressionFromEntityName(name_35); } } } @@ -47891,517 +48554,284 @@ var ts; } } ts.transformJsx = transformJsx; - function createEntitiesMap() { - return ts.createMap({ - "quot": 0x0022, - "amp": 0x0026, - "apos": 0x0027, - "lt": 0x003C, - "gt": 0x003E, - "nbsp": 0x00A0, - "iexcl": 0x00A1, - "cent": 0x00A2, - "pound": 0x00A3, - "curren": 0x00A4, - "yen": 0x00A5, - "brvbar": 0x00A6, - "sect": 0x00A7, - "uml": 0x00A8, - "copy": 0x00A9, - "ordf": 0x00AA, - "laquo": 0x00AB, - "not": 0x00AC, - "shy": 0x00AD, - "reg": 0x00AE, - "macr": 0x00AF, - "deg": 0x00B0, - "plusmn": 0x00B1, - "sup2": 0x00B2, - "sup3": 0x00B3, - "acute": 0x00B4, - "micro": 0x00B5, - "para": 0x00B6, - "middot": 0x00B7, - "cedil": 0x00B8, - "sup1": 0x00B9, - "ordm": 0x00BA, - "raquo": 0x00BB, - "frac14": 0x00BC, - "frac12": 0x00BD, - "frac34": 0x00BE, - "iquest": 0x00BF, - "Agrave": 0x00C0, - "Aacute": 0x00C1, - "Acirc": 0x00C2, - "Atilde": 0x00C3, - "Auml": 0x00C4, - "Aring": 0x00C5, - "AElig": 0x00C6, - "Ccedil": 0x00C7, - "Egrave": 0x00C8, - "Eacute": 0x00C9, - "Ecirc": 0x00CA, - "Euml": 0x00CB, - "Igrave": 0x00CC, - "Iacute": 0x00CD, - "Icirc": 0x00CE, - "Iuml": 0x00CF, - "ETH": 0x00D0, - "Ntilde": 0x00D1, - "Ograve": 0x00D2, - "Oacute": 0x00D3, - "Ocirc": 0x00D4, - "Otilde": 0x00D5, - "Ouml": 0x00D6, - "times": 0x00D7, - "Oslash": 0x00D8, - "Ugrave": 0x00D9, - "Uacute": 0x00DA, - "Ucirc": 0x00DB, - "Uuml": 0x00DC, - "Yacute": 0x00DD, - "THORN": 0x00DE, - "szlig": 0x00DF, - "agrave": 0x00E0, - "aacute": 0x00E1, - "acirc": 0x00E2, - "atilde": 0x00E3, - "auml": 0x00E4, - "aring": 0x00E5, - "aelig": 0x00E6, - "ccedil": 0x00E7, - "egrave": 0x00E8, - "eacute": 0x00E9, - "ecirc": 0x00EA, - "euml": 0x00EB, - "igrave": 0x00EC, - "iacute": 0x00ED, - "icirc": 0x00EE, - "iuml": 0x00EF, - "eth": 0x00F0, - "ntilde": 0x00F1, - "ograve": 0x00F2, - "oacute": 0x00F3, - "ocirc": 0x00F4, - "otilde": 0x00F5, - "ouml": 0x00F6, - "divide": 0x00F7, - "oslash": 0x00F8, - "ugrave": 0x00F9, - "uacute": 0x00FA, - "ucirc": 0x00FB, - "uuml": 0x00FC, - "yacute": 0x00FD, - "thorn": 0x00FE, - "yuml": 0x00FF, - "OElig": 0x0152, - "oelig": 0x0153, - "Scaron": 0x0160, - "scaron": 0x0161, - "Yuml": 0x0178, - "fnof": 0x0192, - "circ": 0x02C6, - "tilde": 0x02DC, - "Alpha": 0x0391, - "Beta": 0x0392, - "Gamma": 0x0393, - "Delta": 0x0394, - "Epsilon": 0x0395, - "Zeta": 0x0396, - "Eta": 0x0397, - "Theta": 0x0398, - "Iota": 0x0399, - "Kappa": 0x039A, - "Lambda": 0x039B, - "Mu": 0x039C, - "Nu": 0x039D, - "Xi": 0x039E, - "Omicron": 0x039F, - "Pi": 0x03A0, - "Rho": 0x03A1, - "Sigma": 0x03A3, - "Tau": 0x03A4, - "Upsilon": 0x03A5, - "Phi": 0x03A6, - "Chi": 0x03A7, - "Psi": 0x03A8, - "Omega": 0x03A9, - "alpha": 0x03B1, - "beta": 0x03B2, - "gamma": 0x03B3, - "delta": 0x03B4, - "epsilon": 0x03B5, - "zeta": 0x03B6, - "eta": 0x03B7, - "theta": 0x03B8, - "iota": 0x03B9, - "kappa": 0x03BA, - "lambda": 0x03BB, - "mu": 0x03BC, - "nu": 0x03BD, - "xi": 0x03BE, - "omicron": 0x03BF, - "pi": 0x03C0, - "rho": 0x03C1, - "sigmaf": 0x03C2, - "sigma": 0x03C3, - "tau": 0x03C4, - "upsilon": 0x03C5, - "phi": 0x03C6, - "chi": 0x03C7, - "psi": 0x03C8, - "omega": 0x03C9, - "thetasym": 0x03D1, - "upsih": 0x03D2, - "piv": 0x03D6, - "ensp": 0x2002, - "emsp": 0x2003, - "thinsp": 0x2009, - "zwnj": 0x200C, - "zwj": 0x200D, - "lrm": 0x200E, - "rlm": 0x200F, - "ndash": 0x2013, - "mdash": 0x2014, - "lsquo": 0x2018, - "rsquo": 0x2019, - "sbquo": 0x201A, - "ldquo": 0x201C, - "rdquo": 0x201D, - "bdquo": 0x201E, - "dagger": 0x2020, - "Dagger": 0x2021, - "bull": 0x2022, - "hellip": 0x2026, - "permil": 0x2030, - "prime": 0x2032, - "Prime": 0x2033, - "lsaquo": 0x2039, - "rsaquo": 0x203A, - "oline": 0x203E, - "frasl": 0x2044, - "euro": 0x20AC, - "image": 0x2111, - "weierp": 0x2118, - "real": 0x211C, - "trade": 0x2122, - "alefsym": 0x2135, - "larr": 0x2190, - "uarr": 0x2191, - "rarr": 0x2192, - "darr": 0x2193, - "harr": 0x2194, - "crarr": 0x21B5, - "lArr": 0x21D0, - "uArr": 0x21D1, - "rArr": 0x21D2, - "dArr": 0x21D3, - "hArr": 0x21D4, - "forall": 0x2200, - "part": 0x2202, - "exist": 0x2203, - "empty": 0x2205, - "nabla": 0x2207, - "isin": 0x2208, - "notin": 0x2209, - "ni": 0x220B, - "prod": 0x220F, - "sum": 0x2211, - "minus": 0x2212, - "lowast": 0x2217, - "radic": 0x221A, - "prop": 0x221D, - "infin": 0x221E, - "ang": 0x2220, - "and": 0x2227, - "or": 0x2228, - "cap": 0x2229, - "cup": 0x222A, - "int": 0x222B, - "there4": 0x2234, - "sim": 0x223C, - "cong": 0x2245, - "asymp": 0x2248, - "ne": 0x2260, - "equiv": 0x2261, - "le": 0x2264, - "ge": 0x2265, - "sub": 0x2282, - "sup": 0x2283, - "nsub": 0x2284, - "sube": 0x2286, - "supe": 0x2287, - "oplus": 0x2295, - "otimes": 0x2297, - "perp": 0x22A5, - "sdot": 0x22C5, - "lceil": 0x2308, - "rceil": 0x2309, - "lfloor": 0x230A, - "rfloor": 0x230B, - "lang": 0x2329, - "rang": 0x232A, - "loz": 0x25CA, - "spades": 0x2660, - "clubs": 0x2663, - "hearts": 0x2665, - "diams": 0x2666 - }); - } -})(ts || (ts = {})); -/// -/// -/*@internal*/ -var ts; -(function (ts) { - function transformESNext(context) { - var hoistVariableDeclaration = context.hoistVariableDeclaration; - var currentSourceFile; - return transformSourceFile; - function transformSourceFile(node) { - currentSourceFile = node; - return ts.visitEachChild(node, visitor, context); - } - function visitor(node) { - if (node.transformFlags & 16 /* ESNext */) { - return visitorWorker(node); - } - else if (node.transformFlags & 32 /* ContainsESNext */) { - return ts.visitEachChild(node, visitor, context); - } - else { - return node; - } - } - function visitorWorker(node) { - switch (node.kind) { - case 176 /* ObjectLiteralExpression */: - return visitObjectLiteralExpression(node); - case 192 /* BinaryExpression */: - return visitBinaryExpression(node); - case 223 /* VariableDeclaration */: - return visitVariableDeclaration(node); - case 213 /* ForOfStatement */: - return visitForOfStatement(node); - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - return node; - case 225 /* FunctionDeclaration */: - return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: - return visitFunctionExpression(node); - case 185 /* ArrowFunction */: - return visitArrowFunction(node); - case 144 /* Parameter */: - return visitParameter(node); - default: - ts.Debug.failBadSyntaxKind(node); - return ts.visitEachChild(node, visitor, context); - } - } - function chunkObjectLiteralElements(elements) { - var chunkObject; - var objects = []; - for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { - var e = elements_3[_i]; - if (e.kind === 259 /* SpreadAssignment */) { - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - chunkObject = undefined; - } - var target = e.expression; - objects.push(ts.visitNode(target, visitor, ts.isExpression)); - } - else { - if (!chunkObject) { - chunkObject = []; - } - if (e.kind === 257 /* PropertyAssignment */) { - var p = e; - chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); - } - else { - chunkObject.push(e); - } - } - } - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - } - return objects; - } - function visitObjectLiteralExpression(node) { - // spread elements emit like so: - // non-spread elements are chunked together into object literals, and then all are passed to __assign: - // { a, ...o, b } => __assign({a}, o, {b}); - // If the first element is a spread element, then the first argument to __assign is {}: - // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) - var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) { - objects.unshift(ts.createObjectLiteral()); - } - return ts.createCall(ts.createIdentifier("__assign"), undefined, objects); - } - /** - * Visits a BinaryExpression that contains a destructuring assignment. - * - * @param node A BinaryExpression node. - */ - function visitBinaryExpression(node) { - if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48 /* AssertESNext */) { - return ts.flattenDestructuringAssignment(context, node, /*needsDestructuringValue*/ true, hoistVariableDeclaration, visitor, /*transformRest*/ true); - } - return ts.visitEachChild(node, visitor, context); - } - /** - * Visits a VariableDeclaration node with a binding pattern. - * - * @param node A VariableDeclaration node. - */ - function visitVariableDeclaration(node) { - // If we are here it is because the name contains a binding pattern with a rest somewhere in it. - if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48 /* AssertESNext */) { - var result = ts.flattenVariableDestructuring(node, /*value*/ undefined, visitor, /*recordTempVariable*/ undefined, /*transformRest*/ true); - return result; - } - return ts.visitEachChild(node, visitor, context); - } - /** - * Visits a ForOfStatement and converts it into a ES2015-compatible ForOfStatement. - * - * @param node A ForOfStatement. - */ - function visitForOfStatement(node) { - // The following ESNext code: - // - // for (let { x, y, ...rest } of expr) { } - // - // should be emitted as - // - // for (var _a of expr) { - // let { x, y } = _a, rest = __rest(_a, ["x", "y"]); - // } - // - // where _a is a temp emitted to capture the RHS. - // When the left hand side is an expression instead of a let declaration, - // the `let` before the `{ x, y }` is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. - // for ( of ) - // where is [let] variabledeclarationlist | expression - var initializer = node.initializer; - if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) { - return ts.visitEachChild(node, visitor, context); - } - return ts.convertForOf(node, undefined, visitor, ts.noop, context, /*transformRest*/ true); - } - function isRestBindingPattern(initializer) { - if (ts.isVariableDeclarationList(initializer)) { - var declaration = ts.firstOrUndefined(initializer.declarations); - return declaration && declaration.name && - declaration.name.kind === 172 /* ObjectBindingPattern */ && - !!(declaration.name.transformFlags & 8388608 /* ContainsSpreadExpression */); - } - return false; - } - function isRestAssignment(initializer) { - return initializer.kind === 176 /* ObjectLiteralExpression */ && - initializer.transformFlags & 8388608 /* ContainsSpreadExpression */; - } - function visitParameter(node) { - if (isObjectRestParameter(node)) { - // Binding patterns are converted into a generated name and are - // evaluated inside the function body. - return ts.setOriginalNode(ts.createParameter( - /*decorators*/ undefined, - /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, ts.getGeneratedNameForNode(node), - /*questionToken*/ undefined, - /*type*/ undefined, node.initializer, - /*location*/ node), - /*original*/ node); - } - else { - return node; - } - } - function isObjectRestParameter(node) { - return node.name && - node.name.kind === 172 /* ObjectBindingPattern */ && - !!(node.name.transformFlags & 8388608 /* ContainsSpreadExpression */); - } - function visitFunctionDeclaration(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) : - ts.visitEachChild(node.body, visitor, context); - return ts.setOriginalNode(ts.createFunctionDeclaration( - /*decorators*/ undefined, node.modifiers, node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, body, - /*location*/ node), - /*original*/ node); - } - function visitArrowFunction(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) : - ts.visitEachChild(node.body, visitor, context); - var func = ts.setOriginalNode(ts.createArrowFunction( - /*modifiers*/ undefined, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, node.equalsGreaterThanToken, body, - /*location*/ node), - /*original*/ node); - ts.setEmitFlags(func, 256 /* CapturesThis */); - return func; - } - function visitFunctionExpression(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) : - ts.visitEachChild(node.body, visitor, context); - return ts.setOriginalNode(ts.createFunctionExpression( - /*modifiers*/ undefined, node.asteriskToken, name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, body, - /*location*/ node), - /*original*/ node); - } - } - ts.transformESNext = transformESNext; + var entities = ts.createMap({ + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + }); })(ts || (ts = {})); /// /// /*@internal*/ var ts; (function (ts) { + var ES2017SubstitutionFlags; + (function (ES2017SubstitutionFlags) { + /** Enables substitutions for async methods with `super` calls. */ + ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); function transformES2017(context) { - var ES2017SubstitutionFlags; - (function (ES2017SubstitutionFlags) { - /** Enables substitutions for async methods with `super` calls. */ - ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; - })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var resolver = context.getEmitResolver(); var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); // These variables contain state that changes as we descend into the tree. - var currentSourceFileExternalHelpersModuleName; + var currentSourceFile; /** * Keeps track of whether expression substitution has been enabled for specific edge cases. * They are persisted between each SourceFile transformation and should not be reset. */ var enabledSubstitutions; - /** - * Keeps track of whether we are within any containing namespaces when performing - * just-in-time substitution while printing an expression identifier. - */ - var applicableSubstitutions; /** * This keeps track of containers where `super` is valid, for use with * just-in-time substitution for `super` expressions inside of async methods. @@ -48413,25 +48843,21 @@ var ts; // Set new transformation hooks. context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - var currentScope; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } - currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName; - return ts.visitEachChild(node, visitor, context); + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function visitor(node) { - if (node.transformFlags & 64 /* ES2017 */) { - return visitorWorker(node); + if ((node.transformFlags & 16 /* ContainsES2017 */) === 0) { + return node; } - else if (node.transformFlags & 128 /* ContainsES2017 */) { - return ts.visitEachChild(node, visitor, context); - } - return node; - } - function visitorWorker(node) { switch (node.kind) { case 119 /* AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 @@ -48452,16 +48878,15 @@ var ts; // ES2017 arrow functions may be 'async' return visitArrowFunction(node); default: - ts.Debug.failBadSyntaxKind(node); - return node; + return ts.visitEachChild(node, visitor, context); } } /** - * Visits an await expression. + * Visits an AwaitExpression node. * * This function will be called any time a ES2017 await expression is encountered. * - * @param node The await expression node. + * @param node The node to visit. */ function visitAwaitExpression(node) { return ts.setOriginalNode(ts.createYield( @@ -48469,106 +48894,73 @@ var ts; /*location*/ node), node); } /** - * Visits a method declaration of a class. + * Visits a MethodDeclaration node. * * This function will be called when one of the following conditions are met: * - The node is marked as async * - * @param node The method node. + * @param node The node to visit. */ function visitMethodDeclaration(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var method = ts.createMethod( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - // While we emit the source map for the node after skipping decorators and modifiers, - // we need to emit the comments for the original range. - ts.setCommentRange(method, node); - ts.setSourceMapRange(method, ts.moveRangePastDecorators(node)); - ts.setOriginalNode(method, node); - return method; + return ts.updateMethod(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } /** - * Visits a function declaration. + * Visits a FunctionDeclaration node. * * This function will be called when one of the following conditions are met: * - The node is marked async * - * @param node The function node. + * @param node The node to visit. */ function visitFunctionDeclaration(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var func = ts.createFunctionDeclaration( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); - return func; + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } /** - * Visits a function expression node. + * Visits a FunctionExpression node. * * This function will be called when one of the following conditions are met: * - The node is marked async * - * @param node The function expression node. + * @param node The node to visit. */ function visitFunctionExpression(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } if (ts.nodeIsMissing(node.body)) { return ts.createOmittedExpression(); } - var func = ts.createFunctionExpression( - /*modifiers*/ undefined, node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); - return func; + return ts.updateFunctionExpression(node, + /*modifiers*/ undefined, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } /** - * @remarks + * Visits an ArrowFunction. + * * This function will be called when one of the following conditions are met: * - The node is marked async + * + * @param node The node to visit. */ function visitArrowFunction(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, node.equalsGreaterThanToken, transformConciseBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); - return func; - } - function transformFunctionBody(node) { - return transformAsyncFunctionBody(node); - } - function transformConciseBody(node) { - return transformAsyncFunctionBody(node); - } - function transformFunctionBodyWorker(body, start) { - if (start === void 0) { start = 0; } - var savedCurrentScope = currentScope; - currentScope = body; - startLexicalEnvironment(); - var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start); - var visited = ts.updateBlock(body, statements); - var declarations = endLexicalEnvironment(); - currentScope = savedCurrentScope; - return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; @@ -48582,54 +48974,51 @@ var ts; if (!isArrowFunction) { var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor); - statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(statements, /*location*/ node.body, /*multiLine*/ true); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. if (languageVersion >= 2 /* ES2015 */) { if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { enableSubstitutionForAsyncMethodsWithSuper(); - ts.setEmitFlags(block, 8 /* EmitAdvancedSuperHelper */); + ts.addEmitHelper(block, advancedAsyncSuperHelper); } else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { enableSubstitutionForAsyncMethodsWithSuper(); - ts.setEmitFlags(block, 4 /* EmitSuperHelper */); + ts.addEmitHelper(block, asyncSuperHelper); } } return block; } else { - return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, /*forceBlockFunctionBody*/ true)); + var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(expression); + return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements)); + } + return expression; } } - function transformConciseBodyWorker(body, forceBlockFunctionBody) { + function transformFunctionBodyWorker(body, start) { if (ts.isBlock(body)) { - return transformFunctionBodyWorker(body); + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); } else { startLexicalEnvironment(); - var visited = ts.visitNode(body, visitor, ts.isConciseBody); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); var declarations = endLexicalEnvironment(); - var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - if (forceBlockFunctionBody && !ts.isBlock(merged)) { - return ts.createBlock([ - ts.createReturn(merged) - ]); - } - else { - return merged; - } + return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); } } function getPromiseConstructor(type) { - if (type) { - var typeName = ts.getEntityNameFromTypeNode(type); - if (typeName && ts.isEntityName(typeName)) { - var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); - if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue - || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { - return typeName; - } + var typeName = type && ts.getEntityNameFromTypeNode(type); + if (typeName && ts.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { + return typeName; } } return undefined; @@ -48713,16 +49102,17 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(emitContext, node, emitCallback) { - var savedApplicableSubstitutions = applicableSubstitutions; - var savedCurrentSuperContainer = currentSuperContainer; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) { + var savedCurrentSuperContainer = currentSuperContainer; currentSuperContainer = node; + previousOnEmitNode(emitContext, node, emitCallback); + currentSuperContainer = savedCurrentSuperContainer; + } + else { + previousOnEmitNode(emitContext, node, emitCallback); } - previousOnEmitNode(emitContext, node, emitCallback); - applicableSubstitutions = savedApplicableSubstitutions; - currentSuperContainer = savedCurrentSuperContainer; } /** * Hooks node substitutions. @@ -48754,6 +49144,40 @@ var ts; } } ts.transformES2017 = transformES2017; + function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(awaiterHelper); + var generatorFunc = ts.createFunctionExpression( + /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */), + /*name*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, body); + // Mark this node as originally an async function + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */; + return ts.createCall(ts.getHelperName("__awaiter"), + /*typeArguments*/ undefined, [ + ts.createThis(), + hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), + promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), + generatorFunc + ]); + } + var awaiterHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };" + }; + var asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: "\n const _super = name => super[name];" + }; + var advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" + }; })(ts || (ts = {})); /// /// @@ -48770,64 +49194,60 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitor(node) { - if (node.transformFlags & 256 /* ES2016 */) { - return visitorWorker(node); - } - else if (node.transformFlags & 512 /* ContainsES2016 */) { - return ts.visitEachChild(node, visitor, context); - } - else { + if ((node.transformFlags & 32 /* ContainsES2016 */) === 0) { return node; } - } - function visitorWorker(node) { switch (node.kind) { case 192 /* BinaryExpression */: return visitBinaryExpression(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitBinaryExpression(node) { - // We are here because ES2016 adds support for the exponentiation operator. + switch (node.operatorToken.kind) { + case 61 /* AsteriskAsteriskEqualsToken */: + return visitExponentiationAssignmentExpression(node); + case 39 /* AsteriskAsteriskToken */: + return visitExponentiationExpression(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function visitExponentiationAssignmentExpression(node) { + var target; + var value; var left = ts.visitNode(node.left, visitor, ts.isExpression); var right = ts.visitNode(node.right, visitor, ts.isExpression); - if (node.operatorToken.kind === 61 /* AsteriskAsteriskEqualsToken */) { - var target = void 0; - var value = void 0; - if (ts.isElementAccessExpression(left)) { - // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)` - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression), - /*location*/ left); - value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, - /*location*/ left); - } - else if (ts.isPropertyAccessExpression(left)) { - // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)` - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name, - /*location*/ left); - value = ts.createPropertyAccess(expressionTemp, left.name, - /*location*/ left); - } - else { - // Transforms `a **= b` into `a = Math.pow(a, b)` - target = left; - value = left; - } - return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node); + if (ts.isElementAccessExpression(left)) { + // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)` + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression), + /*location*/ left); + value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, + /*location*/ left); } - else if (node.operatorToken.kind === 39 /* AsteriskAsteriskToken */) { - // Transforms `a ** b` into `Math.pow(a, b)` - return ts.createMathPow(left, right, /*location*/ node); + else if (ts.isPropertyAccessExpression(left)) { + // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)` + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name, + /*location*/ left); + value = ts.createPropertyAccess(expressionTemp, left.name, + /*location*/ left); } else { - ts.Debug.failBadSyntaxKind(node); - return ts.visitEachChild(node, visitor, context); + // Transforms `a **= b` into `a = Math.pow(a, b)` + target = left; + value = left; } + return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node); + } + function visitExponentiationExpression(node) { + // Transforms `a ** b` into `Math.pow(a, b)` + var left = ts.visitNode(node.left, visitor, ts.isExpression); + var right = ts.visitNode(node.right, visitor, ts.isExpression); + return ts.createMathPow(left, right, /*location*/ node); } } ts.transformES2016 = transformES2016; @@ -48880,7 +49300,7 @@ var ts; SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn"; })(SuperCaptureResult || (SuperCaptureResult = {})); function transformES2015(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -48914,7 +49334,11 @@ var ts; } currentSourceFile = node; currentText = node.text; - return ts.visitNode(node, visitor, ts.isSourceFile); + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + currentText = undefined; + return visited; } function visitor(node) { return saveStateAndInvoke(node, dispatcher); @@ -48954,6 +49378,41 @@ var ts; currentNode = savedCurrentNode; return visited; } + function onBeforeVisitNode(node) { + if (currentNode) { + if (ts.isBlockScope(currentNode, currentParent)) { + enclosingBlockScopeContainer = currentNode; + enclosingBlockScopeContainerParent = currentParent; + } + if (ts.isFunctionLike(currentNode)) { + enclosingFunction = currentNode; + if (currentNode.kind !== 185 /* ArrowFunction */) { + enclosingNonArrowFunction = currentNode; + if (!(ts.getEmitFlags(currentNode) & 131072 /* 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 205 /* VariableStatement */: + enclosingVariableStatement = currentNode; + break; + case 224 /* VariableDeclarationList */: + case 223 /* VariableDeclaration */: + case 174 /* BindingElement */: + case 172 /* ObjectBindingPattern */: + case 173 /* ArrayBindingPattern */: + break; + default: + enclosingVariableStatement = undefined; + } + } + currentParent = currentNode; + currentNode = node; + } function returnCapturedThis(node) { return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } @@ -48961,7 +49420,7 @@ var ts; return isInConstructorWithCapturedSuper && node.kind === 216 /* ReturnStatement */ && !node.expression; } function shouldCheckNode(node) { - return (node.transformFlags & 1024 /* ES2015 */) !== 0 || + return (node.transformFlags & 64 /* ES2015 */) !== 0 || node.kind === 219 /* LabeledStatement */ || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } @@ -48972,10 +49431,10 @@ var ts; else if (shouldCheckNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 2048 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { + else if (node.transformFlags & 128 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { // we want to dive in this branch either if node has children with ES2015 specific syntax // or we are inside constructor that captures result of the super call so all returns without expression should be - // rewritten. Note: we skip expressions since returns should never appear there + // rewritten. Note: we skip expressions since returns should never appear there return ts.visitEachChild(node, visitor, context); } else { @@ -49075,6 +49534,8 @@ var ts; return visitTemplateExpression(node); case 195 /* YieldExpression */: return visitYieldExpression(node); + case 196 /* SpreadElement */: + return visitSpreadElement(node); case 96 /* SuperKeyword */: return visitSuperKeyword(); case 195 /* YieldExpression */: @@ -49082,8 +49543,6 @@ var ts; return ts.visitEachChild(node, visitor, context); case 149 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 261 /* SourceFile */: - return visitSourceFileNode(node); case 205 /* VariableStatement */: return visitVariableStatement(node); default: @@ -49091,40 +49550,14 @@ var ts; return ts.visitEachChild(node, visitor, context); } } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185 /* ArrowFunction */) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 2097152 /* 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 205 /* VariableStatement */: - enclosingVariableStatement = currentNode; - break; - case 224 /* VariableDeclarationList */: - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; + function visitSourceFile(node) { + var statements = []; + startLexicalEnvironment(); + var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); + addCaptureThisForNodeIfNeeded(statements, node); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + ts.addRange(statements, endLexicalEnvironment()); + return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); } function visitSwitchStatement(node) { ts.Debug.assert(convertedLoopState !== undefined); @@ -49249,10 +49682,10 @@ var ts; statements.push(exportStatement); } var emitFlags = ts.getEmitFlags(node); - if ((emitFlags & 33554432 /* HasEndOfDeclarationMarker */) === 0) { + if ((emitFlags & 2097152 /* HasEndOfDeclarationMarker */) === 0) { // Add a DeclarationMarker as a marker for the end of the declaration statements.push(ts.createEndOfDeclarationMarker(node)); - ts.setEmitFlags(statement, emitFlags | 33554432 /* HasEndOfDeclarationMarker */); + ts.setEmitFlags(statement, emitFlags | 2097152 /* HasEndOfDeclarationMarker */); } return ts.singleOrMany(statements); } @@ -49314,17 +49747,17 @@ var ts; // To preserve the behavior of the old emitter, we explicitly indent // the body of the function here if it was requested in an earlier // transformation. - if (ts.getEmitFlags(node) & 524288 /* Indented */) { - ts.setEmitFlags(classFunction, 524288 /* Indented */); + if (ts.getEmitFlags(node) & 32768 /* Indented */) { + ts.setEmitFlags(classFunction, 32768 /* Indented */); } // "inner" and "outer" below are added purely to preserve source map locations from // the old emitter var inner = ts.createPartiallyEmittedExpression(classFunction); inner.end = node.end; - ts.setEmitFlags(inner, 49152 /* NoComments */); + ts.setEmitFlags(inner, 1536 /* NoComments */); var outer = ts.createPartiallyEmittedExpression(inner); outer.end = ts.skipTrivia(currentText, node.pos); - ts.setEmitFlags(outer, 49152 /* NoComments */); + ts.setEmitFlags(outer, 1536 /* NoComments */); return ts.createParen(ts.createCall(outer, /*typeArguments*/ undefined, extendsClauseElement ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)] @@ -49349,14 +49782,14 @@ var ts; // emit with the original emitter. var outer = ts.createPartiallyEmittedExpression(localName); outer.end = closingBraceLocation.end; - ts.setEmitFlags(outer, 49152 /* NoComments */); + ts.setEmitFlags(outer, 1536 /* NoComments */); var statement = ts.createReturn(outer); statement.pos = closingBraceLocation.pos; - ts.setEmitFlags(statement, 49152 /* NoComments */ | 12288 /* NoTokenSourceMaps */); + ts.setEmitFlags(statement, 1536 /* NoComments */ | 384 /* NoTokenSourceMaps */); statements.push(statement); ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), /*location*/ undefined, /*multiLine*/ true); - ts.setEmitFlags(block, 49152 /* NoComments */); + ts.setEmitFlags(block, 1536 /* NoComments */); return block; } /** @@ -49368,7 +49801,7 @@ var ts; */ function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { - statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)), + statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), /*location*/ extendsClauseElement)); } } @@ -49390,7 +49823,7 @@ var ts; /*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), /*location*/ constructor || node); if (extendsClauseElement) { - ts.setEmitFlags(constructorFunction, 256 /* CapturesThis */); + ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */); } statements.push(constructorFunction); } @@ -49407,10 +49840,8 @@ var ts; // `super` call. // If this is the case, we do not include the synthetic `...args` parameter and // will instead use the `arguments` object in ES5/3. - if (constructor && !hasSynthesizedSuper) { - return ts.visitNodes(constructor.parameters, visitor, ts.isParameter); - } - return []; + return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) + || []; } /** * Transforms the body of a constructor declaration of a class. @@ -49423,21 +49854,21 @@ var ts; */ function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { var statements = []; - startLexicalEnvironment(); + resumeLexicalEnvironment(); var statementOffset = -1; if (hasSynthesizedSuper) { // If a super call has already been synthesized, // we're going to assume that we should just transform everything after that. // The assumption is that no prior step in the pipeline has added any prologue directives. - statementOffset = 1; + statementOffset = 0; } else if (constructor) { // Otherwise, try to emit all potential prologue directives first. statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, /*ensureUseStrict*/ false, visitor); } if (constructor) { - ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, /*convertObjectRest*/ false); - ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + addDefaultValueAssignmentsIfNeeded(statements, constructor); + addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); @@ -49465,7 +49896,7 @@ var ts; /*location*/ constructor ? constructor.body : node, /*multiLine*/ true); if (!constructor) { - ts.setEmitFlags(block, 49152 /* NoComments */); + ts.setEmitFlags(block, 1536 /* NoComments */); } return block; } @@ -49503,7 +49934,7 @@ var ts; // If this isn't a derived class, just capture 'this' for arrow functions if necessary. if (!hasExtendsClause) { if (ctor) { - ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis); + addCaptureThisForNodeIfNeeded(statements, ctor); } return 0 /* NoReplacement */; } @@ -49518,7 +49949,7 @@ var ts; // for something like property initializers. // Create a captured '_this' variable and assume it will subsequently be used. if (hasSynthesizedSuper) { - ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); + captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); enableSubstitutionsForCapturedThis(); return 1 /* ReplaceSuperCapture */; } @@ -49549,13 +49980,23 @@ var ts; superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); } } - // Return the result if we have an immediate super() call on the last statement. - if (superCallExpression && statementOffset === ctorStatements.length - 1) { - statements.push(ts.createReturn(superCallExpression)); + // Return the result if we have an immediate super() call on the last statement, + // but only if the constructor itself doesn't use 'this' elsewhere. + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 /* ContainsLexicalThis */ | 32768 /* ContainsCapturedLexicalThis */))) { + var returnStatement = ts.createReturn(superCallExpression); + if (superCallExpression.kind !== 192 /* BinaryExpression */ + || superCallExpression.left.kind !== 179 /* CallExpression */) { + ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); + } + // Shift comments from the original super call to the return statement. + ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536 /* NoComments */))); + statements.push(returnStatement); return 2 /* ReplaceWithReturn */; } // Perform the capture. - ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement); + captureThisForNode(statements, ctor, superCallExpression, firstStatement); // If we're actually replacing the original statement, we need to signal this to the caller. if (superCallExpression) { return 1 /* ReplaceSuperCapture */; @@ -49564,7 +50005,7 @@ var ts; } function createDefaultSuperCallOrThis() { var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 128 /* NoSubstitution */); + ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); return ts.createLogicalOr(superCall, actualThis); } @@ -49607,6 +50048,160 @@ var ts; return node; } } + /** + * Gets a value indicating whether we need to add default value assignments for a + * function-like node. + * + * @param node A function-like node. + */ + function shouldAddDefaultValueAssignments(node) { + return (node.transformFlags & 131072 /* ContainsDefaultValueAssignments */) !== 0; + } + /** + * Adds statements to the body of a function-like node if it contains parameters with + * binding patterns or initializers. + * + * @param statements The statements for the new function body. + * @param node A function-like node. + */ + function addDefaultValueAssignmentsIfNeeded(statements, node) { + if (!shouldAddDefaultValueAssignments(node)) { + return; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + var name_36 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + // A rest parameter cannot have a binding pattern or an initializer, + // so let's just ignore it. + if (dotDotDotToken) { + continue; + } + if (ts.isBindingPattern(name_36)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name_36, initializer); + } + else if (initializer) { + addDefaultValueAssignmentForInitializer(statements, parameter, name_36, initializer); + } + } + } + /** + * Adds statements to the body of a function-like node for parameters with binding patterns + * + * @param statements The statements for the new function body. + * @param parameter The parameter for the function. + * @param name The name of the parameter. + * @param initializer The initializer for the parameter. + */ + function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) { + var temp = ts.getGeneratedNameForNode(parameter); + // In cases where a binding pattern is simply '[]' or '{}', + // we usually don't want to emit a var declaration; however, in the presence + // of an initializer, we must emit that expression to preserve side effects. + if (name.elements.length > 0) { + statements.push(ts.setEmitFlags(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, temp))), 524288 /* CustomPrologue */)); + } + else if (initializer) { + statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288 /* CustomPrologue */)); + } + } + /** + * Adds statements to the body of a function-like node for parameters with initializers. + * + * @param statements The statements for the new function body. + * @param parameter The parameter for the function. + * @param name The name of the parameter. + * @param initializer The initializer for the parameter. + */ + function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { + initializer = ts.visitNode(initializer, visitor, ts.isExpression); + var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48 /* NoSourceMap */), ts.setEmitFlags(initializer, 48 /* NoSourceMap */ | ts.getEmitFlags(initializer)), + /*location*/ parameter)) + ], /*location*/ parameter), 1 /* SingleLine */ | 32 /* NoTrailingSourceMap */ | 384 /* NoTokenSourceMaps */), + /*elseStatement*/ undefined, + /*location*/ parameter); + statement.startsOnNewLine = true; + ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 524288 /* CustomPrologue */); + statements.push(statement); + } + /** + * Gets a value indicating whether we need to add statements to handle a rest parameter. + * + * @param node A ParameterDeclaration node. + * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is + * part of a constructor declaration with a + * synthesized call to `super` + */ + function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { + return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper; + } + /** + * Adds statements to the body of a function-like node if it contains a rest parameter. + * + * @param statements The statements for the new function body. + * @param node A function-like node. + * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is + * part of a constructor declaration with a + * synthesized call to `super` + */ + function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { + var parameter = ts.lastOrUndefined(node.parameters); + if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { + return; + } + // `declarationName` is the name of the local declaration for the parameter. + var declarationName = ts.getMutableClone(parameter.name); + ts.setEmitFlags(declarationName, 48 /* NoSourceMap */); + // `expressionName` is the name of the parameter used in expressions. + var expressionName = ts.getSynthesizedClone(parameter.name); + var restIndex = node.parameters.length - 1; + var temp = ts.createLoopVariable(); + // var param = []; + statements.push(ts.setEmitFlags(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(declarationName, + /*type*/ undefined, ts.createArrayLiteral([])) + ]), + /*location*/ parameter), 524288 /* CustomPrologue */)); + // for (var _i = restIndex; _i < arguments.length; _i++) { + // param[_i - restIndex] = arguments[_i]; + // } + var forStatement = ts.createFor(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(temp, /*type*/ undefined, ts.createLiteral(restIndex)) + ], /*location*/ parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), + /*location*/ parameter), ts.createPostfixIncrement(temp, /*location*/ parameter), ts.createBlock([ + ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 + ? temp + : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), + /*location*/ parameter)) + ])); + ts.setEmitFlags(forStatement, 524288 /* CustomPrologue */); + ts.startOnNewLine(forStatement); + statements.push(forStatement); + } + /** + * Adds a statement to capture the `this` of a function declaration if it is needed. + * + * @param statements The statements for the new function body. + * @param node A node. + */ + function addCaptureThisForNodeIfNeeded(statements, node) { + if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) { + captureThisForNode(statements, node, ts.createThis()); + } + } + function captureThisForNode(statements, node, initializer, originalStatement) { + enableSubstitutionsForCapturedThis(); + var captureThisStatement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_this", + /*type*/ undefined, initializer) + ]), originalStatement); + ts.setEmitFlags(captureThisStatement, 1536 /* NoComments */ | 524288 /* CustomPrologue */); + ts.setSourceMapRange(captureThisStatement, node); + statements.push(captureThisStatement); + } /** * Adds statements to the class body function for a class to define the members of the * class. @@ -49657,18 +50252,18 @@ var ts; function transformClassMethodDeclarationToStatement(receiver, member) { var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); - var func = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); - ts.setEmitFlags(func, 49152 /* NoComments */); - ts.setSourceMapRange(func, sourceMapRange); - var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), - /*location*/ member.name), func), + var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), /*location*/ member.name); + var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); + ts.setEmitFlags(memberFunction, 1536 /* NoComments */); + ts.setSourceMapRange(memberFunction, sourceMapRange); + var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), /*location*/ member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); // The location for the statement is used to emit comments only. // No source map should be emitted for this statement to align with the // old emitter. - ts.setEmitFlags(statement, 1536 /* NoSourceMap */); + ts.setEmitFlags(statement, 48 /* NoSourceMap */); return statement; } /** @@ -49683,7 +50278,7 @@ var ts; // The location for the statement is used to emit source maps only. // No comments should be emitted for this statement to align with the // old emitter. - ts.setEmitFlags(statement, 49152 /* NoComments */); + ts.setEmitFlags(statement, 1536 /* NoComments */); return statement; } /** @@ -49697,16 +50292,16 @@ var ts; // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. var target = ts.getMutableClone(receiver); - ts.setEmitFlags(target, 49152 /* NoComments */ | 1024 /* NoTrailingSourceMap */); + ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */); ts.setSourceMapRange(target, firstAccessor.name); var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName)); - ts.setEmitFlags(propertyName, 49152 /* NoComments */ | 512 /* NoLeadingSourceMap */); + ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */); ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); - ts.setEmitFlags(getterFunction, 16384 /* NoLeadingComments */); + ts.setEmitFlags(getterFunction, 512 /* NoLeadingComments */); var getter = ts.createPropertyAssignment("get", getterFunction); ts.setCommentRange(getter, ts.getCommentRange(getAccessor)); properties.push(getter); @@ -49714,7 +50309,7 @@ var ts; if (setAccessor) { var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); - ts.setEmitFlags(setterFunction, 16384 /* NoLeadingComments */); + ts.setEmitFlags(setterFunction, 512 /* NoLeadingComments */); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); properties.push(setter); @@ -49737,11 +50332,17 @@ var ts; * @param node An ArrowFunction node. */ function visitArrowFunction(node) { - if (node.transformFlags & 262144 /* ContainsLexicalThis */) { + if (node.transformFlags & 16384 /* ContainsLexicalThis */) { enableSubstitutionsForCapturedThis(); } - var func = transformFunctionLikeToExpression(node, /*location*/ node, /*name*/ undefined); - ts.setEmitFlags(func, 256 /* CapturesThis */); + var func = ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node), node); + ts.setOriginalNode(func, node); + ts.setEmitFlags(func, 8 /* CapturesThis */); return func; } /** @@ -49750,7 +50351,12 @@ var ts; * @param node a FunctionExpression node. */ function visitFunctionExpression(node) { - return transformFunctionLikeToExpression(node, /*location*/ node, node.name); + return ts.updateFunctionExpression(node, + /*modifiers*/ undefined, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + ? transformFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } /** * Visits a FunctionDeclaration node. @@ -49758,12 +50364,12 @@ var ts; * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node) { - return ts.setOriginalNode(ts.createFunctionDeclaration( - /*decorators*/ undefined, node.modifiers, node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis), - /*location*/ node), - /*original*/ node); + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, node.modifiers, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + ? transformFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } /** * Transforms a function-like node into a FunctionExpression. @@ -49779,12 +50385,86 @@ var ts; } var expression = ts.setOriginalNode(ts.createFunctionExpression( /*modifiers*/ undefined, node.asteriskToken, name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, saveStateAndInvoke(node, transformFunctionBody), location), /*original*/ node); enclosingNonArrowFunction = savedContainingNonArrowFunction; return expression; } + /** + * Transforms the body of a function-like node. + * + * @param node A function-like node. + */ + function transformFunctionBody(node) { + var multiLine = false; // indicates whether the block *must* be emitted as multiple lines + var singleLine = false; // indicates whether the block *may* be emitted as a single line + var statementsLocation; + var closeBraceLocation; + var statements = []; + var body = node.body; + var statementOffset; + resumeLexicalEnvironment(); + if (ts.isBlock(body)) { + // ensureUseStrict is false because no new prologue-directive should be added. + // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array + statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); + } + addCaptureThisForNodeIfNeeded(statements, node); + addDefaultValueAssignmentsIfNeeded(statements, node); + addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false); + // If we added any generated statements, this must be a multi-line block. + if (!multiLine && statements.length > 0) { + multiLine = true; + } + if (ts.isBlock(body)) { + statementsLocation = body.statements; + ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); + // If the original body was a multi-line block, this must be a multi-line block. + if (!multiLine && body.multiLine) { + multiLine = true; + } + } + else { + ts.Debug.assert(node.kind === 185 /* ArrowFunction */); + // To align with the old emitter, we use a synthetic end position on the location + // for the statement list we synthesize when we down-level an arrow function with + // an expression function body. This prevents both comments and source maps from + // being emitted for the end position only. + statementsLocation = ts.moveRangeEnd(body, -1); + var equalsGreaterThanToken = node.equalsGreaterThanToken; + if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { + if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { + singleLine = true; + } + else { + multiLine = true; + } + } + var expression = ts.visitNode(body, visitor, ts.isExpression); + var returnStatement = ts.createReturn(expression, /*location*/ body); + ts.setEmitFlags(returnStatement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 1024 /* NoTrailingComments */); + statements.push(returnStatement); + // To align with the source map emit for the old emitter, we set a custom + // source map location for the close brace. + closeBraceLocation = body; + } + var lexicalEnvironment = context.endLexicalEnvironment(); + ts.addRange(statements, lexicalEnvironment); + // If we added any final generated statements, this must be a multi-line block + if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { + multiLine = true; + } + var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine); + if (!multiLine && singleLine) { + ts.setEmitFlags(block, 1 /* SingleLine */); + } + if (closeBraceLocation) { + ts.setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation); + } + ts.setOriginalNode(block, node.body); + return block; + } /** * Visits an ExpressionStatement that contains a destructuring assignment. * @@ -49809,14 +50489,12 @@ var ts; */ function visitParenthesizedExpression(node, needsDestructuringValue) { // If we are here it is most likely because our expression is a destructuring assignment. - if (needsDestructuringValue) { + if (!needsDestructuringValue) { switch (node.expression.kind) { case 183 /* ParenthesizedExpression */: - return ts.createParen(visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ true), - /*location*/ node); + return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); case 192 /* BinaryExpression */: - return ts.createParen(visitBinaryExpression(node.expression, /*needsDestructuringValue*/ true), - /*location*/ node); + return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } } return ts.visitEachChild(node, visitor, context); @@ -49830,8 +50508,9 @@ var ts; */ function visitBinaryExpression(node, needsDestructuringValue) { // If we are here it is because this is a destructuring assignment. - ts.Debug.assert(ts.isDestructuringAssignment(node)); - return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor); + if (ts.isDestructuringAssignment(node)) { + return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, needsDestructuringValue); + } } function visitVariableStatement(node) { if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) == 0) { @@ -49843,7 +50522,7 @@ var ts; if (decl.initializer) { var assignment = void 0; if (ts.isBindingPattern(decl.name)) { - assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, /*createAssignmentCallback*/ undefined, visitor); + assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */); } else { assignment = ts.createBinary(decl.name, 57 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression)); @@ -49876,7 +50555,7 @@ var ts; var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node); ts.setOriginalNode(declarationList, node); ts.setCommentRange(declarationList, node); - if (node.transformFlags & 67108864 /* ContainsBindingPattern */ + if (node.transformFlags & 8388608 /* ContainsBindingPattern */ && (ts.isBindingPattern(node.declarations[0].name) || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { // If the first or last declaration is a binding pattern, we need to modify @@ -49964,9 +50643,9 @@ var ts; return visitVariableDeclaration(node); } if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) { - var clone_5 = ts.getMutableClone(node); - clone_5.initializer = ts.createVoidZero(); - return clone_5; + var clone_3 = ts.getMutableClone(node); + clone_3.initializer = ts.createVoidZero(); + return clone_3; } return ts.visitEachChild(node, visitor, context); } @@ -49978,9 +50657,10 @@ var ts; function visitVariableDeclaration(node) { // If we are here it is because the name contains a binding pattern. if (ts.isBindingPattern(node.name)) { - var recordTempVariablesInLine = !enclosingVariableStatement - || !ts.hasModifier(enclosingVariableStatement, 1 /* Export */); - return ts.flattenVariableDestructuring(node, /*value*/ undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration); + var hoistTempVariables = enclosingVariableStatement + && ts.hasModifier(enclosingVariableStatement, 1 /* Export */); + return ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, + /*value*/ undefined, hoistTempVariables); } return ts.visitEachChild(node, visitor, context); } @@ -50024,7 +50704,118 @@ var ts; return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); } function convertForOfToFor(node, convertedLoopBodyStatements) { - return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, /*transformRest*/ false); + // The following ES6 code: + // + // for (let v of expr) { } + // + // should be emitted as + // + // for (var _i = 0, _a = expr; _i < _a.length; _i++) { + // var v = _a[_i]; + // } + // + // where _a and _i are temps emitted to capture the RHS and the counter, + // respectively. + // When the left hand side is an expression instead of a let declaration, + // the "let v" is not emitted. + // When the left hand side is a let/const, the v is renamed if there is + // another v in scope. + // Note that all assignments to the LHS are emitted in the body, including + // all destructuring. + // Note also that because an extra statement is needed to assign to the LHS, + // for-of bodies are always emitted as blocks. + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var initializer = node.initializer; + var statements = []; + // In the case where the user wrote an identifier as the RHS, like this: + // + // for (let v of arr) { } + // + // we don't want to emit a temporary variable for the RHS, just use it directly. + var counter = ts.createLoopVariable(); + var rhsReference = expression.kind === 70 /* Identifier */ + ? ts.createUniqueName(expression.text) + : ts.createTempVariable(/*recordTempVariable*/ undefined); + var elementAccess = ts.createElementAccess(rhsReference, counter); + // Initialize LHS + // var v = _a[_i]; + if (ts.isVariableDeclarationList(initializer)) { + if (initializer.flags & 3 /* BlockScoped */) { + enableSubstitutionsForBlockScopedBindings(); + } + var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); + if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { + // This works whether the declaration is a var, let, or const. + // It will use rhsIterationValue _a[_i] as the initializer. + var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0 /* All */, elementAccess); + var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ initializer); + ts.setOriginalNode(declarationList, initializer); + // Adjust the source map range for the first declaration to align with the old + // emitter. + var firstDeclaration = declarations[0]; + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, declarationList)); + } + else { + // The following call does not include the initializer, so we have + // to emit it separately. + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, ts.setOriginalNode(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(/*recordTempVariable*/ undefined), + /*type*/ undefined, ts.createElementAccess(rhsReference, counter)) + ], /*location*/ ts.moveRangePos(initializer, -1)), initializer), + /*location*/ ts.moveRangeEnd(initializer, -1))); + } + } + else { + // Initializer is an expression. Emit the expression in the body, so that it's + // evaluated on every iteration. + var assignment = ts.createAssignment(initializer, elementAccess); + if (ts.isDestructuringAssignment(assignment)) { + // This is a destructuring pattern, so we flatten the destructuring instead. + statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0 /* All */))); + } + else { + // Currently there is not way to check that assignment is binary expression of destructing assignment + // so we have to cast never type to binaryExpression + assignment.end = initializer.end; + statements.push(ts.createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1))); + } + } + var bodyLocation; + var statementsLocation; + if (convertedLoopBodyStatements) { + ts.addRange(statements, convertedLoopBodyStatements); + } + else { + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + if (ts.isBlock(statement)) { + ts.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; + } + else { + statements.push(statement); + } + } + // The old emitter does not emit source maps for the expression + ts.setEmitFlags(expression, 48 /* NoSourceMap */ | ts.getEmitFlags(expression)); + // The old emitter does not emit source maps for the block. + // We add the location to preserve comments. + var body = ts.createBlock(ts.createNodeArray(statements, /*location*/ statementsLocation), + /*location*/ bodyLocation); + ts.setEmitFlags(body, 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */); + var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(counter, /*type*/ undefined, ts.createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)), + ts.createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression) + ], /*location*/ node.expression), 1048576 /* NoHoisting */), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), + /*location*/ node.expression), ts.createPostfixIncrement(counter, /*location*/ node.expression), body, + /*location*/ node); + // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. + ts.setEmitFlags(forStatement, 256 /* NoTokenTrailingSourceMaps */); + return forStatement; } /** * Visits an ObjectLiteralExpression with computed propety names. @@ -50040,7 +50831,7 @@ var ts; var numInitialProperties = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 134217728 /* ContainsYield */ + if (property.transformFlags & 16777216 /* ContainsYield */ || property.name.kind === 142 /* ComputedPropertyName */) { numInitialProperties = i; break; @@ -50053,7 +50844,7 @@ var ts; // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. var expressions = []; var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), - /*location*/ undefined, node.multiLine), 524288 /* Indented */)); + /*location*/ undefined, node.multiLine), 32768 /* Indented */)); if (node.multiLine) { assignment.startsOnNewLine = true; } @@ -50147,26 +50938,31 @@ var ts; convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; } } + startLexicalEnvironment(); var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { - var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_3); - loopBody = ts.createBlock(statements_3, /*location*/ undefined, /*multiline*/ true); + if (loopOutParameters.length || lexicalEnvironment) { + var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, /*location*/ undefined, /*multiline*/ true); } if (!ts.isBlock(loopBody)) { loopBody = ts.createBlock([loopBody], /*location*/ undefined, /*multiline*/ true); } var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152 /* AsyncFunctionBody */) !== 0 - && (node.statement.transformFlags & 134217728 /* ContainsYield */) !== 0; + && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072 /* AsyncFunctionBody */) !== 0 + && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { - loopBodyFlags |= 256 /* CapturesThis */; + loopBodyFlags |= 8 /* CapturesThis */; } if (isAsyncBlockContainingAwait) { - loopBodyFlags |= 2097152 /* AsyncFunctionBody */; + loopBodyFlags |= 131072 /* AsyncFunctionBody */; } var convertedLoopVariable = ts.createVariableStatement( /*modifiers*/ undefined, ts.setEmitFlags(ts.createVariableDeclarationList([ @@ -50176,7 +50972,7 @@ var ts; /*name*/ undefined, /*typeParameters*/ undefined, loopParameters, /*type*/ undefined, loopBody), loopBodyFlags)) - ]), 16777216 /* NoHoisting */)); + ]), 1048576 /* NoHoisting */)); var statements = [convertedLoopVariable]; var extraVariableDeclarations; // propagate state from the inner loop to the outer loop if necessary @@ -50457,7 +51253,7 @@ var ts; ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); var temp = ts.createTempVariable(undefined); var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenVariableDestructuring(node.variableDeclaration, temp, visitor); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp); var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags); var destructure = ts.createVariableStatement(undefined, list); return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); @@ -50478,7 +51274,7 @@ var ts; // Methods with computed property names are handled in visitObjectLiteralExpression. ts.Debug.assert(!ts.isComputedPropertyName(node.name)); var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined); - ts.setEmitFlags(functionExpression, 16384 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression)); + ts.setEmitFlags(functionExpression, 512 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression)); return ts.createPropertyAssignment(node.name, functionExpression, /*location*/ node); } @@ -50525,10 +51321,10 @@ var ts; // because we contain a SpreadElementExpression. var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; if (node.expression.kind === 96 /* SuperKeyword */) { - ts.setEmitFlags(thisArg, 128 /* NoSubstitution */); + ts.setEmitFlags(thisArg, 4 /* NoSubstitution */); } var resultingCall; - if (node.transformFlags & 8388608 /* ContainsSpreadExpression */) { + if (node.transformFlags & 524288 /* ContainsSpread */) { // [source] // f(...a, b) // x.m(...a, b) @@ -50559,7 +51355,7 @@ var ts; } if (node.expression.kind === 96 /* SuperKeyword */) { var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 128 /* NoSubstitution */); + ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var initializer = ts.createLogicalOr(resultingCall, actualThis); return assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) @@ -50574,7 +51370,7 @@ var ts; */ function visitNewExpression(node) { // We are here because we contain a SpreadElementExpression. - ts.Debug.assert((node.transformFlags & 8388608 /* ContainsSpreadExpression */) !== 0); + ts.Debug.assert((node.transformFlags & 524288 /* ContainsSpread */) !== 0); // [source] // new C(...a) // @@ -50624,6 +51420,9 @@ var ts; return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, /*location*/ undefined, hasTrailingComma), visitor, ts.isExpression), /*location*/ undefined, multiLine); } + function visitSpreadElement(node) { + return ts.visitNode(node.expression, visitor, ts.isExpression); + } /** * Transforms the expression of a SpreadExpression node. * @@ -50790,18 +51589,6 @@ var ts; ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } - function visitSourceFileNode(node) { - var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1]; - var statements = []; - startLexicalEnvironment(); - ts.addRange(statements, prologue); - ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis); - ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement)); - ts.addRange(statements, endLexicalEnvironment()); - var clone = ts.getMutableClone(node); - clone.statements = ts.createNodeArray(statements, /*location*/ node.statements); - return clone; - } /** * Called by the printer just before a node is printed. * @@ -50927,7 +51714,7 @@ var ts; function substituteThisKeyword(node) { if (enabledSubstitutions & 1 /* CapturedThis */ && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 256 /* CapturesThis */) { + && ts.getEmitFlags(enclosingFunction) & 8 /* CapturesThis */) { return ts.createIdentifier("_this", /*location*/ node); } return node; @@ -50940,8 +51727,7 @@ var ts; if (!constructor || !hasExtendsClause) { return false; } - var parameter = ts.singleOrUndefined(constructor.parameters); - if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) { + if (ts.some(constructor.parameters)) { return false; } var statement = ts.firstOrUndefined(constructor.body.statements); @@ -50961,10 +51747,24 @@ var ts; return false; } var expression = callArgument.expression; - return ts.isIdentifier(expression) && expression === parameter.name; + return ts.isIdentifier(expression) && expression.text === "arguments"; } } ts.transformES2015 = transformES2015; + function createExtendsHelper(context, name) { + context.requestEmitHelper(extendsHelper); + return ts.createCall(ts.getHelperName("__extends"), + /*typeArguments*/ undefined, [ + name, + ts.createIdentifier("_super") + ]); + } + var extendsHelper = { + name: "typescript:extends", + scoped: false, + priority: 0, + text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + }; })(ts || (ts = {})); /// /// @@ -51146,7 +51946,7 @@ var ts; _a[7 /* Endfinally */] = "endfinally", _a)); function transformGenerators(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var resolver = context.getEmitResolver(); @@ -51196,15 +51996,15 @@ var ts; var withBlockStack; // A stack containing `with` blocks. return transformSourceFile; function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { + if (ts.isDeclarationFile(node) + || (node.transformFlags & 512 /* ContainsGenerator */) === 0) { return node; } - if (node.transformFlags & 8192 /* ContainsGenerator */) { - currentSourceFile = node; - node = ts.visitEachChild(node, visitor, context); - currentSourceFile = undefined; - } - return node; + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } /** * Visits a node. @@ -51219,10 +52019,10 @@ var ts; else if (inGeneratorFunctionBody) { return visitJavaScriptInGeneratorFunctionBody(node); } - else if (transformFlags & 4096 /* Generator */) { + else if (transformFlags & 256 /* Generator */) { return visitGenerator(node); } - else if (transformFlags & 8192 /* ContainsGenerator */) { + else if (transformFlags & 512 /* ContainsGenerator */) { return ts.visitEachChild(node, visitor, context); } else { @@ -51275,10 +52075,10 @@ var ts; case 216 /* ReturnStatement */: return visitReturnStatement(node); default: - if (node.transformFlags & 134217728 /* ContainsYield */) { + if (node.transformFlags & 16777216 /* ContainsYield */) { return visitJavaScriptContainingYield(node); } - else if (node.transformFlags & (8192 /* ContainsGenerator */ | 268435456 /* ContainsHoistedDeclarationOrCompletion */)) { + else if (node.transformFlags & (512 /* ContainsGenerator */ | 33554432 /* ContainsHoistedDeclarationOrCompletion */)) { return ts.visitEachChild(node, visitor, context); } else { @@ -51340,12 +52140,11 @@ var ts; */ function visitFunctionDeclaration(node) { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) { + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { node = ts.setOriginalNode(ts.createFunctionDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, + /*decorators*/ undefined, node.modifiers, /*asteriskToken*/ undefined, node.name, - /*typeParameters*/ undefined, node.parameters, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, transformGeneratorFunctionBody(node.body), /*location*/ node), node); } @@ -51379,11 +52178,11 @@ var ts; */ function visitFunctionExpression(node) { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) { + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { node = ts.setOriginalNode(ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, node.name, - /*typeParameters*/ undefined, node.parameters, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, transformGeneratorFunctionBody(node.body), /*location*/ node), node); } @@ -51452,7 +52251,7 @@ var ts; operationLocations = undefined; state = ts.createTempVariable(/*recordTempVariable*/ undefined); // Build the generator - startLexicalEnvironment(); + resumeLexicalEnvironment(); var statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); @@ -51483,13 +52282,13 @@ var ts; * @param node The node to visit. */ function visitVariableStatement(node) { - if (node.transformFlags & 134217728 /* ContainsYield */) { + if (node.transformFlags & 16777216 /* ContainsYield */) { transformAndEmitVariableDeclarationList(node.declarationList); return undefined; } else { // Do not hoist custom prologues. - if (ts.getEmitFlags(node) & 8388608 /* CustomPrologue */) { + if (ts.getEmitFlags(node) & 524288 /* CustomPrologue */) { return node; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { @@ -51606,10 +52405,10 @@ var ts; // _a = a(); // .yield resumeLabel // _a + %sent% + c() - var clone_6 = ts.getMutableClone(node); - clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_6; + var clone_4 = ts.getMutableClone(node); + clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_4; } return ts.visitEachChild(node, visitor, context); } @@ -51762,7 +52561,7 @@ var ts; * @param node The node to visit. */ function visitArrayLiteralExpression(node) { - return visitElements(node.elements, node.multiLine); + return visitElements(node.elements, /*leadingElement*/ undefined, /*location*/ undefined, node.multiLine); } /** * Visits an array of expressions containing one or more YieldExpression nodes @@ -51771,7 +52570,7 @@ var ts; * @param elements The elements to visit. * @param multiLine Whether array literals created should be emitted on multiple lines. */ - function visitElements(elements, _multiLine) { + function visitElements(elements, leadingElement, location, multiLine) { // [source] // ar = [1, yield, 2]; // @@ -51785,19 +52584,24 @@ var ts; var temp = declareLocal(); var hasAssignedTemp = false; if (numInitialElements > 0) { - emitAssignment(temp, ts.createArrayLiteral(ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements))); + var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); + emitAssignment(temp, ts.createArrayLiteral(leadingElement + ? [leadingElement].concat(initialElements) : initialElements)); + leadingElement = undefined; hasAssignedTemp = true; } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); return hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)]) - : ts.createArrayLiteral(expressions); + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine); function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { emitAssignment(temp, hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)]) - : ts.createArrayLiteral(expressions)); + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, + /*location*/ undefined, multiLine)); hasAssignedTemp = true; + leadingElement = undefined; expressions = []; } expressions.push(ts.visitNode(element, visitor, ts.isExpression)); @@ -51863,10 +52667,10 @@ var ts; // .yield resumeLabel // .mark resumeLabel // a = _a[%sent%] - var clone_7 = ts.getMutableClone(node); - clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_7; + var clone_5 = ts.getMutableClone(node); + clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -51901,7 +52705,8 @@ var ts; // .mark resumeLabel // new (_b.apply(_a, _c.concat([%sent%, 2]))); var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)), + return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, + /*leadingElement*/ ts.createVoidZero())), /*typeArguments*/ undefined, [], /*location*/ node), node); } @@ -52524,7 +53329,7 @@ var ts; } } function containsYield(node) { - return node && (node.transformFlags & 134217728 /* ContainsYield */) !== 0; + return node && (node.transformFlags & 16777216 /* ContainsYield */) !== 0; } function countInitialNodesWithoutYield(nodes) { var numNodes = nodes.length; @@ -52554,12 +53359,12 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_35 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_35) { - var clone_8 = ts.getMutableClone(name_35); - ts.setSourceMapRange(clone_8, node); - ts.setCommentRange(clone_8, node); - return clone_8; + var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_37) { + var clone_6 = ts.getMutableClone(name_37); + ts.setSourceMapRange(clone_6, node); + ts.setCommentRange(clone_6, node); + return clone_6; } } } @@ -53145,18 +53950,14 @@ var ts; currentExceptionBlock = undefined; withBlockStack = undefined; var buildResult = buildStatements(); - return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), - /*typeArguments*/ undefined, [ - ts.createThis(), - ts.setEmitFlags(ts.createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)], - /*type*/ undefined, ts.createBlock(buildResult, - /*location*/ undefined, - /*multiLine*/ buildResult.length > 0)), 4194304 /* ReuseTempVariableScope */) - ]); + return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)], + /*type*/ undefined, ts.createBlock(buildResult, + /*location*/ undefined, + /*multiLine*/ buildResult.length > 0)), 262144 /* ReuseTempVariableScope */)); } /** * Builds the statements for the generator function body. @@ -53527,6 +54328,76 @@ var ts; } } ts.transformGenerators = transformGenerators; + function createGeneratorHelper(context, body) { + context.requestEmitHelper(generatorHelper); + return ts.createCall(ts.getHelperName("__generator"), + /*typeArguments*/ undefined, [ts.createThis(), body]); + } + // The __generator helper is used by down-level transformations to emulate the runtime + // semantics of an ES2015 generator function. When called, this helper returns an + // object that implements the Iterator protocol, in that it has `next`, `return`, and + // `throw` methods that step through the generator when invoked. + // + // parameters: + // thisArg The value to use as the `this` binding for the transformed generator body. + // body A function that acts as the transformed generator body. + // + // variables: + // _ Persistent state for the generator that is shared between the helper and the + // generator body. The state object has the following members: + // sent() - A method that returns or throws the current completion value. + // label - The next point at which to resume evaluation of the generator body. + // trys - A stack of protected regions (try/catch/finally blocks). + // ops - A stack of pending instructions when inside of a finally block. + // f A value indicating whether the generator is executing. + // y An iterator to delegate for a yield*. + // t A temporary variable that holds one of the following values (note that these + // cases do not overlap): + // - The completion value when resuming from a `yield` or `yield*`. + // - The error value for a catch block. + // - The current protected region (array of try/catch/finally/end labels). + // - The verb (`next`, `throw`, or `return` method) to delegate to the expression + // of a `yield*`. + // - The result of evaluating the verb delegated to the expression of a `yield*`. + // + // functions: + // verb(n) Creates a bound callback to the `step` function for opcode `n`. + // step(op) Evaluates opcodes in a generator body until execution is suspended or + // completed. + // + // The __generator helper understands a limited set of instructions: + // 0: next(value?) - Start or resume the generator with the specified value. + // 1: throw(error) - Resume the generator with an exception. If the generator is + // suspended inside of one or more protected regions, evaluates + // any intervening finally blocks between the current label and + // the nearest catch block or function boundary. If uncaught, the + // exception is thrown to the caller. + // 2: return(value?) - Resume the generator as if with a return. If the generator is + // suspended inside of one or more protected regions, evaluates any + // intervening finally blocks. + // 3: break(label) - Jump to the specified label. If the label is outside of the + // current protected region, evaluates any intervening finally + // blocks. + // 4: yield(value?) - Yield execution to the caller with an optional value. When + // resumed, the generator will continue at the next label. + // 5: yield*(value) - Delegates evaluation to the supplied iterator. When + // delegation completes, the generator will continue at the next + // label. + // 6: catch(error) - Handles an exception thrown from within the generator body. If + // the current label is inside of one or more protected regions, + // evaluates any intervening finally blocks between the current + // label and the nearest catch block or function boundary. If + // uncaught, the exception is thrown to the caller. + // 7: endfinally - Ends a finally block, resuming the last instruction prior to + // entering a finally block. + // + // For examples of how these are used, see the comments in ./transformers/generators.ts + var generatorHelper = { + name: "typescript:generator", + scoped: false, + priority: 6, + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + }; var _a; })(ts || (ts = {})); /// @@ -53615,13 +54486,32 @@ var ts; (function (ts) { function transformES2015Module(context) { var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.enableEmitNotification(261 /* SourceFile */); + context.enableSubstitution(70 /* Identifier */); + var currentSourceFile; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - return ts.visitEachChild(node, visitor, context); + var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); + if (externalHelpersModuleName) { + var statements = []; + var statementOffset = ts.addPrologueDirectives(statements, node.statements); + ts.append(statements, ts.createImportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + } + else { + return ts.visitEachChild(node, visitor, context); + } } return node; } @@ -53639,6 +54529,51 @@ var ts; // Elide `export=` as it is not legal with --module ES6 return node.isExportEquals ? undefined : node; } + // + // Emit Notification + // + /** + * Hook for node emit. + * + * @param emitContext A context hint for the emitter. + * @param node The node to emit. + * @param emit A callback used to emit the node in the printer. + */ + function onEmitNode(emitContext, node, emitCallback) { + if (ts.isSourceFile(node)) { + currentSourceFile = node; + previousOnEmitNode(emitContext, node, emitCallback); + currentSourceFile = undefined; + } + else { + previousOnEmitNode(emitContext, node, emitCallback); + } + } + // + // Substitutions + // + /** + * Hooks node substitutions. + * + * @param emitContext A context hint for the emitter. + * @param node The node to substitute. + */ + function onSubstituteNode(emitContext, node) { + node = previousOnSubstituteNode(emitContext, node); + if (ts.isIdentifier(node) && emitContext === 1 /* Expression */) { + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096 /* HelperName */) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + } + return node; + } } ts.transformES2015Module = transformES2015Module; })(ts || (ts = {})); @@ -53700,13 +54635,14 @@ var ts; // The only exception in this rule is postfix unary operators, // see comment to 'substitutePostfixUnaryExpression' for more details // Collect information about the external module and dependency groups. - moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver); + moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); // Make sure that the name of the 'exports' function does not conflict with // existing identifiers. exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); contextObject = ts.createUniqueName("context"); // Add the body of the module. var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); + var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); var moduleBodyFunction = ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, @@ -53715,19 +54651,21 @@ var ts; ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction), ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject) ], - /*type*/ undefined, createSystemModuleBody(node, dependencyGroups)); + /*type*/ undefined, moduleBodyBlock); // Write the call to `System.register` // Clear the emit-helpers flag for later passes since we'll have already used it in the module body // So the helper will be emit at the correct position instead of at the top of the source-file var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray([ + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.createNodeArray([ ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), /*typeArguments*/ undefined, moduleName ? [moduleName, dependencies, moduleBodyFunction] : [dependencies, moduleBodyFunction])) - ], node.statements)); - ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1 /* EmitEmitHelpers */); + ], node.statements)), 1024 /* NoTrailingComments */); + if (!(compilerOptions.outFile || compilerOptions.out)) { + ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); + } if (noSubstitution) { noSubstitutionMap[id] = noSubstitution; noSubstitution = undefined; @@ -53827,6 +54765,8 @@ var ts; ts.createVariableDeclaration("__moduleName", /*type*/ undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) ]))); + // Visit the synthetic external helpers import declaration if present + ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true); // Visit the statements of the source file, emitting any transformations into // the `executeStatements` array. We do this *before* we fill the `setters` array // as we both emit transformations as well as aggregate some data used when creating @@ -53853,9 +54793,7 @@ var ts; /*multiLine*/ true))) ]), /*multiLine*/ true))); - var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true); - ts.setEmitFlags(body, 1 /* EmitEmitHelpers */); - return body; + return ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true); } /** * Adds an exportStar function to a statement list if it is needed for the file. @@ -53940,7 +54878,8 @@ var ts; var exports = ts.createIdentifier("exports"); var condition = ts.createStrictInequality(n, ts.createLiteral("default")); if (localNames) { - condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n))); + condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), + /*typeArguments*/ undefined, [n]))); } return ts.createFunctionDeclaration( /*decorators*/ undefined, @@ -53956,7 +54895,7 @@ var ts; ts.createForIn(ts.createVariableDeclarationList([ ts.createVariableDeclaration(n, /*type*/ undefined) ]), m, ts.createBlock([ - ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32 /* SingleLine */) + ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1 /* SingleLine */) ])), ts.createStatement(ts.createCall(exportFunction, /*typeArguments*/ undefined, [exports])) @@ -54229,7 +55168,7 @@ var ts; */ function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file - return (ts.getEmitFlags(node) & 16777216 /* NoHoisting */) === 0 + return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 && (enclosingBlockScopedContainer.kind === 261 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } @@ -54242,7 +55181,8 @@ var ts; function transformInitializedVariable(node, isExportedDeclaration) { var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; return ts.isBindingPattern(node.name) - ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor) + ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, + /*needsValue*/ false, createAssignment) : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); } /** @@ -54306,7 +55246,7 @@ var ts; * @param node The node to test. */ function hasAssociatedEndOfDeclarationMarker(node) { - return (ts.getEmitFlags(node) & 33554432 /* HasEndOfDeclarationMarker */) !== 0; + return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0; } /** * Visits a DeclarationMarker used as a placeholder for the end of a transformed @@ -54507,7 +55447,7 @@ var ts; var statement = ts.createStatement(createExportExpression(name, value)); ts.startOnNewLine(statement); if (!allowComments) { - ts.setEmitFlags(statement, 49152 /* NoComments */); + ts.setEmitFlags(statement, 1536 /* NoComments */); } return statement; } @@ -54565,9 +55505,9 @@ var ts; return visitCatchClause(node); case 204 /* Block */: return visitBlock(node); - case 294 /* MergeDeclarationMarker */: + case 295 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 295 /* EndOfDeclarationMarker */: + case 296 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -54746,11 +55686,11 @@ var ts; * @param node The node to visit. */ function destructuringVisitor(node) { - if (node.transformFlags & 16384 /* DestructuringAssignment */ + if (node.transformFlags & 1024 /* DestructuringAssignment */ && node.kind === 192 /* BinaryExpression */) { return visitDestructuringAssignment(node); } - else if (node.transformFlags & 32768 /* ContainsDestructuringAssignment */) { + else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) { return ts.visitEachChild(node, destructuringVisitor, context); } else { @@ -54764,7 +55704,8 @@ var ts; */ function visitDestructuringAssignment(node) { if (hasExportedReferenceInDestructuringTarget(node.left)) { - return ts.flattenDestructuringAssignment(context, node, /*needsValue*/ true, hoistVariableDeclaration, destructuringVisitor); + return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, + /*needsValue*/ true); } return ts.visitEachChild(node, destructuringVisitor, context); } @@ -54888,6 +55829,13 @@ var ts; * @param node The node to substitute. */ function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096 /* HelperName */) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + return node; + } // When we see an identifier in an expression position that // points to an imported symbol, we should substitute a qualified // reference to the imported symbol if one is needed. @@ -55035,7 +55983,7 @@ var ts; _a[ts.ModuleKind.AMD] = transformAMDModule, _a[ts.ModuleKind.UMD] = transformUMDModule, _a)); - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var host = context.getEmitHost(); @@ -55069,7 +56017,7 @@ var ts; return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver); + currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); // Perform the transformation. var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; var updated = transformModule(node); @@ -55086,12 +56034,13 @@ var ts; startLexicalEnvironment(); var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false); var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); if (currentModuleInfo.hasExportStarsToExportValues) { - ts.setEmitFlags(updated, 2 /* EmitExportStar */ | ts.getEmitFlags(node)); + ts.addEmitHelper(updated, exportStarHelper); } return updated; } @@ -55111,8 +56060,7 @@ var ts; * @param node The SourceFile node. */ function transformUMDModule(node) { - var define = ts.createIdentifier("define"); - ts.setEmitFlags(define, 16 /* UMDDefine */); + var define = ts.createRawExpression(umdHelper); return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false); } /** @@ -55209,7 +56157,7 @@ var ts; if (includeNonAmdDependencies && importAliasName) { // Set emitFlags on the name of the classDeclaration // This is so that when printer will not substitute the identifier - ts.setEmitFlags(importAliasName, 128 /* NoSubstitution */); + ts.setEmitFlags(importAliasName, 4 /* NoSubstitution */); aliasedModuleNames.push(externalModuleName); importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName)); } @@ -55229,6 +56177,7 @@ var ts; var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); // Visit each statement of the module body. + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); // End the lexical environment for the module body // and merge any new lexical declarations. @@ -55239,7 +56188,7 @@ var ts; if (currentModuleInfo.hasExportStarsToExportValues) { // If we have any `export * from ...` declarations // we need to inform the emitter to add the __export helper. - ts.setEmitFlags(body, 2 /* EmitExportStar */); + ts.addEmitHelper(body, exportStarHelper); } return body; } @@ -55256,13 +56205,13 @@ var ts; if (emitAsReturn) { var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, /*location*/ currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 49152 /* NoComments */); + ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 1536 /* NoComments */); statements.push(statement); } else { var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), /*location*/ currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 49152 /* NoComments */); + ts.setEmitFlags(statement, 1536 /* NoComments */); statements.push(statement); } } @@ -55291,9 +56240,9 @@ var ts; return visitFunctionDeclaration(node); case 226 /* ClassDeclaration */: return visitClassDeclaration(node); - case 294 /* MergeDeclarationMarker */: + case 295 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 295 /* EndOfDeclarationMarker */: + case 296 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: // This visitor does not descend into the tree, as export/import statements @@ -55582,7 +56531,9 @@ var ts; */ function transformInitializedVariable(node) { if (ts.isBindingPattern(node.name)) { - return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression); + return ts.flattenDestructuringAssignment(node, + /*visitor*/ undefined, context, 0 /* All */, + /*needsValue*/ false, createExportExpression); } else { return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, @@ -55615,7 +56566,7 @@ var ts; * @param node The node to test. */ function hasAssociatedEndOfDeclarationMarker(node) { - return (ts.getEmitFlags(node) & 33554432 /* HasEndOfDeclarationMarker */) !== 0; + return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0; } /** * Visits a DeclarationMarker used as a placeholder for the end of a transformed @@ -55818,7 +56769,7 @@ var ts; var statement = ts.createStatement(createExportExpression(name, value), location); ts.startOnNewLine(statement); if (!allowComments) { - ts.setEmitFlags(statement, 49152 /* NoComments */); + ts.setEmitFlags(statement, 1536 /* NoComments */); } return statement; } @@ -55939,6 +56890,13 @@ var ts; * @param node The node to substitute. */ function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096 /* HelperName */) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + return node; + } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { @@ -55952,8 +56910,8 @@ var ts; /*location*/ node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_36 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_36), + var name_38 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), /*location*/ node); } } @@ -56049,6 +57007,14 @@ var ts; var _a; } ts.transformModule = transformModule; + // emit output for the __export helper function + var exportStarHelper = { + name: "typescript:export-star", + scoped: true, + text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" + }; + // emit output for the UMD helper function. + var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); /// /// @@ -56118,23 +57084,29 @@ var ts; * @param transforms An array of Transformers. */ function transformFiles(resolver, host, sourceFiles, transformers) { + var enabledSyntaxKindFeatures = new Array(298 /* Count */); + var lexicalEnvironmentDisabled = false; + var lexicalEnvironmentVariableDeclarations; + var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; var lexicalEnvironmentFunctionDeclarationsStack = []; - var enabledSyntaxKindFeatures = new Array(296 /* Count */); var lexicalEnvironmentStackOffset = 0; - var hoistedVariableDeclarations; - var hoistedFunctionDeclarations; - var lexicalEnvironmentDisabled; + var lexicalEnvironmentSuspended = false; + var emitHelpers; // The transformation context is provided to each transformer as part of transformer // initialization. var context = { getCompilerOptions: function () { return host.getCompilerOptions(); }, getEmitResolver: function () { return resolver; }, getEmitHost: function () { return host; }, + startLexicalEnvironment: startLexicalEnvironment, + suspendLexicalEnvironment: suspendLexicalEnvironment, + resumeLexicalEnvironment: resumeLexicalEnvironment, + endLexicalEnvironment: endLexicalEnvironment, hoistVariableDeclaration: hoistVariableDeclaration, hoistFunctionDeclaration: hoistFunctionDeclaration, - startLexicalEnvironment: startLexicalEnvironment, - endLexicalEnvironment: endLexicalEnvironment, + requestEmitHelper: requestEmitHelper, + readEmitHelpers: readEmitHelpers, onSubstituteNode: function (_emitContext, node) { return node; }, enableSubstitution: enableSubstitution, isSubstitutionEnabled: isSubstitutionEnabled, @@ -56175,7 +57147,7 @@ var ts; */ function isSubstitutionEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 1 /* Substitution */) !== 0 - && (ts.getEmitFlags(node) & 128 /* NoSubstitution */) === 0; + && (ts.getEmitFlags(node) & 4 /* NoSubstitution */) === 0; } /** * Emits a node with possible substitution. @@ -56208,7 +57180,7 @@ var ts; */ function isEmitNotificationEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 2 /* EmitNotifications */) !== 0 - || (ts.getEmitFlags(node) & 64 /* AdviseOnEmitNode */) !== 0; + || (ts.getEmitFlags(node) & 2 /* AdviseOnEmitNode */) !== 0; } /** * Emits a node with possible emit notification. @@ -56233,11 +57205,11 @@ var ts; function hoistVariableDeclaration(name) { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); var decl = ts.createVariableDeclaration(name); - if (!hoistedVariableDeclarations) { - hoistedVariableDeclarations = [decl]; + if (!lexicalEnvironmentVariableDeclarations) { + lexicalEnvironmentVariableDeclarations = [decl]; } else { - hoistedVariableDeclarations.push(decl); + lexicalEnvironmentVariableDeclarations.push(decl); } } /** @@ -56245,11 +57217,11 @@ var ts; */ function hoistFunctionDeclaration(func) { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = [func]; + if (!lexicalEnvironmentFunctionDeclarations) { + lexicalEnvironmentFunctionDeclarations = [func]; } else { - hoistedFunctionDeclarations.push(func); + lexicalEnvironmentFunctionDeclarations.push(func); } } /** @@ -56258,15 +57230,28 @@ var ts; */ function startLexicalEnvironment() { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); // Save the current lexical environment. Rather than resizing the array we adjust the // stack size variable. This allows us to reuse existing array slots we've // already allocated between transformations to avoid allocation and GC overhead during // transformation. - lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedVariableDeclarations; - lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedFunctionDeclarations; + lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations; + lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations; lexicalEnvironmentStackOffset++; - hoistedVariableDeclarations = undefined; - hoistedFunctionDeclarations = undefined; + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + } + /** Suspends the current lexical environment, usually after visiting a parameter list. */ + function suspendLexicalEnvironment() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); + lexicalEnvironmentSuspended = true; + } + /** Resumes a suspended lexical environment, usually before visiting a function body. */ + function resumeLexicalEnvironment() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); + lexicalEnvironmentSuspended = false; } /** * Ends a lexical environment. The previous set of hoisted declarations are restored and @@ -56274,14 +57259,15 @@ var ts; */ function endLexicalEnvironment() { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; - if (hoistedVariableDeclarations || hoistedFunctionDeclarations) { - if (hoistedFunctionDeclarations) { - statements = hoistedFunctionDeclarations.slice(); + if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { + if (lexicalEnvironmentFunctionDeclarations) { + statements = lexicalEnvironmentFunctionDeclarations.slice(); } - if (hoistedVariableDeclarations) { + if (lexicalEnvironmentVariableDeclarations) { var statement = ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList(hoistedVariableDeclarations)); + /*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations)); if (!statements) { statements = [statement]; } @@ -56292,10 +57278,25 @@ var ts; } // Restore the previous lexical environment. lexicalEnvironmentStackOffset--; - hoistedVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; - hoistedFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + if (lexicalEnvironmentStackOffset === 0) { + lexicalEnvironmentVariableDeclarationsStack = []; + lexicalEnvironmentFunctionDeclarationsStack = []; + } return statements; } + function requestEmitHelper(helper) { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); + emitHelpers = ts.append(emitHelpers, helper); + } + function readEmitHelpers() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + var helpers = emitHelpers; + emitHelpers = undefined; + return helpers; + } } ts.transformFiles = transformFiles; var _a; @@ -56520,12 +57521,12 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 292 /* NotEmittedStatement */ - && (emitFlags & 512 /* NoLeadingSourceMap */) === 0 + if (node.kind !== 293 /* NotEmittedStatement */ + && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); } - if (emitFlags & 2048 /* NoNestedSourceMaps */) { + if (emitFlags & 64 /* NoNestedSourceMaps */) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -56533,8 +57534,8 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 292 /* NotEmittedStatement */ - && (emitFlags & 1024 /* NoTrailingSourceMap */) === 0 + if (node.kind !== 293 /* NotEmittedStatement */ + && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); } @@ -56556,13 +57557,13 @@ var ts; var emitFlags = emitNode && emitNode.flags; var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos); - if ((emitFlags & 4096 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) { + if ((emitFlags & 128 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) { emitPos(tokenPos); } tokenPos = emitCallback(token, tokenPos); if (range) tokenPos = range.end; - if ((emitFlags & 8192 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) { + if ((emitFlags & 256 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) { emitPos(tokenPos); } return tokenPos; @@ -56603,7 +57604,7 @@ var ts; return; } encodeLastRecordedSourceMapSpan(); - return ts.stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, @@ -56699,7 +57700,7 @@ var ts; var emitFlags = ts.getEmitFlags(node); if ((pos < 0 && end < 0) || (pos === end)) { // Both pos and end are synthesized, so just emit the node without comments. - if (emitFlags & 65536 /* NoNestedComments */) { + if (emitFlags & 2048 /* NoNestedComments */) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -56712,9 +57713,9 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 292 /* NotEmittedStatement */; - var skipLeadingComments = pos < 0 || (emitFlags & 16384 /* NoLeadingComments */) !== 0; - var skipTrailingComments = end < 0 || (emitFlags & 32768 /* NoTrailingComments */) !== 0; + var isEmittedNode = node.kind !== 293 /* NotEmittedStatement */; + var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0; + var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { @@ -56738,7 +57739,7 @@ var ts; if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & 65536 /* NoNestedComments */) { + if (emitFlags & 2048 /* NoNestedComments */) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -56770,15 +57771,15 @@ var ts; } var pos = detachedRange.pos, end = detachedRange.end; var emitFlags = ts.getEmitFlags(node); - var skipLeadingComments = pos < 0 || (emitFlags & 16384 /* NoLeadingComments */) !== 0; - var skipTrailingComments = disabled || end < 0 || (emitFlags & 32768 /* NoTrailingComments */) !== 0; + var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0; + var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0; if (!skipLeadingComments) { emitDetachedCommentsAndUpdateCommentsInfo(detachedRange); } if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments"); } - if (emitFlags & 65536 /* NoNestedComments */ && !disabled) { + if (emitFlags & 2048 /* NoNestedComments */ && !disabled) { disabled = true; emitCallback(node); disabled = false; @@ -56791,6 +57792,9 @@ var ts; } if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); @@ -57100,6 +58104,7 @@ var ts; writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -57233,15 +58238,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { - var node = nodes_2[_i]; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { - var node = nodes_3[_i]; + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -57256,7 +58261,7 @@ var ts; } function writeJsDocComments(declaration) { if (declaration) { - var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText); + var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText); ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); // jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space ts.emitComments(currentText, currentLineMap, writer, jsDocComments, /*leadingSeparator*/ false, /*trailingSeparator*/ true, newLine, ts.writeCommentRange); @@ -57451,9 +58456,9 @@ var ts; var count = 0; while (true) { count++; - var name_37 = baseName + "_" + count; - if (!(name_37 in currentIdentifiers)) { - return name_37; + var name_39 = baseName + "_" + count; + if (!(name_39 in currentIdentifiers)) { + return name_39; } } } @@ -57864,6 +58869,9 @@ var ts; case 225 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; + case 228 /* TypeAliasDeclaration */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; + break; default: ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); } @@ -57960,7 +58968,10 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false); + var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); + if (interfaceExtendsTypes && interfaceExtendsTypes.length) { + emitHeritageClause(interfaceExtendsTypes, /*isImplementsList*/ false); + } write(" {"); writeLine(); increaseIndent(); @@ -58395,6 +59406,11 @@ var ts; return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 155 /* IndexSignature */: + // Interfaces cannot have parameter types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* Static */)) { @@ -58611,87 +59627,6 @@ var ts; function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { var delimiters = createDelimiterMap(); var brackets = createBracketsMap(); - // emit output for the __extends helper function - var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; - // Emit output for the __assign helper function. - // This is typically used for JSX spread attributes, - // and can be used for object literal spread properties. - var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; - var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};"; - // emit output for the __decorate helper function - var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; - // emit output for the __metadata helper function - var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - // emit output for the __param helper function - var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - // emit output for the __awaiter helper function - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};"; - // The __generator helper is used by down-level transformations to emulate the runtime - // semantics of an ES2015 generator function. When called, this helper returns an - // object that implements the Iterator protocol, in that it has `next`, `return`, and - // `throw` methods that step through the generator when invoked. - // - // parameters: - // thisArg The value to use as the `this` binding for the transformed generator body. - // body A function that acts as the transformed generator body. - // - // variables: - // _ Persistent state for the generator that is shared between the helper and the - // generator body. The state object has the following members: - // sent() - A method that returns or throws the current completion value. - // label - The next point at which to resume evaluation of the generator body. - // trys - A stack of protected regions (try/catch/finally blocks). - // ops - A stack of pending instructions when inside of a finally block. - // f A value indicating whether the generator is executing. - // y An iterator to delegate for a yield*. - // t A temporary variable that holds one of the following values (note that these - // cases do not overlap): - // - The completion value when resuming from a `yield` or `yield*`. - // - The error value for a catch block. - // - The current protected region (array of try/catch/finally/end labels). - // - The verb (`next`, `throw`, or `return` method) to delegate to the expression - // of a `yield*`. - // - The result of evaluating the verb delegated to the expression of a `yield*`. - // - // functions: - // verb(n) Creates a bound callback to the `step` function for opcode `n`. - // step(op) Evaluates opcodes in a generator body until execution is suspended or - // completed. - // - // The __generator helper understands a limited set of instructions: - // 0: next(value?) - Start or resume the generator with the specified value. - // 1: throw(error) - Resume the generator with an exception. If the generator is - // suspended inside of one or more protected regions, evaluates - // any intervening finally blocks between the current label and - // the nearest catch block or function boundary. If uncaught, the - // exception is thrown to the caller. - // 2: return(value?) - Resume the generator as if with a return. If the generator is - // suspended inside of one or more protected regions, evaluates any - // intervening finally blocks. - // 3: break(label) - Jump to the specified label. If the label is outside of the - // current protected region, evaluates any intervening finally - // blocks. - // 4: yield(value?) - Yield execution to the caller with an optional value. When - // resumed, the generator will continue at the next label. - // 5: yield*(value) - Delegates evaluation to the supplied iterator. When - // delegation completes, the generator will continue at the next - // label. - // 6: catch(error) - Handles an exception thrown from within the generator body. If - // the current label is inside of one or more protected regions, - // evaluates any intervening finally blocks between the current - // label and the nearest catch block or function boundary. If - // uncaught, the exception is thrown to the caller. - // 7: endfinally - Ends a finally block, resuming the last instruction prior to - // entering a finally block. - // - // For examples of how these are used, see the comments in ./transformers/generators.ts - var generatorHelper = "\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};"; - // emit output for the __export helper function - var exportStarHelper = "\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}"; - // emit output for the UMD helper function. - var umdHelper = "\n(function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n})"; - var superHelper = "\nconst _super = name => super[name];"; - var advancedSuperHelper = "\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"; var compilerOptions = host.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); @@ -58713,12 +59648,7 @@ var ts; var currentSourceFile; var currentText; var currentFileIdentifiers; - var extendsEmitted; - var assignEmitted; - var restEmitted; - var decorateEmitted; - var paramEmitted; - var awaiterEmitted; + var bundledHelpers; var isOwnFileEmit; var emitSkipped = false; var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); @@ -58771,12 +59701,13 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNameSet = ts.createMap(); + bundledHelpers = isBundledEmit ? ts.createMap() : undefined; isOwnFileEmit = !isBundledEmit; // Emit helpers from all the files if (isBundledEmit && moduleKind) { for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { var sourceFile = sourceFiles_5[_a]; - emitEmitHelpers(sourceFile); + emitHelpers(sourceFile, /*isBundle*/ true); } } // Print each transformed source file. @@ -58788,14 +59719,14 @@ var ts; } // Write the source map if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false); + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles); } // Record source map data for the test harness. if (sourceMapDataList) { sourceMapDataList.push(sourceMap.getSourceMapData()); } // Write the output file - ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM); + ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); // Reset state sourceMap.reset(); comments.reset(); @@ -58803,11 +59734,6 @@ var ts; tempFlags = 0 /* Auto */; currentSourceFile = undefined; currentText = undefined; - extendsEmitted = false; - assignEmitted = false; - decorateEmitted = false; - paramEmitted = false; - awaiterEmitted = false; isOwnFileEmit = false; } function printSourceFile(node) { @@ -59271,8 +60197,10 @@ var ts; case 247 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); // Transformation nodes - case 293 /* PartiallyEmittedExpression */: + case 294 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); + case 297 /* RawExpression */: + return writeLines(node.text); } } // @@ -59305,12 +60233,7 @@ var ts; // Identifiers // function emitIdentifier(node) { - if (ts.getEmitFlags(node) & 16 /* UMDDefine */) { - writeLines(umdHelper); - } - else { - write(getTextOfNode(node, /*includeTrivia*/ false)); - } + write(getTextOfNode(node, /*includeTrivia*/ false)); } // // Names @@ -59571,7 +60494,7 @@ var ts; write("{}"); } else { - var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */; + var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */; if (indentedFlag) { increaseIndent(); } @@ -59586,7 +60509,7 @@ var ts; function emitPropertyAccessExpression(node) { var indentBeforeDot = false; var indentAfterDot = false; - if (!(ts.getEmitFlags(node) & 1048576 /* NoIndentation */)) { + if (!(ts.getEmitFlags(node) & 65536 /* NoIndentation */)) { var dotRangeStart = node.expression.end; var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1; var dotToken = { kind: 22 /* DotToken */, pos: dotRangeStart, end: dotRangeEnd }; @@ -59793,7 +60716,7 @@ var ts; } } function emitBlockStatements(node) { - if (ts.getEmitFlags(node) & 32 /* SingleLine */) { + if (ts.getEmitFlags(node) & 1 /* SingleLine */) { emitList(node, node.statements, 384 /* SingleLineBlockStatements */); } else { @@ -59972,11 +60895,11 @@ var ts; var body = node.body; if (body) { if (ts.isBlock(body)) { - var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */; + var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */; if (indentedFlag) { increaseIndent(); } - if (ts.getEmitFlags(node) & 4194304 /* ReuseTempVariableScope */) { + if (ts.getEmitFlags(node) & 262144 /* ReuseTempVariableScope */) { emitSignatureHead(node); emitBlockFunctionBody(body); } @@ -60014,7 +60937,7 @@ var ts; // * The body is explicitly marked as multi-line. // * A non-synthesized body's start and end position are on different lines. // * Any statement in the body starts on a new line. - if (ts.getEmitFlags(body) & 32 /* SingleLine */) { + if (ts.getEmitFlags(body) & 1 /* SingleLine */) { return true; } if (body.multiLine) { @@ -60070,7 +60993,7 @@ var ts; emitModifiers(node, node.modifiers); write("class"); emitNodeWithPrefix(" ", node.name, emitIdentifierName); - var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */; + var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */; if (indentedFlag) { increaseIndent(); } @@ -60350,7 +61273,7 @@ var ts; // "comment1" is not considered to be leading comment for node.initializer // but rather a trailing comment on the previous node. var initializer = node.initializer; - if ((ts.getEmitFlags(initializer) & 16384 /* NoLeadingComments */) === 0) { + if ((ts.getEmitFlags(initializer) & 512 /* NoLeadingComments */) === 0) { var commentRange = ts.getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos); } @@ -60416,78 +61339,37 @@ var ts; } return statements.length; } - function emitHelpers(node) { - var emitFlags = ts.getEmitFlags(node); + function emitHelpers(node, isBundle) { + var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile; + var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); + var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit; var helpersEmitted = false; - if (emitFlags & 1 /* EmitEmitHelpers */) { - helpersEmitted = emitEmitHelpers(currentSourceFile); - } - if (emitFlags & 2 /* EmitExportStar */) { - writeLines(exportStarHelper); - helpersEmitted = true; - } - if (emitFlags & 4 /* EmitSuperHelper */) { - writeLines(superHelper); - helpersEmitted = true; - } - if (emitFlags & 8 /* EmitAdvancedSuperHelper */) { - writeLines(advancedSuperHelper); - helpersEmitted = true; - } - return helpersEmitted; - } - function emitEmitHelpers(node) { - // Only emit helpers if the user did not say otherwise. - if (compilerOptions.noEmitHelpers) { - return false; - } - // Don't emit helpers if we can import them. - if (compilerOptions.importHelpers - && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { - return false; - } - var helpersEmitted = false; - // Only Emit __extends function when target ES5. - // For target ES6 and above, we can emit classDeclaration as is. - if ((languageVersion < 2 /* ES2015 */) && (!extendsEmitted && node.flags & 1024 /* HasClassExtends */)) { - writeLines(extendsHelper); - extendsEmitted = true; - helpersEmitted = true; - } - if ((languageVersion < 5 /* ESNext */ || currentSourceFile.scriptKind === 2 /* JSX */ || currentSourceFile.scriptKind === 4 /* TSX */) && - compilerOptions.jsx !== 1 /* Preserve */ && - !assignEmitted && - node.flags & 16384 /* HasSpreadAttribute */) { - writeLines(assignHelper); - assignEmitted = true; - } - if (languageVersion < 5 /* ESNext */ && !restEmitted && node.flags & 32768 /* HasRestAttribute */) { - writeLines(restHelper); - restEmitted = true; - } - if (!decorateEmitted && node.flags & 2048 /* HasDecorators */) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); + var helpers = ts.getEmitHelpers(node); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + // Skip the helper if it can be skipped and the noEmitHelpers compiler + // option is set, or if it can be imported and the importHelpers compiler + // option is set. + if (shouldSkip) + continue; + // Skip the helper if it can be bundled but hasn't already been emitted and we + // are emitting a bundled module. + if (shouldBundle) { + if (bundledHelpers[helper.name]) { + continue; + } + bundledHelpers[helper.name] = true; + } + } + else if (isBundle) { + // Skip the helper if it is scoped and we are emitting bundled helpers + continue; + } + writeLines(helper.text); + helpersEmitted = true; } - decorateEmitted = true; - helpersEmitted = true; - } - if (!paramEmitted && node.flags & 4096 /* HasParamDecorators */) { - writeLines(paramHelper); - paramEmitted = true; - helpersEmitted = true; - } - // Only emit __awaiter function when target ES5/ES6. - // Only emit __generator function when target ES5. - // For target ES2017 and above, we can emit async/await as is. - if ((languageVersion < 4 /* ES2017 */) && (!awaiterEmitted && node.flags & 8192 /* HasAsyncFunctions */)) { - writeLines(awaiterHelper); - if (languageVersion < 2 /* ES2015 */) { - writeLines(generatorHelper); - } - awaiterEmitted = true; - helpersEmitted = true; } if (helpersEmitted) { writeLine(); @@ -60495,9 +61377,10 @@ var ts; return helpersEmitted; } function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); for (var i = 0; i < lines.length; i++) { - var line = lines[i]; + var line = indentation ? lines[i].slice(indentation) : lines[i]; if (line.length) { if (i > 0) { writeLine(); @@ -60506,6 +61389,21 @@ var ts; } } } + function guessIndentation(lines) { + var indentation; + for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { + var line = lines_1[_a]; + for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { + if (!ts.isWhiteSpace(line.charCodeAt(i))) { + if (indentation === undefined || i < indentation) { + indentation = i; + break; + } + } + } + } + return indentation; + } // // Helpers // @@ -60873,10 +61771,10 @@ var ts; */ function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_38 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_38)) { + var name_40 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_40)) { tempFlags |= flags; - return name_38; + return name_40; } } while (true) { @@ -60884,11 +61782,11 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_39 = count < 26 + var name_41 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_39)) { - return name_39; + if (isUniqueName(name_41)) { + return name_41; } } } @@ -61113,8 +62011,6 @@ var ts; /// var ts; (function (ts) { - /** The version of the TypeScript compiler release */ - ts.version = "2.2.0"; var emptyArray = []; function findConfigFile(searchPath, fileExists, configName) { if (configName === void 0) { configName = "tsconfig.json"; } @@ -61341,10 +62237,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_40 = names_1[_i]; - var result = name_40 in cache - ? cache[name_40] - : cache[name_40] = loader(name_40, containingFile); + var name_42 = names_1[_i]; + var result = name_42 in cache + ? cache[name_42] + : cache[name_42] = loader(name_42, containingFile); resolutions.push(result); } return resolutions; @@ -61414,7 +62310,8 @@ var ts; var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host); if (typeReferences.length) { // This containingFilename needs to match with the one used in managed-side - var containingFilename = ts.combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts"); + var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); + var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts"); var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename); for (var i = 0; i < typeReferences.length; i++) { processTypeReferenceDirective(typeReferences[i], resolutions[i]); @@ -61995,8 +62892,8 @@ var ts; } break; } - for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) { - var node = nodes_4[_b]; + for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { + var node = nodes_6[_b]; walk(node); } } @@ -62911,7 +63808,7 @@ var ts; "es2017": 4 /* ES2017 */, "esnext": 5 /* ESNext */, }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, paramType: ts.Diagnostics.VERSION, }, { @@ -63100,11 +63997,18 @@ var ts; } ]; /* @internal */ - ts.typingOptionDeclarations = [ + ts.typeAcquisitionDeclarations = [ { + /* @deprecated typingOptions.enableAutoDiscovery + * Use typeAcquisition.enable instead. + */ name: "enableAutoDiscovery", type: "boolean", }, + { + name: "enable", + type: "boolean", + }, { name: "include", type: "list", @@ -63131,6 +64035,20 @@ var ts; }; var optionNameMapCache; /* @internal */ + function convertEnableAutoDiscoveryToEnable(typeAcquisition) { + // Convert deprecated typingOptions.enableAutoDiscovery to typeAcquisition.enable + if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { + var result = { + enable: typeAcquisition.enableAutoDiscovery, + include: typeAcquisition.include || [], + exclude: typeAcquisition.exclude || [] + }; + return result; + } + return typeAcquisition; + } + ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; + /* @internal */ function getOptionNameMap() { if (optionNameMapCache) { return optionNameMapCache; @@ -63155,14 +64073,7 @@ var ts; ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; /* @internal */ function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; /* @internal */ @@ -63186,7 +64097,6 @@ var ts; } } ts.parseListTypeOption = parseListTypeOption; - /* @internal */ function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -63371,11 +64281,11 @@ var ts; function serializeCompilerOptions(options) { var result = ts.createMap(); var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_41 in options) { - if (ts.hasProperty(options, name_41)) { + for (var name_43 in options) { + if (ts.hasProperty(options, name_43)) { // tsconfig only options cannot be specified via command line, // so we can assume that only types that can appear here string | number | boolean - switch (name_41) { + switch (name_43) { case "init": case "watch": case "version": @@ -63383,14 +64293,14 @@ var ts; case "project": break; default: - var value = options[name_41]; - var optionDefinition = optionsNameMap[name_41.toLowerCase()]; + var value = options[name_43]; + var optionDefinition = optionsNameMap[name_43.toLowerCase()]; if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { // There is no map associated with this compiler option then use the value as-is // This is the case if the value is expect to be string, number, boolean or list of string - result[name_41] = value; + result[name_43] = value; } else { if (optionDefinition.type === "list") { @@ -63399,11 +64309,11 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_41] = convertedValue; + result[name_43] = convertedValue; } else { // There is a typeMap associated with this command-line option so use it to map value back to its name - result[name_41] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name_43] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -63446,9 +64356,10 @@ var ts; * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); @@ -63456,14 +64367,17 @@ var ts; return { options: {}, fileNames: [], - typingOptions: {}, + typeAcquisition: {}, raw: json, errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))], wildcardDirectories: {} }; } var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + // typingOptions has been deprecated and is only supported for backward compatibility purposes. + // It should be removed in future releases - use typeAcquisition instead. + var jsonOptions = json["typeAcquisition"] || json["typingOptions"]; + var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); if (json["extends"]) { var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3]; if (typeof json["extends"] === "string") { @@ -63490,7 +64404,7 @@ var ts; return { options: options, fileNames: fileNames, - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, raw: json, errors: errors, wildcardDirectories: wildcardDirectories, @@ -63499,7 +64413,7 @@ var ts; function tryExtendsName(extendedConfig) { // If the path isn't a rooted or relative path, don't try to resolve it (we reserve the right to special case module-id like paths in the future) if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted)); + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); return; } var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName); @@ -63563,8 +64477,8 @@ var ts; errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); } else { - // By default, exclude common package folders and the outDir - excludeSpecs = ["node_modules", "bower_components", "jspm_packages"]; + // If no includes were specified, exclude common package folders and the outDir + excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"]; var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; if (outDir) { excludeSpecs.push(outDir); @@ -63573,7 +64487,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -63599,12 +64513,12 @@ var ts; return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; - function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { var errors = []; - var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } - ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } @@ -63612,9 +64526,10 @@ var ts; convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); return options; } - function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; - convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); + convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors); return options; } function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { @@ -63749,7 +64664,7 @@ var ts; * @param host The host used to resolve files and directories. * @param errors An array for diagnostic reporting. */ - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); // The exclude spec list is converted into a regular expression, which allows us to quickly // test whether a file or directory should be excluded before recursively traversing the @@ -63776,7 +64691,7 @@ var ts; var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); // Rather than requery this for each file and filespec, we query the supported extensions // once and store it on the expansion context. - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); // Literal files are always included verbatim. An "include" or "exclude" specification cannot // remove a literal file. if (fileNames) { @@ -63973,7 +64888,9 @@ var ts; this.text = text; } StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); }; StringScriptSnapshot.prototype.getLength = function () { return this.text.length; @@ -64519,7 +65436,7 @@ var ts; case 243 /* ExportSpecifier */: case 237 /* NamespaceImport */: return ts.ScriptElementKind.alias; - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -64755,7 +65672,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 291 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 292 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -65065,11 +65982,11 @@ var ts; } } if (node) { - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - if (jsDocComment.tags) { - for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) { + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + if (jsDoc.tags) { + for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; if (tag.pos <= position && position <= tag.end) { return tag; @@ -65246,6 +66163,7 @@ var ts; writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, + writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName); }, writeSymbol: writeSymbol, writeLine: writeLine, increaseIndent: function () { indent++; }, @@ -65408,7 +66326,7 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - else if (ts.isStringOrNumericLiteral(location.kind) && + else if (ts.isStringOrNumericLiteral(location) && location.parent.kind === 142 /* ComputedPropertyName */) { return location.text; } @@ -66145,16 +67063,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 280 /* JSDocParameterTag */: + case 281 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 283 /* JSDocTemplateTag */: + case 284 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 282 /* JSDocTypeTag */: + case 283 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 281 /* JSDocReturnTag */: + case 282 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -66432,14 +67350,14 @@ var ts; function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var nameTable = ts.getNameTable(sourceFile); - for (var name_42 in nameTable) { + for (var name_44 in nameTable) { // Skip identifiers produced only from the current location - if (nameTable[name_42] === position) { + if (nameTable[name_44] === position) { continue; } - if (!uniqueNames[name_42]) { - uniqueNames[name_42] = name_42; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_42), compilerOptions.target, /*performCharacterChecks*/ true); + if (!uniqueNames[name_44]) { + uniqueNames[name_44] = name_44; + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_44), compilerOptions.target, /*performCharacterChecks*/ true); if (displayName) { var entry = { name: displayName, @@ -66952,11 +67870,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_14 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_14) { + var parent_13 = ts.getDirectoryPath(currentDir); + if (currentDir === parent_13) { break; } - currentDir = parent_14; + currentDir = parent_13; } else { break; @@ -67037,14 +67955,14 @@ var ts; // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_2 = completionData.location; + var symbols = completionData.symbols, location_3 = completionData.location; // Find the symbol with the matching entry name. // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; }); + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_2, location_2, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), @@ -67072,12 +67990,12 @@ var ts; // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_3 = completionData.location; + var symbols = completionData.symbols, location_4 = completionData.location; // Find the symbol with the matching entry name. // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; }); + return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_4) === entryName ? s : undefined; }); } return undefined; } @@ -67108,9 +68026,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 282 /* JSDocTypeTag */: - case 280 /* JSDocParameterTag */: - case 281 /* JSDocReturnTag */: + case 283 /* JSDocTypeTag */: + case 281 /* JSDocParameterTag */: + case 282 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -67155,13 +68073,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_15 = contextToken.parent, kind = contextToken.kind; + var parent_14 = contextToken.parent, kind = contextToken.kind; if (kind === 22 /* DotToken */) { - if (parent_15.kind === 177 /* PropertyAccessExpression */) { + if (parent_14.kind === 177 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_15.kind === 141 /* QualifiedName */) { + else if (parent_14.kind === 141 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -67548,9 +68466,9 @@ var ts; switch (contextToken.kind) { case 16 /* OpenBraceToken */: // const x = { | case 25 /* CommaToken */: - var parent_16 = contextToken.parent; - if (parent_16 && (parent_16.kind === 176 /* ObjectLiteralExpression */ || parent_16.kind === 172 /* ObjectBindingPattern */)) { - return parent_16; + var parent_15 = contextToken.parent; + if (parent_15 && (parent_15.kind === 176 /* ObjectLiteralExpression */ || parent_15.kind === 172 /* ObjectBindingPattern */)) { + return parent_15; } break; } @@ -67577,37 +68495,37 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_17 = contextToken.parent; + var parent_16 = contextToken.parent; switch (contextToken.kind) { case 27 /* LessThanSlashToken */: case 40 /* SlashToken */: case 70 /* Identifier */: case 250 /* JsxAttribute */: case 251 /* JsxSpreadAttribute */: - if (parent_17 && (parent_17.kind === 247 /* JsxSelfClosingElement */ || parent_17.kind === 248 /* JsxOpeningElement */)) { - return parent_17; + if (parent_16 && (parent_16.kind === 247 /* JsxSelfClosingElement */ || parent_16.kind === 248 /* JsxOpeningElement */)) { + return parent_16; } - else if (parent_17.kind === 250 /* JsxAttribute */) { - return parent_17.parent; + else if (parent_16.kind === 250 /* JsxAttribute */) { + return parent_16.parent; } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_17 && ((parent_17.kind === 250 /* JsxAttribute */) || (parent_17.kind === 251 /* JsxSpreadAttribute */))) { - return parent_17.parent; + if (parent_16 && ((parent_16.kind === 250 /* JsxAttribute */) || (parent_16.kind === 251 /* JsxSpreadAttribute */))) { + return parent_16.parent; } break; case 17 /* CloseBraceToken */: - if (parent_17 && - parent_17.kind === 252 /* JsxExpression */ && - parent_17.parent && - (parent_17.parent.kind === 250 /* JsxAttribute */)) { - return parent_17.parent.parent; + if (parent_16 && + parent_16.kind === 252 /* JsxExpression */ && + parent_16.parent && + (parent_16.parent.kind === 250 /* JsxAttribute */)) { + return parent_16.parent.parent; } - if (parent_17 && parent_17.kind === 251 /* JsxSpreadAttribute */) { - return parent_17.parent; + if (parent_16 && parent_16.kind === 251 /* JsxSpreadAttribute */) { + return parent_16.parent; } break; } @@ -67744,8 +68662,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_43 = element.propertyName || element.name; - existingImportsOrExports[name_43.text] = true; + var name_45 = element.propertyName || element.name; + existingImportsOrExports[name_45.text] = true; } if (!ts.someProperties(existingImportsOrExports)) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); @@ -68104,19 +69022,19 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_18 = child.parent; - if (ts.isFunctionBlock(parent_18) || parent_18.kind === 261 /* SourceFile */) { - return parent_18; + var parent_17 = child.parent; + if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261 /* SourceFile */) { + return parent_17; } // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. - if (parent_18.kind === 221 /* TryStatement */) { - var tryStatement = parent_18; + if (parent_17.kind === 221 /* TryStatement */) { + var tryStatement = parent_17; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_18; + child = parent_17; } return undefined; } @@ -69073,24 +69991,24 @@ var ts; // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface var containingTypeReference = getContainingTypeReference(refNode); if (containingTypeReference) { - var parent_19 = containingTypeReference.parent; - if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); + var parent_18 = containingTypeReference.parent; + if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); } - else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { - if (parent_19.body.kind === 204 /* Block */) { - ts.forEachReturnStatement(parent_19.body, function (returnStatement) { + else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { + if (parent_18.body.kind === 204 /* Block */) { + ts.forEachReturnStatement(parent_18.body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); } }); } - else if (isImplementationExpression(parent_19.body)) { - maybeAdd(getReferenceEntryFromNode(parent_19.body)); + else if (isImplementationExpression(parent_18.body)) { + maybeAdd(getReferenceEntryFromNode(parent_18.body)); } } - else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_19.expression)); + else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { + maybeAdd(getReferenceEntryFromNode(parent_18.expression)); } } } @@ -69392,8 +70310,8 @@ var ts; if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { return; } - var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); - if (type_2 === searchType) { + var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + if (type_1 === searchType) { references.push(getReferenceEntryFromNode(node_2)); } } @@ -69585,9 +70503,9 @@ var ts; return undefined; } } - var result_3 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3, /*previousIterationSymbolsCache*/ ts.createMap()); - return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result_4 = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ ts.createMap()); + return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); } return undefined; }); @@ -69596,7 +70514,7 @@ var ts; if (node.name.kind === 142 /* ComputedPropertyName */) { var nameExpression = node.name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal - if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; } return undefined; @@ -69608,20 +70526,20 @@ var ts; var contextualType = typeChecker.getContextualType(objectLiteral); var name = getNameFromObjectLiteralElement(node); if (name && contextualType) { - var result_4 = []; + var result_5 = []; var symbol_2 = contextualType.getProperty(name); if (symbol_2) { - result_4.push(symbol_2); + result_5.push(symbol_2); } if (contextualType.flags & 65536 /* Union */) { ts.forEach(contextualType.types, function (t) { var symbol = t.getProperty(name); if (symbol) { - result_4.push(symbol); + result_5.push(symbol); } }); } - return result_4; + return result_5; } return undefined; } @@ -69888,13 +70806,13 @@ var ts; return undefined; } if (type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */)) { - var result_5 = []; + var result_6 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(/*to*/ result_5, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node)); + ts.addRange(/*to*/ result_6, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node)); } }); - return result_5; + return result_6; } if (!type.symbol) { return undefined; @@ -70077,6 +70995,7 @@ var ts; "lends", "link", "memberOf", + "method", "name", "namespace", "param", @@ -70105,7 +71024,7 @@ var ts; // from Array - Array and Array var documentationComment = []; forEachUnique(declarations, function (declaration) { - var comments = ts.getJSDocComments(declaration, /*checkParentVariableStatement*/ true); + var comments = ts.getCommentsFromJSDoc(declaration); if (!comments) { return; } @@ -70214,13 +71133,19 @@ var ts; var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; for (var i = 0, numParams = parameters.length; i < numParams; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 /* Identifier */ ? currentName.text : "param" + i; - docParams += indentationStr + " * @param " + paramName + newLine; + if (isJavaScriptFile) { + docParams += indentationStr + " * @param {any} " + paramName + newLine; + } + else { + docParams += indentationStr + " * @param " + paramName + newLine; + } } // A doc comment consists of the following // * The opening comment line @@ -70312,13 +71237,13 @@ var ts; * @param projectRootPath is the path to the project root directory * @param safeListPath is the path used to retrieve the safe list * @param packageNameToTypingLocation is the map of package names to their cached typing locations - * @param typingOptions are used to customize the typing inference process + * @param typeAcquisition is used to customize the typing acquisition process * @param compilerOptions are used as a source for typing inference */ - function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) { + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { // A typing name to typing file path mapping var inferredTypings = ts.createMap(); - if (!typingOptions || !typingOptions.enableAutoDiscovery) { + if (!typeAcquisition || !typeAcquisition.enable) { return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; } // Only infer typings for .js and .jsx files @@ -70334,8 +71259,8 @@ var ts; // Directories to search for package.json, bower.json and other typing information var searchDirs = []; var exclude = []; - mergeTypings(typingOptions.include); - exclude = typingOptions.exclude || []; + mergeTypings(typeAcquisition.include); + exclude = typeAcquisition.exclude || []; var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); if (projectRootPath) { possibleSearchDirs.push(projectRootPath); @@ -70362,9 +71287,9 @@ var ts; } } // Add the cached typing locations for inferred typings that are already installed - for (var name_44 in packageNameToTypingLocation) { - if (name_44 in inferredTypings && !inferredTypings[name_44]) { - inferredTypings[name_44] = packageNameToTypingLocation[name_44]; + for (var name_46 in packageNameToTypingLocation) { + if (name_46 in inferredTypings && !inferredTypings[name_46]) { + inferredTypings[name_46] = packageNameToTypingLocation[name_46]; } } // Remove typings that the user has added to the exclude list @@ -70502,12 +71427,12 @@ var ts; return; } var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_45 in nameToDeclarations) { - var declarations = nameToDeclarations[name_45]; + for (var name_47 in nameToDeclarations) { + var declarations = nameToDeclarations[name_47]; if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_45); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_47); if (!matches) { continue; } @@ -70520,14 +71445,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_45); + matches = patternMatcher.getMatches(containers, name_47); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_45, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_47, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -70816,9 +71741,9 @@ var ts; case 174 /* BindingElement */: case 223 /* VariableDeclaration */: var decl = node; - var name_46 = decl.name; - if (ts.isBindingPattern(name_46)) { - addChildrenRecursively(name_46); + var name_48 = decl.name; + if (ts.isBindingPattern(name_48)) { + addChildrenRecursively(name_48); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { // For `const x = function() {}`, just use the function node, not the const. @@ -70865,9 +71790,9 @@ var ts; addLeafNode(node); break; default: - ts.forEach(node.jsDocComments, function (jsDocComment) { - ts.forEach(jsDocComment.tags, function (tag) { - if (tag.kind === 284 /* JSDocTypedefTag */) { + ts.forEach(node.jsDoc, function (jsDoc) { + ts.forEach(jsDoc.tags, function (tag) { + if (tag.kind === 285 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -70997,7 +71922,7 @@ var ts; case 185 /* ArrowFunction */: case 197 /* ClassExpression */: return getFunctionOrClassName(node); - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; @@ -71040,7 +71965,7 @@ var ts; return "()"; case 155 /* IndexSignature */: return "[]"; - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -71088,7 +72013,7 @@ var ts; case 230 /* ModuleDeclaration */: case 261 /* SourceFile */: case 228 /* TypeAliasDeclaration */: - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return true; case 150 /* Constructor */: case 149 /* MethodDeclaration */: @@ -71325,28 +72250,28 @@ var ts; switch (n.kind) { case 204 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_20 = n.parent; + var parent_19 = n.parent; var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_20.kind === 209 /* DoStatement */ || - parent_20.kind === 212 /* ForInStatement */ || - parent_20.kind === 213 /* ForOfStatement */ || - parent_20.kind === 211 /* ForStatement */ || - parent_20.kind === 208 /* IfStatement */ || - parent_20.kind === 210 /* WhileStatement */ || - parent_20.kind === 217 /* WithStatement */ || - parent_20.kind === 256 /* CatchClause */) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + if (parent_19.kind === 209 /* DoStatement */ || + parent_19.kind === 212 /* ForInStatement */ || + parent_19.kind === 213 /* ForOfStatement */ || + parent_19.kind === 211 /* ForStatement */ || + parent_19.kind === 208 /* IfStatement */ || + parent_19.kind === 210 /* WhileStatement */ || + parent_19.kind === 217 /* WithStatement */ || + parent_19.kind === 256 /* CatchClause */) { + addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_20.kind === 221 /* TryStatement */) { + if (parent_19.kind === 221 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_20; + var tryStatement = parent_19; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -73439,9 +74364,9 @@ var ts; return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { + for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { // Reached source file or module block - if (parent_21.kind === 261 /* SourceFile */ || parent_21.kind === 231 /* ModuleBlock */) { + if (parent_20.kind === 261 /* SourceFile */ || parent_20.kind === 231 /* ModuleBlock */) { return false; } } @@ -73552,7 +74477,7 @@ var ts; return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_4 = function (opt) { + var _loop_3 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -73571,7 +74496,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_4(opt); + _loop_3(opt); } return options; } @@ -74046,7 +74971,7 @@ var ts; function RuleOperationContext() { var funcs = []; for (var _i = 0; _i < arguments.length; _i++) { - funcs[_i - 0] = arguments[_i]; + funcs[_i] = arguments[_i]; } this.customContextChecks = funcs; } @@ -74317,9 +75242,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_47 in o) { - if (o[name_47] === rule) { - return name_47; + for (var name_49 in o) { + if (o[name_49] === rule) { + return name_49; } } throw new Error("Unknown rule"); @@ -75707,11 +76632,23 @@ var ts; else { var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); - if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) { + if (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) { recordReplace(startLinePosition, tokenStart.character, indentationString); } } } + function characterToColumn(startLinePosition, characterInLine) { + var column = 0; + for (var i = 0; i < characterInLine; i++) { + if (sourceFile.text.charCodeAt(startLinePosition + i) === 9 /* tab */) { + column += options.tabSize - column % options.tabSize; + } + else { + column++; + } + } + return column; + } function indentationIsDifferent(indentationString, startLinePosition) { return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); } @@ -76500,7 +77437,666 @@ var ts; }); })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + var ModuleSpecifierComparison; + (function (ModuleSpecifierComparison) { + ModuleSpecifierComparison[ModuleSpecifierComparison["Better"] = 0] = "Better"; + ModuleSpecifierComparison[ModuleSpecifierComparison["Equal"] = 1] = "Equal"; + ModuleSpecifierComparison[ModuleSpecifierComparison["Worse"] = 2] = "Worse"; + })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); + var ImportCodeActionMap = (function () { + function ImportCodeActionMap() { + this.symbolIdToActionMap = ts.createMap(); + } + ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { + if (!newAction) { + return; + } + if (!this.symbolIdToActionMap[symbolId]) { + this.symbolIdToActionMap[symbolId] = [newAction]; + return; + } + if (newAction.kind === "CodeChange") { + this.symbolIdToActionMap[symbolId].push(newAction); + return; + } + var updatedNewImports = []; + for (var _i = 0, _a = this.symbolIdToActionMap[symbolId]; _i < _a.length; _i++) { + var existingAction = _a[_i]; + if (existingAction.kind === "CodeChange") { + // only import actions should compare + updatedNewImports.push(existingAction); + continue; + } + switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) { + case ModuleSpecifierComparison.Better: + // the new one is not worth considering if it is a new improt. + // However if it is instead a insertion into existing import, the user might want to use + // the module specifier even it is worse by our standards. So keep it. + if (newAction.kind === "NewImport") { + return; + } + case ModuleSpecifierComparison.Equal: + // the current one is safe. But it is still possible that the new one is worse + // than another existing one. For example, you may have new imports from "./foo/bar" + // and "bar", when the new one is "bar/bar2" and the current one is "./foo/bar". The new + // one and the current one are not comparable (one relative path and one absolute path), + // but the new one is worse than the other one, so should not add to the list. + updatedNewImports.push(existingAction); + break; + case ModuleSpecifierComparison.Worse: + // the existing one is worse, remove from the list. + continue; + } + } + // if we reach here, it means the new one is better or equal to all of the existing ones. + updatedNewImports.push(newAction); + this.symbolIdToActionMap[symbolId] = updatedNewImports; + }; + ImportCodeActionMap.prototype.addActions = function (symbolId, newActions) { + for (var _i = 0, newActions_1 = newActions; _i < newActions_1.length; _i++) { + var newAction = newActions_1[_i]; + this.addAction(symbolId, newAction); + } + }; + ImportCodeActionMap.prototype.getAllActions = function () { + var result = []; + for (var symbolId in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + } + return result; + }; + ImportCodeActionMap.prototype.compareModuleSpecifiers = function (moduleSpecifier1, moduleSpecifier2) { + if (moduleSpecifier1 === moduleSpecifier2) { + return ModuleSpecifierComparison.Equal; + } + // if moduleSpecifier1 (ms1) is a substring of ms2, then it is better + if (moduleSpecifier2.indexOf(moduleSpecifier1) === 0) { + return ModuleSpecifierComparison.Better; + } + if (moduleSpecifier1.indexOf(moduleSpecifier2) === 0) { + return ModuleSpecifierComparison.Worse; + } + // if both are relative paths, and ms1 has fewer levels, then it is better + if (ts.isExternalModuleNameRelative(moduleSpecifier1) && ts.isExternalModuleNameRelative(moduleSpecifier2)) { + var regex = new RegExp(ts.directorySeparator, "g"); + var moduleSpecifier1LevelCount = (moduleSpecifier1.match(regex) || []).length; + var moduleSpecifier2LevelCount = (moduleSpecifier2.match(regex) || []).length; + return moduleSpecifier1LevelCount < moduleSpecifier2LevelCount + ? ModuleSpecifierComparison.Better + : moduleSpecifier1LevelCount === moduleSpecifier2LevelCount + ? ModuleSpecifierComparison.Equal + : ModuleSpecifierComparison.Worse; + } + // the equal cases include when the two specifiers are not comparable. + return ModuleSpecifierComparison.Equal; + }; + return ImportCodeActionMap; + }()); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var checker = context.program.getTypeChecker(); + var allSourceFiles = context.program.getSourceFiles(); + var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + var name = token.getText(); + var symbolIdActionMap = new ImportCodeActionMap(); + // this is a module id -> module import declaration map + var cachedImportDeclarations = ts.createMap(); + var cachedNewImportInsertPosition; + var allPotentialModules = checker.getAmbientModules(); + for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { + var otherSourceFile = allSourceFiles_1[_i]; + if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) { + allPotentialModules.push(otherSourceFile.symbol); + } + } + var currentTokenMeaning = ts.getMeaningFromLocation(token); + for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { + var moduleSymbol = allPotentialModules_1[_a]; + context.cancellationToken.throwIfCancellationRequested(); + // check the default export + var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); + if (defaultExport) { + var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport); + if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { + // check if this symbol is already used + var symbolId = getUniqueSymbolId(localSymbol); + symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, /*isDefault*/ true)); + } + } + // check exports with the same name + var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol); + if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) { + var symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName); + symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol)); + } + } + return symbolIdActionMap.getAllActions(); + function getImportDeclarations(moduleSymbol) { + var moduleSymbolId = getUniqueSymbolId(moduleSymbol); + if (cachedImportDeclarations[moduleSymbolId]) { + return cachedImportDeclarations[moduleSymbolId]; + } + var existingDeclarations = []; + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var importModuleSpecifier = _a[_i]; + var importSymbol = checker.getSymbolAtLocation(importModuleSpecifier); + if (importSymbol === moduleSymbol) { + existingDeclarations.push(getImportDeclaration(importModuleSpecifier)); + } + } + cachedImportDeclarations[moduleSymbolId] = existingDeclarations; + return existingDeclarations; + function getImportDeclaration(moduleSpecifier) { + var node = moduleSpecifier; + while (node) { + if (node.kind === 235 /* ImportDeclaration */) { + return node; + } + if (node.kind === 234 /* ImportEqualsDeclaration */) { + return node; + } + node = node.parent; + } + return undefined; + } + } + function getUniqueSymbolId(symbol) { + if (symbol.flags & 8388608 /* Alias */) { + return ts.getSymbolId(checker.getAliasedSymbol(symbol)); + } + return ts.getSymbolId(symbol); + } + function checkSymbolHasMeaning(symbol, meaning) { + var declarations = symbol.getDeclarations(); + return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; + } + function getCodeActionForImport(moduleSymbol, isDefault) { + var existingDeclarations = getImportDeclarations(moduleSymbol); + if (existingDeclarations.length > 0) { + // With an existing import statement, there are more than one actions the user can do. + return getCodeActionsForExistingImport(existingDeclarations); + } + else { + return [getCodeActionForNewImport()]; + } + function getCodeActionsForExistingImport(declarations) { + var actions = []; + // It is possible that multiple import statements with the same specifier exist in the file. + // e.g. + // + // import * as ns from "foo"; + // import { member1, member2 } from "foo"; + // + // member3/**/ <-- cusor here + // + // in this case we should provie 2 actions: + // 1. change "member3" to "ns.member3" + // 2. add "member3" to the second import statement's import list + // and it is up to the user to decide which one fits best. + var namespaceImportDeclaration; + var namedImportDeclaration; + var existingModuleSpecifier; + for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { + var declaration = declarations_11[_i]; + if (declaration.kind === 235 /* ImportDeclaration */) { + var namedBindings = declaration.importClause && declaration.importClause.namedBindings; + if (namedBindings && namedBindings.kind === 237 /* NamespaceImport */) { + // case: + // import * as ns from "foo" + namespaceImportDeclaration = declaration; + } + else { + // cases: + // import default from "foo" + // import { bar } from "foo" or combination with the first one + // import "foo" + namedImportDeclaration = declaration; + } + existingModuleSpecifier = declaration.moduleSpecifier.getText(); + } + else { + // case: + // import foo = require("foo") + namespaceImportDeclaration = declaration; + existingModuleSpecifier = getModuleSpecifierFromImportEqualsDeclaration(declaration); + } + } + if (namespaceImportDeclaration) { + actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); + } + if (namedImportDeclaration && namedImportDeclaration.importClause && + (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { + /** + * If the existing import declaration already has a named import list, just + * insert the identifier into that list. + */ + var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); + var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); + actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); + } + else { + // we need to create a new import statement, but the existing module specifier can be reused. + actions.push(getCodeActionForNewImport(existingModuleSpecifier)); + } + return actions; + function getModuleSpecifierFromImportEqualsDeclaration(declaration) { + if (declaration.moduleReference && declaration.moduleReference.kind === 245 /* ExternalModuleReference */) { + return declaration.moduleReference.expression.getText(); + } + return declaration.moduleReference.getText(); + } + function getTextChangeForImportClause(importClause) { + var newImportText = isDefault ? "default as " + name : name; + var importList = importClause.namedBindings; + // case 1: + // original text: import default from "module" + // change to: import default, { name } from "module" + if (!importList && importClause.name) { + var start = importClause.name.getEnd(); + return { + newText: ", { " + newImportText + " }", + span: { start: start, length: 0 } + }; + } + // case 2: + // original text: import {} from "module" + // change to: import { name } from "module" + if (importList.elements.length === 0) { + var start = importList.getStart(); + return { + newText: "{ " + newImportText + " }", + span: { start: start, length: importList.getEnd() - start } + }; + } + // case 3: + // original text: import { foo, bar } from "module" + // change to: import { foo, bar, name } from "module" + var insertPoint = importList.elements[importList.elements.length - 1].getEnd(); + /** + * If the import list has one import per line, preserve that. Otherwise, insert on same line as last element + * import { + * foo + * } from "./module"; + */ + var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart()); + var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd()); + var oneImportPerLine = endLine - startLine > importList.elements.length; + return { + newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText, + span: { start: insertPoint, length: 0 } + }; + } + function getCodeActionForNamespaceImport(declaration) { + var namespacePrefix; + if (declaration.kind === 235 /* ImportDeclaration */) { + namespacePrefix = declaration.importClause.namedBindings.name.getText(); + } + else { + namespacePrefix = declaration.name.getText(); + } + namespacePrefix = ts.stripQuotes(namespacePrefix); + /** + * Cases: + * import * as ns from "mod" + * import default, * as ns from "mod" + * import ns = require("mod") + * + * Because there is no import list, we alter the reference to include the + * namespace instead of altering the import declaration. For example, "foo" would + * become "ns.foo" + */ + return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange"); + } + } + function getCodeActionForNewImport(moduleSpecifier) { + if (!cachedNewImportInsertPosition) { + // insert after any existing imports + var lastModuleSpecifierEnd = -1; + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var moduleSpecifier_1 = _a[_i]; + var end = moduleSpecifier_1.getEnd(); + if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) { + lastModuleSpecifierEnd = end; + } + } + cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart(); + } + var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); + var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); + var importStatementText = isDefault + ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" + : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; + // if this file doesn't have any import statements, insert an import statement and then insert a new line + // between the only import statement and user code. Otherwise just insert the statement because chances + // are there are already a new line seperating code and import statements. + var newText = cachedNewImportInsertPosition === sourceFile.getStart() + ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter + : "" + context.newLineCharacter + importStatementText + ";"; + return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes); + function getModuleSpecifierForNewImport() { + var fileName = sourceFile.path; + var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path; + var sourceDirectory = ts.getDirectoryPath(fileName); + var options = context.program.getCompilerOptions(); + return tryGetModuleNameFromAmbientModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || + tryGetModuleNameFromTypeRoots() || + tryGetModuleNameAsNodeModule() || + ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); + function tryGetModuleNameFromAmbientModule() { + if (moduleSymbol.valueDeclaration.kind !== 261 /* SourceFile */) { + return moduleSymbol.name; + } + } + function tryGetModuleNameFromBaseUrl() { + if (!options.baseUrl) { + return undefined; + } + var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName); + var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl); + if (!relativeName) { + return undefined; + } + relativeName = removeExtensionAndIndexPostFix(relativeName); + if (options.paths) { + for (var key in options.paths) { + for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { + var pattern = _a[_i]; + var indexOfStar = pattern.indexOf("*"); + if (indexOfStar === 0 && pattern.length === 1) { + continue; + } + else if (indexOfStar !== -1) { + var prefix = pattern.substr(0, indexOfStar); + var suffix = pattern.substr(indexOfStar + 1); + if (relativeName.length >= prefix.length + suffix.length && + ts.startsWith(relativeName, prefix) && + ts.endsWith(relativeName, suffix)) { + var matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length); + return key.replace("\*", matchedStar); + } + } + else if (pattern === relativeName) { + return key; + } + } + } + } + return relativeName; + } + function tryGetModuleNameFromRootDirs() { + if (options.rootDirs) { + var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, /*basePath*/ undefined, getCanonicalFileName); }); + var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs); + var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs); + if (normalizedTargetPath !== undefined) { + var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath; + return ts.removeFileExtension(relativePath); + } + } + return undefined; + } + function tryGetModuleNameFromTypeRoots() { + var typeRoots = ts.getEffectiveTypeRoots(options, context.host); + if (typeRoots) { + var normalizedTypeRoots = ts.map(typeRoots, function (typeRoot) { return ts.toPath(typeRoot, /*basePath*/ undefined, getCanonicalFileName); }); + for (var _i = 0, normalizedTypeRoots_1 = normalizedTypeRoots; _i < normalizedTypeRoots_1.length; _i++) { + var typeRoot = normalizedTypeRoots_1[_i]; + if (ts.startsWith(moduleFileName, typeRoot)) { + var relativeFileName = moduleFileName.substring(typeRoot.length + 1); + return removeExtensionAndIndexPostFix(relativeFileName); + } + } + } + } + function tryGetModuleNameAsNodeModule() { + if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) { + // nothing to do here + return undefined; + } + var indexOfNodeModules = moduleFileName.indexOf("node_modules"); + if (indexOfNodeModules < 0) { + return undefined; + } + var relativeFileName; + if (sourceDirectory.indexOf(moduleFileName.substring(0, indexOfNodeModules - 1)) === 0) { + // if node_modules folder is in this folder or any of its parent folder, no need to keep it. + relativeFileName = moduleFileName.substring(indexOfNodeModules + 13 /* "node_modules\".length */); + } + else { + relativeFileName = getRelativePath(moduleFileName, sourceDirectory); + } + relativeFileName = ts.removeFileExtension(relativeFileName); + if (ts.endsWith(relativeFileName, "/index")) { + relativeFileName = ts.getDirectoryPath(relativeFileName); + } + else { + try { + var moduleDirectory = ts.getDirectoryPath(moduleFileName); + var packageJsonContent = JSON.parse(context.host.readFile(ts.combinePaths(moduleDirectory, "package.json"))); + if (packageJsonContent) { + var mainFile = packageJsonContent.main || packageJsonContent.typings; + if (mainFile) { + var mainExportFile = ts.toPath(mainFile, moduleDirectory, getCanonicalFileName); + if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(moduleFileName)) { + relativeFileName = ts.getDirectoryPath(relativeFileName); + } + } + } + } + catch (e) { } + } + return relativeFileName; + } + } + function getPathRelativeToRootDirs(path, rootDirs) { + for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) { + var rootDir = rootDirs_2[_i]; + var relativeName = tryRemoveParentDirectoryName(path, rootDir); + if (relativeName !== undefined) { + return relativeName; + } + } + return undefined; + } + function removeExtensionAndIndexPostFix(fileName) { + fileName = ts.removeFileExtension(fileName); + if (ts.endsWith(fileName, "/index")) { + fileName = fileName.substr(0, fileName.length - 6 /* "/index".length */); + } + return fileName; + } + function getRelativePath(path, directoryPath) { + var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); + return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath; + } + function tryRemoveParentDirectoryName(path, parentDirectory) { + var index = path.indexOf(parentDirectory); + if (index === 0) { + return ts.endsWith(parentDirectory, ts.directorySeparator) + ? path.substring(parentDirectory.length) + : path.substring(parentDirectory.length + 1); + } + return undefined; + } + } + } + function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) { + return { + description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)), + changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }], + kind: kind, + moduleSpecifier: moduleSpecifier + }; + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + // this handles var ["computed"] = 12; + if (token.kind === 20 /* OpenBracketToken */) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70 /* Identifier */: + switch (token.parent.kind) { + case 223 /* VariableDeclaration */: + switch (token.parent.parent.parent.kind) { + case 211 /* ForStatement */: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); + } + else { + return removeSingleItem(forInitializer.declarations, token); + } + case 213 /* ForOfStatement */: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { + var forOfInitializer = forOfStatement.initializer; + return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); + } + break; + case 212 /* ForInStatement */: + // There is no valid fix in the case of: + // for .. in + return undefined; + case 256 /* CatchClause */: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return createCodeFix("", parameter.pos, parameter.end - parameter.pos); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); + } + else { + var declarations = variableStatement.declarationList.declarations; + return removeSingleItem(declarations, token); + } + } + case 143 /* TypeParameter */: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); + } + else { + return removeSingleItem(typeParameters, token); + } + case 144 /* Parameter */: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else { + return removeSingleItem(functionDeclaration.parameters, token); + } + // handle case where 'import a = A;' + case 234 /* ImportEqualsDeclaration */: + var importEquals = findImportDeclaration(token); + return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); + case 239 /* ImportSpecifier */: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + // Only 1 import and it is unused. So the entire declaration should be removed. + var importSpec = findImportDeclaration(token); + return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); + } + else { + return removeSingleItem(namedImports.elements, token); + } + // handle case where "import d, * as ns from './file'" + // or "'import {a, b as ns} from './file'" + case 236 /* ImportClause */: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = findImportDeclaration(importClause); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); + } + case 237 /* NamespaceImport */: + var namespaceImport = token.parent; + if (namespaceImport.name == token && !namespaceImport.parent.name) { + var importDecl = findImportDeclaration(namespaceImport); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + var start_4 = namespaceImport.parent.name.end; + return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); + } + } + break; + case 147 /* PropertyDeclaration */: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + case 237 /* NamespaceImport */: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + if (ts.isDeclarationName(token)) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); + } + else { + return undefined; + } + function findImportDeclaration(token) { + var importDecl = token; + while (importDecl.kind != 235 /* ImportDeclaration */ && importDecl.parent) { + importDecl = importDecl.parent; + } + return importDecl; + } + function createCodeFix(newText, start, length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ newText: newText, span: { start: start, length: length } }] + }] + }]; + } + function removeSingleItem(elements, token) { + if (elements[0] === token.parent) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + else { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + } + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); /// +/// +/// /// /// /// @@ -76591,11 +78187,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(291 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(292 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var node = nodes_5[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -76614,7 +78210,7 @@ var ts; ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 290 /* LastJSDocTagNode */; + var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 291 /* LastJSDocTagNode */; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -76633,8 +78229,8 @@ var ts; pos_3 = nodes.end; }; // jsDocComments need to be the first children - if (this.jsDocComments) { - for (var _i = 0, _a = this.jsDocComments; _i < _a.length; _i++) { + if (this.jsDoc) { + for (var _i = 0, _a = this.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; processNode(jsDocComment); } @@ -76858,6 +78454,20 @@ var ts; SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) { return ts.getPositionOfLineAndCharacter(this, line, character); }; + SourceFileObject.prototype.getLineEndOfPosition = function (pos) { + var line = this.getLineAndCharacterOfPosition(pos).line; + var lineStarts = this.getLineStarts(); + var lastCharPos; + if (line + 1 >= lineStarts.length) { + lastCharPos = this.getEnd(); + } + if (!lastCharPos) { + lastCharPos = lineStarts[line + 1] - 1; + } + var fullText = this.getFullText(); + // if the new line is "\r\n", we should return the last non-new-line-character position + return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos; + }; SourceFileObject.prototype.getNamedDeclarations = function () { if (!this.namedDeclarations) { this.namedDeclarations = this.computeNamedDeclarations(); @@ -76879,9 +78489,9 @@ var ts; } function getDeclarationName(declaration) { if (declaration.name) { - var result_6 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_6 !== undefined) { - return result_6; + var result_7 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_7 !== undefined) { + return result_7; } if (declaration.name.kind === 142 /* ComputedPropertyName */) { var expr = declaration.name.expression; @@ -76925,8 +78535,8 @@ var ts; else { declarations.push(functionDeclaration); } - ts.forEachChild(node, visit); } + ts.forEachChild(node, visit); break; case 226 /* ClassDeclaration */: case 197 /* ClassExpression */: @@ -77453,7 +79063,7 @@ var ts; return program; } function cleanupSemanticCache() { - // TODO: Should we jettison the program (or it's type checker) here? + program = undefined; } function dispose() { if (program) { @@ -77837,7 +79447,9 @@ var ts; sourceFile: sourceFile, span: span, program: program, - newLineCharacter: newLineChar + newLineCharacter: newLineChar, + host: host, + cancellationToken: cancellationToken }; var fixes = ts.codefix.getFixes(context); if (fixes) { @@ -77861,7 +79473,7 @@ var ts; } var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Check if in a context where we don't want to perform any insertion - if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + if (ts.isInString(sourceFile, position)) { return false; } if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { @@ -78079,10 +79691,10 @@ var ts; break; default: ts.forEachChild(node, walk); - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - ts.forEachChild(jsDocComment, walk); + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + ts.forEachChild(jsDoc, walk); } } } @@ -79408,7 +81020,7 @@ var ts; if (result.error) { return { options: {}, - typingOptions: {}, + typeAcquisition: {}, files: [], raw: {}, errors: [realizeDiagnostic(result.error, "\r\n")] @@ -79418,7 +81030,7 @@ var ts; var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName); return { options: configFile.options, - typingOptions: configFile.typingOptions, + typeAcquisition: configFile.typeAcquisition, files: configFile.fileNames, raw: configFile.raw, errors: realizeDiagnostics(configFile.errors, "\r\n") @@ -79433,7 +81045,7 @@ var ts; var getCanonicalFileName = ts.createGetCanonicalFileName(/*useCaseSensitivefileNames:*/ false); return this.forwardJSONCall("discoverTypings()", function () { var info = JSON.parse(discoverTypingsJson); - return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.unresolvedImports); + return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports); }); }; return CoreServicesShimObject; diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 5c337f07cc6..e11c200ef44 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -317,23 +317,25 @@ declare namespace ts { JSDocThisType = 277, JSDocComment = 278, JSDocTag = 279, - JSDocParameterTag = 280, - JSDocReturnTag = 281, - JSDocTypeTag = 282, - JSDocTemplateTag = 283, - JSDocTypedefTag = 284, - JSDocPropertyTag = 285, - JSDocTypeLiteral = 286, - JSDocLiteralType = 287, - JSDocNullKeyword = 288, - JSDocUndefinedKeyword = 289, - JSDocNeverKeyword = 290, - SyntaxList = 291, - NotEmittedStatement = 292, - PartiallyEmittedExpression = 293, - MergeDeclarationMarker = 294, - EndOfDeclarationMarker = 295, - Count = 296, + JSDocAugmentsTag = 280, + JSDocParameterTag = 281, + JSDocReturnTag = 282, + JSDocTypeTag = 283, + JSDocTemplateTag = 284, + JSDocTypedefTag = 285, + JSDocPropertyTag = 286, + JSDocTypeLiteral = 287, + JSDocLiteralType = 288, + JSDocNullKeyword = 289, + JSDocUndefinedKeyword = 290, + JSDocNeverKeyword = 291, + SyntaxList = 292, + NotEmittedStatement = 293, + PartiallyEmittedExpression = 294, + MergeDeclarationMarker = 295, + EndOfDeclarationMarker = 296, + RawExpression = 297, + Count = 298, FirstAssignment = 57, LastAssignment = 69, FirstCompoundAssignment = 58, @@ -360,9 +362,9 @@ declare namespace ts { LastBinaryOperator = 69, FirstNode = 141, FirstJSDocNode = 262, - LastJSDocNode = 287, + LastJSDocNode = 288, FirstJSDocTagNode = 278, - LastJSDocTagNode = 290, + LastJSDocTagNode = 291, } enum NodeFlags { None = 0, @@ -376,26 +378,20 @@ declare namespace ts { HasImplicitReturn = 128, HasExplicitReturn = 256, GlobalAugmentation = 512, - HasClassExtends = 1024, - HasDecorators = 2048, - HasParamDecorators = 4096, - HasAsyncFunctions = 8192, - HasSpreadAttribute = 16384, - HasRestAttribute = 32768, - DisallowInContext = 65536, - YieldContext = 131072, - DecoratorContext = 262144, - AwaitContext = 524288, - ThisNodeHasError = 1048576, - JavaScriptFile = 2097152, - ThisNodeOrAnySubNodesHasError = 4194304, - HasAggregatedChildData = 8388608, + HasAsyncFunctions = 1024, + DisallowInContext = 2048, + YieldContext = 4096, + DecoratorContext = 8192, + AwaitContext = 16384, + ThisNodeHasError = 32768, + JavaScriptFile = 65536, + ThisNodeOrAnySubNodesHasError = 131072, + HasAggregatedChildData = 262144, BlockScoped = 3, ReachabilityCheckFlags = 384, - EmitHelperFlags = 64512, - ReachabilityAndEmitFlags = 64896, - ContextFlags = 3080192, - TypeExcludesFlags = 655360, + ReachabilityAndEmitFlags = 1408, + ContextFlags = 96256, + TypeExcludesFlags = 20480, } enum ModifierFlags { None = 0, @@ -464,14 +460,14 @@ declare namespace ts { right: Identifier; } type EntityName = Identifier | QualifiedName; - type PropertyName = Identifier | LiteralExpression | ComputedPropertyName; - type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; + type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName; + type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern; interface Declaration extends Node { _declarationBrand: any; name?: DeclarationName; } interface DeclarationStatement extends Declaration, Statement { - name?: Identifier | LiteralExpression; + name?: Identifier | StringLiteral | NumericLiteral; } interface ComputedPropertyName extends Node { kind: SyntaxKind.ComputedPropertyName; @@ -573,18 +569,16 @@ declare namespace ts { interface PropertyLikeDeclaration extends Declaration { name: PropertyName; } - interface BindingPattern extends Node { - elements: NodeArray; - } - interface ObjectBindingPattern extends BindingPattern { + interface ObjectBindingPattern extends Node { kind: SyntaxKind.ObjectBindingPattern; elements: NodeArray; } - type ArrayBindingElement = BindingElement | OmittedExpression; - interface ArrayBindingPattern extends BindingPattern { + interface ArrayBindingPattern extends Node { kind: SyntaxKind.ArrayBindingPattern; elements: NodeArray; } + type BindingPattern = ObjectBindingPattern | ArrayBindingPattern; + type ArrayBindingElement = BindingElement | OmittedExpression; /** * Several node kinds share function-like features such as a signature, * a name, and a body. These nodes should extend FunctionLikeDeclaration. @@ -809,17 +803,25 @@ declare namespace ts { operatorToken: BinaryOperatorToken; right: Expression; } - interface AssignmentExpression extends BinaryExpression { + type AssignmentOperatorToken = Token; + interface AssignmentExpression extends BinaryExpression { left: LeftHandSideExpression; - operatorToken: Token; + operatorToken: TOperator; } - interface ObjectDestructuringAssignment extends AssignmentExpression { + interface ObjectDestructuringAssignment extends AssignmentExpression { left: ObjectLiteralExpression; } - interface ArrayDestructuringAssignment extends AssignmentExpression { + interface ArrayDestructuringAssignment extends AssignmentExpression { left: ArrayLiteralExpression; } type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment; + type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression | Identifier | PropertyAccessExpression | ElementAccessExpression; + type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment; + type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression; + type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression; + type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression; + type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression; + type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern; interface ConditionalExpression extends Expression { kind: SyntaxKind.ConditionalExpression; condition: Expression; @@ -1180,7 +1182,7 @@ declare namespace ts { type ModuleName = Identifier | StringLiteral; interface ModuleDeclaration extends DeclarationStatement { kind: SyntaxKind.ModuleDeclaration; - name: Identifier | LiteralExpression; + name: Identifier | StringLiteral; body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier; } interface NamespaceDeclaration extends ModuleDeclaration { @@ -1332,7 +1334,7 @@ declare namespace ts { type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; interface JSDocRecordMember extends PropertySignature { kind: SyntaxKind.JSDocRecordMember; - name: Identifier | LiteralExpression; + name: Identifier | StringLiteral | NumericLiteral; type?: JSDocType; } interface JSDoc extends Node { @@ -1348,6 +1350,10 @@ declare namespace ts { interface JSDocUnknownTag extends JSDocTag { kind: SyntaxKind.JSDocTag; } + interface JSDocAugmentsTag extends JSDocTag { + kind: SyntaxKind.JSDocAugmentsTag; + typeExpression: JSDocTypeExpression; + } interface JSDocTemplateTag extends JSDocTag { kind: SyntaxKind.JSDocTemplateTag; typeParameters: NodeArray; @@ -1596,6 +1602,7 @@ declare namespace ts { getJsxIntrinsicTagNames(): Symbol[]; isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; + tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; @@ -1616,6 +1623,7 @@ declare namespace ts { writeSpace(text: string): void; writeStringLiteral(text: string): void; writeParameter(text: string): void; + writeProperty(text: string): void; writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; @@ -1761,13 +1769,14 @@ declare namespace ts { Literal = 480, StringOrNumberLiteral = 96, PossiblyFalsy = 7406, - StringLike = 34, + StringLike = 262178, NumberLike = 340, BooleanLike = 136, EnumLike = 272, UnionOrIntersection = 196608, StructuredType = 229376, StructuredOrTypeParameter = 507904, + TypeVariable = 540672, Narrowable = 1033215, NotUnionOrUnit = 33281, } @@ -1837,15 +1846,18 @@ declare namespace ts { elementType: Type; finalArrayType?: Type; } - interface TypeParameter extends Type { + interface TypeVariable extends Type { + } + interface TypeParameter extends TypeVariable { constraint: Type; } - interface IndexType extends Type { - type: TypeParameter; - } - interface IndexedAccessType extends Type { + interface IndexedAccessType extends TypeVariable { objectType: Type; - indexType: TypeParameter; + indexType: Type; + constraint?: Type; + } + interface IndexType extends Type { + type: TypeVariable | UnionOrIntersectionType; } enum SignatureKind { Call = 0, @@ -1865,6 +1877,11 @@ declare namespace ts { isReadonly: boolean; declaration?: SignatureDeclaration; } + interface FileExtensionInfo { + extension: string; + scriptKind: ScriptKind; + isMixedContent: boolean; + } interface DiagnosticMessage { key: string; category: DiagnosticCategory; @@ -1962,12 +1979,13 @@ declare namespace ts { target?: ScriptTarget; traceResolution?: boolean; types?: string[]; - /** Paths used to used to compute primary types search locations */ + /** Paths used to compute primary types search locations */ typeRoots?: string[]; [option: string]: CompilerOptionsValue | undefined; } - interface TypingOptions { + interface TypeAcquisition { enableAutoDiscovery?: boolean; + enable?: boolean; include?: string[]; exclude?: string[]; [option: string]: string[] | boolean | undefined; @@ -1977,7 +1995,7 @@ declare namespace ts { projectRootPath: string; safeListPath: string; packageNameToTypingLocation: Map; - typingOptions: TypingOptions; + typeAcquisition: TypeAcquisition; compilerOptions: CompilerOptions; unresolvedImports: ReadonlyArray; } @@ -2025,7 +2043,7 @@ declare namespace ts { /** Either a parsed command line or a parsed tsconfig.json */ interface ParsedCommandLine { options: CompilerOptions; - typingOptions?: TypingOptions; + typeAcquisition?: TypeAcquisition; fileNames: string[]; raw?: any; errors: Diagnostic[]; @@ -2129,6 +2147,10 @@ declare namespace ts { _children: Node[]; } } +declare namespace ts { + /** The version of the TypeScript compiler release */ + const version = "2.2.0"; +} declare namespace ts { type FileWatcherCallback = (fileName: string, removed?: boolean) => void; type DirectoryWatcherCallback = (fileName: string) => void; @@ -2260,9 +2282,19 @@ declare namespace ts { */ function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; - function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean; + function isParameterPropertyDeclaration(node: Node): boolean; function getCombinedModifierFlags(node: Node): ModifierFlags; function getCombinedNodeFlags(node: Node): NodeFlags; + /** + * Checks to see if the locale is in the appropriate format, + * and if it is, attempts to set the appropriate language. + */ + function validateLocaleAndSetLanguage(locale: string, sys: { + getExecutingFilePath(): string; + resolvePath(path: string): string; + fileExists(fileName: string): boolean; + readFile(fileName: string): string; + }, errors?: Diagnostic[]): void; } declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; @@ -2273,6 +2305,7 @@ declare namespace ts { function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { + function moduleHasNonRelativeName(moduleName: string): boolean; function getEffectiveTypeRoots(options: CompilerOptions, host: { directoryExists?: (directoryName: string) => boolean; getCurrentDirectory?: () => string; @@ -2297,8 +2330,6 @@ declare namespace ts { function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; } declare namespace ts { - /** The version of the TypeScript compiler release */ - const version = "2.2.0"; function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; @@ -2313,6 +2344,7 @@ declare namespace ts { function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare namespace ts { + function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; /** * Read tsconfig.json file * @param fileName The path to the config file @@ -2337,14 +2369,14 @@ declare namespace ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine; + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine; function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; errors: Diagnostic[]; }; - function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { - options: TypingOptions; + function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: TypeAcquisition; errors: Diagnostic[]; }; } @@ -2393,6 +2425,7 @@ declare namespace ts { } interface SourceFile { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineEndOfPosition(pos: number): number; getLineStarts(): number[]; getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 59bd352a9d9..7f41e5d07f5 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -333,26 +333,28 @@ var ts; SyntaxKind[SyntaxKind["JSDocThisType"] = 277] = "JSDocThisType"; SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 280] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 281] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 282] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 283] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 284] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 285] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 286] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocLiteralType"] = 287] = "JSDocLiteralType"; - SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 288] = "JSDocNullKeyword"; - SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 289] = "JSDocUndefinedKeyword"; - SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 290] = "JSDocNeverKeyword"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 281] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 282] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 283] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 284] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 285] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 286] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 287] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocLiteralType"] = 288] = "JSDocLiteralType"; + SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 289] = "JSDocNullKeyword"; + SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 290] = "JSDocUndefinedKeyword"; + SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 291] = "JSDocNeverKeyword"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 291] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 292] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 292] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 293] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 294] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 295] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 293] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 294] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 295] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 296] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["RawExpression"] = 297] = "RawExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 296] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 298] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment"; @@ -380,9 +382,9 @@ var ts; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode"; SyntaxKind[SyntaxKind["FirstJSDocNode"] = 262] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 287] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 278] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 290] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 291] = "LastJSDocTagNode"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -397,28 +399,22 @@ var ts; NodeFlags[NodeFlags["HasImplicitReturn"] = 128] = "HasImplicitReturn"; NodeFlags[NodeFlags["HasExplicitReturn"] = 256] = "HasExplicitReturn"; NodeFlags[NodeFlags["GlobalAugmentation"] = 512] = "GlobalAugmentation"; - NodeFlags[NodeFlags["HasClassExtends"] = 1024] = "HasClassExtends"; - NodeFlags[NodeFlags["HasDecorators"] = 2048] = "HasDecorators"; - NodeFlags[NodeFlags["HasParamDecorators"] = 4096] = "HasParamDecorators"; - NodeFlags[NodeFlags["HasAsyncFunctions"] = 8192] = "HasAsyncFunctions"; - NodeFlags[NodeFlags["HasSpreadAttribute"] = 16384] = "HasSpreadAttribute"; - NodeFlags[NodeFlags["HasRestAttribute"] = 32768] = "HasRestAttribute"; - NodeFlags[NodeFlags["DisallowInContext"] = 65536] = "DisallowInContext"; - NodeFlags[NodeFlags["YieldContext"] = 131072] = "YieldContext"; - NodeFlags[NodeFlags["DecoratorContext"] = 262144] = "DecoratorContext"; - NodeFlags[NodeFlags["AwaitContext"] = 524288] = "AwaitContext"; - NodeFlags[NodeFlags["ThisNodeHasError"] = 1048576] = "ThisNodeHasError"; - NodeFlags[NodeFlags["JavaScriptFile"] = 2097152] = "JavaScriptFile"; - NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 4194304] = "ThisNodeOrAnySubNodesHasError"; - NodeFlags[NodeFlags["HasAggregatedChildData"] = 8388608] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["HasAsyncFunctions"] = 1024] = "HasAsyncFunctions"; + NodeFlags[NodeFlags["DisallowInContext"] = 2048] = "DisallowInContext"; + NodeFlags[NodeFlags["YieldContext"] = 4096] = "YieldContext"; + NodeFlags[NodeFlags["DecoratorContext"] = 8192] = "DecoratorContext"; + NodeFlags[NodeFlags["AwaitContext"] = 16384] = "AwaitContext"; + NodeFlags[NodeFlags["ThisNodeHasError"] = 32768] = "ThisNodeHasError"; + NodeFlags[NodeFlags["JavaScriptFile"] = 65536] = "JavaScriptFile"; + NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 131072] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags[NodeFlags["HasAggregatedChildData"] = 262144] = "HasAggregatedChildData"; NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped"; NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags"; - NodeFlags[NodeFlags["EmitHelperFlags"] = 64512] = "EmitHelperFlags"; - NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 64896] = "ReachabilityAndEmitFlags"; + NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 1408] = "ReachabilityAndEmitFlags"; // Parsing context flags - NodeFlags[NodeFlags["ContextFlags"] = 3080192] = "ContextFlags"; + NodeFlags[NodeFlags["ContextFlags"] = 96256] = "ContextFlags"; // Exclude these flags when parsing a Type - NodeFlags[NodeFlags["TypeExcludesFlags"] = 655360] = "TypeExcludesFlags"; + NodeFlags[NodeFlags["TypeExcludesFlags"] = 20480] = "TypeExcludesFlags"; })(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {})); var ModifierFlags; (function (ModifierFlags) { @@ -710,13 +706,14 @@ var ts; TypeFlags[TypeFlags["Intrinsic"] = 16015] = "Intrinsic"; /* @internal */ TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive"; - TypeFlags[TypeFlags["StringLike"] = 34] = "StringLike"; + TypeFlags[TypeFlags["StringLike"] = 262178] = "StringLike"; TypeFlags[TypeFlags["NumberLike"] = 340] = "NumberLike"; TypeFlags[TypeFlags["BooleanLike"] = 136] = "BooleanLike"; TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike"; TypeFlags[TypeFlags["UnionOrIntersection"] = 196608] = "UnionOrIntersection"; TypeFlags[TypeFlags["StructuredType"] = 229376] = "StructuredType"; TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 507904] = "StructuredOrTypeParameter"; + TypeFlags[TypeFlags["TypeVariable"] = 540672] = "TypeVariable"; // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never TypeFlags[TypeFlags["Narrowable"] = 1033215] = "Narrowable"; @@ -974,99 +971,114 @@ var ts; // - Flags used to indicate that a node or subtree contains syntax that requires transformation. TransformFlags[TransformFlags["TypeScript"] = 1] = "TypeScript"; TransformFlags[TransformFlags["ContainsTypeScript"] = 2] = "ContainsTypeScript"; - TransformFlags[TransformFlags["Jsx"] = 4] = "Jsx"; - TransformFlags[TransformFlags["ContainsJsx"] = 8] = "ContainsJsx"; - TransformFlags[TransformFlags["ESNext"] = 16] = "ESNext"; - TransformFlags[TransformFlags["ContainsESNext"] = 32] = "ContainsESNext"; - TransformFlags[TransformFlags["ES2017"] = 64] = "ES2017"; - TransformFlags[TransformFlags["ContainsES2017"] = 128] = "ContainsES2017"; - TransformFlags[TransformFlags["ES2016"] = 256] = "ES2016"; - TransformFlags[TransformFlags["ContainsES2016"] = 512] = "ContainsES2016"; - TransformFlags[TransformFlags["ES2015"] = 1024] = "ES2015"; - TransformFlags[TransformFlags["ContainsES2015"] = 2048] = "ContainsES2015"; - TransformFlags[TransformFlags["Generator"] = 4096] = "Generator"; - TransformFlags[TransformFlags["ContainsGenerator"] = 8192] = "ContainsGenerator"; - TransformFlags[TransformFlags["DestructuringAssignment"] = 16384] = "DestructuringAssignment"; - TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 32768] = "ContainsDestructuringAssignment"; + TransformFlags[TransformFlags["ContainsJsx"] = 4] = "ContainsJsx"; + TransformFlags[TransformFlags["ContainsESNext"] = 8] = "ContainsESNext"; + TransformFlags[TransformFlags["ContainsES2017"] = 16] = "ContainsES2017"; + TransformFlags[TransformFlags["ContainsES2016"] = 32] = "ContainsES2016"; + TransformFlags[TransformFlags["ES2015"] = 64] = "ES2015"; + TransformFlags[TransformFlags["ContainsES2015"] = 128] = "ContainsES2015"; + TransformFlags[TransformFlags["Generator"] = 256] = "Generator"; + TransformFlags[TransformFlags["ContainsGenerator"] = 512] = "ContainsGenerator"; + TransformFlags[TransformFlags["DestructuringAssignment"] = 1024] = "DestructuringAssignment"; + TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 2048] = "ContainsDestructuringAssignment"; // Markers // - Flags used to indicate that a subtree contains a specific transformation. - TransformFlags[TransformFlags["ContainsDecorators"] = 65536] = "ContainsDecorators"; - TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 131072] = "ContainsPropertyInitializer"; - TransformFlags[TransformFlags["ContainsLexicalThis"] = 262144] = "ContainsLexicalThis"; - TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 524288] = "ContainsCapturedLexicalThis"; - TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 1048576] = "ContainsLexicalThisInComputedPropertyName"; - TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 2097152] = "ContainsDefaultValueAssignments"; - TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 4194304] = "ContainsParameterPropertyAssignments"; - TransformFlags[TransformFlags["ContainsSpreadExpression"] = 8388608] = "ContainsSpreadExpression"; - TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 16777216] = "ContainsComputedPropertyName"; - TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 33554432] = "ContainsBlockScopedBinding"; - TransformFlags[TransformFlags["ContainsBindingPattern"] = 67108864] = "ContainsBindingPattern"; - TransformFlags[TransformFlags["ContainsYield"] = 134217728] = "ContainsYield"; - TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 268435456] = "ContainsHoistedDeclarationOrCompletion"; + TransformFlags[TransformFlags["ContainsDecorators"] = 4096] = "ContainsDecorators"; + TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 8192] = "ContainsPropertyInitializer"; + TransformFlags[TransformFlags["ContainsLexicalThis"] = 16384] = "ContainsLexicalThis"; + TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 32768] = "ContainsCapturedLexicalThis"; + TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 65536] = "ContainsLexicalThisInComputedPropertyName"; + TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 131072] = "ContainsDefaultValueAssignments"; + TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 262144] = "ContainsParameterPropertyAssignments"; + TransformFlags[TransformFlags["ContainsSpread"] = 524288] = "ContainsSpread"; + TransformFlags[TransformFlags["ContainsObjectSpread"] = 1048576] = "ContainsObjectSpread"; + TransformFlags[TransformFlags["ContainsRest"] = 524288] = "ContainsRest"; + TransformFlags[TransformFlags["ContainsObjectRest"] = 1048576] = "ContainsObjectRest"; + TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 2097152] = "ContainsComputedPropertyName"; + TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 4194304] = "ContainsBlockScopedBinding"; + TransformFlags[TransformFlags["ContainsBindingPattern"] = 8388608] = "ContainsBindingPattern"; + TransformFlags[TransformFlags["ContainsYield"] = 16777216] = "ContainsYield"; + TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 33554432] = "ContainsHoistedDeclarationOrCompletion"; TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags"; // Assertions // - Bitmasks that are used to assert facts about the syntax of a node and its subtree. TransformFlags[TransformFlags["AssertTypeScript"] = 3] = "AssertTypeScript"; - TransformFlags[TransformFlags["AssertJsx"] = 12] = "AssertJsx"; - TransformFlags[TransformFlags["AssertESNext"] = 48] = "AssertESNext"; - TransformFlags[TransformFlags["AssertES2017"] = 192] = "AssertES2017"; - TransformFlags[TransformFlags["AssertES2016"] = 768] = "AssertES2016"; - TransformFlags[TransformFlags["AssertES2015"] = 3072] = "AssertES2015"; - TransformFlags[TransformFlags["AssertGenerator"] = 12288] = "AssertGenerator"; - TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 49152] = "AssertDestructuringAssignment"; + TransformFlags[TransformFlags["AssertJsx"] = 4] = "AssertJsx"; + TransformFlags[TransformFlags["AssertESNext"] = 8] = "AssertESNext"; + TransformFlags[TransformFlags["AssertES2017"] = 16] = "AssertES2017"; + TransformFlags[TransformFlags["AssertES2016"] = 32] = "AssertES2016"; + TransformFlags[TransformFlags["AssertES2015"] = 192] = "AssertES2015"; + TransformFlags[TransformFlags["AssertGenerator"] = 768] = "AssertGenerator"; + TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 3072] = "AssertDestructuringAssignment"; // Scope Exclusions // - Bitmasks that exclude flags from propagating out of a specific context // into the subtree flags of their container. - TransformFlags[TransformFlags["NodeExcludes"] = 536892757] = "NodeExcludes"; - TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 979719509] = "ArrowFunctionExcludes"; - TransformFlags[TransformFlags["FunctionExcludes"] = 980243797] = "FunctionExcludes"; - TransformFlags[TransformFlags["ConstructorExcludes"] = 975983957] = "ConstructorExcludes"; - TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 975983957] = "MethodOrAccessorExcludes"; - TransformFlags[TransformFlags["ClassExcludes"] = 559895893] = "ClassExcludes"; - TransformFlags[TransformFlags["ModuleExcludes"] = 839734613] = "ModuleExcludes"; + TransformFlags[TransformFlags["NodeExcludes"] = 536872257] = "NodeExcludes"; + TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 601249089] = "ArrowFunctionExcludes"; + TransformFlags[TransformFlags["FunctionExcludes"] = 601281857] = "FunctionExcludes"; + TransformFlags[TransformFlags["ConstructorExcludes"] = 601015617] = "ConstructorExcludes"; + TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 601015617] = "MethodOrAccessorExcludes"; + TransformFlags[TransformFlags["ClassExcludes"] = 539358529] = "ClassExcludes"; + TransformFlags[TransformFlags["ModuleExcludes"] = 574674241] = "ModuleExcludes"; TransformFlags[TransformFlags["TypeExcludes"] = -3] = "TypeExcludes"; - TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 554784085] = "ObjectLiteralExcludes"; - TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 545281365] = "ArrayLiteralOrCallOrNewExcludes"; - TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 604001621] = "VariableDeclarationListExcludes"; - TransformFlags[TransformFlags["ParameterExcludes"] = 604001621] = "ParameterExcludes"; + TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 540087617] = "ObjectLiteralExcludes"; + TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 537396545] = "ArrayLiteralOrCallOrNewExcludes"; + TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 546309441] = "VariableDeclarationListExcludes"; + TransformFlags[TransformFlags["ParameterExcludes"] = 536872257] = "ParameterExcludes"; + TransformFlags[TransformFlags["CatchClauseExcludes"] = 537920833] = "CatchClauseExcludes"; + TransformFlags[TransformFlags["BindingPatternExcludes"] = 537396545] = "BindingPatternExcludes"; // Masks // - Additional bitmasks - TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 4390912] = "TypeScriptClassSyntaxMask"; - TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 2621440] = "ES2015FunctionSyntaxMask"; + TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 274432] = "TypeScriptClassSyntaxMask"; + TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 163840] = "ES2015FunctionSyntaxMask"; })(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {})); /* @internal */ var EmitFlags; (function (EmitFlags) { - EmitFlags[EmitFlags["EmitEmitHelpers"] = 1] = "EmitEmitHelpers"; - EmitFlags[EmitFlags["EmitExportStar"] = 2] = "EmitExportStar"; - EmitFlags[EmitFlags["EmitSuperHelper"] = 4] = "EmitSuperHelper"; - EmitFlags[EmitFlags["EmitAdvancedSuperHelper"] = 8] = "EmitAdvancedSuperHelper"; - EmitFlags[EmitFlags["UMDDefine"] = 16] = "UMDDefine"; - EmitFlags[EmitFlags["SingleLine"] = 32] = "SingleLine"; - EmitFlags[EmitFlags["AdviseOnEmitNode"] = 64] = "AdviseOnEmitNode"; - EmitFlags[EmitFlags["NoSubstitution"] = 128] = "NoSubstitution"; - EmitFlags[EmitFlags["CapturesThis"] = 256] = "CapturesThis"; - EmitFlags[EmitFlags["NoLeadingSourceMap"] = 512] = "NoLeadingSourceMap"; - EmitFlags[EmitFlags["NoTrailingSourceMap"] = 1024] = "NoTrailingSourceMap"; - EmitFlags[EmitFlags["NoSourceMap"] = 1536] = "NoSourceMap"; - EmitFlags[EmitFlags["NoNestedSourceMaps"] = 2048] = "NoNestedSourceMaps"; - EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 4096] = "NoTokenLeadingSourceMaps"; - EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 8192] = "NoTokenTrailingSourceMaps"; - EmitFlags[EmitFlags["NoTokenSourceMaps"] = 12288] = "NoTokenSourceMaps"; - EmitFlags[EmitFlags["NoLeadingComments"] = 16384] = "NoLeadingComments"; - EmitFlags[EmitFlags["NoTrailingComments"] = 32768] = "NoTrailingComments"; - EmitFlags[EmitFlags["NoComments"] = 49152] = "NoComments"; - EmitFlags[EmitFlags["NoNestedComments"] = 65536] = "NoNestedComments"; - EmitFlags[EmitFlags["ExportName"] = 131072] = "ExportName"; - EmitFlags[EmitFlags["LocalName"] = 262144] = "LocalName"; - EmitFlags[EmitFlags["Indented"] = 524288] = "Indented"; - EmitFlags[EmitFlags["NoIndentation"] = 1048576] = "NoIndentation"; - EmitFlags[EmitFlags["AsyncFunctionBody"] = 2097152] = "AsyncFunctionBody"; - EmitFlags[EmitFlags["ReuseTempVariableScope"] = 4194304] = "ReuseTempVariableScope"; - EmitFlags[EmitFlags["CustomPrologue"] = 8388608] = "CustomPrologue"; - EmitFlags[EmitFlags["NoHoisting"] = 16777216] = "NoHoisting"; - EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 33554432] = "HasEndOfDeclarationMarker"; + EmitFlags[EmitFlags["SingleLine"] = 1] = "SingleLine"; + EmitFlags[EmitFlags["AdviseOnEmitNode"] = 2] = "AdviseOnEmitNode"; + EmitFlags[EmitFlags["NoSubstitution"] = 4] = "NoSubstitution"; + EmitFlags[EmitFlags["CapturesThis"] = 8] = "CapturesThis"; + EmitFlags[EmitFlags["NoLeadingSourceMap"] = 16] = "NoLeadingSourceMap"; + EmitFlags[EmitFlags["NoTrailingSourceMap"] = 32] = "NoTrailingSourceMap"; + EmitFlags[EmitFlags["NoSourceMap"] = 48] = "NoSourceMap"; + EmitFlags[EmitFlags["NoNestedSourceMaps"] = 64] = "NoNestedSourceMaps"; + EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 128] = "NoTokenLeadingSourceMaps"; + EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 256] = "NoTokenTrailingSourceMaps"; + EmitFlags[EmitFlags["NoTokenSourceMaps"] = 384] = "NoTokenSourceMaps"; + EmitFlags[EmitFlags["NoLeadingComments"] = 512] = "NoLeadingComments"; + EmitFlags[EmitFlags["NoTrailingComments"] = 1024] = "NoTrailingComments"; + EmitFlags[EmitFlags["NoComments"] = 1536] = "NoComments"; + EmitFlags[EmitFlags["NoNestedComments"] = 2048] = "NoNestedComments"; + EmitFlags[EmitFlags["HelperName"] = 4096] = "HelperName"; + EmitFlags[EmitFlags["ExportName"] = 8192] = "ExportName"; + EmitFlags[EmitFlags["LocalName"] = 16384] = "LocalName"; + EmitFlags[EmitFlags["Indented"] = 32768] = "Indented"; + EmitFlags[EmitFlags["NoIndentation"] = 65536] = "NoIndentation"; + EmitFlags[EmitFlags["AsyncFunctionBody"] = 131072] = "AsyncFunctionBody"; + EmitFlags[EmitFlags["ReuseTempVariableScope"] = 262144] = "ReuseTempVariableScope"; + EmitFlags[EmitFlags["CustomPrologue"] = 524288] = "CustomPrologue"; + EmitFlags[EmitFlags["NoHoisting"] = 1048576] = "NoHoisting"; + EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 2097152] = "HasEndOfDeclarationMarker"; })(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {})); + /** + * Used by the checker, this enum keeps track of external emit helpers that should be type + * checked. + */ + /* @internal */ + var ExternalEmitHelpers; + (function (ExternalEmitHelpers) { + ExternalEmitHelpers[ExternalEmitHelpers["Extends"] = 1] = "Extends"; + ExternalEmitHelpers[ExternalEmitHelpers["Assign"] = 2] = "Assign"; + ExternalEmitHelpers[ExternalEmitHelpers["Rest"] = 4] = "Rest"; + ExternalEmitHelpers[ExternalEmitHelpers["Decorate"] = 8] = "Decorate"; + ExternalEmitHelpers[ExternalEmitHelpers["Metadata"] = 16] = "Metadata"; + ExternalEmitHelpers[ExternalEmitHelpers["Param"] = 32] = "Param"; + ExternalEmitHelpers[ExternalEmitHelpers["Awaiter"] = 64] = "Awaiter"; + ExternalEmitHelpers[ExternalEmitHelpers["Generator"] = 128] = "Generator"; + ExternalEmitHelpers[ExternalEmitHelpers["FirstEmitHelper"] = 1] = "FirstEmitHelper"; + ExternalEmitHelpers[ExternalEmitHelpers["LastEmitHelper"] = 128] = "LastEmitHelper"; + })(ExternalEmitHelpers = ts.ExternalEmitHelpers || (ts.ExternalEmitHelpers = {})); /* @internal */ var EmitContext; (function (EmitContext) { @@ -1172,8 +1184,12 @@ var ts; })(ts || (ts = {})); /// /// -/* @internal */ var ts; +(function (ts) { + /** The version of the TypeScript compiler release */ + ts.version = "2.2.0"; +})(ts || (ts = {})); +/* @internal */ (function (ts) { /** * Ternary values are defined such that @@ -1727,7 +1743,7 @@ var ts; if (value === undefined) return to; if (to === undefined) - to = []; + return [value]; to.push(value); return to; } @@ -1750,6 +1766,17 @@ var ts; return to; } ts.addRange = addRange; + /** + * Stable sort of an array. Elements equal to each other maintain their relative position in the array. + */ + function stableSort(array, comparer) { + if (comparer === void 0) { comparer = compareValues; } + return array + .map(function (_, i) { return i; }) // create array of indices + .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); }) // sort indices by value then position + .map(function (i) { return array[i]; }); // get sorted array + } + ts.stableSort = stableSort; function rangeEquals(array1, array2, pos, end) { while (pos < end) { if (array1[pos] !== array2[pos]) { @@ -1968,6 +1995,15 @@ var ts; } } ts.copyProperties = copyProperties; + function appendProperty(map, key, value) { + if (key === undefined || value === undefined) + return map; + if (map === undefined) + map = createMap(); + map[key] = value; + return map; + } + ts.appendProperty = appendProperty; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -2001,25 +2037,6 @@ var ts; return result; } ts.reduceProperties = reduceProperties; - /** - * Reduce the properties defined on a map-like (but not from its prototype chain). - * - * NOTE: This is intended for use with MapLike objects. For Map objects, use - * reduceProperties instead as it offers better performance. - * - * @param map The map-like to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; /** * Performs a shallow equality comparison of the contents of two map-likes. * @@ -2483,6 +2500,14 @@ var ts; getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS; } ts.getEmitModuleKind = getEmitModuleKind; + function getEmitModuleResolutionKind(compilerOptions) { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + } + return moduleResolution; + } + ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind; /* @internal */ function hasZeroOrOneAsteriskCharacter(str) { var seenAsterisk = false; @@ -2979,8 +3004,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (needAllExtensions || extInfo.scriptKind === 3 /* TS */) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -2991,11 +3027,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -3140,6 +3176,17 @@ var ts; Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); /** Remove an item from an array, moving everything to its right one space left. */ + function orderedRemoveItem(array, item) { + for (var i = 0; i < array.length; i++) { + if (array[i] === item) { + orderedRemoveItemAt(array, i); + return true; + } + } + return false; + } + ts.orderedRemoveItem = orderedRemoveItem; + /** Remove an item by index from an array, moving everything to its right one space left. */ function orderedRemoveItemAt(array, index) { // This seems to be faster than either `array.splice(i, 1)` or `array.copyWithin(i, i+ 1)`. for (var i = index; i < array.length - 1; i++) { @@ -4024,6 +4071,7 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -4067,6 +4115,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -4077,6 +4126,7 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, @@ -4244,7 +4294,7 @@ var ts; Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." }, - Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." }, + Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." }, Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." }, Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." }, Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." }, @@ -4309,7 +4359,8 @@ var ts; An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, - An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." }, + The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, + _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -4380,7 +4431,10 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, @@ -4422,7 +4476,7 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -4583,6 +4637,7 @@ var ts; type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, + Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", message: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, @@ -4593,9 +4648,10 @@ var ts; A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, - Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." }, + Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, - The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." }, + A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, @@ -4607,6 +4663,9 @@ var ts; Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, }; })(ts || (ts = {})); /// @@ -6365,6 +6424,7 @@ var ts; writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, // Completely ignore indentation for string writers. And map newlines to // a single space. @@ -6443,24 +6503,24 @@ var ts; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); - return (node.flags & 4194304 /* ThisNodeOrAnySubNodesHasError */) !== 0; + return (node.flags & 131072 /* ThisNodeOrAnySubNodesHasError */) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.flags & 8388608 /* HasAggregatedChildData */)) { + if (!(node.flags & 262144 /* HasAggregatedChildData */)) { // A node is considered to contain a parse error if: // a) the parser explicitly marked that it had an error // b) any of it's children reported that it had an error. - var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576 /* ThisNodeHasError */) !== 0) || + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768 /* ThisNodeHasError */) !== 0) || ts.forEachChild(node, containsParseError); // If so, mark ourselves accordingly. if (thisNodeOrAnySubNodesHasError) { - node.flags |= 4194304 /* ThisNodeOrAnySubNodesHasError */; + node.flags |= 131072 /* ThisNodeOrAnySubNodesHasError */; } // Also mark that we've propagated the child information to this node. This way we can // always consult the bit directly on this node without needing to check its children // again. - node.flags |= 8388608 /* HasAggregatedChildData */; + node.flags |= 262144 /* HasAggregatedChildData */; } } function getSourceFileOfNode(node) { @@ -6551,7 +6611,7 @@ var ts; return !nodeIsMissing(node); } ts.nodeIsPresent = nodeIsPresent; - function getTokenPosOfNode(node, sourceFile, includeJsDocComment) { + function getTokenPosOfNode(node, sourceFile, includeJsDoc) { // With nodes that have no width (i.e. 'Missing' nodes), we actually *don't* // want to skip trivia because this will launch us forward to the next token. if (nodeIsMissing(node)) { @@ -6560,25 +6620,25 @@ var ts; if (isJSDocNode(node)) { return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); } - if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) { - return getTokenPosOfNode(node.jsDocComments[0]); + if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { + return getTokenPosOfNode(node.jsDoc[0]); } // For a syntax list, it is possible that one of its children has JSDocComment nodes, while // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 291 /* SyntaxList */ && node._children.length > 0) { - return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment); + if (node.kind === 292 /* SyntaxList */ && node._children.length > 0) { + return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 287 /* LastJSDocNode */; + return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 290 /* LastJSDocTagNode */; + return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 291 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -6725,6 +6785,10 @@ var ts; return false; } ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { case 261 /* SourceFile */: @@ -6777,7 +6841,7 @@ var ts; case 8 /* NumericLiteral */: return name.text; case 142 /* ComputedPropertyName */: - if (isStringOrNumericLiteral(name.expression.kind)) { + if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } } @@ -6906,7 +6970,8 @@ var ts; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; + return node.kind === 207 /* ExpressionStatement */ + && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -6917,26 +6982,21 @@ var ts; return ts.getLeadingCommentRanges(text, node.pos); } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; - function getJsDocComments(node, sourceFileOfNode) { - return getJsDocCommentsFromText(node, sourceFileOfNode.text); - } - ts.getJsDocComments = getJsDocComments; - function getJsDocCommentsFromText(node, text) { + function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 144 /* Parameter */ || node.kind === 143 /* TypeParameter */ || node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); - return ts.filter(commentRanges, isJsDocComment); - function isJsDocComment(comment) { - // True if the comment starts with '/**' but not if it is '/**/' + // True if the comment starts with '/**' but not if it is '/**/' + return ts.filter(commentRanges, function (comment) { return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */; - } + }); } - ts.getJsDocCommentsFromText = getJsDocCommentsFromText; + ts.getJSDocCommentRanges = getJSDocCommentRanges; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; @@ -7088,6 +7148,24 @@ var ts; } } ts.forEachYieldExpression = forEachYieldExpression; + /** + * Gets the most likely element type for a TypeNode. This is not an exhaustive test + * as it assumes a rest argument can only be an array type (either T[], or Array). + * + * @param node The type node. + */ + function getRestParameterElementType(node) { + if (node && node.kind === 162 /* ArrayType */) { + return node.elementType; + } + else if (node && node.kind === 157 /* TypeReference */) { + return ts.singleOrUndefined(node.typeArguments); + } + else { + return undefined; + } + } + ts.getRestParameterElementType = getRestParameterElementType; function isVariableLike(node) { if (node) { switch (node.kind) { @@ -7519,6 +7597,7 @@ var ts; case 145 /* Decorator */: case 252 /* JsxExpression */: case 251 /* JsxSpreadAttribute */: + case 259 /* SpreadAssignment */: return true; case 199 /* ExpressionWithTypeArguments */: return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); @@ -7555,7 +7634,7 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.flags & 2097152 /* JavaScriptFile */); + return node && !!(node.flags & 65536 /* JavaScriptFile */); } ts.isInJavaScriptFile = isInJavaScriptFile; /** @@ -7689,127 +7768,98 @@ var ts; node.parameters[0].type.kind === 276 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getJSDocTag(node, kind, checkParentVariableStatement) { - if (!node) { - return undefined; - } - var jsDocTags = getJSDocTags(node, checkParentVariableStatement); - if (!jsDocTags) { - return undefined; - } - for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) { - var tag = jsDocTags_1[_i]; - if (tag.kind === kind) { - return tag; - } - } + function getCommentsFromJSDoc(node) { + return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); } - function append(previous, additional) { - if (additional) { - if (!previous) { - previous = []; - } - for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) { - var x = additional_1[_i]; - previous.push(x); - } - } - return previous; - } - function getJSDocComments(node, checkParentVariableStatement) { - return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); }); - } - ts.getJSDocComments = getJSDocComments; - function getJSDocTags(node, checkParentVariableStatement) { - return getJSDocs(node, checkParentVariableStatement, function (docs) { + ts.getCommentsFromJSDoc = getCommentsFromJSDoc; + function getJSDocTags(node, kind) { + var docs = getJSDocs(node); + if (docs) { var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.tags) { - result.push.apply(result, doc.tags); + if (doc.kind === 281 /* JSDocParameterTag */) { + if (doc.kind === kind) { + result.push(doc); + } + } + else { + result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; })); } } return result; - }, function (tags) { return tags; }); + } } - function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) { - // TODO: Get rid of getJsDocComments and friends (note the lowercase 's' in Js) - // TODO: A lot of this work should be cached, maybe. I guess it's only used in services right now... - var result = undefined; - // prepend documentation from parent sources - if (checkParentVariableStatement) { + function getFirstJSDocTag(node, kind) { + return node && ts.firstOrUndefined(getJSDocTags(node, kind)); + } + function getJSDocs(node) { + var cache = node.jsDocCache; + if (!cache) { + getJSDocsWorker(node); + node.jsDocCache = cache; + } + return cache; + function getJSDocsWorker(node) { + var parent = node.parent; // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement. // /** // * @param {number} name // * @returns {number} // */ // var x = function(name) { return name.length; } - var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) && - (node.parent).initializer === node && - node.parent.parent.parent.kind === 205 /* VariableStatement */; + var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && + parent.initializer === node && + parent.parent.parent.kind === 205 /* VariableStatement */; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - node.parent.parent.kind === 205 /* VariableStatement */; - var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : - isVariableOfVariableDeclarationStatement ? node.parent.parent : + parent.parent.kind === 205 /* VariableStatement */; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : + isVariableOfVariableDeclarationStatement ? parent.parent : undefined; if (variableStatementNode) { - result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags)); - } - if (node.kind === 230 /* ModuleDeclaration */ && - node.parent && node.parent.kind === 230 /* ModuleDeclaration */) { - result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags)); + getJSDocsWorker(variableStatementNode); } // Also recognize when the node is the RHS of an assignment expression - var parent_4 = node.parent; - var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent && - parent_4.kind === 192 /* BinaryExpression */ && - parent_4.operatorToken.kind === 57 /* EqualsToken */ && - parent_4.parent.kind === 207 /* ExpressionStatement */; + var isSourceOfAssignmentExpressionStatement = parent && parent.parent && + parent.kind === 192 /* BinaryExpression */ && + parent.operatorToken.kind === 57 /* EqualsToken */ && + parent.parent.kind === 207 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { - result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags)); + getJSDocsWorker(parent.parent); } - var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 257 /* PropertyAssignment */; - if (isPropertyAssignmentExpression) { - result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags)); + var isModuleDeclaration = node.kind === 230 /* ModuleDeclaration */ && + parent && parent.kind === 230 /* ModuleDeclaration */; + var isPropertyAssignmentExpression = parent && parent.kind === 257 /* PropertyAssignment */; + if (isModuleDeclaration || isPropertyAssignmentExpression) { + getJSDocsWorker(parent); } // Pull parameter comments from declaring function as well if (node.kind === 144 /* Parameter */) { - var paramTags = getJSDocParameterTag(node, checkParentVariableStatement); - if (paramTags) { - result = append(result, getTags(paramTags)); - } + cache = ts.concatenate(cache, getJSDocParameterTags(node)); } - } - if (isVariableLike(node) && node.initializer) { - result = append(result, getJSDocs(node.initializer, /*checkParentVariableStatement*/ false, getDocs, getTags)); - } - if (node.jsDocComments) { - if (result) { - result = append(result, getDocs(node.jsDocComments)); - } - else { - return getDocs(node.jsDocComments); + if (isVariableLike(node) && node.initializer) { + cache = ts.concatenate(cache, node.initializer.jsDoc); } + cache = ts.concatenate(cache, node.jsDoc); } - return result; } - function getJSDocParameterTag(param, checkParentVariableStatement) { + function getJSDocParameterTags(param) { + if (!isParameter(param)) { + return undefined; + } var func = param.parent; - var tags = getJSDocTags(func, checkParentVariableStatement); + var tags = getJSDocTags(func, 281 /* JSDocParameterTag */); if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 /* JSDocParameterTag */; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70 /* Identifier */) { var name_6 = param.name.text; - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); - if (paramTags) { - return paramTags; - } + return ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines @@ -7817,40 +7867,30 @@ var ts; return undefined; } } - function getJSDocTypeTag(node) { - return getJSDocTag(node, 282 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false); + ts.getJSDocParameterTags = getJSDocParameterTags; + function getJSDocType(node) { + var tag = getFirstJSDocTag(node, 283 /* JSDocTypeTag */); + if (!tag && node.kind === 144 /* Parameter */) { + var paramTags = getJSDocParameterTags(node); + if (paramTags) { + tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); + } + } + return tag && tag.typeExpression && tag.typeExpression.type; } - ts.getJSDocTypeTag = getJSDocTypeTag; + ts.getJSDocType = getJSDocType; + function getJSDocAugmentsTag(node) { + return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */); + } + ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 281 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true); + return getFirstJSDocTag(node, 282 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 283 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false); + return getFirstJSDocTag(node, 284 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; - function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 70 /* Identifier */) { - // If it's a parameter, see if the parent has a jsdoc comment with an @param - // annotation. - var parameterName = parameter.name.text; - var jsDocTags = getJSDocTags(parameter.parent, /*checkParentVariableStatement*/ true); - if (!jsDocTags) { - return undefined; - } - for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) { - var tag = jsDocTags_2[_i]; - if (tag.kind === 280 /* JSDocParameterTag */) { - var parameterTag = tag; - if (parameterTag.parameterName.text === parameterName) { - return parameterTag; - } - } - } - } - return undefined; - } - ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; function hasRestParameter(s) { return isRestParameter(ts.lastOrUndefined(s.parameters)); } @@ -7860,14 +7900,11 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 2097152 /* JavaScriptFile */)) { - if (node.type && node.type.kind === 275 /* JSDocVariadicType */) { + if (node && (node.flags & 65536 /* JavaScriptFile */)) { + if (node.type && node.type.kind === 275 /* JSDocVariadicType */ || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275 /* JSDocVariadicType */; })) { return true; } - var paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 275 /* JSDocVariadicType */; - } } return isDeclaredRestParam(node); } @@ -8114,8 +8151,10 @@ var ts; return isFunctionLike(node) && hasModifier(node, 256 /* Async */) && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; - function isStringOrNumericLiteral(kind) { - return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */; + function isStringOrNumericLiteral(node) { + var kind = node.kind; + return kind === 9 /* StringLiteral */ + || kind === 8 /* NumericLiteral */; } ts.isStringOrNumericLiteral = isStringOrNumericLiteral; /** @@ -8131,7 +8170,7 @@ var ts; ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { return name.kind === 142 /* ComputedPropertyName */ && - !isStringOrNumericLiteral(name.expression.kind) && + !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } ts.isDynamicName = isDynamicName; @@ -8355,6 +8394,7 @@ var ts; case 194 /* TemplateExpression */: case 183 /* ParenthesizedExpression */: case 198 /* OmittedExpression */: + case 297 /* RawExpression */: return 19; case 181 /* TaggedTemplateExpression */: case 177 /* PropertyAccessExpression */: @@ -9225,19 +9265,19 @@ var ts; } } ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments; - function isAssignmentExpression(node) { + function isAssignmentExpression(node, excludeCompoundAssignment) { return isBinaryExpression(node) - && isAssignmentOperator(node.operatorToken.kind) + && (excludeCompoundAssignment + ? node.operatorToken.kind === 57 /* EqualsToken */ + : isAssignmentOperator(node.operatorToken.kind)) && isLeftHandSideExpression(node.left); } ts.isAssignmentExpression = isAssignmentExpression; function isDestructuringAssignment(node) { - if (isBinaryExpression(node)) { - if (node.operatorToken.kind === 57 /* EqualsToken */) { - var kind = node.left.kind; - return kind === 176 /* ObjectLiteralExpression */ - || kind === 175 /* ArrayLiteralExpression */; - } + if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { + var kind = node.left.kind; + return kind === 176 /* ObjectLiteralExpression */ + || kind === 175 /* ArrayLiteralExpression */; } return false; } @@ -9327,47 +9367,6 @@ var ts; } return output; } - /** - * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph - * as the fallback implementation does not check for circular references by default. - */ - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - /** - * Serialize an object graph into a JSON string. - */ - function stringifyFallback(value) { - // JSON.stringify returns `undefined` here, instead of the string "undefined". - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; - } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; - } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; - } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); - } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; /** * Converts a string to a base-64 encoded ASCII string. @@ -9631,135 +9630,6 @@ var ts; return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos); } ts.getStartPositionOfRange = getStartPositionOfRange; - function collectExternalModuleInfo(sourceFile, resolver) { - var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); - var uniqueExports = ts.createMap(); - var hasExportDefault = false; - var exportEquals = undefined; - var hasExportStarsToExportValues = false; - for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { - var node = _a[_i]; - switch (node.kind) { - case 235 /* ImportDeclaration */: - // import "mod" - // import x from "mod" - // import * as x from "mod" - // import { x, y } from "mod" - externalImports.push(node); - break; - case 234 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { - // import x = require("mod") - externalImports.push(node); - } - break; - case 241 /* ExportDeclaration */: - if (node.moduleSpecifier) { - if (!node.exportClause) { - // export * from "mod" - externalImports.push(node); - hasExportStarsToExportValues = true; - } - else { - // export { x, y } from "mod" - externalImports.push(node); - } - } - else { - // export { x, y } - for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { - var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_8 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_8.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_8) - || resolver.getReferencedValueDeclaration(name_8); - if (decl) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name); - } - uniqueExports[specifier.name.text] = specifier.name; - } - } - } - break; - case 240 /* ExportAssignment */: - if (node.isExportEquals && !exportEquals) { - // export = x - exportEquals = node; - } - break; - case 205 /* VariableStatement */: - if (hasModifier(node, 1 /* Export */)) { - for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { - var decl = _e[_d]; - collectExportedVariableInfo(decl, uniqueExports); - } - } - break; - case 225 /* FunctionDeclaration */: - if (hasModifier(node, 1 /* Export */)) { - if (hasModifier(node, 512 /* Default */)) { - // export default function() { } - if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); - hasExportDefault = true; - } - } - else { - // export function x() { } - var name_9 = node.name; - if (!uniqueExports[name_9.text]) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_9); - uniqueExports[name_9.text] = name_9; - } - } - } - break; - case 226 /* ClassDeclaration */: - if (hasModifier(node, 1 /* Export */)) { - if (hasModifier(node, 512 /* Default */)) { - // export default class { } - if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); - hasExportDefault = true; - } - } - else { - // export class x { } - var name_10 = node.name; - if (!uniqueExports[name_10.text]) { - ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_10); - uniqueExports[name_10.text] = name_10; - } - } - } - break; - } - } - var exportedNames; - for (var key in uniqueExports) { - exportedNames = ts.append(exportedNames, uniqueExports[key]); - } - return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames }; - } - ts.collectExternalModuleInfo = collectExternalModuleInfo; - function collectExportedVariableInfo(decl, uniqueExports) { - if (isBindingPattern(decl.name)) { - for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (!isOmittedExpression(element)) { - collectExportedVariableInfo(element, uniqueExports); - } - } - } - else if (!isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = decl.name; - } - } - } /** * Determines whether a name was originally the declaration name of an enum or namespace * declaration. @@ -9963,6 +9833,14 @@ var ts; } ts.isTypeNode = isTypeNode; // Binding patterns + function isArrayBindingPattern(node) { + return node.kind === 173 /* ArrayBindingPattern */; + } + ts.isArrayBindingPattern = isArrayBindingPattern; + function isObjectBindingPattern(node) { + return node.kind === 172 /* ObjectBindingPattern */; + } + ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; @@ -9972,6 +9850,12 @@ var ts; return false; } ts.isBindingPattern = isBindingPattern; + function isAssignmentPattern(node) { + var kind = node.kind; + return kind === 175 /* ArrayLiteralExpression */ + || kind === 176 /* ObjectLiteralExpression */; + } + ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { return node.kind === 174 /* BindingElement */; } @@ -9982,6 +9866,51 @@ var ts; || kind === 198 /* OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; + /** + * Determines whether the BindingOrAssignmentElement is a BindingElement-like declaration + */ + function isDeclarationBindingElement(bindingElement) { + switch (bindingElement.kind) { + case 223 /* VariableDeclaration */: + case 144 /* Parameter */: + case 174 /* BindingElement */: + return true; + } + return false; + } + ts.isDeclarationBindingElement = isDeclarationBindingElement; + /** + * Determines whether a node is a BindingOrAssignmentPattern + */ + function isBindingOrAssignmentPattern(node) { + return isObjectBindingOrAssignmentPattern(node) + || isArrayBindingOrAssignmentPattern(node); + } + ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; + /** + * Determines whether a node is an ObjectBindingOrAssignmentPattern + */ + function isObjectBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 172 /* ObjectBindingPattern */: + case 176 /* ObjectLiteralExpression */: + return true; + } + return false; + } + ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; + /** + * Determines whether a node is an ArrayBindingOrAssignmentPattern + */ + function isArrayBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 173 /* ArrayBindingPattern */: + case 175 /* ArrayLiteralExpression */: + return true; + } + return false; + } + ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; // Expression function isArrayLiteralExpression(node) { return node.kind === 175 /* ArrayLiteralExpression */; @@ -10049,7 +9978,8 @@ var ts; || kind === 98 /* ThisKeyword */ || kind === 100 /* TrueKeyword */ || kind === 96 /* SuperKeyword */ - || kind === 201 /* NonNullExpression */; + || kind === 201 /* NonNullExpression */ + || kind === 297 /* RawExpression */; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); @@ -10077,6 +10007,7 @@ var ts; || kind === 196 /* SpreadElement */ || kind === 200 /* AsExpression */ || kind === 198 /* OmittedExpression */ + || kind === 297 /* RawExpression */ || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10090,11 +10021,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 293 /* PartiallyEmittedExpression */; + return node.kind === 294 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 292 /* NotEmittedStatement */; + return node.kind === 293 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10208,7 +10139,7 @@ var ts; || kind === 228 /* TypeAliasDeclaration */ || kind === 143 /* TypeParameter */ || kind === 223 /* VariableDeclaration */ - || kind === 284 /* JSDocTypedefTag */; + || kind === 285 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { return kind === 225 /* FunctionDeclaration */ @@ -10243,9 +10174,9 @@ var ts; || kind === 205 /* VariableStatement */ || kind === 210 /* WhileStatement */ || kind === 217 /* WithStatement */ - || kind === 292 /* NotEmittedStatement */ - || kind === 295 /* EndOfDeclarationMarker */ - || kind === 294 /* MergeDeclarationMarker */; + || kind === 293 /* NotEmittedStatement */ + || kind === 296 /* EndOfDeclarationMarker */ + || kind === 295 /* MergeDeclarationMarker */; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10640,6 +10571,60 @@ var ts; return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; + /** + * Checks to see if the locale is in the appropriate format, + * and if it is, attempts to set the appropriate language. + */ + function validateLocaleAndSetLanguage(locale, sys, errors) { + var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); + if (!matchResult) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); + } + return; + } + var language = matchResult[1]; + var territory = matchResult[3]; + // First try the entire locale, then fall back to just language if that's all we have. + // Either ways do not fail, and fallback to the English diagnostic strings. + if (!trySetLanguageAndTerritory(language, territory, errors)) { + trySetLanguageAndTerritory(language, /*territory*/ undefined, errors); + } + function trySetLanguageAndTerritory(language, territory, errors) { + var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath()); + var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath); + var filePath = ts.combinePaths(containingDirectoryPath, language); + if (territory) { + filePath = filePath + "-" + territory; + } + filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")); + if (!sys.fileExists(filePath)) { + return false; + } + // TODO: Add codePage support for readFile? + var fileContents = ""; + try { + fileContents = sys.readFile(filePath); + } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)); + } + return false; + } + try { + ts.localizedDiagnosticMessages = JSON.parse(fileContents); + } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)); + } + return false; + } + return true; + } + } + ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; })(ts || (ts = {})); /// /// @@ -10857,9 +10842,9 @@ var ts; return node; } ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node); + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) { + return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node); } return node; } @@ -10994,9 +10979,9 @@ var ts; return node; } ts.createBindingElement = createBindingElement; - function updateBindingElement(node, propertyName, name, initializer) { - if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) { - return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node); + function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { + if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) { + return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node); } return node; } @@ -11037,7 +11022,7 @@ var ts; function createPropertyAccess(expression, name, location, flags) { var node = createNode(177 /* PropertyAccessExpression */, location, flags); node.expression = parenthesizeForAccess(expression); - (node.emitNode || (node.emitNode = {})).flags |= 1048576 /* NoIndentation */; + (node.emitNode || (node.emitNode = {})).flags |= 65536 /* NoIndentation */; node.name = typeof name === "string" ? createIdentifier(name) : name; return node; } @@ -11259,13 +11244,23 @@ var ts; return node; } ts.updateBinary = updateBinary; - function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) { - var node = createNode(193 /* ConditionalExpression */, location); - node.condition = condition; - node.questionToken = questionToken; - node.whenTrue = whenTrue; - node.colonToken = colonToken; - node.whenFalse = whenFalse; + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { + var node = createNode(193 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation); + node.condition = parenthesizeForConditionalHead(condition); + if (whenFalse) { + // second overload + node.questionToken = questionTokenOrWhenTrue; + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); + node.colonToken = colonTokenOrLocation; + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); + } + else { + // first overload + node.questionToken = createToken(54 /* QuestionToken */); + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); + node.colonToken = createToken(55 /* ColonToken */); + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); + } return node; } ts.createConditional = createConditional; @@ -12081,8 +12076,6 @@ var ts; updated.imports = node.imports; if (node.moduleAugmentations !== undefined) updated.moduleAugmentations = node.moduleAugmentations; - if (node.externalHelpersModuleName !== undefined) - updated.externalHelpersModuleName = node.externalHelpersModuleName; return updateNode(updated, node); } return node; @@ -12096,7 +12089,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createNode(292 /* NotEmittedStatement */, /*location*/ original); + var node = createNode(293 /* NotEmittedStatement */, /*location*/ original); node.original = original; return node; } @@ -12106,7 +12099,7 @@ var ts; * order to properly emit exports. */ function createEndOfDeclarationMarker(original) { - var node = createNode(295 /* EndOfDeclarationMarker */); + var node = createNode(296 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12117,7 +12110,7 @@ var ts; * order to properly emit exports. */ function createMergeDeclarationMarker(original) { - var node = createNode(294 /* MergeDeclarationMarker */); + var node = createNode(295 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12132,7 +12125,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(293 /* PartiallyEmittedExpression */, /*location*/ location || original); + var node = createNode(294 /* PartiallyEmittedExpression */, /*location*/ location || original); node.expression = expression; node.original = original; return node; @@ -12145,6 +12138,19 @@ var ts; return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; + /** + * Creates a node that emits a string of raw text in an expression position. Raw text is never + * transformed, should be ES3 compliant, and should have the same precedence as + * PrimaryExpression. + * + * @param text The raw text of the node. + */ + function createRawExpression(text) { + var node = createNode(297 /* RawExpression */); + node.text = text; + return node; + } + ts.createRawExpression = createRawExpression; // Compound nodes function createComma(left, right) { return createBinary(left, 25 /* CommaToken */, right); @@ -12194,13 +12200,19 @@ var ts; return createVoid(createLiteral(0)); } ts.createVoidZero = createVoidZero; + function createTypeCheck(value, tag) { + return tag === "undefined" + ? createStrictEquality(value, createVoidZero()) + : createStrictEquality(createTypeOf(value), createLiteral(tag)); + } + ts.createTypeCheck = createTypeCheck; function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) { return createElementAccess(target, memberName.expression, location); } else { var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - (expression.emitNode || (expression.emitNode = {})).flags |= 2048 /* NoNestedSourceMaps */; + (expression.emitNode || (expression.emitNode = {})).flags |= 64 /* NoNestedSourceMaps */; return expression; } } @@ -12244,14 +12256,17 @@ var ts; // flag and setting a parent node. var react = createIdentifier(reactNamespace || "React"); react.flags &= ~8 /* Synthesized */; - // Set the parent that is in parse tree + // Set the parent that is in parse tree // this makes sure that parent chain is intact for checker to traverse complete scope tree react.parent = ts.getParseTreeNode(parent); return react; } function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { - return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536 /* NoSourceMap */)); + var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); + var right = createSynthesizedNode(70 /* Identifier */); + right.text = jsxFactory.right.text; + return createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); @@ -12307,170 +12322,10 @@ var ts; } ts.createConstDeclarationList = createConstDeclarationList; // Helpers - function createHelperName(externalHelpersModuleName, name) { - return externalHelpersModuleName - ? createPropertyAccess(externalHelpersModuleName, name) - : createIdentifier(name); + function getHelperName(name) { + return setEmitFlags(createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); } - ts.createHelperName = createHelperName; - function createExtendsHelper(externalHelpersModuleName, name) { - return createCall(createHelperName(externalHelpersModuleName, "__extends"), - /*typeArguments*/ undefined, [ - name, - createIdentifier("_super") - ]); - } - ts.createExtendsHelper = createExtendsHelper; - function createAssignHelper(externalHelpersModuleName, attributesSegments) { - return createCall(createHelperName(externalHelpersModuleName, "__assign"), - /*typeArguments*/ undefined, attributesSegments); - } - ts.createAssignHelper = createAssignHelper; - function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) { - return createCall(createHelperName(externalHelpersModuleName, "__param"), - /*typeArguments*/ undefined, [ - createLiteral(parameterOffset), - expression - ], location); - } - ts.createParamHelper = createParamHelper; - function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) { - return createCall(createHelperName(externalHelpersModuleName, "__metadata"), - /*typeArguments*/ undefined, [ - createLiteral(metadataKey), - metadataValue - ]); - } - ts.createMetadataHelper = createMetadataHelper; - function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) { - var argumentsArray = []; - argumentsArray.push(createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); - } - } - return createCall(createHelperName(externalHelpersModuleName, "__decorate"), /*typeArguments*/ undefined, argumentsArray, location); - } - ts.createDecorateHelper = createDecorateHelper; - function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) { - var generatorFunc = createFunctionExpression( - /*modifiers*/ undefined, createToken(38 /* AsteriskToken */), - /*name*/ undefined, - /*typeParameters*/ undefined, - /*parameters*/ [], - /*type*/ undefined, body); - // Mark this node as originally an async function - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152 /* AsyncFunctionBody */; - return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), - /*typeArguments*/ undefined, [ - createThis(), - hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(), - promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(), - generatorFunc - ]); - } - ts.createAwaiterHelper = createAwaiterHelper; - function createHasOwnProperty(target, propertyName) { - return createCall(createPropertyAccess(target, "hasOwnProperty"), - /*typeArguments*/ undefined, [propertyName]); - } - ts.createHasOwnProperty = createHasOwnProperty; - function createObjectCreate(prototype) { - return createCall(createPropertyAccess(createIdentifier("Object"), "create"), - /*typeArguments*/ undefined, [prototype]); - } - function createGeti(target) { - // name => super[name] - return createArrowFunction( - /*modifiers*/ undefined, - /*typeParameters*/ undefined, [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name")], - /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createElementAccess(target, createIdentifier("name"))); - } - function createSeti(target) { - // (name, value) => super[name] = value - return createArrowFunction( - /*modifiers*/ undefined, - /*typeParameters*/ undefined, [ - createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name"), - createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "value") - ], - /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value"))); - } - function createAdvancedAsyncSuperHelper() { - // const _super = (function (geti, seti) { - // const cache = Object.create(null); - // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); - // })(name => super[name], (name, value) => super[name] = value); - // const cache = Object.create(null); - var createCache = createVariableStatement( - /*modifiers*/ undefined, createConstDeclarationList([ - createVariableDeclaration("cache", - /*type*/ undefined, createObjectCreate(createNull())) - ])); - // get value() { return geti(name); } - var getter = createGetAccessor( - /*decorators*/ undefined, - /*modifiers*/ undefined, "value", - /*parameters*/ [], - /*type*/ undefined, createBlock([ - createReturn(createCall(createIdentifier("geti"), - /*typeArguments*/ undefined, [createIdentifier("name")])) - ])); - // set value(v) { seti(name, v); } - var setter = createSetAccessor( - /*decorators*/ undefined, - /*modifiers*/ undefined, "value", [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "v")], createBlock([ - createStatement(createCall(createIdentifier("seti"), - /*typeArguments*/ undefined, [ - createIdentifier("name"), - createIdentifier("v") - ])) - ])); - // return name => cache[name] || ... - var getOrCreateAccessorsForName = createReturn(createArrowFunction( - /*modifiers*/ undefined, - /*typeParameters*/ undefined, [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name")], - /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([ - getter, - setter - ])))))); - // const _super = (function (geti, seti) { - // const cache = Object.create(null); - // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); - // })(name => super[name], (name, value) => super[name] = value); - return createVariableStatement( - /*modifiers*/ undefined, createConstDeclarationList([ - createVariableDeclaration("_super", - /*type*/ undefined, createCall(createParen(createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, [ - createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "geti"), - createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "seti") - ], - /*type*/ undefined, createBlock([ - createCache, - getOrCreateAccessorsForName - ]))), - /*typeArguments*/ undefined, [ - createGeti(createSuper()), - createSeti(createSuper()) - ])) - ])); - } - ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper; - function createSimpleAsyncSuperHelper() { - return createVariableStatement( - /*modifiers*/ undefined, createConstDeclarationList([ - createVariableDeclaration("_super", - /*type*/ undefined, createGeti(createSuper())) - ])); - } - ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper; + ts.getHelperName = getHelperName; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12656,14 +12511,14 @@ var ts; * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. */ function getLocalName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 262144 /* LocalName */); + return getName(node, allowComments, allowSourceMaps, 16384 /* LocalName */); } ts.getLocalName = getLocalName; /** * Gets whether an identifier should only be referred to by its local name. */ function isLocalName(node) { - return (getEmitFlags(node) & 262144 /* LocalName */) !== 0; + return (getEmitFlags(node) & 16384 /* LocalName */) !== 0; } ts.isLocalName = isLocalName; /** @@ -12677,7 +12532,7 @@ var ts; * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. */ function getExportName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 131072 /* ExportName */); + return getName(node, allowComments, allowSourceMaps, 8192 /* ExportName */); } ts.getExportName = getExportName; /** @@ -12685,7 +12540,7 @@ var ts; * name points to an exported symbol. */ function isExportName(node) { - return (getEmitFlags(node) & 131072 /* ExportName */) !== 0; + return (getEmitFlags(node) & 8192 /* ExportName */) !== 0; } ts.isExportName = isExportName; /** @@ -12701,15 +12556,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_11 = getMutableClone(node.name); + var name_8 = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) - emitFlags |= 1536 /* NoSourceMap */; + emitFlags |= 48 /* NoSourceMap */; if (!allowComments) - emitFlags |= 49152 /* NoComments */; + emitFlags |= 1536 /* NoComments */; if (emitFlags) - setEmitFlags(name_11, emitFlags); - return name_11; + setEmitFlags(name_8, emitFlags); + return name_8; } return getGeneratedNameForNode(node); } @@ -12743,15 +12598,18 @@ var ts; var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), /*location*/ name); var emitFlags; if (!allowSourceMaps) - emitFlags |= 1536 /* NoSourceMap */; + emitFlags |= 48 /* NoSourceMap */; if (!allowComments) - emitFlags |= 49152 /* NoComments */; + emitFlags |= 1536 /* NoComments */; if (emitFlags) setEmitFlags(qualifiedName, emitFlags); return qualifiedName; } ts.getNamespaceMemberName = getNamespaceMemberName; - // Utilities + function convertToFunctionBody(node, multiLine) { + return ts.isBlock(node) ? node : createBlock([createReturn(node, /*location*/ node)], /*location*/ node, multiLine); + } + ts.convertToFunctionBody = convertToFunctionBody; function isUseStrictPrologue(node) { return node.expression.text === "use strict"; } @@ -12789,7 +12647,7 @@ var ts; } while (statementOffset < numStatements) { var statement = source[statementOffset]; - if (getEmitFlags(statement) & 8388608 /* CustomPrologue */) { + if (getEmitFlags(statement) & 524288 /* CustomPrologue */) { target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); } else { @@ -12800,15 +12658,22 @@ var ts; return statementOffset; } ts.addPrologueDirectives = addPrologueDirectives; + function startsWithUseStrict(statements) { + var firstStatement = ts.firstOrUndefined(statements); + return firstStatement !== undefined + && ts.isPrologueDirective(firstStatement) + && isUseStrictPrologue(firstStatement); + } + ts.startsWithUseStrict = startsWithUseStrict; /** * Ensures "use strict" directive is added * - * @param node source file + * @param statements An array of statements */ - function ensureUseStrict(node) { + function ensureUseStrict(statements) { var foundUseStrict = false; - for (var _i = 0, _a = node.statements; _i < _a.length; _i++) { - var statement = _a[_i]; + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; if (ts.isPrologueDirective(statement)) { if (isUseStrictPrologue(statement)) { foundUseStrict = true; @@ -12820,12 +12685,11 @@ var ts; } } if (!foundUseStrict) { - var statements = []; - statements.push(startOnNewLine(createStatement(createLiteral("use strict")))); - // add "use strict" as the first statement - return updateSourceFileNode(node, statements.concat(node.statements)); + return createNodeArray([ + startOnNewLine(createStatement(createLiteral("use strict"))) + ].concat(statements), statements); } - return node; + return statements; } ts.ensureUseStrict = ensureUseStrict; /** @@ -12986,6 +12850,24 @@ var ts; } return 0 /* Unknown */; } + function parenthesizeForConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(193 /* ConditionalExpression */, 54 /* QuestionToken */); + var emittedCondition = skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { + return createParen(condition); + } + return condition; + } + ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; + function parenthesizeSubexpressionOfConditionalExpression(e) { + // per ES grammar both 'whenTrue' and 'whenFalse' parts of conditional expression are assignment expressions + // so in case when comma expression is introduced as a part of previous transformations + // if should be wrapped in parens since comma operator has the lowest precedence + return e.kind === 192 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */ + ? createParen(e) + : e; + } /** * Wraps an expression in parentheses if it is needed in order to use the expression * as the expression of a NewExpression node. @@ -13117,7 +12999,7 @@ var ts; case 177 /* PropertyAccessExpression */: node = node.expression; continue; - case 293 /* PartiallyEmittedExpression */: + case 294 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -13172,7 +13054,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 293 /* PartiallyEmittedExpression */) { + while (node.kind === 294 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -13194,8 +13076,8 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges; - if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges)) + var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) destEmitNode = {}; if (flags) destEmitNode.flags = flags; @@ -13205,6 +13087,10 @@ var ts; destEmitNode.sourceMapRange = sourceMapRange; if (tokenSourceMapRanges) destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -13257,6 +13143,7 @@ var ts; } return node.emitNode; } + ts.getOrCreateEmitNode = getOrCreateEmitNode; /** * Gets flags that control emit behavior of a node. * @@ -13278,6 +13165,16 @@ var ts; return node; } ts.setEmitFlags = setEmitFlags; + /** + * Gets a custom text range to use when emitting source maps. + * + * @param node The node. + */ + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; /** * Sets a custom text range to use when emitting source maps. * @@ -13289,6 +13186,18 @@ var ts; return node; } ts.setSourceMapRange = setSourceMapRange; + /** + * Gets the TextRange to use for source maps for a token of a node. + * + * @param node The node. + * @param token The token. + */ + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; /** * Sets the TextRange to use for source maps for a token of a node. * @@ -13303,14 +13212,6 @@ var ts; return node; } ts.setTokenSourceMapRange = setTokenSourceMapRange; - /** - * Sets a custom text range to use when emitting comments. - */ - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; /** * Gets a custom text range to use when emitting comments. * @@ -13322,27 +13223,13 @@ var ts; } ts.getCommentRange = getCommentRange; /** - * Gets a custom text range to use when emitting source maps. - * - * @param node The node. + * Sets a custom text range to use when emitting comments. */ - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; } - ts.getSourceMapRange = getSourceMapRange; - /** - * Gets the TextRange to use for source maps for a token of a node. - * - * @param node The node. - * @param token The token. - */ - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; + ts.setCommentRange = setCommentRange; /** * Gets the constant value to emit for an expression. */ @@ -13360,6 +13247,118 @@ var ts; return node; } ts.setConstantValue = setConstantValue; + function getExternalHelpersModuleName(node) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = parseNode && parseNode.emitNode; + return emitNode && emitNode.externalHelpersModuleName; + } + ts.getExternalHelpersModuleName = getExternalHelpersModuleName; + function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) { + if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { + var externalHelpersModuleName = getExternalHelpersModuleName(node); + if (externalHelpersModuleName) { + return externalHelpersModuleName; + } + var helpers = getEmitHelpers(node); + if (helpers) { + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!helper.scoped) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText)); + } + } + } + } + } + ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; + /** + * Adds an EmitHelper to a node. + */ + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + /** + * Adds an EmitHelper to a node. + */ + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + /** + * Removes an EmitHelper from a node. + */ + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + /** + * Gets the EmitHelpers of a node. + */ + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + /** + * Moves matching emit helpers from a source node to a target node. + */ + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + function compareEmitHelpers(x, y) { + if (x === y) + return 0 /* EqualTo */; + if (x.priority === y.priority) + return 0 /* EqualTo */; + if (x.priority === undefined) + return 1 /* GreaterThan */; + if (y.priority === undefined) + return -1 /* LessThan */; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; function setTextRange(node, location) { if (location) { node.pos = location.pos; @@ -13389,8 +13388,8 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_12 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_12) ? name_12 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name_9 = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } if (node.kind === 235 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); @@ -13453,362 +13452,390 @@ var ts; return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); } /** - * Transforms the body of a function-like node. - * - * @param node A function-like node. + * Gets the initializer of an BindingOrAssignmentElement. */ - function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) { - var multiLine = false; // indicates whether the block *must* be emitted as multiple lines - var singleLine = false; // indicates whether the block *may* be emitted as a single line - var statementsLocation; - var closeBraceLocation; - var statements = []; - var body = node.body; - var statementOffset; - context.startLexicalEnvironment(); - if (ts.isBlock(body)) { - // ensureUseStrict is false because no new prologue-directive should be added. - // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array - statementOffset = addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); + function getInitializerOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + // `1` in `let { a = 1 } = ...` + // `1` in `let { a: b = 1 } = ...` + // `1` in `let { a: {b} = 1 } = ...` + // `1` in `let { a: [b] = 1 } = ...` + // `1` in `let [a = 1] = ...` + // `1` in `let [{a} = 1] = ...` + // `1` in `let [[a] = 1] = ...` + return bindingElement.initializer; } - addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis); - addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest); - addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false); - // If we added any generated statements, this must be a multi-line block. - if (!multiLine && statements.length > 0) { - multiLine = true; + if (ts.isPropertyAssignment(bindingElement)) { + // `1` in `({ a: b = 1 } = ...)` + // `1` in `({ a: {b} = 1 } = ...)` + // `1` in `({ a: [b] = 1 } = ...)` + return ts.isAssignmentExpression(bindingElement.initializer, /*excludeCompoundAssignment*/ true) + ? bindingElement.initializer.right + : undefined; } - if (ts.isBlock(body)) { - statementsLocation = body.statements; - ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); - // If the original body was a multi-line block, this must be a multi-line block. - if (!multiLine && body.multiLine) { - multiLine = true; + if (ts.isShorthandPropertyAssignment(bindingElement)) { + // `1` in `({ a = 1 } = ...)` + return bindingElement.objectAssignmentInitializer; + } + if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) { + // `1` in `[a = 1] = ...` + // `1` in `[{a} = 1] = ...` + // `1` in `[[a] = 1] = ...` + return bindingElement.right; + } + if (ts.isSpreadExpression(bindingElement)) { + // Recovery consistent with existing emit. + return getInitializerOfBindingOrAssignmentElement(bindingElement.expression); + } + } + ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement; + /** + * Gets the name of an BindingOrAssignmentElement. + */ + function getTargetOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + // `a` in `let { a } = ...` + // `a` in `let { a = 1 } = ...` + // `b` in `let { a: b } = ...` + // `b` in `let { a: b = 1 } = ...` + // `a` in `let { ...a } = ...` + // `{b}` in `let { a: {b} } = ...` + // `{b}` in `let { a: {b} = 1 } = ...` + // `[b]` in `let { a: [b] } = ...` + // `[b]` in `let { a: [b] = 1 } = ...` + // `a` in `let [a] = ...` + // `a` in `let [a = 1] = ...` + // `a` in `let [...a] = ...` + // `{a}` in `let [{a}] = ...` + // `{a}` in `let [{a} = 1] = ...` + // `[a]` in `let [[a]] = ...` + // `[a]` in `let [[a] = 1] = ...` + return bindingElement.name; + } + if (ts.isObjectLiteralElementLike(bindingElement)) { + switch (bindingElement.kind) { + case 257 /* PropertyAssignment */: + // `b` in `({ a: b } = ...)` + // `b` in `({ a: b = 1 } = ...)` + // `{b}` in `({ a: {b} } = ...)` + // `{b}` in `({ a: {b} = 1 } = ...)` + // `[b]` in `({ a: [b] } = ...)` + // `[b]` in `({ a: [b] = 1 } = ...)` + // `b.c` in `({ a: b.c } = ...)` + // `b.c` in `({ a: b.c = 1 } = ...)` + // `b[0]` in `({ a: b[0] } = ...)` + // `b[0]` in `({ a: b[0] = 1 } = ...)` + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); + case 258 /* ShorthandPropertyAssignment */: + // `a` in `({ a } = ...)` + // `a` in `({ a = 1 } = ...)` + return bindingElement.name; + case 259 /* SpreadAssignment */: + // `a` in `({ ...a } = ...)` + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + // no target + return undefined; + } + if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) { + // `a` in `[a = 1] = ...` + // `{a}` in `[{a} = 1] = ...` + // `[a]` in `[[a] = 1] = ...` + // `a.b` in `[a.b = 1] = ...` + // `a[0]` in `[a[0] = 1] = ...` + return getTargetOfBindingOrAssignmentElement(bindingElement.left); + } + if (ts.isSpreadExpression(bindingElement)) { + // `a` in `[...a] = ...` + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + // `a` in `[a] = ...` + // `{a}` in `[{a}] = ...` + // `[a]` in `[[a]] = ...` + // `a.b` in `[a.b] = ...` + // `a[0]` in `[a[0]] = ...` + return bindingElement; + } + ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; + /** + * Determines whether an BindingOrAssignmentElement is a rest element. + */ + function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 144 /* Parameter */: + case 174 /* BindingElement */: + // `...` in `let [...a] = ...` + return bindingElement.dotDotDotToken; + case 196 /* SpreadElement */: + case 259 /* SpreadAssignment */: + // `...` in `[...a] = ...` + return bindingElement; + } + return undefined; + } + ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; + /** + * Gets the property name of a BindingOrAssignmentElement + */ + function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 174 /* BindingElement */: + // `a` in `let { a: b } = ...` + // `[a]` in `let { [a]: b } = ...` + // `"a"` in `let { "a": b } = ...` + // `1` in `let { 1: b } = ...` + if (bindingElement.propertyName) { + var propertyName = bindingElement.propertyName; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 257 /* PropertyAssignment */: + // `a` in `({ a: b } = ...)` + // `[a]` in `({ [a]: b } = ...)` + // `"a"` in `({ "a": b } = ...)` + // `1` in `({ 1: b } = ...)` + if (bindingElement.name) { + var propertyName = bindingElement.name; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 259 /* SpreadAssignment */: + // `a` in `({ ...a } = ...)` + return bindingElement.name; + } + var target = getTargetOfBindingOrAssignmentElement(bindingElement); + if (target && ts.isPropertyName(target)) { + return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression) + ? target.expression + : target; + } + ts.Debug.fail("Invalid property name for binding element."); + } + ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; + /** + * Gets the elements of a BindingOrAssignmentPattern + */ + function getElementsOfBindingOrAssignmentPattern(name) { + switch (name.kind) { + case 172 /* ObjectBindingPattern */: + case 173 /* ArrayBindingPattern */: + case 175 /* ArrayLiteralExpression */: + // `a` in `{a}` + // `a` in `[a]` + return name.elements; + case 176 /* ObjectLiteralExpression */: + // `a` in `{a}` + return name.properties; + } + } + ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern; + function convertToArrayAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createSpread(element.name, element), element); + } + var expression = convertToAssignmentElementTarget(element.name); + return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression; + } + ts.Debug.assertNode(element, ts.isExpression); + return element; + } + ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement; + function convertToObjectAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createSpreadAssignment(element.name, element), element); + } + if (element.propertyName) { + var expression = convertToAssignmentElementTarget(element.name); + return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element); + } + ts.Debug.assertNode(element.name, ts.isIdentifier); + return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element); + } + ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); + return element; + } + ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; + function convertToAssignmentPattern(node) { + switch (node.kind) { + case 173 /* ArrayBindingPattern */: + case 175 /* ArrayLiteralExpression */: + return convertToArrayAssignmentPattern(node); + case 172 /* ObjectBindingPattern */: + case 176 /* ObjectLiteralExpression */: + return convertToObjectAssignmentPattern(node); + } + } + ts.convertToAssignmentPattern = convertToAssignmentPattern; + function convertToObjectAssignmentPattern(node) { + if (ts.isObjectBindingPattern(node)) { + return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node); + } + ts.Debug.assertNode(node, ts.isObjectLiteralExpression); + return node; + } + ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; + function convertToArrayAssignmentPattern(node) { + if (ts.isArrayBindingPattern(node)) { + return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node); + } + ts.Debug.assertNode(node, ts.isArrayLiteralExpression); + return node; + } + ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern; + function convertToAssignmentElementTarget(node) { + if (ts.isBindingPattern(node)) { + return convertToAssignmentPattern(node); + } + ts.Debug.assertNode(node, ts.isExpression); + return node; + } + ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; + function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { + var externalImports = []; + var exportSpecifiers = ts.createMap(); + var exportedBindings = ts.createMap(); + var uniqueExports = ts.createMap(); + var exportedNames; + var hasExportDefault = false; + var exportEquals = undefined; + var hasExportStarsToExportValues = false; + var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions); + var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, createImportClause(/*name*/ undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText)); + if (externalHelpersImportDeclaration) { + externalImports.push(externalHelpersImportDeclaration); + } + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 235 /* ImportDeclaration */: + // import "mod" + // import x from "mod" + // import * as x from "mod" + // import { x, y } from "mod" + externalImports.push(node); + break; + case 234 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { + // import x = require("mod") + externalImports.push(node); + } + break; + case 241 /* ExportDeclaration */: + if (node.moduleSpecifier) { + if (!node.exportClause) { + // export * from "mod" + externalImports.push(node); + hasExportStarsToExportValues = true; + } + else { + // export { x, y } from "mod" + externalImports.push(node); + } + } + else { + // export { x, y } + for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { + var specifier = _c[_b]; + if (!uniqueExports[specifier.name.text]) { + var name_10 = specifier.propertyName || specifier.name; + ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name_10) + || resolver.getReferencedValueDeclaration(name_10); + if (decl) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + } + uniqueExports[specifier.name.text] = true; + exportedNames = ts.append(exportedNames, specifier.name); + } + } + } + break; + case 240 /* ExportAssignment */: + if (node.isExportEquals && !exportEquals) { + // export = x + exportEquals = node; + } + break; + case 205 /* VariableStatement */: + if (ts.hasModifier(node, 1 /* Export */)) { + for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { + var decl = _e[_d]; + exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames); + } + } + break; + case 225 /* FunctionDeclaration */: + if (ts.hasModifier(node, 1 /* Export */)) { + if (ts.hasModifier(node, 512 /* Default */)) { + // export default function() { } + if (!hasExportDefault) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + // export function x() { } + var name_11 = node.name; + if (!uniqueExports[name_11.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11); + uniqueExports[name_11.text] = true; + exportedNames = ts.append(exportedNames, name_11); + } + } + } + break; + case 226 /* ClassDeclaration */: + if (ts.hasModifier(node, 1 /* Export */)) { + if (ts.hasModifier(node, 512 /* Default */)) { + // export default class { } + if (!hasExportDefault) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + // export class x { } + var name_12 = node.name; + if (!uniqueExports[name_12.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); + uniqueExports[name_12.text] = true; + exportedNames = ts.append(exportedNames, name_12); + } + } + } + break; } } - else { - ts.Debug.assert(node.kind === 185 /* ArrowFunction */); - // To align with the old emitter, we use a synthetic end position on the location - // for the statement list we synthesize when we down-level an arrow function with - // an expression function body. This prevents both comments and source maps from - // being emitted for the end position only. - statementsLocation = ts.moveRangeEnd(body, -1); - var equalsGreaterThanToken = node.equalsGreaterThanToken; - if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { - if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { - singleLine = true; - } - else { - multiLine = true; + return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration }; + } + ts.collectExternalModuleInfo = collectExternalModuleInfo; + function collectExportedVariableInfo(decl, uniqueExports, exportedNames) { + if (ts.isBindingPattern(decl.name)) { + for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames); } } - var expression = ts.visitNode(body, visitor, ts.isExpression); - var returnStatement = createReturn(expression, /*location*/ body); - setEmitFlags(returnStatement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 32768 /* NoTrailingComments */); - statements.push(returnStatement); - // To align with the source map emit for the old emitter, we set a custom - // source map location for the close brace. - closeBraceLocation = body; } - var lexicalEnvironment = context.endLexicalEnvironment(); - ts.addRange(statements, lexicalEnvironment); - // If we added any final generated statements, this must be a multi-line block - if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { - multiLine = true; - } - var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine); - if (!multiLine && singleLine) { - setEmitFlags(block, 32 /* SingleLine */); - } - if (closeBraceLocation) { - setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation); - } - setOriginalNode(block, node.body); - return block; - } - ts.transformFunctionBody = transformFunctionBody; - /** - * Adds a statement to capture the `this` of a function declaration if it is needed. - * - * @param statements The statements for the new function body. - * @param node A node. - */ - function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) { - if (node.transformFlags & 524288 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) { - captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis); - } - } - ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded; - function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) { - enableSubstitutionsForCapturedThis(); - var captureThisStatement = createVariableStatement( - /*modifiers*/ undefined, createVariableDeclarationList([ - createVariableDeclaration("_this", - /*type*/ undefined, initializer) - ]), originalStatement); - setEmitFlags(captureThisStatement, 49152 /* NoComments */ | 8388608 /* CustomPrologue */); - setSourceMapRange(captureThisStatement, node); - statements.push(captureThisStatement); - } - ts.captureThisForNode = captureThisForNode; - /** - * Gets a value indicating whether we need to add default value assignments for a - * function-like node. - * - * @param node A function-like node. - */ - function shouldAddDefaultValueAssignments(node) { - return (node.transformFlags & 2097152 /* ContainsDefaultValueAssignments */) !== 0; - } - /** - * Adds statements to the body of a function-like node if it contains parameters with - * binding patterns or initializers. - * - * @param statements The statements for the new function body. - * @param node A function-like node. - */ - function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) { - if (!shouldAddDefaultValueAssignments(node)) { - return; - } - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var parameter = _a[_i]; - var name_13 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; - // A rest parameter cannot have a binding pattern or an initializer, - // so let's just ignore it. - if (dotDotDotToken) { - continue; - } - if (ts.isBindingPattern(name_13)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_13, initializer, visitor, convertObjectRest); - } - else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_13, initializer, visitor); + else if (!ts.isGeneratedIdentifier(decl.name)) { + if (!uniqueExports[decl.name.text]) { + uniqueExports[decl.name.text] = true; + exportedNames = ts.append(exportedNames, decl.name); } } + return exportedNames; } - ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded; - /** - * Adds statements to the body of a function-like node for parameters with binding patterns - * - * @param statements The statements for the new function body. - * @param parameter The parameter for the function. - * @param name The name of the parameter. - * @param initializer The initializer for the parameter. - */ - function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) { - var temp = getGeneratedNameForNode(parameter); - // In cases where a binding pattern is simply '[]' or '{}', - // we usually don't want to emit a var declaration; however, in the presence - // of an initializer, we must emit that expression to preserve side effects. - if (name.elements.length > 0) { - statements.push(setEmitFlags(createVariableStatement( - /*modifiers*/ undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608 /* CustomPrologue */)); - } - else if (initializer) { - statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608 /* CustomPrologue */)); - } - } - /** - * Adds statements to the body of a function-like node for parameters with initializers. - * - * @param statements The statements for the new function body. - * @param parameter The parameter for the function. - * @param name The name of the parameter. - * @param initializer The initializer for the parameter. - */ - function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) { - initializer = ts.visitNode(initializer, visitor, ts.isExpression); - var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([ - createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536 /* NoSourceMap */), setEmitFlags(initializer, 1536 /* NoSourceMap */ | getEmitFlags(initializer)), - /*location*/ parameter)) - ], /*location*/ parameter), 32 /* SingleLine */ | 1024 /* NoTrailingSourceMap */ | 12288 /* NoTokenSourceMaps */), - /*elseStatement*/ undefined, - /*location*/ parameter); - statement.startsOnNewLine = true; - setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 8388608 /* CustomPrologue */); - statements.push(statement); - } - /** - * Gets a value indicating whether we need to add statements to handle a rest parameter. - * - * @param node A ParameterDeclaration node. - * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is - * part of a constructor declaration with a - * synthesized call to `super` - */ - function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { - return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper; - } - /** - * Adds statements to the body of a function-like node if it contains a rest parameter. - * - * @param statements The statements for the new function body. - * @param node A function-like node. - * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is - * part of a constructor declaration with a - * synthesized call to `super` - */ - function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { - var parameter = ts.lastOrUndefined(node.parameters); - if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { - return; - } - // `declarationName` is the name of the local declaration for the parameter. - var declarationName = getMutableClone(parameter.name); - setEmitFlags(declarationName, 1536 /* NoSourceMap */); - // `expressionName` is the name of the parameter used in expressions. - var expressionName = getSynthesizedClone(parameter.name); - var restIndex = node.parameters.length - 1; - var temp = createLoopVariable(); - // var param = []; - statements.push(setEmitFlags(createVariableStatement( - /*modifiers*/ undefined, createVariableDeclarationList([ - createVariableDeclaration(declarationName, - /*type*/ undefined, createArrayLiteral([])) - ]), - /*location*/ parameter), 8388608 /* CustomPrologue */)); - // for (var _i = restIndex; _i < arguments.length; _i++) { - // param[_i - restIndex] = arguments[_i]; - // } - var forStatement = createFor(createVariableDeclarationList([ - createVariableDeclaration(temp, /*type*/ undefined, createLiteral(restIndex)) - ], /*location*/ parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"), - /*location*/ parameter), createPostfixIncrement(temp, /*location*/ parameter), createBlock([ - startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)), - /*location*/ parameter)) - ])); - setEmitFlags(forStatement, 8388608 /* CustomPrologue */); - startOnNewLine(forStatement); - statements.push(forStatement); - } - ts.addRestParameterIfNeeded = addRestParameterIfNeeded; - function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (var _i = 0, _a = expr; _i < _a.length; _i++) { - // var v = _a[_i]; - // } - // - // where _a and _i are temps emitted to capture the RHS and the counter, - // respectively. - // When the left hand side is an expression instead of a let declaration, - // the "let v" is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var initializer = node.initializer; - var statements = []; - // In the case where the user wrote an identifier as the RHS, like this: - // - // for (let v of arr) { } - // - // we don't want to emit a temporary variable for the RHS, just use it directly. - var counter = convertObjectRest ? undefined : createLoopVariable(); - var rhsReference = expression.kind === 70 /* Identifier */ - ? createUniqueName(expression.text) - : createTempVariable(/*recordTempVariable*/ undefined); - var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter); - // Initialize LHS - // var v = _a[_i]; - if (ts.isVariableDeclarationList(initializer)) { - if (initializer.flags & 3 /* BlockScoped */) { - enableSubstitutionsForBlockScopedBindings(); - } - var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); - if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { - // This works whether the declaration is a var, let, or const. - // It will use rhsIterationValue _a[_i] as the initializer. - var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor, - /*recordTempVariable*/ undefined, convertObjectRest); - var declarationList = createVariableDeclarationList(declarations, /*location*/ initializer); - setOriginalNode(declarationList, initializer); - // Adjust the source map range for the first declaration to align with the old - // emitter. - var firstDeclaration = declarations[0]; - var lastDeclaration = ts.lastOrUndefined(declarations); - setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - statements.push(createVariableStatement( - /*modifiers*/ undefined, declarationList)); - } - else { - // The following call does not include the initializer, so we have - // to emit it separately. - statements.push(createVariableStatement( - /*modifiers*/ undefined, setOriginalNode(createVariableDeclarationList([ - createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(/*recordTempVariable*/ undefined), - /*type*/ undefined, createElementAccess(rhsReference, counter)) - ], /*location*/ ts.moveRangePos(initializer, -1)), initializer), - /*location*/ ts.moveRangeEnd(initializer, -1))); - } - } - else { - // Initializer is an expression. Emit the expression in the body, so that it's - // evaluated on every iteration. - var assignment = createAssignment(initializer, elementAccess); - if (ts.isDestructuringAssignment(assignment)) { - // This is a destructuring pattern, so we flatten the destructuring instead. - statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment, - /*needsValue*/ false, context.hoistVariableDeclaration, visitor, convertObjectRest))); - } - else { - // Currently there is not way to check that assignment is binary expression of destructing assignment - // so we have to cast never type to binaryExpression - assignment.end = initializer.end; - statements.push(createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1))); - } - } - var bodyLocation; - var statementsLocation; - if (convertedLoopBodyStatements) { - ts.addRange(statements, convertedLoopBodyStatements); - } - else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); - if (ts.isBlock(statement)) { - ts.addRange(statements, statement.statements); - bodyLocation = statement; - statementsLocation = statement.statements; - } - else { - statements.push(statement); - } - } - // The old emitter does not emit source maps for the expression - setEmitFlags(expression, 1536 /* NoSourceMap */ | getEmitFlags(expression)); - // The old emitter does not emit source maps for the block. - // We add the location to preserve comments. - var body = createBlock(createNodeArray(statements, /*location*/ statementsLocation), - /*location*/ bodyLocation); - setEmitFlags(body, 1536 /* NoSourceMap */ | 12288 /* NoTokenSourceMaps */); - var forStatement; - if (convertObjectRest) { - forStatement = createForOf(createVariableDeclarationList([ - createVariableDeclaration(rhsReference, /*type*/ undefined, /*initializer*/ undefined, /*location*/ node.expression) - ], /*location*/ node.expression), node.expression, body, - /*location*/ node); - } - else { - forStatement = createFor(setEmitFlags(createVariableDeclarationList([ - createVariableDeclaration(counter, /*type*/ undefined, createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)), - createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression) - ], /*location*/ node.expression), 16777216 /* NoHoisting */), createLessThan(counter, createPropertyAccess(rhsReference, "length"), - /*location*/ node.expression), createPostfixIncrement(counter, /*location*/ node.expression), body, - /*location*/ node); - } - // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. - setEmitFlags(forStatement, 8192 /* NoTokenTrailingSourceMaps */); - return forStatement; - } - ts.convertForOf = convertForOf; })(ts || (ts = {})); /// /// @@ -14216,29 +14243,31 @@ var ts; visitNode(cbNode, node.type); case 278 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 280 /* JSDocParameterTag */: + case 281 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 281 /* JSDocReturnTag */: + case 282 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 282 /* JSDocTypeTag */: + case 283 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 283 /* JSDocTemplateTag */: + case 280 /* JSDocAugmentsTag */: + return visitNode(cbNode, node.typeExpression); + case 284 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 286 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 285 /* JSDocPropertyTag */: + case 286 /* JSDocPropertyTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 293 /* PartiallyEmittedExpression */: + case 294 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); - case 287 /* JSDocLiteralType */: + case 288 /* JSDocLiteralType */: return visitNode(cbNode, node.literal); } } @@ -14298,7 +14327,7 @@ var ts; // Share a single scanner across all calls to parse a source file. This helps speed things // up by avoiding the cost of creating/compiling scanners over and over again. var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ true); - var disallowInAndDecoratorContext = 65536 /* DisallowInContext */ | 262144 /* DecoratorContext */; + var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks var NodeConstructor; var TokenConstructor; @@ -14422,7 +14451,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 2097152 /* JavaScriptFile */ : 0 /* None */; + contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 65536 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); @@ -14461,7 +14490,7 @@ var ts; return sourceFile; } function addJSDocComment(node) { - var comments = ts.getJsDocCommentsFromText(node, sourceFile.text); + var comments = ts.getJSDocCommentRanges(node, sourceFile.text); if (comments) { for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { var comment = comments_2[_i]; @@ -14469,10 +14498,10 @@ var ts; if (!jsDoc) { continue; } - if (!node.jsDocComments) { - node.jsDocComments = []; + if (!node.jsDoc) { + node.jsDoc = []; } - node.jsDocComments.push(jsDoc); + node.jsDoc.push(jsDoc); } } return node; @@ -14494,12 +14523,12 @@ var ts; var saveParent = parent; parent = n; forEachChild(n, visitNode); - if (n.jsDocComments) { - for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - jsDocComment.parent = n; - parent = jsDocComment; - forEachChild(jsDocComment, visitNode); + if (n.jsDoc) { + for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + jsDoc.parent = n; + parent = jsDoc; + forEachChild(jsDoc, visitNode); } } parent = saveParent; @@ -14530,16 +14559,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 65536 /* DisallowInContext */); + setContextFlag(val, 2048 /* DisallowInContext */); } function setYieldContext(val) { - setContextFlag(val, 131072 /* YieldContext */); + setContextFlag(val, 4096 /* YieldContext */); } function setDecoratorContext(val) { - setContextFlag(val, 262144 /* DecoratorContext */); + setContextFlag(val, 8192 /* DecoratorContext */); } function setAwaitContext(val) { - setContextFlag(val, 524288 /* AwaitContext */); + setContextFlag(val, 16384 /* AwaitContext */); } function doOutsideOfContext(context, func) { // contextFlagsToClear will contain only the context flags that are @@ -14580,40 +14609,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(65536 /* DisallowInContext */, func); + return doOutsideOfContext(2048 /* DisallowInContext */, func); } function disallowInAnd(func) { - return doInsideOfContext(65536 /* DisallowInContext */, func); + return doInsideOfContext(2048 /* DisallowInContext */, func); } function doInYieldContext(func) { - return doInsideOfContext(131072 /* YieldContext */, func); + return doInsideOfContext(4096 /* YieldContext */, func); } function doInDecoratorContext(func) { - return doInsideOfContext(262144 /* DecoratorContext */, func); + return doInsideOfContext(8192 /* DecoratorContext */, func); } function doInAwaitContext(func) { - return doInsideOfContext(524288 /* AwaitContext */, func); + return doInsideOfContext(16384 /* AwaitContext */, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(524288 /* AwaitContext */, func); + return doOutsideOfContext(16384 /* AwaitContext */, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(131072 /* YieldContext */ | 524288 /* AwaitContext */, func); + return doInsideOfContext(4096 /* YieldContext */ | 16384 /* AwaitContext */, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(131072 /* YieldContext */); + return inContext(4096 /* YieldContext */); } function inDisallowInContext() { - return inContext(65536 /* DisallowInContext */); + return inContext(2048 /* DisallowInContext */); } function inDecoratorContext() { - return inContext(262144 /* DecoratorContext */); + return inContext(8192 /* DecoratorContext */); } function inAwaitContext() { - return inContext(524288 /* AwaitContext */); + return inContext(16384 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -14817,7 +14846,7 @@ var ts; // flag so that we don't mark any subsequent nodes. if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 1048576 /* ThisNodeHasError */; + node.flags |= 32768 /* ThisNodeHasError */; } return node; } @@ -15211,7 +15240,7 @@ var ts; // differently depending on what mode it is in. // // This also applies to all our other context flags as well. - var nodeContextFlags = node.flags & 3080192 /* ContextFlags */; + var nodeContextFlags = node.flags & 96256 /* ContextFlags */; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -16066,6 +16095,8 @@ var ts; case 16 /* OpenBraceToken */: case 20 /* OpenBracketToken */: case 26 /* LessThanToken */: + case 48 /* BarToken */: + case 47 /* AmpersandToken */: case 93 /* NewKeyword */: case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -16120,6 +16151,7 @@ var ts; return parseArrayTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { var types = createNodeArray([type], type.pos); @@ -16213,7 +16245,7 @@ var ts; function parseType() { // The rules about 'yield' only apply to actual code/expression contexts. They don't // apply to 'type' contexts. So we disable these parameters here before moving on. - return doOutsideOfContext(655360 /* TypeExcludesFlags */, parseTypeWorker); + return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { @@ -18323,7 +18355,7 @@ var ts; // The checker may still error in the static case to explicitly disallow the yield expression. property.initializer = ts.hasModifier(property, 32 /* Static */) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(131072 /* YieldContext */ | 65536 /* DisallowInContext */, parseNonParameterInitializer); + : doOutsideOfContext(4096 /* YieldContext */ | 2048 /* DisallowInContext */, parseNonParameterInitializer); parseSemicolon(); return addJSDocComment(finishNode(property)); } @@ -18523,8 +18555,8 @@ var ts; } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_14 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_14, /*questionToken*/ undefined); + var name_13 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -19275,7 +19307,7 @@ var ts; return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(287 /* JSDocLiteralType */); + var result = createNode(288 /* JSDocLiteralType */); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -19401,7 +19433,7 @@ var ts; break; case 38 /* AsteriskToken */: var asterisk = scanner.getTokenText(); - if (state === 1 /* SawAsterisk */) { + if (state === 1 /* SawAsterisk */ || state === 2 /* SavingComments */) { // If we've already seen an asterisk, then we can no longer parse a tag on this line state = 2 /* SavingComments */; pushComment(asterisk); @@ -19422,7 +19454,10 @@ var ts; case 5 /* WhitespaceTrivia */: // only collect whitespace if we're already saving comments or have just crossed the comment indent margin var whitespace = scanner.getTokenText(); - if (state === 2 /* SavingComments */ || margin !== undefined && indent + whitespace.length > margin) { + if (state === 2 /* SavingComments */) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -19430,6 +19465,8 @@ var ts; case 1 /* EndOfFileToken */: break; default: + // anything other than whitespace or asterisk at the beginning of the line starts the comment text + state = 2 /* SavingComments */; pushComment(scanner.getTokenText()); break; } @@ -19485,6 +19522,9 @@ var ts; var tag; if (tagName) { switch (tagName.text) { + case "augments": + tag = parseAugmentsTag(atToken, tagName); + break; case "param": tag = parseParamTag(atToken, tagName); break; @@ -19632,7 +19672,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(280 /* JSDocParameterTag */, atToken.pos); + var result = createNode(281 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -19643,20 +19683,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(281 /* JSDocReturnTag */, atToken.pos); + var result = createNode(282 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282 /* JSDocTypeTag */, atToken.pos); + var result = createNode(283 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -19671,17 +19711,25 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(285 /* JSDocPropertyTag */, atToken.pos); + var result = createNode(286 /* JSDocPropertyTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; result.typeExpression = typeExpression; return finishNode(result); } + function parseAugmentsTag(atToken, tagName) { + var typeExpression = tryParseTypeExpression(); + var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + result.typeExpression = typeExpression; + return finishNode(result); + } function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(284 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(285 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); @@ -19698,8 +19746,8 @@ var ts; if (typeExpression.type.kind === 272 /* JSDocTypeReference */) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70 /* Identifier */) { - var name_15 = jsDocTypeReference.name; - if (name_15.text === "Object") { + var name_14 = jsDocTypeReference.name; + if (name_14.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -19713,7 +19761,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(286 /* JSDocTypeLiteral */, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -19800,20 +19848,20 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } // Type parameter list looks like '@template T,U,V' var typeParameters = createNodeArray(); while (true) { - var name_16 = parseJSDocIdentifierName(); + var name_15 = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_16) { + if (!name_15) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143 /* TypeParameter */, name_16.pos); - typeParameter.name = name_16; + var typeParameter = createNode(143 /* TypeParameter */, name_15.pos); + typeParameter.name = name_15; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25 /* CommaToken */) { @@ -19824,7 +19872,7 @@ var ts; break; } } - var result = createNode(283 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(284 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -19951,8 +19999,8 @@ var ts; ts.Debug.assert(text === newText.substring(node.pos, node.end)); } forEachChild(node, visitNode, visitArray); - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; forEachChild(jsDocComment, visitNode, visitArray); } @@ -20529,7 +20577,7 @@ var ts; if (node.name.kind === 142 /* ComputedPropertyName */) { var nameExpression = node.name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal - if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; } ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); @@ -20579,7 +20627,7 @@ var ts; var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; if (parentNode && parentNode.kind === 205 /* VariableStatement */) { @@ -20712,7 +20760,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - var isJSDocTypedefInJSDocNamespace = node.kind === 284 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 285 /* JSDocTypedefTag */ && node.name && node.name.kind === 70 /* Identifier */ && node.name.isInJSDocNamespace; @@ -20793,8 +20841,7 @@ var ts; hasExplicitReturn = false; bindChildren(node); // Reset all reachability check related flags on node (for incremental scenarios) - // Reset all emit helper flags on node (for incremental scenarios) - node.flags &= ~64896 /* ReachabilityAndEmitFlags */; + node.flags &= ~1408 /* ReachabilityAndEmitFlags */; if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && ts.nodeIsPresent(node.body)) { node.flags |= 128 /* HasImplicitReturn */; if (hasExplicitReturn) @@ -20844,15 +20891,38 @@ var ts; subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags); } } + function bindEach(nodes) { + if (nodes === undefined) { + return; + } + if (skipTransformFlagAggregation) { + ts.forEach(nodes, bind); + } + else { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0 /* None */; + var nodeArrayFlags = 0 /* None */; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; + bind(node); + nodeArrayFlags |= node.transformFlags & ~536870912 /* HasComputedFlags */; + } + nodes.transformFlags = nodeArrayFlags | 536870912 /* HasComputedFlags */; + subtreeTransformFlags |= savedSubtreeTransformFlags; + } + } + function bindEachChild(node) { + ts.forEachChild(node, bind, bindEach); + } function bindChildrenWorker(node) { // Binding of JsDocComment should be done before the current block scope container changes. // because the scope of JsDocComment should not be affected by whether the current node is a // container or not. - if (ts.isInJavaScriptFile(node) && node.jsDocComments) { - ts.forEach(node.jsDocComments, bind); + if (ts.isInJavaScriptFile(node) && node.jsDoc) { + ts.forEach(node.jsDoc, bind); } if (checkUnreachable(node)) { - ts.forEachChild(node, bind); + bindEachChild(node); return; } switch (node.kind) { @@ -20917,7 +20987,7 @@ var ts; bindCallExpressionFlow(node); break; default: - ts.forEachChild(node, bind); + bindEachChild(node); break; } } @@ -21223,7 +21293,7 @@ var ts; } return undefined; } - function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { + function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { var flowLabel = node.kind === 215 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); @@ -21236,11 +21306,11 @@ var ts; var activeLabel = findActiveLabel(node.label.text); if (activeLabel) { activeLabel.referenced = true; - bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); } } else { - bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); } } function bindTryStatement(node) { @@ -21302,6 +21372,8 @@ var ts; currentFlow = finishFlowLabel(postSwitchLabel); } function bindCaseBlock(node) { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0; var clauses = node.clauses; var fallthroughFlow = unreachableFlow; for (var i = 0; i < clauses.length; i++) { @@ -21321,13 +21393,15 @@ var ts; errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); } } + clauses.transformFlags = subtreeTransformFlags | 536870912 /* HasComputedFlags */; + subtreeTransformFlags |= savedSubtreeTransformFlags; } function bindCaseClause(node) { var saveCurrentFlow = currentFlow; currentFlow = preSwitchCaseFlow; bind(node.expression); currentFlow = saveCurrentFlow; - ts.forEach(node.statements, bind); + bindEach(node.statements); } function pushActiveLabel(name, breakTarget, continueTarget) { var activeLabel = { @@ -21414,19 +21488,19 @@ var ts; var saveTrueTarget = currentTrueTarget; currentTrueTarget = currentFalseTarget; currentFalseTarget = saveTrueTarget; - ts.forEachChild(node, bind); + bindEachChild(node); currentFalseTarget = currentTrueTarget; currentTrueTarget = saveTrueTarget; } else { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) { bindAssignmentTargetFlow(node.operand); } } } function bindPostfixUnaryExpressionFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) { bindAssignmentTargetFlow(node.operand); } @@ -21444,7 +21518,7 @@ var ts; } } else { - ts.forEachChild(node, bind); + bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); if (operator === 57 /* EqualsToken */ && node.left.kind === 178 /* ElementAccessExpression */) { @@ -21457,7 +21531,7 @@ var ts; } } function bindDeleteExpressionFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.expression.kind === 177 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } @@ -21490,7 +21564,7 @@ var ts; } } function bindVariableDeclarationFlow(node) { - ts.forEachChild(node, bind); + bindEachChild(node); if (node.initializer || node.parent.parent.kind === 212 /* ForInStatement */ || node.parent.parent.kind === 213 /* ForOfStatement */) { bindInitializedVariableFlow(node); } @@ -21504,12 +21578,12 @@ var ts; expr = expr.expression; } if (expr.kind === 184 /* FunctionExpression */ || expr.kind === 185 /* ArrowFunction */) { - ts.forEach(node.typeArguments, bind); - ts.forEach(node.arguments, bind); + bindEach(node.typeArguments); + bindEach(node.arguments); bind(node.expression); } else { - ts.forEachChild(node, bind); + bindEachChild(node); } if (node.expression.kind === 177 /* PropertyAccessExpression */) { var propertyAccess = node.expression; @@ -21525,7 +21599,7 @@ var ts; case 229 /* EnumDeclaration */: case 176 /* ObjectLiteralExpression */: case 161 /* TypeLiteral */: - case 286 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: case 270 /* JSDocRecordType */: return 1 /* IsContainer */; case 227 /* InterfaceDeclaration */: @@ -21615,7 +21689,7 @@ var ts; case 176 /* ObjectLiteralExpression */: case 227 /* InterfaceDeclaration */: case 270 /* JSDocRecordType */: - case 286 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the @@ -21989,8 +22063,8 @@ var ts; } function updateStrictModeStatementList(statements) { if (!inStrictMode) { - for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { - var statement = statements_1[_i]; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; if (!ts.isPrologueDirective(statement)) { return; } @@ -22017,7 +22091,7 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 284 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 285 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); @@ -22080,15 +22154,12 @@ var ts; return bindParameter(node); case 223 /* VariableDeclaration */: case 174 /* BindingElement */: - if (node.dotDotDotToken && node.parent.kind === 172 /* ObjectBindingPattern */) { - emitFlags |= 32768 /* HasRestAttribute */; - } return bindVariableDeclarationOrBindingElement(node); case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 271 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); - case 285 /* JSDocPropertyTag */: + case 286 /* JSDocPropertyTag */: return bindJSDocProperty(node); case 257 /* PropertyAssignment */: case 258 /* ShorthandPropertyAssignment */: @@ -22109,7 +22180,6 @@ var ts; } root = root.parent; } - emitFlags |= hasRest ? 32768 /* HasRestAttribute */ : 16384 /* HasSpreadAttribute */; return; case 153 /* CallSignature */: case 154 /* ConstructSignature */: @@ -22136,7 +22206,7 @@ var ts; return bindFunctionOrConstructorType(node); case 161 /* TypeLiteral */: case 170 /* MappedType */: - case 286 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: case 270 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); case 176 /* ObjectLiteralExpression */: @@ -22157,7 +22227,7 @@ var ts; return bindClassLikeDeclaration(node); case 227 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */); - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: if (!node.fullName || node.fullName.kind === 70 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); } @@ -22237,12 +22307,12 @@ var ts; return; } else { - var parent_5 = node.parent; - if (!ts.isExternalModule(parent_5)) { + var parent_4 = node.parent; + if (!ts.isExternalModule(parent_4)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_5.isDeclarationFile) { + if (!parent_4.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -22335,14 +22405,6 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 1024 /* HasClassExtends */; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048 /* HasDecorators */; - } - } if (node.kind === 226 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } @@ -22405,11 +22467,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (2048 /* HasDecorators */ | 4096 /* HasParamDecorators */); - } if (inStrictMode) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -22431,7 +22488,7 @@ var ts; function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; + emitFlags |= 1024 /* HasAsyncFunctions */; } } checkStrictModeFunctionName(node); @@ -22446,7 +22503,7 @@ var ts; function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; + emitFlags |= 1024 /* HasAsyncFunctions */; } } if (currentFlow) { @@ -22459,10 +22516,7 @@ var ts; function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048 /* HasDecorators */; + emitFlags |= 1024 /* HasAsyncFunctions */; } } if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -22590,14 +22644,14 @@ var ts; if (node.typeArguments) { transformFlags |= 3 /* AssertTypeScript */; } - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */ + if (subtreeFlags & 524288 /* ContainsSpread */ || isSuperOrSuperProperty(expression, expressionKind)) { // If the this node contains a SpreadExpression, or is a super call, then it is an ES6 // node. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~545281365 /* ArrayLiteralOrCallOrNewExcludes */; + return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */; } function isSuperOrSuperProperty(node, kind) { switch (kind) { @@ -22616,13 +22670,13 @@ var ts; if (node.typeArguments) { transformFlags |= 3 /* AssertTypeScript */; } - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { + if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadElementExpression then it is an ES6 // node. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~545281365 /* ArrayLiteralOrCallOrNewExcludes */; + return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */; } function computeBinaryExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22631,19 +22685,19 @@ var ts; if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ObjectLiteralExpression */) { // Destructuring object assignments with are ES2015 syntax // and possibly ESNext if they contain rest - transformFlags |= 48 /* AssertESNext */ | 3072 /* AssertES2015 */ | 49152 /* AssertDestructuringAssignment */; + transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ArrayLiteralExpression */) { // Destructuring assignments are ES2015 syntax. - transformFlags |= 3072 /* AssertES2015 */ | 49152 /* AssertDestructuringAssignment */; + transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } else if (operatorTokenKind === 39 /* AsteriskAsteriskToken */ || operatorTokenKind === 61 /* AsteriskAsteriskEqualsToken */) { // Exponentiation is ES2016 syntax. - transformFlags |= 768 /* AssertES2016 */; + transformFlags |= 32 /* AssertES2016 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeParameter(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22655,25 +22709,25 @@ var ts; // syntax. if (node.questionToken || node.type - || subtreeFlags & 65536 /* ContainsDecorators */ + || subtreeFlags & 4096 /* ContainsDecorators */ || ts.isThisIdentifier(name)) { transformFlags |= 3 /* AssertTypeScript */; } // If a parameter has an accessibility modifier, then it is TypeScript syntax. if (modifierFlags & 92 /* ParameterPropertyModifier */) { - transformFlags |= 3 /* AssertTypeScript */ | 4194304 /* ContainsParameterPropertyAssignments */; + transformFlags |= 3 /* AssertTypeScript */ | 262144 /* ContainsParameterPropertyAssignments */; } // parameters with object rest destructuring are ES Next syntax - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { - transformFlags |= 48 /* AssertESNext */; + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; } // If a parameter has an initializer, a binding pattern or a dotDotDot token, then // it is ES6 syntax and its container must emit default value assignments or parameter destructuring downlevel. - if (subtreeFlags & 67108864 /* ContainsBindingPattern */ || initializer || dotDotDotToken) { - transformFlags |= 3072 /* AssertES2015 */ | 2097152 /* ContainsDefaultValueAssignments */; + if (subtreeFlags & 8388608 /* ContainsBindingPattern */ || initializer || dotDotDotToken) { + transformFlags |= 192 /* AssertES2015 */ | 131072 /* ContainsDefaultValueAssignments */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~604001621 /* ParameterExcludes */; + return transformFlags & ~536872257 /* ParameterExcludes */; } function computeParenthesizedExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22689,11 +22743,11 @@ var ts; } // If the expression of a ParenthesizedExpression is a destructuring assignment, // then the ParenthesizedExpression is a destructuring assignment. - if (expressionTransformFlags & 16384 /* DestructuringAssignment */) { - transformFlags |= 16384 /* DestructuringAssignment */; + if (expressionTransformFlags & 1024 /* DestructuringAssignment */) { + transformFlags |= 1024 /* DestructuringAssignment */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeClassDeclaration(node, subtreeFlags) { var transformFlags; @@ -22704,47 +22758,47 @@ var ts; } else { // A ClassDeclaration is ES6 syntax. - transformFlags = subtreeFlags | 3072 /* AssertES2015 */; + transformFlags = subtreeFlags | 192 /* AssertES2015 */; // A class with a parameter property assignment, property initializer, or decorator is // TypeScript syntax. // An exported declaration may be TypeScript syntax, but is handled by the visitor // for a namespace declaration. - if ((subtreeFlags & 4390912 /* TypeScriptClassSyntaxMask */) + if ((subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */) || node.typeParameters) { transformFlags |= 3 /* AssertTypeScript */; } - if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) { + if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) { // A computed property name containing `this` might need to be rewritten, // so propagate the ContainsLexicalThis flag upward. - transformFlags |= 262144 /* ContainsLexicalThis */; + transformFlags |= 16384 /* ContainsLexicalThis */; } } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~559895893 /* ClassExcludes */; + return transformFlags & ~539358529 /* ClassExcludes */; } function computeClassExpression(node, subtreeFlags) { // A ClassExpression is ES6 syntax. - var transformFlags = subtreeFlags | 3072 /* AssertES2015 */; + var transformFlags = subtreeFlags | 192 /* AssertES2015 */; // A class with a parameter property assignment, property initializer, or decorator is // TypeScript syntax. - if (subtreeFlags & 4390912 /* TypeScriptClassSyntaxMask */ + if (subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */ || node.typeParameters) { transformFlags |= 3 /* AssertTypeScript */; } - if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) { + if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) { // A computed property name containing `this` might need to be rewritten, // so propagate the ContainsLexicalThis flag upward. - transformFlags |= 262144 /* ContainsLexicalThis */; + transformFlags |= 16384 /* ContainsLexicalThis */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~559895893 /* ClassExcludes */; + return transformFlags & ~539358529 /* ClassExcludes */; } function computeHeritageClause(node, subtreeFlags) { var transformFlags = subtreeFlags; switch (node.token) { case 84 /* ExtendsKeyword */: // An `extends` HeritageClause is ES6 syntax. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; break; case 107 /* ImplementsKeyword */: // An `implements` HeritageClause is TypeScript syntax. @@ -22755,27 +22809,27 @@ var ts; break; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeCatchClause(node, subtreeFlags) { var transformFlags = subtreeFlags; if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) { - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~537920833 /* CatchClauseExcludes */; } function computeExpressionWithTypeArguments(node, subtreeFlags) { // An ExpressionWithTypeArguments is ES6 syntax, as it is used in the // extends clause of a class. - var transformFlags = subtreeFlags | 3072 /* AssertES2015 */; + var transformFlags = subtreeFlags | 192 /* AssertES2015 */; // If an ExpressionWithTypeArguments contains type arguments, then it // is TypeScript syntax. if (node.typeArguments) { transformFlags |= 3 /* AssertTypeScript */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeConstructor(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22784,12 +22838,16 @@ var ts; || !node.body) { transformFlags |= 3 /* AssertTypeScript */; } + // function declarations with object rest destructuring are ES Next syntax + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; + } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~975983957 /* ConstructorExcludes */; + return transformFlags & ~601015617 /* ConstructorExcludes */; } function computeMethod(node, subtreeFlags) { // A MethodDeclaration is ES6 syntax. - var transformFlags = subtreeFlags | 3072 /* AssertES2015 */; + var transformFlags = subtreeFlags | 192 /* AssertES2015 */; // Decorators, TypeScript-specific modifiers, type parameters, type annotations, and // overloads are TypeScript syntax. if (node.decorators @@ -22799,16 +22857,20 @@ var ts; || !node.body) { transformFlags |= 3 /* AssertTypeScript */; } + // function declarations with object rest destructuring are ES Next syntax + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; + } // An async method declaration is ES2017 syntax. if (ts.hasModifier(node, 256 /* Async */)) { - transformFlags |= 192 /* AssertES2017 */; + transformFlags |= 16 /* AssertES2017 */; } // Currently, we only support generators that were originally async function bodies. - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) { - transformFlags |= 12288 /* AssertGenerator */; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + transformFlags |= 768 /* AssertGenerator */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~975983957 /* MethodOrAccessorExcludes */; + return transformFlags & ~601015617 /* MethodOrAccessorExcludes */; } function computeAccessor(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22820,8 +22882,12 @@ var ts; || !node.body) { transformFlags |= 3 /* AssertTypeScript */; } + // function declarations with object rest destructuring are ES Next syntax + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; + } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~975983957 /* MethodOrAccessorExcludes */; + return transformFlags & ~601015617 /* MethodOrAccessorExcludes */; } function computePropertyDeclaration(node, subtreeFlags) { // A PropertyDeclaration is TypeScript syntax. @@ -22829,10 +22895,10 @@ var ts; // If the PropertyDeclaration has an initializer, we need to inform its ancestor // so that it handle the transformation. if (node.initializer) { - transformFlags |= 131072 /* ContainsPropertyInitializer */; + transformFlags |= 8192 /* ContainsPropertyInitializer */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeFunctionDeclaration(node, subtreeFlags) { var transformFlags; @@ -22844,7 +22910,7 @@ var ts; transformFlags = 3 /* AssertTypeScript */; } else { - transformFlags = subtreeFlags | 268435456 /* ContainsHoistedDeclarationOrCompletion */; + transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */; // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript // syntax. if (modifierFlags & 2270 /* TypeScriptModifier */ @@ -22854,29 +22920,29 @@ var ts; } // An async function declaration is ES2017 syntax. if (modifierFlags & 256 /* Async */) { - transformFlags |= 192 /* AssertES2017 */; + transformFlags |= 16 /* AssertES2017 */; } // function declarations with object rest destructuring are ES Next syntax - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { - transformFlags |= 48 /* AssertESNext */; + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; } // If a FunctionDeclaration's subtree has marked the container as needing to capture the // lexical this, or the function contains parameters with initializers, then this node is // ES6 syntax. - if (subtreeFlags & 2621440 /* ES2015FunctionSyntaxMask */) { - transformFlags |= 3072 /* AssertES2015 */; + if (subtreeFlags & 163840 /* ES2015FunctionSyntaxMask */) { + transformFlags |= 192 /* AssertES2015 */; } // If a FunctionDeclaration is generator function and is the body of a // transformed async function, then this node can be transformed to a // down-level generator. // Currently we do not support transforming any other generator fucntions // down level. - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) { - transformFlags |= 12288 /* AssertGenerator */; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + transformFlags |= 768 /* AssertGenerator */; } } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~980243797 /* FunctionExcludes */; + return transformFlags & ~601281857 /* FunctionExcludes */; } function computeFunctionExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22889,32 +22955,32 @@ var ts; } // An async function expression is ES2017 syntax. if (ts.hasModifier(node, 256 /* Async */)) { - transformFlags |= 192 /* AssertES2017 */; + transformFlags |= 16 /* AssertES2017 */; } // function expressions with object rest destructuring are ES Next syntax - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { - transformFlags |= 48 /* AssertESNext */; + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; } // If a FunctionExpression's subtree has marked the container as needing to capture the // lexical this, or the function contains parameters with initializers, then this node is // ES6 syntax. - if (subtreeFlags & 2621440 /* ES2015FunctionSyntaxMask */) { - transformFlags |= 3072 /* AssertES2015 */; + if (subtreeFlags & 163840 /* ES2015FunctionSyntaxMask */) { + transformFlags |= 192 /* AssertES2015 */; } // If a FunctionExpression is generator function and is the body of a // transformed async function, then this node can be transformed to a // down-level generator. // Currently we do not support transforming any other generator fucntions // down level. - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) { - transformFlags |= 12288 /* AssertGenerator */; + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + transformFlags |= 768 /* AssertGenerator */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~980243797 /* FunctionExcludes */; + return transformFlags & ~601281857 /* FunctionExcludes */; } function computeArrowFunction(node, subtreeFlags) { // An ArrowFunction is ES6 syntax, and excludes markers that should not escape the scope of an ArrowFunction. - var transformFlags = subtreeFlags | 3072 /* AssertES2015 */; + var transformFlags = subtreeFlags | 192 /* AssertES2015 */; // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript // syntax. if (ts.hasModifier(node, 2270 /* TypeScriptModifier */) @@ -22924,18 +22990,18 @@ var ts; } // An async arrow function is ES2017 syntax. if (ts.hasModifier(node, 256 /* Async */)) { - transformFlags |= 192 /* AssertES2017 */; + transformFlags |= 16 /* AssertES2017 */; } // arrow functions with object rest destructuring are ES Next syntax - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { - transformFlags |= 48 /* AssertESNext */; + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; } // If an ArrowFunction contains a lexical this, its container must capture the lexical this. - if (subtreeFlags & 262144 /* ContainsLexicalThis */) { - transformFlags |= 524288 /* ContainsCapturedLexicalThis */; + if (subtreeFlags & 16384 /* ContainsLexicalThis */) { + transformFlags |= 32768 /* ContainsCapturedLexicalThis */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~979719509 /* ArrowFunctionExcludes */; + return transformFlags & ~601249089 /* ArrowFunctionExcludes */; } function computePropertyAccess(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -22944,28 +23010,24 @@ var ts; // If a PropertyAccessExpression starts with a super keyword, then it is // ES6 syntax, and requires a lexical `this` binding. if (expressionKind === 96 /* SuperKeyword */) { - transformFlags |= 262144 /* ContainsLexicalThis */; + transformFlags |= 16384 /* ContainsLexicalThis */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeVariableDeclaration(node, subtreeFlags) { var transformFlags = subtreeFlags; - var nameKind = node.name.kind; - // A VariableDeclaration with an object binding pattern is ES2015 syntax - // and possibly ESNext syntax if it contains an object binding pattern - if (nameKind === 172 /* ObjectBindingPattern */) { - transformFlags |= 48 /* AssertESNext */ | 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */; - } - else if (nameKind === 173 /* ArrayBindingPattern */) { - transformFlags |= 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */; + transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; + // A VariableDeclaration containing ObjectRest is ESNext syntax + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; } // Type annotations are TypeScript syntax. if (node.type) { transformFlags |= 3 /* AssertTypeScript */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeVariableStatement(node, subtreeFlags) { var transformFlags; @@ -22977,22 +23039,22 @@ var ts; } else { transformFlags = subtreeFlags; - if (declarationListTransformFlags & 67108864 /* ContainsBindingPattern */) { - transformFlags |= 3072 /* AssertES2015 */; + if (declarationListTransformFlags & 8388608 /* ContainsBindingPattern */) { + transformFlags |= 192 /* AssertES2015 */; } } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeLabeledStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; // A labeled statement containing a block scoped binding *may* need to be transformed from ES6. - if (subtreeFlags & 33554432 /* ContainsBlockScopedBinding */ + if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */ && ts.isIterationStatement(node, /*lookInLabeledStatements*/ true)) { - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeImportEquals(node, subtreeFlags) { var transformFlags = subtreeFlags; @@ -23001,18 +23063,18 @@ var ts; transformFlags |= 3 /* AssertTypeScript */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeExpressionStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; // If the expression of an expression statement is a destructuring assignment, // then we treat the statement as ES6 so that we can indicate that we do not // need to hold on to the right-hand side. - if (node.expression.transformFlags & 16384 /* DestructuringAssignment */) { - transformFlags |= 3072 /* AssertES2015 */; + if (node.expression.transformFlags & 1024 /* DestructuringAssignment */) { + transformFlags |= 192 /* AssertES2015 */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~536892757 /* NodeExcludes */; + return transformFlags & ~536872257 /* NodeExcludes */; } function computeModuleDeclaration(node, subtreeFlags) { var transformFlags = 3 /* AssertTypeScript */; @@ -23021,29 +23083,29 @@ var ts; transformFlags |= subtreeFlags; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~839734613 /* ModuleExcludes */; + return transformFlags & ~574674241 /* ModuleExcludes */; } function computeVariableDeclarationList(node, subtreeFlags) { - var transformFlags = subtreeFlags | 268435456 /* ContainsHoistedDeclarationOrCompletion */; - if (subtreeFlags & 67108864 /* ContainsBindingPattern */) { - transformFlags |= 3072 /* AssertES2015 */; + var transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */; + if (subtreeFlags & 8388608 /* ContainsBindingPattern */) { + transformFlags |= 192 /* AssertES2015 */; } // If a VariableDeclarationList is `let` or `const`, then it is ES6 syntax. if (node.flags & 3 /* BlockScoped */) { - transformFlags |= 3072 /* AssertES2015 */ | 33554432 /* ContainsBlockScopedBinding */; + transformFlags |= 192 /* AssertES2015 */ | 4194304 /* ContainsBlockScopedBinding */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; - return transformFlags & ~604001621 /* VariableDeclarationListExcludes */; + return transformFlags & ~546309441 /* VariableDeclarationListExcludes */; } function computeOther(node, kind, subtreeFlags) { // Mark transformations needed for each node var transformFlags = subtreeFlags; - var excludeFlags = 536892757 /* NodeExcludes */; + var excludeFlags = 536872257 /* NodeExcludes */; switch (kind) { case 119 /* AsyncKeyword */: case 189 /* AwaitExpression */: // async/await is ES2017 syntax - transformFlags |= 192 /* AssertES2017 */; + transformFlags |= 16 /* AssertES2017 */; break; case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: @@ -23069,11 +23131,11 @@ var ts; case 251 /* JsxSpreadAttribute */: case 252 /* JsxExpression */: // These nodes are Jsx syntax. - transformFlags |= 12 /* AssertJsx */; + transformFlags |= 4 /* AssertJsx */; break; case 213 /* ForOfStatement */: // for-of might be ESNext if it has a rest destructuring - transformFlags |= 48 /* AssertESNext */; + transformFlags |= 8 /* AssertESNext */; // FALLTHROUGH case 12 /* NoSubstitutionTemplateLiteral */: case 13 /* TemplateHead */: @@ -23084,11 +23146,11 @@ var ts; case 258 /* ShorthandPropertyAssignment */: case 114 /* StaticKeyword */: // These nodes are ES6 syntax. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; break; case 195 /* YieldExpression */: // This node is ES6 syntax. - transformFlags |= 3072 /* AssertES2015 */ | 134217728 /* ContainsYield */; + transformFlags |= 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; break; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: @@ -23129,8 +23191,8 @@ var ts; // Even though computed property names are ES6, we don't treat them as such. // This is so that they can flow through PropertyName transforms unaffected. // Instead, we mark the container as ES6, so that it can properly handle the transform. - transformFlags |= 16777216 /* ContainsComputedPropertyName */; - if (subtreeFlags & 262144 /* ContainsLexicalThis */) { + transformFlags |= 2097152 /* ContainsComputedPropertyName */; + if (subtreeFlags & 16384 /* ContainsLexicalThis */) { // A computed method name like `[this.getName()](x: string) { ... }` needs to // distinguish itself from the normal case of a method body containing `this`: // `this` inside a method doesn't need to be rewritten (the method provides `this`), @@ -23139,66 +23201,69 @@ var ts; // `_this = this; () => class K { [_this.getName()]() { ... } }` // To make this distinction, use ContainsLexicalThisInComputedPropertyName // instead of ContainsLexicalThis for computed property names - transformFlags |= 1048576 /* ContainsLexicalThisInComputedPropertyName */; + transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */; } break; case 196 /* SpreadElement */: - case 259 /* SpreadAssignment */: - // This node is ES6 or ES next syntax, but is handled by a containing node. - transformFlags |= 8388608 /* ContainsSpreadExpression */; + transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; + break; + case 259 /* SpreadAssignment */: + transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; - case 174 /* BindingElement */: - if (node.dotDotDotToken) { - // this node is ES2015 or ES next syntax, but is handled by a containing node. - transformFlags |= 8388608 /* ContainsSpreadExpression */; - } case 96 /* SuperKeyword */: // This node is ES6 syntax. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; break; case 98 /* ThisKeyword */: // Mark this node and its ancestors as containing a lexical `this` keyword. - transformFlags |= 262144 /* ContainsLexicalThis */; + transformFlags |= 16384 /* ContainsLexicalThis */; break; case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - // These nodes are ES2015 or ES Next syntax. - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { - transformFlags |= 48 /* AssertESNext */ | 67108864 /* ContainsBindingPattern */; + transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; + if (subtreeFlags & 524288 /* ContainsRest */) { + transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */; } - else { - transformFlags |= 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */; + excludeFlags = 537396545 /* BindingPatternExcludes */; + break; + case 173 /* ArrayBindingPattern */: + transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; + excludeFlags = 537396545 /* BindingPatternExcludes */; + break; + case 174 /* BindingElement */: + transformFlags |= 192 /* AssertES2015 */; + if (node.dotDotDotToken) { + transformFlags |= 524288 /* ContainsRest */; } break; case 145 /* Decorator */: // This node is TypeScript syntax, and marks its container as also being TypeScript syntax. - transformFlags |= 3 /* AssertTypeScript */ | 65536 /* ContainsDecorators */; + transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */; break; case 176 /* ObjectLiteralExpression */: - excludeFlags = 554784085 /* ObjectLiteralExcludes */; - if (subtreeFlags & 16777216 /* ContainsComputedPropertyName */) { + excludeFlags = 540087617 /* ObjectLiteralExcludes */; + if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) { // If an ObjectLiteralExpression contains a ComputedPropertyName, then it // is an ES6 node. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } - if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) { + if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) { // A computed property name containing `this` might need to be rewritten, // so propagate the ContainsLexicalThis flag upward. - transformFlags |= 262144 /* ContainsLexicalThis */; + transformFlags |= 16384 /* ContainsLexicalThis */; } - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { + if (subtreeFlags & 1048576 /* ContainsObjectSpread */) { // If an ObjectLiteralExpression contains a spread element, then it // is an ES next node. - transformFlags |= 48 /* AssertESNext */; + transformFlags |= 8 /* AssertESNext */; } break; case 175 /* ArrayLiteralExpression */: case 180 /* NewExpression */: - excludeFlags = 545281365 /* ArrayLiteralOrCallOrNewExcludes */; - if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) { + excludeFlags = 537396545 /* ArrayLiteralOrCallOrNewExcludes */; + if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadExpression, then it is an ES6 // node. - transformFlags |= 3072 /* AssertES2015 */; + transformFlags |= 192 /* AssertES2015 */; } break; case 209 /* DoStatement */: @@ -23206,19 +23271,19 @@ var ts; case 211 /* ForStatement */: case 212 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. - if (subtreeFlags & 33554432 /* ContainsBlockScopedBinding */) { - transformFlags |= 3072 /* AssertES2015 */; + if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { + transformFlags |= 192 /* AssertES2015 */; } break; case 261 /* SourceFile */: - if (subtreeFlags & 524288 /* ContainsCapturedLexicalThis */) { - transformFlags |= 3072 /* AssertES2015 */; + if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { + transformFlags |= 192 /* AssertES2015 */; } break; case 216 /* ReturnStatement */: case 214 /* ContinueStatement */: case 215 /* BreakStatement */: - transformFlags |= 268435456 /* ContainsHoistedDeclarationOrCompletion */; + transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; @@ -23240,27 +23305,27 @@ var ts; case 179 /* CallExpression */: case 180 /* NewExpression */: case 175 /* ArrayLiteralExpression */: - return 545281365 /* ArrayLiteralOrCallOrNewExcludes */; + return 537396545 /* ArrayLiteralOrCallOrNewExcludes */; case 230 /* ModuleDeclaration */: - return 839734613 /* ModuleExcludes */; + return 574674241 /* ModuleExcludes */; case 144 /* Parameter */: - return 604001621 /* ParameterExcludes */; + return 536872257 /* ParameterExcludes */; case 185 /* ArrowFunction */: - return 979719509 /* ArrowFunctionExcludes */; + return 601249089 /* ArrowFunctionExcludes */; case 184 /* FunctionExpression */: case 225 /* FunctionDeclaration */: - return 980243797 /* FunctionExcludes */; + return 601281857 /* FunctionExcludes */; case 224 /* VariableDeclarationList */: - return 604001621 /* VariableDeclarationListExcludes */; + return 546309441 /* VariableDeclarationListExcludes */; case 226 /* ClassDeclaration */: case 197 /* ClassExpression */: - return 559895893 /* ClassExcludes */; + return 539358529 /* ClassExcludes */; case 150 /* Constructor */: - return 975983957 /* ConstructorExcludes */; + return 601015617 /* ConstructorExcludes */; case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - return 975983957 /* MethodOrAccessorExcludes */; + return 601015617 /* MethodOrAccessorExcludes */; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: @@ -23278,9 +23343,14 @@ var ts; case 228 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; case 176 /* ObjectLiteralExpression */: - return 554784085 /* ObjectLiteralExcludes */; + return 540087617 /* ObjectLiteralExcludes */; + case 256 /* CatchClause */: + return 537920833 /* CatchClauseExcludes */; + case 172 /* ObjectBindingPattern */: + case 173 /* ArrayBindingPattern */: + return 537396545 /* BindingPatternExcludes */; default: - return 536892757 /* NodeExcludes */; + return 536872257 /* NodeExcludes */; } } ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions; @@ -23331,6 +23401,7 @@ var ts; function moduleHasNonRelativeName(moduleName) { return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } + ts.moduleHasNonRelativeName = moduleHasNonRelativeName; function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { @@ -24037,6 +24108,8 @@ var ts; // is because diagnostics can be quite expensive, and we want to allow hosts to bail out if // they no longer need the information (for example, if the user started editing again). var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); @@ -24099,6 +24172,7 @@ var ts; getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, isOptionalParameter: isOptionalParameter, + tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { // we deliberately exclude augmentations // since we are only interested in declarations of the module itself @@ -24110,6 +24184,7 @@ var ts; var intersectionTypes = ts.createMap(); var stringLiteralTypes = ts.createMap(); var numericLiteralTypes = ts.createMap(); + var indexedAccessTypes = ts.createMap(); var evolvingArrayTypes = []; var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); @@ -24129,7 +24204,6 @@ var ts; var voidType = createIntrinsicType(1024 /* Void */, "void"); var neverType = createIntrinsicType(8192 /* Never */, "never"); var silentNeverType = createIntrinsicType(8192 /* Never */, "never"); - var stringOrNumberType = getUnionType([stringType, numberType]); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); @@ -24431,9 +24505,7 @@ var ts; // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -24852,6 +24924,7 @@ var ts; if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && + !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } @@ -24950,6 +25023,16 @@ var ts; return undefined; } } + function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) { + if (meaning === 1920 /* Namespace */) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 /* Type */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name); + return true; + } + } + return false; + } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { if (meaning & (107455 /* Value */ & ~1024 /* NamespaceModule */)) { var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 /* Type */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)); @@ -24996,7 +25079,7 @@ var ts; } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { @@ -25078,31 +25161,31 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_17 = specifier.propertyName || specifier.name; - if (name_17.text) { + var name_16 = specifier.propertyName || specifier.name; + if (name_16.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; // First check if module was specified with "export=". If so, get the member from the resolved type if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_17.text); + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_17.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text); } // if symbolFromVariable is export - get its final target symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_17.text); + var symbolFromModule = getExportOfModule(targetSymbol, name_16.text); // If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default - if (!symbolFromModule && allowSyntheticDefaultImports && name_17.text === "default") { + if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_17, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_17)); + error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16)); } return symbol; } @@ -25306,9 +25389,8 @@ var ts; // May be an untyped module. If so, ignore resolutionDiagnostic. if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - ts.Debug.assert(!!moduleNotFoundError); var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } else if (compilerOptions.noImplicitAny && moduleNotFoundError) { error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); @@ -25356,6 +25438,12 @@ var ts; function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function tryGetMemberInModuleExports(memberName, moduleSymbol) { + var symbolTable = getExportsOfModule(moduleSymbol); + if (symbolTable) { + return symbolTable[memberName]; + } + } function getExportsOfSymbol(symbol) { return symbol.flags & 1536 /* Module */ ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; } @@ -25557,6 +25645,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { @@ -25575,31 +25673,33 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - // Check if symbol is any of the alias - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 /* Alias */ - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) { - if (!useOnlyExternalAliasing || - // Is this external alias, then use it to name - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain - // but only if the symbolFromSymbolTable can be qualified - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + // If symbol is directly available by its name in the symbol table + if (isAccessible(symbols[symbol.name])) { + return [symbol]; + } + // Check if symbol is any of the alias + return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 /* Alias */ + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) { + if (!useOnlyExternalAliasing || + // Is this external alias, then use it to name + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain + // but only if the symbolFromSymbolTable can be qualified + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -25966,9 +26066,9 @@ var ts; if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { // Go up and add our parent. - var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_6) { - walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); + var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent_5) { + walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); } } if (accessibleSymbolChain) { @@ -26118,14 +26218,14 @@ var ts; while (i < length_1) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); writePunctuation(writer, 22 /* DotToken */); } } @@ -26416,7 +26516,7 @@ var ts; } ts.Debug.assert(bindingElement.kind === 174 /* BindingElement */); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); } @@ -26564,14 +26664,14 @@ var ts; if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_8 = getDeclarationContainer(node); + var parent_7 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_8.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_8))) { - return isGlobalSourceFile(parent_8); + !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_7.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_7))) { + return isGlobalSourceFile(parent_7); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_8); + return isDeclarationVisible(parent_7); case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 151 /* GetAccessor */: @@ -26756,15 +26856,21 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false); } function isComputedNonLiteralName(name) { - return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { - ts.Debug.assert(!!(source.flags & 32768 /* Object */), "Rest types only support object types right now."); + source = filterType(source, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (source.flags & 8192 /* Never */) { + return emptyObjectType; + } + if (source.flags & 65536 /* Union */) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_18 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_18)] = true; + var name_17 = properties_2[_i]; + names[ts.getTextOfPropertyName(name_17)] = true; } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; @@ -26800,14 +26906,14 @@ var ts; var type; if (pattern.kind === 172 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & 32768 /* Object */)) { + if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } var literalMembers = []; for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198 /* OmittedExpression */ && !element.dotDotDotToken) { + if (!element.dotDotDotToken) { literalMembers.push(element.propertyName || element.name); } } @@ -26815,8 +26921,8 @@ var ts; } else { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) - var name_19 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_19)) { + var name_18 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_18)) { // computed properties with non-literal names are treated as 'any' return anyType; } @@ -26825,12 +26931,12 @@ var ts; } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - var text = ts.getTextOfPropertyName(name_19); + var text = ts.getTextOfPropertyName(name_18); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); if (!type) { - error(name_19, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_19)); + error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18)); return unknownType; } } @@ -26871,33 +26977,9 @@ var ts; type; } function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { - var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); - if (jsDocType) { - return getTypeFromTypeNode(jsDocType); - } - } - function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) { - // First, see if this node has an @type annotation on it directly. - var typeTag = ts.getJSDocTypeTag(declaration); - if (typeTag && typeTag.typeExpression) { - return typeTag.typeExpression.type; - } - if (declaration.kind === 223 /* VariableDeclaration */ && - declaration.parent.kind === 224 /* VariableDeclarationList */ && - declaration.parent.parent.kind === 205 /* VariableStatement */) { - // @type annotation might have been on the variable statement, try that instead. - var annotation = ts.getJSDocTypeTag(declaration.parent.parent); - if (annotation && annotation.typeExpression) { - return annotation.typeExpression.type; - } - } - else if (declaration.kind === 144 /* Parameter */) { - // If it's a parameter, see if the parent has a jsdoc comment with an @param - // annotation. - var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type; - } + var jsdocType = ts.getJSDocType(declaration); + if (jsdocType) { + return getTypeFromTypeNode(jsdocType); } return undefined; } @@ -26914,7 +26996,7 @@ var ts; } // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { // If this is a variable in a JavaScript file, then use the JSDoc type (if it has // one as its type), otherwise fallback to the below standard TS codepaths to // try to figure it out. @@ -26923,9 +27005,11 @@ var ts; return type; } } - // A variable declared in a for..in statement is always of type string + // A variable declared in a for..in statement is of type string, or of type keyof T when the + // right hand expression is of a type parameter type. if (declaration.parent.parent.kind === 212 /* ForInStatement */) { - return stringType; + var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); + return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType; } if (declaration.parent.parent.kind === 213 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was @@ -26941,9 +27025,11 @@ var ts; if (declaration.type) { return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality); } - if (declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + if ((compilerOptions.noImplicitAny || declaration.flags & 65536 /* JavaScriptFile */) && + declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) { - // Use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no + // If --noImplicitAny is on or the declaration is in a Javascript file, + // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no // initializer or a 'null' or 'undefined' initializer. if (!(ts.getCombinedNodeFlags(declaration) & 2 /* Const */) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -27016,14 +27102,19 @@ var ts; // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { - // do not include computed properties or rests in the implied type + if (isComputedNonLiteralName(name)) { + // do not include computed properties in the implied type hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); + return; + } var text = ts.getTextOfPropertyName(name); var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); var symbol = createSymbol(flags, text); @@ -27031,7 +27122,7 @@ var ts; symbol.bindingElement = e; members[symbol.name] = symbol; }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -27122,7 +27213,7 @@ var ts; if (declaration.kind === 240 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 2097152 /* JavaScriptFile */ && declaration.kind === 285 /* JSDocPropertyTag */ && declaration.typeExpression) { + if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 286 /* JSDocPropertyTag */ && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } // Handle variable, parameter or property @@ -27138,10 +27229,10 @@ var ts; if (declaration.kind === 192 /* BinaryExpression */ || declaration.kind === 177 /* PropertyAccessExpression */ && declaration.parent.kind === 192 /* BinaryExpression */) { // Use JS Doc type if present on parent expression statement - if (declaration.flags & 2097152 /* JavaScriptFile */) { - var typeTag = ts.getJSDocTypeTag(declaration.parent); - if (typeTag && typeTag.typeExpression) { - return links.type = getTypeFromTypeNode(typeTag.typeExpression.type); + if (declaration.flags & 65536 /* JavaScriptFile */) { + var jsdocType = ts.getJSDocType(declaration.parent); + if (jsdocType) { + return links.type = getTypeFromTypeNode(jsdocType); } } var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 /* BinaryExpression */ ? @@ -27153,18 +27244,7 @@ var ts; type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - // Variable has type annotation that circularly references the variable itself - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - // Variable has initializer that circularly references the variable itself - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -27194,7 +27274,7 @@ var ts; if (!links.type) { var getter = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); var setter = ts.getDeclarationOfKind(symbol, 152 /* SetAccessor */); - if (getter && getter.flags & 2097152 /* JavaScriptFile */) { + if (getter && getter.flags & 65536 /* JavaScriptFile */) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; @@ -27284,10 +27364,29 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!pushTypeResolution(symbol, 0 /* Type */)) { + return unknownType; + } + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; } return links.type; } + function reportCircularityError(symbol) { + // Check if variable has type annotation that circularly references the variable itself + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + // Otherwise variable has initializer that circularly references the variable itself + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { if (symbol.flags & 16777216 /* Instantiated */) { return getTypeOfInstantiatedSymbol(symbol); @@ -27476,6 +27575,14 @@ var ts; } baseType = getReturnTypeOfSignature(constructors[0]); } + // In a JS file, you can use the @augments jsdoc tag to specify a base type with type parameters + var valueDecl = type.symbol.valueDeclaration; + if (valueDecl && ts.isInJavaScriptFile(valueDecl)) { + var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration); + if (augTag) { + baseType = getTypeFromTypeNode(augTag.typeExpression.type); + } + } if (baseType === unknownType) { return; } @@ -27484,7 +27591,7 @@ var ts; return; } if (type === baseType || hasBaseType(baseType, type)) { - error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */)); + error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */)); return; } if (type.resolvedBaseTypes === emptyArray) { @@ -27598,7 +27705,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 284 /* JSDocTypedefTag */); + var declaration = ts.getDeclarationOfKind(symbol, 285 /* JSDocTypedefTag */); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -28121,49 +28228,54 @@ var ts; function resolveMappedTypeMembers(type) { var members = ts.createMap(); var stringIndexInfo; - var numberIndexInfo; + // Resolve upfront such that recursive references see an empty object type. + setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); // In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type, // and T as the template type. var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var isReadonly = !!type.declaration.readonlyToken; - var isOptional = !!type.declaration.questionToken; - // First, if the constraint type is a type parameter, obtain the base constraint. Then, - // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. - // Finally, iterate over the constituents of the resulting iteration type. - var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentType(constraintType) : constraintType; - var iterationType = keyType.flags & 262144 /* Index */ ? getIndexType(getApparentType(keyType.type)) : keyType; - forEachType(iterationType, function (t) { + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 168 /* TypeOperator */) { + // We have a { [P in keyof T]: X } + forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + if (getIndexInfoOfType(modifiersType, 0 /* String */)) { + addMemberForKeyType(stringType); + } + } + else { + // First, if the constraint type is a type parameter, obtain the base constraint. Then, + // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. + // Finally, iterate over the constituents of the resulting iteration type. + var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 /* Index */ ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t) { // Create a mapper from T to the current iteration type constituent. Then, if the // mapped type is itself an instantiated type, combine the iteration mapper with the // instantiation mapper. var iterationMapper = createUnaryTypeMapper(typeParameter, t); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); - // If the current iteration type constituent is a literal type, create a property. - // Otherwise, for type string create a string index signature and for type number - // create a numeric index signature. - if (t.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */)) { + // If the current iteration type constituent is a string literal type, create a property. + // Otherwise, for type string create a string index signature. + if (t.flags & 32 /* StringLiteral */) { var propName = t.text; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 536870912 /* Optional */); var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | (isOptional ? 536870912 /* Optional */ : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; + prop.type = propType; + prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); members[propName] = prop; } else if (t.flags & 2 /* String */) { - stringIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } - else if (t.flags & 4 /* Number */) { - numberIndexInfo = createIndexInfo(propType, isReadonly); - } - }); - // If we created both a string and a numeric string index signature, and if the two index - // signatures have identical types, discard the redundant numeric index signature. - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeParameterFromMappedType(type) { return type.typeParameter || @@ -28176,13 +28288,37 @@ var ts; function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 168 /* TypeOperator */) { + // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check + // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves + // 'keyof T' to a literal union type and we can't recover T from that type. + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + // Otherwise, get the declared constraint type, and if the constraint type is a type parameter, + // get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T', + // the modifiers type is T. Otherwise, the modifiers type is {}. + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint.flags & 262144 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; + } + function getErasedTemplateTypeFromMappedType(type) { + return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + } function isGenericMappedType(type) { if (getObjectFlags(type) & 32 /* Mapped */) { var constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (16384 /* TypeParameter */ | 262144 /* Index */)); + return maybeTypeOfKind(constraintType, 540672 /* TypeVariable */ | 262144 /* Index */); } return false; } @@ -28266,11 +28402,11 @@ var ts; * The apparent type of a type parameter is the base constraint instantiated with the type parameter * as the type argument for the 'this' type. */ - function getApparentTypeOfTypeParameter(type) { + function getApparentTypeOfTypeVariable(type) { if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); + var constraintType = getConstraintOfTypeVariable(type); while (constraintType && constraintType.flags & 16384 /* TypeParameter */) { - constraintType = getConstraintOfTypeParameter(constraintType); + constraintType = getConstraintOfTypeVariable(constraintType); } type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); } @@ -28282,13 +28418,12 @@ var ts; * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type) { - var t = type.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(type) : type; - return t.flags & 34 /* StringLike */ ? globalStringType : + var t = type.flags & 540672 /* TypeVariable */ ? getApparentTypeOfTypeVariable(type) : type; + return t.flags & 262178 /* StringLike */ ? globalStringType : t.flags & 340 /* NumberLike */ ? globalNumberType : t.flags & 136 /* BooleanLike */ ? globalBooleanType : t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() : - t.flags & 262144 /* Index */ ? stringOrNumberType : - t; + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; @@ -28452,7 +28587,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -28482,17 +28617,20 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 2097152 /* JavaScriptFile */) { + if (node.flags & 65536 /* JavaScriptFile */) { if (node.type && node.type.kind === 273 /* JSDocOptionalType */) { return true; } - var paramTag = ts.getCorrespondingJSDocParameterTag(node); - if (paramTag) { - if (paramTag.isBracketed) { - return true; - } - if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */; + var paramTags = ts.getJSDocParameterTags(node); + if (paramTags) { + for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) { + var paramTag = paramTags_1[_i]; + if (paramTag.isBracketed) { + return true; + } + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */; + } } } } @@ -28615,7 +28753,7 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; @@ -28816,6 +28954,11 @@ var ts; } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } + function getConstraintOfTypeVariable(type) { + return type.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : + type.flags & 524288 /* IndexedAccess */ ? type.constraint : + undefined; + } function getParentSymbolOfTypeParameter(typeParameter) { return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143 /* TypeParameter */).parent); } @@ -29327,6 +29470,9 @@ var ts; typeSet.containsAny = true; } else if (!(type.flags & 8192 /* Never */) && (strictNullChecks || !(type.flags & 6144 /* Nullable */)) && !ts.contains(typeSet, type)) { + if (type.flags & 65536 /* Union */ && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } typeSet.push(type); } } @@ -29352,18 +29498,6 @@ var ts; if (types.length === 0) { return emptyObjectType; } - var _loop_2 = function (i) { - var type_1 = types[i]; - if (type_1.flags & 65536 /* Union */) { - return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }), - /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments) }; - } - }; - for (var i = 0; i < types.length; i++) { - var state_2 = _loop_2(i); - if (typeof state_2 === "object") - return state_2.value; - } var typeSet = []; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { @@ -29372,6 +29506,14 @@ var ts; if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of + // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), + /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { @@ -29390,7 +29532,7 @@ var ts; } return links.resolvedType; } - function getIndexTypeForTypeParameter(type) { + function getIndexTypeForGenericType(type) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(262144 /* Index */); type.resolvedIndexType.type = type; @@ -29406,11 +29548,15 @@ var ts; return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); } function getIndexType(type) { - return type.flags & 16384 /* TypeParameter */ ? getIndexTypeForTypeParameter(type) : - type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringOrNumberType : - getIndexInfoOfType(type, 1 /* Number */) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) : + return maybeTypeOfKind(type, 540672 /* TypeVariable */) ? getIndexTypeForGenericType(type) : + getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) : + type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromPropertyNames(type); } + function getIndexTypeOrString(type) { + var indexType = getIndexType(type); + return indexType !== neverType ? indexType : stringType; + } function getTypeFromTypeOperatorNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -29422,12 +29568,26 @@ var ts; var type = createType(524288 /* IndexedAccess */); type.objectType = objectType; type.indexType = indexType; + // We eagerly compute the constraint of the indexed access type such that circularity + // errors are immediately caught and reported. For example, class C { x: this["x"] } + // becomes an error only when the constraint is eagerly computed. + if (type.objectType.flags & 229376 /* StructuredType */) { + // The constraint of T[K], where T is an object, union, or intersection type, + // is the type of the string index signature of T, if any. + type.constraint = getIndexTypeOfType(type.objectType, 0 /* String */); + } + else if (type.objectType.flags & 540672 /* TypeVariable */) { + // The constraint of T[K], where T is a type variable, is A[K], where A is the + // apparent type of T. + var apparentType = getApparentTypeOfTypeVariable(type.objectType); + if (apparentType !== emptyObjectType) { + type.constraint = isTypeOfKind(type.indexType, 262178 /* StringLike */) ? + getIndexedAccessType(apparentType, type.indexType) : + getIndexTypeOfType(apparentType, 0 /* String */); + } + } return type; } - function getIndexedAccessTypeForTypeParameter(objectType, indexType) { - var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []); - return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType)); - } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; var propName = indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */) ? @@ -29450,7 +29610,7 @@ var ts; return getTypeOfSymbol(prop); } } - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) { + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) { if (isTypeAny(objectType)) { return anyType; } @@ -29490,20 +29650,53 @@ var ts; } return unknownType; } - function getIndexedAccessType(objectType, indexType, accessNode) { - if (indexType.flags & 16384 /* TypeParameter */) { - if (accessNode && !isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - return getIndexedAccessTypeForTypeParameter(objectType, indexType); + function getIndexedAccessForMappedType(type, indexType, accessNode) { + var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; + if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { + error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); + return unknownType; } - var apparentType = getApparentType(objectType); + var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); + } + function getIndexedAccessType(objectType, indexType, accessNode) { + // If the index type is generic, if the object type is generic and doesn't originate in an expression, + // or if the object type is a mapped type with a generic constraint, we are performing a higher-order + // index access where we cannot meaningfully access the properties of the object type. Note that for a + // generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to + // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved + // eagerly using the constraint type of 'this' at the given location. + if (maybeTypeOfKind(indexType, 540672 /* TypeVariable */ | 262144 /* Index */) || + maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && !(accessNode && accessNode.kind === 178 /* ElementAccessExpression */) || + isGenericMappedType(objectType)) { + if (objectType.flags & 1 /* Any */) { + return objectType; + } + // We first check that the index type is assignable to 'keyof T' for the object type. + if (accessNode) { + if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return unknownType; + } + } + // If the object type is a mapped type { [P in K]: E }, we instantiate E using a mapper that substitutes + // the index type for P. For example, for an index access { [P in K]: Box }[X], we construct the + // type Box. + if (isGenericMappedType(objectType)) { + return getIndexedAccessForMappedType(objectType, indexType, accessNode); + } + // Otherwise we defer the operation by creating an indexed access type. + var id = objectType.id + "," + indexType.id; + return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + } + // In the following we resolve T[K] to the type of the property in T selected by K. + var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 /* Union */ && !(indexType.flags & 8190 /* Primitive */)) { var propTypes = []; for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) { var t = _a[_i]; - var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, /*cacheSymbol*/ false); + var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false); if (propType === unknownType) { return unknownType; } @@ -29511,7 +29704,7 @@ var ts; } return getUnionType(propTypes); } - return getPropertyTypeForIndexType(apparentType, indexType, accessNode, /*cacheSymbol*/ true); + return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true); } function getTypeFromIndexedAccessTypeNode(node) { var links = getNodeLinks(node); @@ -29528,6 +29721,9 @@ var ts; type.aliasSymbol = getAliasSymbolForTypeNode(node); type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); links.resolvedType = type; + // Eagerly resolve the constraint type which forces an error if the constraint type circularly + // references itself through one or more type aliases. + getConstraintTypeFromMappedType(type); } return links.resolvedType; } @@ -29561,10 +29757,23 @@ var ts; * and right = the new element to be spread. */ function getSpreadType(left, right, isFromObjectLiteral) { - ts.Debug.assert(!!(left.flags & (32768 /* Object */ | 1 /* Any */)) && !!(right.flags & (32768 /* Object */ | 1 /* Any */)), "Only object types may be spread."); if (left.flags & 1 /* Any */ || right.flags & 1 /* Any */) { return anyType; } + left = filterType(left, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (left.flags & 8192 /* Never */) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (right.flags & 8192 /* Never */) { + return left; + } + if (left.flags & 65536 /* Union */) { + return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + } + if (right.flags & 65536 /* Union */) { + return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); var stringIndexInfo; @@ -29704,18 +29913,18 @@ var ts; return nullType; case 129 /* NeverKeyword */: return neverType; - case 288 /* JSDocNullKeyword */: + case 289 /* JSDocNullKeyword */: return nullType; - case 289 /* JSDocUndefinedKeyword */: + case 290 /* JSDocUndefinedKeyword */: return undefinedType; - case 290 /* JSDocNeverKeyword */: + case 291 /* JSDocNeverKeyword */: return neverType; case 167 /* ThisType */: case 98 /* ThisKeyword */: return getTypeFromThisTypeNode(node); case 171 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 287 /* JSDocLiteralType */: + case 288 /* JSDocLiteralType */: return getTypeFromLiteralTypeNode(node.literal); case 157 /* TypeReference */: case 272 /* JSDocTypeReference */: @@ -29748,7 +29957,7 @@ var ts; case 158 /* FunctionType */: case 159 /* ConstructorType */: case 161 /* TypeLiteral */: - case 286 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: case 274 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 168 /* TypeOperator */: @@ -29919,6 +30128,33 @@ var ts; return result; } function instantiateMappedType(type, mapper) { + // Check if we have a homomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some + // type variable T. If so, the mapped type is distributive over a union type and when T is instantiated + // to a union type A | B, we produce { [P in keyof A]: X } | { [P in keyof B]: X }. Furthermore, for + // homomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a + // union type A | undefined, we produce { [P in keyof A]: X } | undefined. + var constraintType = getConstraintTypeFromMappedType(type); + if (constraintType.flags & 262144 /* Index */) { + var typeVariable_1 = constraintType.type; + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } + } + return instantiateMappedObjectType(type, mapper); + } + function isMappableType(type) { + return type.flags & (16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */); + } + function instantiateMappedObjectType(type, mapper) { var result = createObjectType(32 /* Mapped */ | 64 /* Instantiated */, type.symbol); result.declaration = type.declaration; result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; @@ -30336,7 +30572,7 @@ var ts; return false; if (target.flags & 1 /* Any */ || source.flags & 8192 /* Never */) return true; - if (source.flags & 34 /* StringLike */ && target.flags & 2 /* String */) + if (source.flags & 262178 /* StringLike */ && target.flags & 2 /* String */) return true; if (source.flags & 340 /* NumberLike */ && target.flags & 4 /* Number */) return true; @@ -30455,6 +30691,25 @@ var ts; reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608 /* UnionOrIntersection */)) { + return false; + } + // at this point we know that this is union or intersection type possibly with nullable constituents. + // check if we still will have compound type if we ignore nullable components. + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144 /* Nullable */) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } // Compare two types and return // Ternary.True if they are related with no assumptions, // Ternary.Maybe if they are related with assumptions of other relationships, or @@ -30475,12 +30730,6 @@ var ts; } if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return -1 /* True */; - if (source.flags & 262144 /* Index */) { - // A keyof T is related to a union type containing both string and number - if (maybeTypeOfKind(target, 2 /* String */) && maybeTypeOfKind(target, 4 /* Number */)) { - return -1 /* True */; - } - } if (getObjectFlags(source) & 128 /* ObjectLiteral */ && source.flags & 1048576 /* FreshLiteral */) { if (hasExcessProperties(source, target, reportErrors)) { if (reportErrors) { @@ -30492,7 +30741,7 @@ var ts; // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - if (target.flags & 196608 /* UnionOrIntersection */) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -30539,13 +30788,25 @@ var ts; return result; } } - if (target.flags & 16384 /* TypeParameter */) { - // Given a type parameter K with a constraint keyof T, a type S is - // assignable to K if S is assignable to keyof T. - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144 /* Index */) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; + else if (target.flags & 16384 /* TypeParameter */) { + // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P]. + if (getObjectFlags(source) & 32 /* Mapped */ && getConstraintTypeFromMappedType(source) === getIndexType(target)) { + if (!source.declaration.questionToken) { + var templateType = getTemplateTypeFromMappedType(source); + var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); + if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { + return result; + } + } + } + else { + // Given a type parameter K with a constraint keyof T, a type S is + // assignable to K if S is assignable to keyof T. + var constraint = getConstraintOfTypeParameter(target); + if (constraint && constraint.flags & 262144 /* Index */) { + if (result = isRelatedTo(source, constraint, reportErrors)) { + return result; + } } } } @@ -30556,27 +30817,67 @@ var ts; return result; } } - // Given a type parameter T with a constraint C, a type S is assignable to + // Given a type variable T with a constraint C, a type S is assignable to // keyof T if S is assignable to keyof C. - var constraint = getConstraintOfTypeParameter(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + if (target.type.flags & 540672 /* TypeVariable */) { + var constraint = getConstraintOfTypeVariable(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } + } + } + else if (target.flags & 524288 /* IndexedAccess */) { + // if we have indexed access types with identical index types, see if relationship holds for + // the two object types. + if (source.flags & 524288 /* IndexedAccess */ && source.indexType === target.indexType) { + if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { + return result; + } + } + // A type S is related to a type T[K] if S is related to A[K], where K is string-like and + // A is the apparent type of S. + if (target.constraint) { + if (result = isRelatedTo(source, target.constraint, reportErrors)) { + errorInfo = saveErrorInfo; return result; } } } if (source.flags & 16384 /* TypeParameter */) { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1 /* Any */) { - constraint = emptyObjectType; + // A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X. + if (getObjectFlags(target) & 32 /* Mapped */ && getConstraintTypeFromMappedType(target) === getIndexType(source)) { + var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } - // The constraint may need to be further instantiated with its 'this' type. - constraint = getTypeWithThisArgument(constraint, source); - // Report constraint errors only if the constraint is not the empty object type - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; - return result; + else { + var constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & 1 /* Any */) { + constraint = emptyObjectType; + } + // The constraint may need to be further instantiated with its 'this' type. + constraint = getTypeWithThisArgument(constraint, source); + // Report constraint errors only if the constraint is not the empty object type + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + else if (source.flags & 524288 /* IndexedAccess */) { + // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and + // A is the apparent type of S. + if (source.constraint) { + if (result = isRelatedTo(source.constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } else { @@ -30586,29 +30887,18 @@ var ts; return result; } } - if (isGenericMappedType(target)) { - // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. - if (isGenericMappedType(source)) { - if ((result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) && - (result = isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors))) { - return result; - } - } - } - else { - // Even if relationship doesn't hold for unions, intersections, or generic type references, - // it may hold in a structural comparison. - var apparentSource = getApparentType(source); - // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates - // to X. Failing both of those we want to check if the aggregation of A and B's members structurally - // relates to X. Thus, we include intersection types on the source side here. - if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) { - // Report structural errors only if we haven't reported any errors yet - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */); - if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { - errorInfo = saveErrorInfo; - return result; - } + // Even if relationship doesn't hold for unions, intersections, or generic type references, + // it may hold in a structural comparison. + var apparentSource = getApparentType(source); + // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates + // to X. Failing both of those we want to check if the aggregation of A and B's members structurally + // relates to X. Thus, we include intersection types on the source side here. + if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) { + // Report structural errors only if we haven't reported any errors yet + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */); + if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + errorInfo = saveErrorInfo; + return result; } } } @@ -30831,6 +31121,9 @@ var ts; if (expandingFlags === 3) { result = 1 /* Maybe */; } + else if (isGenericMappedType(source) || isGenericMappedType(target)) { + result = mappedTypeRelatedTo(source, target, reportErrors); + } else { result = propertiesRelatedTo(source, target, reportErrors); if (result) { @@ -30861,6 +31154,34 @@ var ts; } return result; } + // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. + function mappedTypeRelatedTo(source, target, reportErrors) { + if (isGenericMappedType(target)) { + if (isGenericMappedType(source)) { + var result_2; + if (relation === identityRelation) { + var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; + var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; + if (readonlyMatches && optionalMatches) { + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); + } + } + } + else { + if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + } + } + } + } + } + else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { + return -1 /* True */; + } + return 0 /* False */; + } function propertiesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { return propertiesIdenticalTo(source, target); @@ -31400,7 +31721,7 @@ var ts; return type; } var types = [type]; - if (flags & 34 /* StringLike */) + if (flags & 262178 /* StringLike */) types.push(emptyStringType); if (flags & 340 /* NumberLike */) types.push(zeroType); @@ -31628,25 +31949,73 @@ var ts; // Return true if the given type could possibly reference a type parameter for which // we perform type inference (i.e. a type parameter of a generic function). We cache // results for union and intersection types for performance reasons. - function couldContainTypeParameters(type) { + function couldContainTypeVariables(type) { var objectFlags = getObjectFlags(type); - return !!(type.flags & 16384 /* TypeParameter */ || - objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeParameters) || + return !!(type.flags & 540672 /* TypeVariable */ || + objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) || objectFlags & 32 /* Mapped */ || - type.flags & 196608 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & 196608 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || type.flags & 196608 /* UnionOrIntersection */ && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); } - function inferTypes(context, originalSource, originalTarget) { - var typeParameters = context.signature.typeParameters; + // Infer a suitable input type for a homomorphic mapped type { [P in keyof T]: X }. We construct + // an object type with the same set of properties as the source type, where the type of each + // property is computed by inferring from the source property type to X for the type + // variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for). + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0 /* String */); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 536870912 /* Optional */; + var members = createSymbolTable(properties); + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var prop = properties_4[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 /* Property */ | 67108864 /* Transient */ | prop.flags & optionalMask, prop.name); + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); + members[prop.name] = inferredProp; + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, /*subtypeReduction*/ true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; @@ -31662,7 +32031,7 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -31714,7 +32083,7 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384 /* TypeParameter */) { + if (target.flags & 540672 /* TypeVariable */) { // If target is a type parameter, make an inference, unless the source type contains // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). // Because the anyFunctionType is internal, it should not be exposed to the user by adding @@ -31724,9 +32093,9 @@ var ts; if (source.flags & 8388608 /* ContainsAnyFunctionType */) { return; } - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { // Any inferences that are made to a type parameter in a union type are inferior // to inferences made to a flat (non-union) type. This is because if we infer to @@ -31740,7 +32109,7 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & 16384 /* TypeParameter */ && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -31759,25 +32128,25 @@ var ts; } else if (target.flags & 196608 /* UnionOrIntersection */) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; - // First infer to each type in union or intersection that isn't a type parameter + var typeVariableCount = 0; + var typeVariable = void 0; + // First infer to each type in union or intersection that isn't a type variable for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { var t = targetTypes_2[_d]; - if (t.flags & 16384 /* TypeParameter */ && ts.contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + if (t.flags & 540672 /* TypeVariable */ && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - // Next, if target containings a single naked type parameter, make a secondary inference to that type - // parameter. This gives meaningful results for union types in co-variant positions and intersection + // Next, if target containings a single naked type variable, make a secondary inference to that type + // variable. This gives meaningful results for union types in co-variant positions and intersection // types in contra-variant positions (such as callback parameters). - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -31790,19 +32159,6 @@ var ts; } } else { - if (getObjectFlags(target) & 32 /* Mapped */) { - var constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & 32 /* Mapped */) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); - return; - } - if (constraintType.flags & 16384 /* TypeParameter */) { - inferFromTypes(getIndexType(source), constraintType); - inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); - return; - } - } source = getApparentType(source); if (source.flags & 32768 /* Object */) { if (isInProcess(source, target)) { @@ -31823,18 +32179,47 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; depth++; - inferFromProperties(source, target); - inferFromSignatures(source, target, 0 /* Call */); - inferFromSignatures(source, target, 1 /* Construct */); - inferFromIndexTypes(source, target); + inferFromObjectTypes(source, target); depth--; } } } + function inferFromObjectTypes(source, target) { + if (getObjectFlags(target) & 32 /* Mapped */) { + var constraintType = getConstraintTypeFromMappedType(target); + if (constraintType.flags & 262144 /* Index */) { + // We're inferring from some source type S to a homomorphic mapped type { [P in keyof T]: X }, + // where T is a type variable. Use inferTypeForHomomorphicMappedType to infer a suitable source + // type and then make a secondary inference from that type to T. We make a secondary inference + // such that direct inferences to T get priority over inferences to Partial, for example. + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } + return; + } + if (constraintType.flags & 16384 /* TypeParameter */) { + // We're inferring from some source type S to a mapped type { [P in T]: X }, where T is a type + // parameter. Infer from 'keyof S' to T and infer from a union of each property type in S to X. + inferFromTypes(getIndexType(source), constraintType); + inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); + return; + } + } + inferFromProperties(source, target); + inferFromSignatures(source, target, 0 /* Call */); + inferFromSignatures(source, target, 1 /* Construct */); + inferFromIndexTypes(source, target); + } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var targetProp = properties_5[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -32199,7 +32584,7 @@ var ts; } function getTypeWithDefault(type, defaultExpression) { if (defaultExpression) { - var defaultType = checkExpression(defaultExpression); + var defaultType = getTypeOfExpression(defaultExpression); return getUnionType([getTypeWithFacts(type, 131072 /* NEUndefined */), defaultType]); } return type; @@ -32222,7 +32607,7 @@ var ts; function getAssignedTypeOfBinaryExpression(node) { return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 257 /* PropertyAssignment */ ? getTypeWithDefault(getAssignedType(node), node.right) : - checkExpression(node.right); + getTypeOfExpression(node.right); } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); @@ -32273,7 +32658,7 @@ var ts; // from its initializer, we'll already have cached the type. Otherwise we compute it now // without caching such that transient types are reflected. var links = getNodeLinks(node); - return links.resolvedType || checkExpression(node); + return links.resolvedType || getTypeOfExpression(node); } function getInitialTypeOfVariableDeclaration(node) { if (node.initializer) { @@ -32326,7 +32711,7 @@ var ts; } function getTypeOfSwitchClause(clause) { if (clause.kind === 253 /* CaseClause */) { - var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression)); + var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } return neverType; @@ -32418,7 +32803,7 @@ var ts; // we defer subtype reduction until the evolving array type is finalized into a manifest // array type. function addEvolvingArrayElementType(evolvingArrayType, node) { - var elementType = getBaseTypeOfLiteralType(checkExpression(node)); + var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { @@ -32472,7 +32857,7 @@ var ts; parent.parent.operatorToken.kind === 57 /* EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && - isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 /* NumberLike */ | 2048 /* Undefined */); + isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 /* NumberLike */ | 2048 /* Undefined */); return isLengthPushOrUnshift || isElementAssignment; } function maybeTypePredicateCall(node) { @@ -32629,7 +33014,7 @@ var ts; } } else { - var indexType = checkExpression(node.left.argumentExpression); + var indexType = getTypeOfExpression(node.left.argumentExpression); if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */ | 2048 /* Undefined */)) { evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right); } @@ -32847,7 +33232,7 @@ var ts; if (operator === 32 /* ExclamationEqualsToken */ || operator === 34 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } - var valueType = checkExpression(value); + var valueType = getTypeOfExpression(value); if (valueType.flags & 6144 /* Nullable */) { if (!strictNullChecks) { return type; @@ -32929,7 +33314,7 @@ var ts; return type; } // Check that right operand is a function type with a prototype property - var rightType = checkExpression(expr.right); + var rightType = getTypeOfExpression(expr.right); if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } @@ -32960,18 +33345,18 @@ var ts; } } if (targetType) { - return getNarrowedType(type, targetType, assumeTrue); + return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf); } return type; } - function getNarrowedType(type, candidate, assumeTrue) { + function getNarrowedType(type, candidate, assumeTrue, isRelated) { if (!assumeTrue) { - return filterType(type, function (t) { return !isTypeInstanceOf(t, candidate); }); + return filterType(type, function (t) { return !isRelated(t, candidate); }); } // If the current type is a union type, remove all constituents that couldn't be instances of // the candidate type. If one or more constituents remain, return a union of those. if (type.flags & 65536 /* Union */) { - var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); }); + var assignableType = filterType(type, function (t) { return isRelated(t, candidate); }); if (!(assignableType.flags & 8192 /* Never */)) { return assignableType; } @@ -33004,7 +33389,7 @@ var ts; var predicateArgument = callExpression.arguments[predicate.parameterIndex]; if (predicateArgument) { if (isMatchingReference(reference, predicateArgument)) { - return getNarrowedType(type, predicate.type, assumeTrue); + return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } if (containsMatchingReference(reference, predicateArgument)) { return declaredType; @@ -33017,7 +33402,7 @@ var ts; var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { - return getNarrowedType(type, predicate.type, assumeTrue); + return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } if (containsMatchingReference(reference, possibleReference)) { return declaredType; @@ -33059,7 +33444,7 @@ var ts; location = location.parent; } if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) { - var type = checkExpression(location); + var type = getTypeOfExpression(location); if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { return type; } @@ -33143,7 +33528,7 @@ var ts; error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } - if (node.flags & 524288 /* AwaitContext */) { + if (node.flags & 16384 /* AwaitContext */) { getNodeLinks(container).flags |= 8192 /* CaptureArguments */; } return getTypeOfSymbol(symbol); @@ -33157,8 +33542,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (languageVersion === 2 /* ES2015 */ - && declaration_1.kind === 226 /* ClassDeclaration */ + if (declaration_1.kind === 226 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -33374,30 +33758,33 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + // If a containing class does not have extends clause or the class extends null + // skip checking whether super statement is called before "this" accessing. + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + // We should give an error in the following cases: + // - No super-call + // - "this" is accessing before super-call. + // i.e super(this) + // this.x; super(); + // We want to make sure that super-call is done before accessing "this" so that + // "this" is not accessed as a parameter of the super-call. + if (!superCall || superCall.end > node.pos) { + // In ES6, super inside constructor of class-declaration has to precede "this" accessing + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; if (container.kind === 150 /* Constructor */) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - // If a containing class does not have extends clause or the class extends null - // skip checking whether super statement is called before "this" accessing. - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - // We should give an error in the following cases: - // - No super-call - // - "this" is accessing before super-call. - // i.e super(this) - // this.x; super(); - // We want to make sure that super-call is done before accessing "this" so that - // "this" is not accessed as a parameter of the super-call. - if (!superCall || superCall.end > node.pos) { - // In ES6, super inside constructor of class-declaration has to precede "this" accessing - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. if (container.kind === 185 /* ArrowFunction */) { @@ -33473,9 +33860,9 @@ var ts; return anyType; } function getTypeForThisExpressionFromJSDoc(node) { - var typeTag = ts.getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 274 /* JSDocFunctionType */) { - var jsDocFunctionType = typeTag.typeExpression.type; + var jsdocType = ts.getJSDocType(node); + if (jsdocType && jsdocType.kind === 274 /* JSDocFunctionType */) { + var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277 /* JSDocThisType */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } @@ -33526,6 +33913,9 @@ var ts; } return unknownType; } + if (!isCallExpression && container.kind === 150 /* Constructor */) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } if ((ts.getModifierFlags(container) & 32 /* Static */) || isCallExpression) { nodeCheckFlag = 512 /* SuperStatic */; } @@ -33745,11 +34135,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_20 = declaration.propertyName || declaration.name; + var name_19 = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_20)) { - var text = ts.getTextOfPropertyName(name_20); + !ts.isBindingPattern(name_19)) { + var text = ts.getTextOfPropertyName(name_19); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -33835,7 +34225,7 @@ var ts; } // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { - return checkExpression(binaryExpression.left); + return getTypeOfExpression(binaryExpression.left); } } else if (operator === 53 /* BarBarToken */) { @@ -33843,7 +34233,7 @@ var ts; // expression has no contextual type, the right operand is contextually typed by the type of the left operand. var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { - type = checkExpression(binaryExpression.left); + type = getTypeOfExpression(binaryExpression.left); } return type; } @@ -34134,13 +34524,7 @@ var ts; return mapper && mapper.context; } function checkSpreadExpression(node, contextualMapper) { - // It is usually not safe to call checkExpressionCached if we can be contextually typing. - // You can tell that we are contextually typing because of the contextualMapper parameter. - // While it is true that a spread element can have a contextual type, it does not do anything - // with this type. It is neither affected by it, nor does it propagate it to its operand. - // So the fact that contextualMapper is passed is not important, because the operand of a spread - // element is not contextually typed. - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); + var arrayOrIterableType = checkExpression(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { @@ -34261,7 +34645,7 @@ var ts; links.resolvedType = checkExpression(node.expression); // This will allow types number, string, symbol or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). - if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 /* NumberLike */ | 34 /* StringLike */ | 512 /* ESSymbol */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 /* NumberLike */ | 262178 /* StringLike */ | 512 /* ESSymbol */)) { error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { @@ -34270,10 +34654,10 @@ var ts; } return links.resolvedType; } - function getObjectLiteralIndexInfo(node, properties, kind) { + function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) { var propTypes = []; for (var i = 0; i < properties.length; i++) { - if (kind === 0 /* String */ || isNumericName(node.properties[i].name)) { + if (kind === 0 /* String */ || isNumericName(propertyNodes[i + offset].name)) { propTypes.push(getTypeOfSymbol(properties[i])); } } @@ -34295,8 +34679,9 @@ var ts; var patternWithComputedProperties = false; var hasComputedStringProperty = false; var hasComputedNumberProperty = false; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var memberDecl = _a[_i]; + var offset = 0; + for (var i = 0; i < node.properties.length; i++) { + var memberDecl = node.properties[i]; var member = memberDecl.symbol; if (memberDecl.kind === 257 /* PropertyAssignment */ || memberDecl.kind === 258 /* ShorthandPropertyAssignment */ || @@ -34333,7 +34718,7 @@ var ts; if (impliedProp) { prop.flags |= impliedProp.flags & 536870912 /* Optional */; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0 /* String */)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -34347,6 +34732,9 @@ var ts; member = prop; } else if (memberDecl.kind === 259 /* SpreadAssignment */) { + if (languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(memberDecl, 2 /* Assign */); + } if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); propertiesArray = []; @@ -34356,11 +34744,12 @@ var ts; typeFlags = 0; } var type = checkExpression(memberDecl.expression); - if (!(type.flags & (32768 /* Object */ | 1 /* Any */))) { + if (!isValidSpreadType(type)) { error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false); + offset = i + 1; continue; } else { @@ -34388,8 +34777,8 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. if (contextualTypeHasPattern) { - for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { - var prop = _c[_b]; + for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { + var prop = _a[_i]; if (!propertiesTable[prop.name]) { if (!(prop.flags & 536870912 /* Optional */)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); @@ -34403,14 +34792,17 @@ var ts; if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; + if (spread.flags & 32768 /* Object */) { + // only set the symbol and flags if this is a (fresh) object type + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; + } return spread; } return createObjectLiteralType(); function createObjectLiteralType() { - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0 /* String */) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1 /* Number */) : undefined; + var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0 /* String */) : undefined; + var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1 /* Number */) : undefined; var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshLiteral */; result.flags |= 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */); @@ -34427,6 +34819,11 @@ var ts; return result; } } + function isValidSpreadType(type) { + return !!(type.flags & (1 /* Any */ | 4096 /* Null */ | 2048 /* Undefined */) || + type.flags & 32768 /* Object */ && !isGenericMappedType(type) || + type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); + } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; @@ -34516,6 +34913,9 @@ var ts; return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { + if (compilerOptions.jsx === 2 /* React */) { + checkExternalEmitHelpers(node, 2 /* Assign */); + } var type = checkExpression(node.expression); var props = getPropertiesOfType(type); for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { @@ -35085,7 +35485,7 @@ var ts; if (node.kind === 212 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && - hasNumericPropertyNames(checkExpression(node.expression))) { + hasNumericPropertyNames(getTypeOfExpression(node.expression))) { return true; } child = node; @@ -35191,13 +35591,13 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_9 = signature.declaration && signature.declaration.parent; + var parent_8 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_9 === lastParent) { + if (lastParent && parent_8 === lastParent) { index++; } else { - lastParent = parent_9; + lastParent = parent_8; index = cutoffIndex; } } @@ -35205,7 +35605,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_9; + lastParent = parent_8; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -35317,7 +35717,7 @@ var ts; var context = createInferenceContext(signature, /*inferUnionTypes*/ true); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { // Type parameters from outer context referenced by source type are fixed by instantiation of the source type - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -35348,7 +35748,7 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } // We perform two passes over the arguments. In the first pass we infer from all arguments, but use // wildcards for all context sensitive function expressions. @@ -35367,7 +35767,7 @@ var ts; var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } // In the second pass we visit only context sensitive arguments, and only those that aren't excluded, this @@ -35381,7 +35781,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -36112,12 +36512,13 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; if (modifiers & 16 /* Protected */ && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } if (modifiers & 8 /* Private */) { @@ -36342,7 +36743,7 @@ var ts; for (var i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -36427,7 +36828,7 @@ var ts; // T in the second overload so that we do not infer Base as a candidate for T // (inferring Base would make type argument inference inconsistent between the two // overloads). - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -36537,7 +36938,7 @@ var ts; if (!node.possiblyExhaustive) { return false; } - var type = checkExpression(node.expression); + var type = getTypeOfExpression(node.expression); if (!isLiteralType(type)) { return false; } @@ -36545,7 +36946,7 @@ var ts; if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { if (!(func.flags & 128 /* HasImplicitReturn */)) { @@ -36813,7 +37214,7 @@ var ts; function checkAwaitExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.flags & 524288 /* AwaitContext */)) { + if (!(node.flags & 16384 /* AwaitContext */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -36944,32 +37345,33 @@ var ts; // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. - if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) { + if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 /* NumberLike */ | 512 /* ESSymbol */))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var p = properties_5[_i]; - checkObjectLiteralDestructuringPropertyAssignment(sourceType, p); + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var p = properties_6[_i]; + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } - function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) { + /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { if (property.kind === 257 /* PropertyAssignment */ || property.kind === 258 /* ShorthandPropertyAssignment */) { - var name_21 = property.name; - if (name_21.kind === 142 /* ComputedPropertyName */) { - checkComputedPropertyName(name_21); + var name_20 = property.name; + if (name_20.kind === 142 /* ComputedPropertyName */) { + checkComputedPropertyName(name_20); } - if (isComputedNonLiteralName(name_21)) { + if (isComputedNonLiteralName(name_20)) { return undefined; } - var text = ts.getTextOfPropertyName(name_21); + var text = ts.getTextOfPropertyName(name_20); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || @@ -36985,13 +37387,21 @@ var ts; } } else { - error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_21)); + error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); } } else if (property.kind === 259 /* SpreadAssignment */) { - if (property.expression.kind !== 70 /* Identifier */) { - error(property.expression, ts.Diagnostics.An_object_rest_element_must_be_an_identifier); + if (languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(property, 4 /* Rest */); } + var nonRestNames = []; + if (allProperties) { + for (var i = 0; i < allProperties.length - 1; i++) { + nonRestNames.push(allProperties[i].name); + } + } + var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); + return checkDestructuringAssignment(property.expression, type); } else { error(property, ts.Diagnostics.Property_assignment_expected); @@ -37083,7 +37493,10 @@ var ts; } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) { + var error = target.parent.kind === 259 /* SpreadAssignment */ ? + ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : + ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; + if (checkReferenceExpression(target, error)) { checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined); } return sourceType; @@ -37246,7 +37659,7 @@ var ts; resultType = numberType; } else { - if (isTypeOfKind(leftType, 34 /* StringLike */) || isTypeOfKind(rightType, 34 /* StringLike */)) { + if (isTypeOfKind(leftType, 262178 /* StringLike */) || isTypeOfKind(rightType, 262178 /* StringLike */)) { // If one or both operands are of the String primitive type, the result is of the String primitive type. resultType = stringType; } @@ -37273,6 +37686,8 @@ var ts; case 29 /* LessThanEqualsToken */: case 30 /* GreaterThanEqualsToken */: if (checkForDisallowedESSymbolOperand(operator)) { + leftType = getBaseTypeOfLiteralType(leftType); + rightType = getBaseTypeOfLiteralType(rightType); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -37375,7 +37790,7 @@ var ts; function checkYieldExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.flags & 131072 /* YieldContext */) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096 /* YieldContext */) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -37469,13 +37884,13 @@ var ts; function checkDeclarationInitializer(declaration) { var type = checkExpressionCached(declaration.initializer); return ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || - ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ || + ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } function isLiteralContextualType(contextualType) { if (contextualType) { - if (contextualType.flags & 16384 /* TypeParameter */) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); + if (contextualType.flags & 540672 /* TypeVariable */) { + var apparentType = getApparentTypeOfTypeVariable(contextualType); // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. @@ -37484,7 +37899,7 @@ var ts; } contextualType = apparentType; } - return maybeTypeOfKind(contextualType, 480 /* Literal */); + return maybeTypeOfKind(contextualType, (480 /* Literal */ | 262144 /* Index */)); } return false; } @@ -37528,6 +37943,23 @@ var ts; } return type; } + // Returns the type of an expression. Unlike checkExpression, this function is simply concerned + // with computing the type and may not fully check all contained sub-expressions for errors. + function getTypeOfExpression(node) { + // Optimize for the common case of a call to a function with a single non-generic call + // signature where we can just fetch the return type without checking the arguments. + if (node.kind === 179 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) { + var funcType = checkNonNullExpression(node.expression); + var signature = getSingleCallSignature(funcType); + if (signature && !signature.typeParameters) { + return getReturnTypeOfSignature(signature); + } + } + // Otherwise simply call checkExpression. Ideally, the entire family of checkXXX functions + // should have a parameter that indicates whether full error checking is required such that + // we can perform the optimizations locally. + return checkExpression(node); + } // Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When // contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the // expression is being inferentially typed (section 4.15.2 in spec) and provides the type mapper to use in @@ -37730,9 +38162,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_22 = _a[_i].name; - if (ts.isBindingPattern(name_22) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, parameterName, typePredicate.parameterName)) { + var name_21 = _a[_i].name; + if (ts.isBindingPattern(name_21) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -37752,9 +38184,9 @@ var ts; case 158 /* FunctionType */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: - var parent_10 = node.parent; - if (node === parent_10.type) { - return parent_10; + var parent_9 = node.parent; + if (node === parent_9.type) { + return parent_9; } } } @@ -37764,15 +38196,15 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_23 = element.name; - if (name_23.kind === 70 /* Identifier */ && - name_23.text === predicateVariableName) { + var name_22 = element.name; + if (name_22.kind === 70 /* Identifier */ && + name_22.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_23.kind === 173 /* ArrayBindingPattern */ || - name_23.kind === 172 /* ObjectBindingPattern */) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, predicateVariableNode, predicateVariableName)) { + else if (name_22.kind === 173 /* ArrayBindingPattern */ || + name_22.kind === 172 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) { return true; } } @@ -37788,6 +38220,12 @@ var ts; node.kind === 154 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } + if (ts.isAsyncFunctionLike(node) && languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 64 /* Awaiter */); + if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(node, 128 /* Generator */); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -38040,8 +38478,8 @@ var ts; if (superCallShouldBeFirst) { var statements = node.body.statements; var superCallStatement = void 0; - for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { - var statement = statements_2[_i]; + for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { + var statement = statements_3[_i]; if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; @@ -38193,8 +38631,8 @@ var ts; checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint); + var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentTypeOfTypeVariable(constraintType) : constraintType; + checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node); @@ -38475,10 +38913,10 @@ var ts; case 229 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; case 234 /* ImportEqualsDeclaration */: - var result_2 = 0; + var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); }); - return result_2; + ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); + return result_3; default: return 1048576 /* ExportValue */; } @@ -38533,7 +38971,7 @@ var ts; if (thenSignatures.length === 0) { return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072 /* NEUndefined */); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288 /* NEUndefinedOrNull */); if (isTypeAny(onfulfilledParameterType)) { return undefined; } @@ -38775,6 +39213,9 @@ var ts; markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } /** Check the decorators of a node */ function checkDecorators(node) { if (!node.decorators) { @@ -38788,7 +39229,13 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */); + if (node.kind === 144 /* Parameter */) { + checkExternalEmitHelpers(firstDecorator, 32 /* Param */); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { case 226 /* ClassDeclaration */: @@ -38796,7 +39243,7 @@ var ts; if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; @@ -38805,11 +39252,13 @@ var ts; case 152 /* SetAccessor */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; case 147 /* PropertyDeclaration */: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; case 144 /* Parameter */: markTypeNodeAsReferenced(node.type); break; @@ -38939,7 +39388,7 @@ var ts; } function checkUnusedLocalsAndParameters(node) { if (node.parent.kind !== 227 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_3 = function (key) { + var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144 /* Parameter */) { @@ -38957,10 +39406,17 @@ var ts; } }; for (var key in node.locals) { - _loop_3(key); + _loop_2(key); } } } + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); @@ -38970,7 +39426,9 @@ var ts; return; } } - error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 /* Identifier */ ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); @@ -39141,7 +39599,7 @@ var ts; } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 /* ES2017 */ || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } // Uninstantiated modules shouldnt do this check @@ -39150,7 +39608,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192 /* HasAsyncFunctions */) { + if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -39211,8 +39669,8 @@ var ts; // otherwise if variable has an initializer - show error that initialization will fail // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { - var name_24 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_24, name_24); + var name_23 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23); } } } @@ -39298,18 +39756,21 @@ var ts; } } if (node.kind === 174 /* BindingElement */) { + if (node.parent.kind === 172 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(node, 4 /* Rest */); + } // check computed properties inside property names of binding elements if (node.propertyName && node.propertyName.kind === 142 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access - var parent_11 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_11); - var name_25 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_25)); + var parent_10 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_10); + var name_24 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); markPropertyAsReferenced(property); - if (parent_11.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + if (parent_10.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); } } // For a binding pattern, check contained binding elements @@ -39501,6 +39962,7 @@ var ts; function checkForInStatement(node) { // Grammar checking checkGrammarForInOrForOfStatement(node); + var rightType = checkNonNullExpression(node.expression); // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form // for (let VarDecl in Expr) Statement @@ -39523,7 +39985,7 @@ var ts; if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } - else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 /* StringLike */)) { + else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -39531,10 +39993,9 @@ var ts; checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - var rightType = checkNonNullExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -39719,17 +40180,17 @@ var ts; */ function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { ts.Debug.assert(languageVersion < 2 /* ES2015 */); - // After we remove all types that are StringLike, we will know if there was a string constituent - // based on whether the remaining type is the same as the initial type. var arrayType = arrayOrStringType; if (arrayOrStringType.flags & 65536 /* Union */) { + // After we remove all types that are StringLike, we will know if there was a string constituent + // based on whether the result of filter is a new array. var arrayTypes = arrayOrStringType.types; - var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 34 /* StringLike */); }); + var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178 /* StringLike */); }); if (filteredTypes !== arrayTypes) { arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true); } } - else if (arrayOrStringType.flags & 34 /* StringLike */) { + else if (arrayOrStringType.flags & 262178 /* StringLike */) { arrayType = neverType; } var hasStringConstituent = arrayOrStringType !== arrayType; @@ -39761,7 +40222,7 @@ var ts; var arrayElementType = getIndexTypeOfType(arrayType, 1 /* Number */) || unknownType; if (hasStringConstituent) { // This is just an optimization for the case where arrayOrStringType is string | string[] - if (arrayElementType.flags & 34 /* StringLike */) { + if (arrayElementType.flags & 262178 /* StringLike */) { return stringType; } return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true); @@ -39836,7 +40297,7 @@ var ts; function checkWithStatement(node) { // Grammar checking for withStatement if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 524288 /* AwaitContext */) { + if (node.flags & 16384 /* AwaitContext */) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -40107,6 +40568,9 @@ var ts; checkClassForDuplicateDeclarations(node); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2 /* ES2015 */ && !ts.isInAmbientContext(node)) { + checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; @@ -40316,8 +40780,8 @@ var ts; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var prop = properties_6[_a]; + for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { + var prop = properties_7[_a]; var existing = seen[prop.name]; if (!existing) { seen[prop.name] = { prop: prop, containingType: base }; @@ -40532,7 +40996,7 @@ var ts; return undefined; } } - enumType_1 = checkExpression(expression); + enumType_1 = getTypeOfExpression(expression); // allow references to constant members of other enums if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384 /* Enum */))) { return undefined; @@ -40753,9 +41217,9 @@ var ts; break; case 174 /* BindingElement */: case 223 /* VariableDeclaration */: - var name_26 = node.name; - if (ts.isBindingPattern(name_26)) { - for (var _b = 0, _c = name_26.elements; _b < _c.length; _b++) { + var name_25 = node.name; + if (ts.isBindingPattern(name_25)) { + for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); @@ -41587,7 +42051,7 @@ var ts; } // fallthrough case 96 /* SuperKeyword */: - var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); + var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; case 167 /* ThisType */: return getTypeFromTypeNode(node).symbol; @@ -41613,7 +42077,7 @@ var ts; case 8 /* NumericLiteral */: // index access if (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { - var objectType = checkExpression(node.parent.expression); + var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; var apparentType = getApparentType(objectType); @@ -41649,7 +42113,7 @@ var ts; return getTypeFromTypeNode(node); } if (ts.isPartOfExpression(node)) { - return getTypeOfExpression(node); + return getRegularTypeOfExpression(node); } if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { // A SyntaxKind.ExpressionWithTypeArguments is considered a type node, except when it occurs in the @@ -41702,7 +42166,7 @@ var ts; // If this is from "for" initializer // for ({a } = elems[0];.....) { } if (expr.parent.kind === 192 /* BinaryExpression */) { - var iteratedType = checkExpression(expr.parent.right); + var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern @@ -41729,11 +42193,11 @@ var ts; var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); } - function getTypeOfExpression(expr) { + function getRegularTypeOfExpression(expr) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } - return getRegularTypeOfLiteralType(checkExpression(expr)); + return getRegularTypeOfLiteralType(getTypeOfExpression(expr)); } /** * Gets either the static or instance type of a class element, based on @@ -41762,9 +42226,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456 /* SyntheticProperty */) { var symbols_3 = []; - var name_27 = symbol.name; + var name_26 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_27); + var symbol = getPropertyOfType(t, name_26); if (symbol) { symbols_3.push(symbol); } @@ -41823,7 +42287,7 @@ var ts; } function isNameOfModuleOrEnumDeclaration(node) { var parent = node.parent; - return ts.isModuleOrEnumDeclaration(parent) && node === parent.name; + return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name; } // When resolved as an expression identifier, if the given node references an exported entity, return the declaration // node of the exported entity's container. Otherwise, return undefined. @@ -42084,7 +42548,7 @@ var ts; else if (isTypeOfKind(type, 340 /* NumberLike */)) { return ts.TypeReferenceSerializationKind.NumberLikeType; } - else if (isTypeOfKind(type, 34 /* StringLike */)) { + else if (isTypeOfKind(type, 262178 /* StringLike */)) { return ts.TypeReferenceSerializationKind.StringLikeType; } else if (isTupleType(type)) { @@ -42116,7 +42580,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getWidenedType(getTypeOfExpression(expr)); + var type = getWidenedType(getRegularTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { @@ -42137,9 +42601,9 @@ var ts; if (startInDeclarationContainer) { // When resolving the name of a declaration as a value, we need to start resolution // at a point outside of the declaration. - var parent_12 = reference.parent; - if (ts.isDeclaration(parent_12) && reference === parent_12.name) { - location = getDeclarationContainer(parent_12); + var parent_11 = reference.parent; + if (ts.isDeclaration(parent_11) && reference === parent_11.name) { + location = getDeclarationContainer(parent_11); } } return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -42268,9 +42732,9 @@ var ts; // external modules cannot define or contribute to type declaration files var current = symbol; while (true) { - var parent_13 = getParentOfSymbol(current); - if (parent_13) { - current = parent_13; + var parent_12 = getParentOfSymbol(current); + if (parent_12) { + current = parent_12; } else { break; @@ -42306,8 +42770,6 @@ var ts; } // Initialize global symbol table var augmentations; - var requestedExternalEmitHelpers = 0; - var firstFileRequestingExternalHelpers; for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { @@ -42328,15 +42790,6 @@ var ts; } } } - if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) { - var fileRequestedExternalEmitHelpers = file.flags & 64512 /* EmitHelperFlags */; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; - } - } - } } if (augmentations) { // merge module augmentations. @@ -42395,50 +42848,46 @@ var ts; var symbol = getGlobalSymbol("ReadonlyArray", 793064 /* Type */, /*diagnostic*/ undefined); globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; - // If we have specified that we are importing helpers, we should report global - // errors if we cannot resolve the helpers external module, or if it does not have - // the necessary helpers exported. - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - // Find the first reference to the helpers module. - var helpersModule = resolveExternalModule(firstFileRequestingExternalHelpers, ts.externalHelpersModuleNameText, ts.Diagnostics.Cannot_find_module_0, - /*errorNode*/ undefined); - // If we found the module, report errors if it does not have the necessary exports. - if (helpersModule) { - var exports = helpersModule.exports; - if (requestedExternalEmitHelpers & 1024 /* HasClassExtends */ && languageVersion < 2 /* ES2015 */) { - verifyHelperSymbol(exports, "__extends", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 16384 /* HasSpreadAttribute */ && - (languageVersion < 5 /* ESNext */ || compilerOptions.jsx === 2 /* React */)) { - verifyHelperSymbol(exports, "__assign", 107455 /* Value */); - } - if (languageVersion < 5 /* ESNext */ && requestedExternalEmitHelpers & 32768 /* HasRestAttribute */) { - verifyHelperSymbol(exports, "__rest", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 2048 /* HasDecorators */) { - verifyHelperSymbol(exports, "__decorate", 107455 /* Value */); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports, "__metadata", 107455 /* Value */); - } - } - if (requestedExternalEmitHelpers & 4096 /* HasParamDecorators */) { - verifyHelperSymbol(exports, "__param", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 8192 /* HasAsyncFunctions */) { - verifyHelperSymbol(exports, "__awaiter", 107455 /* Value */); - if (languageVersion < 2 /* ES2015 */) { - verifyHelperSymbol(exports, "__generator", 107455 /* Value */); + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1 /* FirstEmitHelper */; helper <= 128 /* LastEmitHelper */; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name_27 = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_27), 107455 /* Value */); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_27); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols, name, meaning) { - var symbol = getSymbol(symbols, ts.escapeIdentifier(name), meaning); - if (!symbol) { - error(/*location*/ undefined, ts.Diagnostics.Module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + function getHelperName(helper) { + switch (helper) { + case 1 /* Extends */: return "__extends"; + case 2 /* Assign */: return "__assign"; + case 4 /* Rest */: return "__rest"; + case 8 /* Decorate */: return "__decorate"; + case 16 /* Metadata */: return "__metadata"; + case 32 /* Param */: return "__param"; + case 64 /* Awaiter */: return "__awaiter"; + case 128 /* Generator */: return "__generator"; } } + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; + } + return externalHelpersModule; + } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); if (promiseLikeType !== emptyGenericType) { @@ -43120,6 +43569,9 @@ var ts; else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128 /* Abstract */)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128 /* Abstract */) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } @@ -43577,19 +44029,24 @@ var ts; function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } + function reduceNodeArray(nodes, f, initial) { + return nodes ? f(initial, nodes) : initial; + } /** * Similar to `reduceLeft`, performs a reduction against each child of a node. * NOTE: Unlike `forEachChild`, this does *not* visit every node. Only nodes added to the * `nodeEdgeTraversalMap` above will be visited. * * @param node The node containing the children to reduce. - * @param f The callback function * @param initial The initial value to supply to the reduction. + * @param f The callback function */ - function reduceEachChild(node, f, initial) { + function reduceEachChild(node, initial, cbNode, cbNodeArray) { if (node === undefined) { return initial; } + var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; + var cbNodes = cbNodeArray || cbNode; var kind = node.kind; // No need to visit nodes with no children. if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { @@ -43606,114 +44063,114 @@ var ts; case 206 /* EmptyStatement */: case 198 /* OmittedExpression */: case 222 /* DebuggerStatement */: - case 292 /* NotEmittedStatement */: + case 293 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names case 142 /* ComputedPropertyName */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; // Signature elements case 144 /* Parameter */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 145 /* Decorator */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; // Type member case 147 /* PropertyDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 149 /* MethodDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 150 /* Constructor */: - result = ts.reduceLeft(node.modifiers, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); break; case 151 /* GetAccessor */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 152 /* SetAccessor */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); break; // Binding patterns case 172 /* ObjectBindingPattern */: case 173 /* ArrayBindingPattern */: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 174 /* BindingElement */: - result = reduceNode(node.propertyName, f, result); - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; // Expression case 175 /* ArrayLiteralExpression */: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 176 /* ObjectLiteralExpression */: - result = ts.reduceLeft(node.properties, f, result); + result = reduceNodes(node.properties, cbNodes, result); break; case 177 /* PropertyAccessExpression */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.name, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 178 /* ElementAccessExpression */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.argumentExpression, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.argumentExpression, cbNode, result); break; case 179 /* CallExpression */: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); - result = ts.reduceLeft(node.arguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); break; case 180 /* NewExpression */: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); - result = ts.reduceLeft(node.arguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); break; case 181 /* TaggedTemplateExpression */: - result = reduceNode(node.tag, f, result); - result = reduceNode(node.template, f, result); + result = reduceNode(node.tag, cbNode, result); + result = reduceNode(node.template, cbNode, result); break; case 184 /* FunctionExpression */: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 185 /* ArrowFunction */: - result = ts.reduceLeft(node.modifiers, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 183 /* ParenthesizedExpression */: case 186 /* DeleteExpression */: @@ -43723,212 +44180,212 @@ var ts; case 195 /* YieldExpression */: case 196 /* SpreadElement */: case 201 /* NonNullExpression */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 190 /* PrefixUnaryExpression */: case 191 /* PostfixUnaryExpression */: - result = reduceNode(node.operand, f, result); + result = reduceNode(node.operand, cbNode, result); break; case 192 /* BinaryExpression */: - result = reduceNode(node.left, f, result); - result = reduceNode(node.right, f, result); + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); break; case 193 /* ConditionalExpression */: - result = reduceNode(node.condition, f, result); - result = reduceNode(node.whenTrue, f, result); - result = reduceNode(node.whenFalse, f, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.whenTrue, cbNode, result); + result = reduceNode(node.whenFalse, cbNode, result); break; case 194 /* TemplateExpression */: - result = reduceNode(node.head, f, result); - result = ts.reduceLeft(node.templateSpans, f, result); + result = reduceNode(node.head, cbNode, result); + result = reduceNodes(node.templateSpans, cbNodes, result); break; case 197 /* ClassExpression */: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.heritageClauses, f, result); - result = ts.reduceLeft(node.members, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); break; case 199 /* ExpressionWithTypeArguments */: - result = reduceNode(node.expression, f, result); - result = ts.reduceLeft(node.typeArguments, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); break; // Misc case 202 /* TemplateSpan */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.literal, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); break; // Element case 204 /* Block */: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 205 /* VariableStatement */: - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.declarationList, f, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.declarationList, cbNode, result); break; case 207 /* ExpressionStatement */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 208 /* IfStatement */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.thenStatement, f, result); - result = reduceNode(node.elseStatement, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.thenStatement, cbNode, result); + result = reduceNode(node.elseStatement, cbNode, result); break; case 209 /* DoStatement */: - result = reduceNode(node.statement, f, result); - result = reduceNode(node.expression, f, result); + result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 210 /* WhileStatement */: case 217 /* WithStatement */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 211 /* ForStatement */: - result = reduceNode(node.initializer, f, result); - result = reduceNode(node.condition, f, result); - result = reduceNode(node.incrementor, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.incrementor, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 212 /* ForInStatement */: case 213 /* ForOfStatement */: - result = reduceNode(node.initializer, f, result); - result = reduceNode(node.expression, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 216 /* ReturnStatement */: case 220 /* ThrowStatement */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 218 /* SwitchStatement */: - result = reduceNode(node.expression, f, result); - result = reduceNode(node.caseBlock, f, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.caseBlock, cbNode, result); break; case 219 /* LabeledStatement */: - result = reduceNode(node.label, f, result); - result = reduceNode(node.statement, f, result); + result = reduceNode(node.label, cbNode, result); + result = reduceNode(node.statement, cbNode, result); break; case 221 /* TryStatement */: - result = reduceNode(node.tryBlock, f, result); - result = reduceNode(node.catchClause, f, result); - result = reduceNode(node.finallyBlock, f, result); + result = reduceNode(node.tryBlock, cbNode, result); + result = reduceNode(node.catchClause, cbNode, result); + result = reduceNode(node.finallyBlock, cbNode, result); break; case 223 /* VariableDeclaration */: - result = reduceNode(node.name, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 224 /* VariableDeclarationList */: - result = ts.reduceLeft(node.declarations, f, result); + result = reduceNodes(node.declarations, cbNodes, result); break; case 225 /* FunctionDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.parameters, f, result); - result = reduceNode(node.type, f, result); - result = reduceNode(node.body, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); break; case 226 /* ClassDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.name, f, result); - result = ts.reduceLeft(node.typeParameters, f, result); - result = ts.reduceLeft(node.heritageClauses, f, result); - result = ts.reduceLeft(node.members, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); break; case 232 /* CaseBlock */: - result = ts.reduceLeft(node.clauses, f, result); + result = reduceNodes(node.clauses, cbNodes, result); break; case 235 /* ImportDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.importClause, f, result); - result = reduceNode(node.moduleSpecifier, f, result); + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.importClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); break; case 236 /* ImportClause */: - result = reduceNode(node.name, f, result); - result = reduceNode(node.namedBindings, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); break; case 237 /* NamespaceImport */: - result = reduceNode(node.name, f, result); + result = reduceNode(node.name, cbNode, result); break; case 238 /* NamedImports */: case 242 /* NamedExports */: - result = ts.reduceLeft(node.elements, f, result); + result = reduceNodes(node.elements, cbNodes, result); break; case 239 /* ImportSpecifier */: case 243 /* ExportSpecifier */: - result = reduceNode(node.propertyName, f, result); - result = reduceNode(node.name, f, result); + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); break; case 240 /* ExportAssignment */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.expression, f, result); + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 241 /* ExportDeclaration */: - result = ts.reduceLeft(node.decorators, f, result); - result = ts.reduceLeft(node.modifiers, f, result); - result = reduceNode(node.exportClause, f, result); - result = reduceNode(node.moduleSpecifier, f, result); + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.exportClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); break; // JSX case 246 /* JsxElement */: - result = reduceNode(node.openingElement, f, result); - result = ts.reduceLeft(node.children, f, result); - result = reduceNode(node.closingElement, f, result); + result = reduceNode(node.openingElement, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingElement, cbNode, result); break; case 247 /* JsxSelfClosingElement */: case 248 /* JsxOpeningElement */: - result = reduceNode(node.tagName, f, result); - result = ts.reduceLeft(node.attributes, f, result); + result = reduceNode(node.tagName, cbNode, result); + result = reduceNodes(node.attributes, cbNodes, result); break; case 249 /* JsxClosingElement */: - result = reduceNode(node.tagName, f, result); + result = reduceNode(node.tagName, cbNode, result); break; case 250 /* JsxAttribute */: - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 251 /* JsxSpreadAttribute */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; case 252 /* JsxExpression */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; // Clauses case 253 /* CaseClause */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); // fall-through case 254 /* DefaultClause */: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 255 /* HeritageClause */: - result = ts.reduceLeft(node.types, f, result); + result = reduceNodes(node.types, cbNodes, result); break; case 256 /* CatchClause */: - result = reduceNode(node.variableDeclaration, f, result); - result = reduceNode(node.block, f, result); + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); break; // Property assignments case 257 /* PropertyAssignment */: - result = reduceNode(node.name, f, result); - result = reduceNode(node.initializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); break; case 258 /* ShorthandPropertyAssignment */: - result = reduceNode(node.name, f, result); - result = reduceNode(node.objectAssignmentInitializer, f, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; case 259 /* SpreadAssignment */: - result = reduceNode(node.expression, f, result); + result = reduceNode(node.expression, cbNode, result); break; // Top-level nodes case 261 /* SourceFile */: - result = ts.reduceLeft(node.statements, f, result); + result = reduceNodes(node.statements, cbNodes, result); break; - case 293 /* PartiallyEmittedExpression */: - result = reduceNode(node.expression, f, result); + case 294 /* PartiallyEmittedExpression */: + result = reduceNode(node.expression, cbNode, result); break; default: var edgeTraversalPath = nodeEdgeTraversalMap[kind]; @@ -43938,8 +44395,8 @@ var ts; var value = node[edge.name]; if (value !== undefined) { result = ts.isArray(value) - ? ts.reduceLeft(value, f, result) - : f(result, value); + ? reduceNodes(value, cbNodes, result) + : cbNode(result, value); } } } @@ -43949,8 +44406,8 @@ var ts; } ts.reduceEachChild = reduceEachChild; function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { - if (node === undefined) { - return undefined; + if (node === undefined || visitor === undefined) { + return node; } aggregateTransformFlags(node); var visited = visitor(node); @@ -44034,6 +44491,43 @@ var ts; return updated || nodes; } ts.visitNodes = visitNodes; + /** + * Starts a new lexical environment and visits a statement list, ending the lexical environment + * and merging hoisted declarations upon completion. + */ + function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) { + context.startLexicalEnvironment(); + statements = visitNodes(statements, visitor, ts.isStatement, start); + if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { + statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements); + } + var declarations = context.endLexicalEnvironment(); + return ts.createNodeArray(ts.concatenate(statements, declarations), statements); + } + ts.visitLexicalEnvironment = visitLexicalEnvironment; + /** + * Starts a new lexical environment and visits a parameter list, suspending the lexical + * environment upon completion. + */ + function visitParameterList(nodes, visitor, context) { + context.startLexicalEnvironment(); + var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration); + context.suspendLexicalEnvironment(); + return updated; + } + ts.visitParameterList = visitParameterList; + function visitFunctionBody(node, visitor, context) { + context.resumeLexicalEnvironment(); + var updated = visitNode(node, visitor, ts.isConciseBody); + var declarations = context.endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(updated); + var statements = mergeLexicalEnvironment(block.statements, declarations); + return ts.updateBlock(block, statements); + } + return updated; + } + ts.visitFunctionBody = visitFunctionBody; function visitEachChild(node, visitor, context) { if (node === undefined) { return undefined; @@ -44059,25 +44553,25 @@ var ts; return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); // Signature elements case 144 /* Parameter */: - return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); + return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); // Type member case 147 /* PropertyDeclaration */: return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); case 149 /* MethodDeclaration */: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); case 150 /* Constructor */: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 151 /* GetAccessor */: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); case 152 /* SetAccessor */: - return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); // Binding patterns case 172 /* ObjectBindingPattern */: return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 173 /* ArrayBindingPattern */: return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); case 174 /* BindingElement */: - return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); + return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); // Expression case 175 /* ArrayLiteralExpression */: return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); @@ -44096,9 +44590,9 @@ var ts; case 183 /* ParenthesizedExpression */: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 184 /* FunctionExpression */: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); case 185 /* ArrowFunction */: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); case 186 /* DeleteExpression */: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 187 /* TypeOfExpression */: @@ -44168,7 +44662,7 @@ var ts; case 224 /* VariableDeclarationList */: return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 225 /* FunctionDeclaration */: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment())); + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); case 226 /* ClassDeclaration */: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); case 232 /* CaseBlock */: @@ -44224,10 +44718,9 @@ var ts; return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Top-level nodes case 261 /* SourceFile */: - context.startLexicalEnvironment(); - return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements)); + return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 293 /* PartiallyEmittedExpression */: + case 294 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; @@ -44256,6 +44749,15 @@ var ts; // return node; } ts.visitEachChild = visitEachChild; + function mergeLexicalEnvironment(statements, declarations) { + if (!ts.some(declarations)) { + return statements; + } + return ts.isNodeArray(statements) + ? ts.createNodeArray(ts.concatenate(statements, declarations), statements) + : ts.addRange(statements, declarations); + } + ts.mergeLexicalEnvironment = mergeLexicalEnvironment; function mergeFunctionBodyLexicalEnvironment(body, declarations) { if (body && declarations !== undefined && declarations.length > 0) { if (ts.isBlock(body)) { @@ -44308,13 +44810,25 @@ var ts; if (node === undefined) { return 0 /* None */; } - else if (node.transformFlags & 536870912 /* HasComputedFlags */) { + if (node.transformFlags & 536870912 /* HasComputedFlags */) { return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind); } - else { - var subtreeFlags = aggregateTransformFlagsForSubtree(node); - return ts.computeTransformFlagsForNode(node, subtreeFlags); + var subtreeFlags = aggregateTransformFlagsForSubtree(node); + return ts.computeTransformFlagsForNode(node, subtreeFlags); + } + function aggregateTransformFlagsForNodeArray(nodes) { + if (nodes === undefined) { + return 0 /* None */; } + var subtreeFlags = 0 /* None */; + var nodeArrayFlags = 0 /* None */; + for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { + var node = nodes_3[_i]; + subtreeFlags |= aggregateTransformFlagsForNode(node); + nodeArrayFlags |= node.transformFlags & ~536870912 /* HasComputedFlags */; + } + nodes.transformFlags = nodeArrayFlags | 536870912 /* HasComputedFlags */; + return subtreeFlags; } /** * Aggregates the transform flags for the subtree of a node. @@ -44326,14 +44840,17 @@ var ts; return 0 /* None */; } // Aggregate the transform flags of each child. - return reduceEachChild(node, aggregateTransformFlagsForChildNode, 0 /* None */); + return reduceEachChild(node, 0 /* None */, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); } /** * Aggregates the TransformFlags of a child node with the TransformFlags of its * siblings. */ - function aggregateTransformFlagsForChildNode(transformFlags, child) { - return transformFlags | aggregateTransformFlagsForNode(child); + function aggregateTransformFlagsForChildNode(transformFlags, node) { + return transformFlags | aggregateTransformFlagsForNode(node); + } + function aggregateTransformFlagsForChildNodes(transformFlags, nodes) { + return transformFlags | aggregateTransformFlagsForNodeArray(nodes); } var Debug; (function (Debug) { @@ -44343,9 +44860,21 @@ var ts; Debug.failBadSyntaxKind = Debug.shouldAssert(1 /* Normal */) ? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); } : ts.noop; + Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */) + ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }); } + : ts.noop; Debug.assertNode = Debug.shouldAssert(1 /* Normal */) ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); } : ts.noop; + Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */) + ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); } + : ts.noop; + Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */) + ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }); } + : ts.noop; + Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */) + ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }); } + : ts.noop; function getFunctionName(func) { if (typeof func !== "function") { return ""; @@ -44367,504 +44896,348 @@ var ts; /*@internal*/ var ts; (function (ts) { + var FlattenLevel; + (function (FlattenLevel) { + FlattenLevel[FlattenLevel["All"] = 0] = "All"; + FlattenLevel[FlattenLevel["ObjectRest"] = 1] = "ObjectRest"; + })(FlattenLevel = ts.FlattenLevel || (ts.FlattenLevel = {})); /** - * Flattens a destructuring assignment expression. + * Flattens a DestructuringAssignment or a VariableDeclaration to an expression. * - * @param root The destructuring assignment expression. - * @param needsValue Indicates whether the value from the right-hand-side of the - * destructuring assignment is needed as part of a larger expression. - * @param recordTempVariable A callback used to record new temporary variables. - * @param visitor An optional visitor to use to visit expressions. + * @param node The node to flatten. + * @param visitor An optional visitor used to visit initializers. + * @param context The transformation context. + * @param level Indicates the extent to which flattening should occur. + * @param needsValue An optional value indicating whether the value from the right-hand-side of + * the destructuring assignment is needed as part of a larger expression. + * @param createAssignmentCallback An optional callback used to create the assignment expression. */ - function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) { - if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { - var right = node.right; - if (ts.isDestructuringAssignment(right)) { - return flattenDestructuringAssignment(context, right, needsValue, recordTempVariable, visitor); - } - else { - return node.right; - } - } + function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) { var location = node; - var value = node.right; - var expressions = []; - if (needsValue) { - // If the right-hand value of the destructuring assignment needs to be preserved (as - // is the case when the destructuring assignmen) is part of a larger expression), - // then we need to cache the right-hand value. - // - // The source map location for the assignment should point to the entire binary - // expression. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment, visitor); + var value; + if (ts.isDestructuringAssignment(node)) { + value = node.right; + while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { + if (ts.isDestructuringAssignment(value)) { + location = node = value; + value = node.right; + } + else { + return value; + } + } } - else if (ts.nodeIsSynthesized(node)) { - // Generally, the source map location for a destructuring assignment is the root - // expression. - // - // However, if the root expression is synthesized (as in the case - // of the initializer when transforming a ForOfStatement), then the source map - // location should point to the right-hand value of the expression. - location = value; + var expressions; + var flattenContext = { + context: context, + level: level, + hoistTempVariables: true, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern, + createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern, + createArrayBindingOrAssignmentElement: makeAssignmentElement, + visitor: visitor + }; + if (value) { + value = ts.visitNode(value, visitor, ts.isExpression); + if (needsValue) { + // If the right-hand value of the destructuring assignment needs to be preserved (as + // is the case when the destructuring assignment is part of a larger expression), + // then we need to cache the right-hand value. + // + // The source map location for the assignment should point to the entire binary + // expression. + value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location); + } + else if (ts.nodeIsSynthesized(node)) { + // Generally, the source map location for a destructuring assignment is the root + // expression. + // + // However, if the root expression is synthesized (as in the case + // of the initializer when transforming a ForOfStatement), then the source map + // location should point to the right-hand value of the expression. + location = value; + } } - flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor); - if (needsValue) { + flattenBindingOrAssignmentElement(flattenContext, node, value, location, /*skipInitializer*/ ts.isDestructuringAssignment(node)); + if (value && needsValue) { + if (!ts.some(expressions)) { + return value; + } expressions.push(value); } - var expression = ts.inlineExpressions(expressions); - ts.aggregateTransformFlags(expression); - return expression; - function emitAssignment(name, value, location) { - var expression = ts.createAssignment(name, value, location); + return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression(); + function emitExpression(expression) { // NOTE: this completely disables source maps, but aligns with the behavior of // `emitAssignment` in the old emitter. - ts.setEmitFlags(expression, 2048 /* NoNestedSourceMaps */); + ts.setEmitFlags(expression, 64 /* NoNestedSourceMaps */); ts.aggregateTransformFlags(expression); - expressions.push(expression); + expressions = ts.append(expressions, expression); } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - emitAssignment(name, value, location); - return name; - } - function emitRestAssignment(elements, value, location) { - emitAssignment(ts.createObjectLiteral(elements), value, location); + function emitBindingOrAssignment(target, value, location, original) { + ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); + var expression = createAssignmentCallback + ? createAssignmentCallback(target, value, location) + : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location); + expression.original = original; + emitExpression(expression); } } ts.flattenDestructuringAssignment = flattenDestructuringAssignment; /** - * Flattens binding patterns in a parameter declaration. + * Flattens a VariableDeclaration or ParameterDeclaration to one or more variable declarations. * - * @param node The ParameterDeclaration to flatten. - * @param value The rhs value for the binding pattern. - * @param visitor An optional visitor to use to visit expressions. + * @param node The node to flatten. + * @param visitor An optional visitor used to visit initializers. + * @param context The transformation context. + * @param boundValue The value bound to the declaration. + * @param skipInitializer A value indicating whether to ignore the initializer of `node`. + * @param hoistTempVariables Indicates whether temporary variables should not be recorded in-line. + * @param level Indicates the extent to which flattening should occur. */ - function flattenParameterDestructuring(node, value, visitor, transformRest) { + function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) { + var pendingExpressions; + var pendingDeclarations = []; var declarations = []; - flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor); + var flattenContext = { + context: context, + level: level, + hoistTempVariables: hoistTempVariables, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayBindingPattern, + createObjectBindingOrAssignmentPattern: makeObjectBindingPattern, + createArrayBindingOrAssignmentElement: makeBindingElement, + visitor: visitor + }; + flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer); + if (pendingExpressions) { + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + if (hoistTempVariables) { + var value = ts.inlineExpressions(pendingExpressions); + pendingExpressions = undefined; + emitBindingOrAssignment(temp, value, /*location*/ undefined, /*original*/ undefined); + } + else { + context.hoistVariableDeclaration(temp); + var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations); + pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value)); + ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions); + pendingDeclaration.value = temp; + } + } + for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_30 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name_30, + /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + variable.original = original; + if (ts.isIdentifier(name_30)) { + ts.setEmitFlags(variable, 64 /* NoNestedSourceMaps */); + } + ts.aggregateTransformFlags(variable); + declarations.push(variable); + } return declarations; - function emitAssignment(name, value, location) { - var declaration = ts.createVariableDeclaration(name, /*type*/ undefined, value, location); - // NOTE: this completely disables source maps, but aligns with the behavior of - // `emitAssignment` in the old emitter. - ts.setEmitFlags(declaration, 2048 /* NoNestedSourceMaps */); - ts.aggregateTransformFlags(declaration); - declarations.push(declaration); + function emitExpression(value) { + pendingExpressions = ts.append(pendingExpressions, value); } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(/*recordTempVariable*/ undefined); - emitAssignment(name, value, location); - return name; - } - function emitRestAssignment(elements, value, location) { - emitAssignment(ts.createObjectBindingPattern(elements), value, location); + function emitBindingOrAssignment(target, value, location, original) { + ts.Debug.assertNode(target, ts.isBindingName); + if (pendingExpressions) { + value = ts.inlineExpressions(ts.append(pendingExpressions, value)); + pendingExpressions = undefined; + } + pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original }); } } - ts.flattenParameterDestructuring = flattenParameterDestructuring; + ts.flattenDestructuringBinding = flattenDestructuringBinding; /** - * Flattens binding patterns in a variable declaration. + * Flattens a BindingOrAssignmentElement into zero or more bindings or assignments. * - * @param node The VariableDeclaration to flatten. - * @param value An optional rhs value for the binding pattern. - * @param visitor An optional visitor to use to visit expressions. + * @param flattenContext Options used to control flattening. + * @param element The element to flatten. + * @param value The current RHS value to assign to the element. + * @param location The location to use for source maps and comments. + * @param skipInitializer An optional value indicating whether to include the initializer + * for the element. */ - function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) { - var declarations = []; - var pendingAssignments; - flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor); - return declarations; - function emitAssignment(name, value, location, original) { - if (pendingAssignments) { - pendingAssignments.push(value); - value = ts.inlineExpressions(pendingAssignments); - pendingAssignments = undefined; - } - var declaration = ts.createVariableDeclaration(name, /*type*/ undefined, value, location); - declaration.original = original; - // NOTE: this completely disables source maps, but aligns with the behavior of - // `emitAssignment` in the old emitter. - ts.setEmitFlags(declaration, 2048 /* NoNestedSourceMaps */); - declarations.push(declaration); - ts.aggregateTransformFlags(declaration); - } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - if (recordTempVariable) { - var assignment = ts.createAssignment(name, value, location); - if (pendingAssignments) { - pendingAssignments.push(assignment); - } - else { - pendingAssignments = [assignment]; - } - } - else { - emitAssignment(name, value, location, /*original*/ undefined); - } - return name; - } - function emitRestAssignment(elements, value, location, original) { - emitAssignment(ts.createObjectBindingPattern(elements), value, location, original); - } - } - ts.flattenVariableDestructuring = flattenVariableDestructuring; - /** - * Flattens binding patterns in a variable declaration and transforms them into an expression. - * - * @param node The VariableDeclaration to flatten. - * @param recordTempVariable A callback used to record new temporary variables. - * @param createAssignmentCallback An optional callback used to create assignment expressions - * for non-temporary variables. - * @param visitor An optional visitor to use to visit expressions. - */ - function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) { - var pendingAssignments = []; - flattenDestructuring(node, /*value*/ undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, /*transformRest*/ false, visitor); - var expression = ts.inlineExpressions(pendingAssignments); - ts.aggregateTransformFlags(expression); - return expression; - function emitAssignment(name, value, location, original) { - var expression = createAssignmentCallback - ? createAssignmentCallback(name.kind === 70 /* Identifier */ ? name : emitTempVariableAssignment(name, location), value, location) - : ts.createAssignment(name, value, location); - emitPendingAssignment(expression, original); - } - function emitTempVariableAssignment(value, location) { - var name = ts.createTempVariable(recordTempVariable); - emitPendingAssignment(ts.createAssignment(name, value, location), /*original*/ undefined); - return name; - } - function emitRestAssignment(elements, value, location, original) { - emitAssignment(ts.createObjectLiteral(elements), value, location, original); - } - function emitPendingAssignment(expression, original) { - expression.original = original; - // NOTE: this completely disables source maps, but aligns with the behavior of - // `emitAssignment` in the old emitter. - ts.setEmitFlags(expression, 2048 /* NoNestedSourceMaps */); - pendingAssignments.push(expression); - } - } - ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression; - function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) { - if (value && visitor) { - value = ts.visitNode(value, visitor, ts.isExpression); - } - if (ts.isBinaryExpression(root)) { - emitDestructuringAssignment(root.left, value, location); - } - else { - emitBindingElement(root, value); - } - function emitDestructuringAssignment(bindingTarget, value, location) { - // When emitting target = value use source map node to highlight, including any temporary assignments needed for this - var target; - if (ts.isShorthandPropertyAssignment(bindingTarget)) { - var initializer = visitor - ? ts.visitNode(bindingTarget.objectAssignmentInitializer, visitor, ts.isExpression) - : bindingTarget.objectAssignmentInitializer; - if (initializer) { - value = createDefaultValueCheck(value, initializer, location); - } - target = bindingTarget.name; - } - else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57 /* EqualsToken */) { - var initializer = visitor - ? ts.visitNode(bindingTarget.right, visitor, ts.isExpression) - : bindingTarget.right; - value = createDefaultValueCheck(value, initializer, location); - target = bindingTarget.left; - } - else { - target = bindingTarget; - } - if (target.kind === 176 /* ObjectLiteralExpression */) { - emitObjectLiteralAssignment(target, value, location); - } - else if (target.kind === 175 /* ArrayLiteralExpression */) { - emitArrayLiteralAssignment(target, value, location); - } - else { - var name_30 = ts.getMutableClone(target); - ts.setSourceMapRange(name_30, target); - ts.setCommentRange(name_30, target); - emitAssignment(name_30, value, location, /*original*/ undefined); - } - } - function emitObjectLiteralAssignment(target, value, location) { - var properties = target.properties; - if (properties.length !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - // When doing so we want to hightlight the passed in source map node since thats the one needing this temp assignment - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment); - } - var bindingElements = []; - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; - if (p.kind === 257 /* PropertyAssignment */ || p.kind === 258 /* ShorthandPropertyAssignment */) { - if (!transformRest || - p.transformFlags & 8388608 /* ContainsSpreadExpression */ || - (p.kind === 257 /* PropertyAssignment */ && p.initializer.transformFlags & 8388608 /* ContainsSpreadExpression */)) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - var propName = p.name; - var bindingTarget = p.kind === 258 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; - // Assignment for bindingTarget = value.propName should highlight whole property, hence use p as source map node - emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p); - } - else { - bindingElements.push(p); - } - } - else if (i === properties.length - 1 && - p.kind === 259 /* SpreadAssignment */ && - p.expression.kind === 70 /* Identifier */) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - var propName = p.expression; - var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target); - emitDestructuringAssignment(propName, restCall, p); - } - } - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, location, target); - bindingElements = []; - } - } - function emitArrayLiteralAssignment(target, value, location) { - if (transformRest) { - emitESNextArrayLiteralAssignment(target, value, location); - } - else { - emitES2015ArrayLiteralAssignment(target, value, location); - } - } - function emitESNextArrayLiteralAssignment(target, value, location) { - var elements = target.elements; - var numElements = elements.length; - if (numElements !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - // When doing so we want to highlight the passed-in source map node since thats the one needing this temp assignment - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment); - } - var expressions = []; - var spreadContainingExpressions = []; - for (var i = 0; i < numElements; i++) { - var e = elements[i]; - if (e.kind === 198 /* OmittedExpression */) { - continue; - } - if (e.transformFlags & 8388608 /* ContainsSpreadExpression */ && i < numElements - 1) { - var tmp = ts.createTempVariable(recordTempVariable); - spreadContainingExpressions.push([e, tmp]); - expressions.push(tmp); - } - else { - expressions.push(e); - } - } - emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined); - for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) { - var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1]; - emitDestructuringAssignment(e, tmp, e); - } - } - function emitES2015ArrayLiteralAssignment(target, value, location) { - var elements = target.elements; - var numElements = elements.length; - if (numElements !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - // When doing so we want to highlight the passed-in source map node since thats the one needing this temp assignment - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment); - } - for (var i = 0; i < numElements; i++) { - var e = elements[i]; - if (e.kind !== 198 /* OmittedExpression */) { - // Assignment for target = value.propName should highligh whole property, hence use e as source map node - if (e.kind !== 196 /* SpreadElement */) { - emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e); - } - else if (i === numElements - 1) { - emitDestructuringAssignment(e.expression, ts.createArraySlice(value, i), e); - } - } - } - } - /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement - * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/ - function createRestCall(value, elements, getPropertyName, location) { - var propertyNames = []; - for (var i = 0; i < elements.length - 1; i++) { - if (ts.isOmittedExpression(elements[i])) { - continue; - } - var str = ts.createSynthesizedNode(9 /* StringLiteral */); - str.pos = location.pos; - str.end = location.end; - str.text = ts.getTextOfPropertyName(getPropertyName(elements[i])); - propertyNames.push(str); - } - var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]); - return ts.createCall(ts.createIdentifier("__rest"), undefined, args); - } - function emitBindingElement(target, value) { - // Any temporary assignments needed to emit target = value should point to target - var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer; - if (transformRest) { - value = value || initializer; - } - else if (initializer) { + function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) { + if (!skipInitializer) { + var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression); + if (initializer) { // Combine value and initializer - value = value ? createDefaultValueCheck(value, initializer, target) : initializer; + value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer; } else if (!value) { // Use 'void 0' in absence of value and initializer value = ts.createVoidZero(); } - var name = target.name; - if (!ts.isBindingPattern(name)) { - emitAssignment(name, value, target, target); - } - else { - var numElements = name.elements.length; - if (numElements !== 1) { - // For anything other than a single-element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. Additionally, if we have zero elements - // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, - // so in that case, we'll intentionally create that temporary. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0, target, emitTempVariableAssignment); - } - if (name.kind === 173 /* ArrayBindingPattern */) { - emitArrayBindingElement(name, value); + } + var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element); + if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) { + flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) { + flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else { + flattenContext.emitBindingOrAssignment(bindingTarget, value, location, /*original*/ element); + } + } + /** + * Flattens an ObjectBindingOrAssignmentPattern into zero or more bindings or assignments. + * + * @param flattenContext Options used to control flattening. + * @param parent The parent element of the pattern. + * @param pattern The ObjectBindingOrAssignmentPattern to flatten. + * @param value The current RHS value to assign to the element. + * @param location The location to use for source maps and comments. + */ + function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1) { + // For anything other than a single-element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. Additionally, if we have zero elements + // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, + // so in that case, we'll intentionally create that temporary. + var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var computedTempVariables; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element); + if (flattenContext.level >= 1 /* ObjectRest */ + && !(element.transformFlags & (524288 /* ContainsRest */ | 1048576 /* ContainsObjectRest */)) + && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 /* ContainsRest */ | 1048576 /* ContainsObjectRest */)) + && !ts.isComputedPropertyName(propertyName)) { + bindingElements = ts.append(bindingElements, element); } else { - emitObjectBindingElement(target, value); - } - } - } - function emitArrayBindingElement(name, value) { - if (transformRest) { - emitESNextArrayBindingElement(name, value); - } - else { - emitES2015ArrayBindingElement(name, value); - } - } - function emitES2015ArrayBindingElement(name, value) { - var elements = name.elements; - var numElements = elements.length; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (!element.dotDotDotToken) { - // Rewrite element to a declaration that accesses array element at index i - emitBindingElement(element, ts.createElementAccess(value, i)); - } - else if (i === numElements - 1) { - emitBindingElement(element, ts.createArraySlice(value, i)); - } - } - } - function emitESNextArrayBindingElement(name, value) { - var elements = name.elements; - var numElements = elements.length; - var bindingElements = []; - var spreadContainingElements = []; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (element.transformFlags & 8388608 /* ContainsSpreadExpression */ && i < numElements - 1) { - spreadContainingElements.push(element); - bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value)); - } - else { - bindingElements.push(element); - } - } - emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined); - for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) { - var element = spreadContainingElements_1[_i]; - emitBindingElement(element, ts.getGeneratedNameForNode(element)); - } - } - function emitObjectBindingElement(target, value) { - var name = target.name; - var elements = name.elements; - var numElements = elements.length; - var bindingElements = []; - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (ts.isOmittedExpression(element)) { - continue; - } - if (i === numElements - 1 && element.dotDotDotToken) { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; } - var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name); - emitBindingElement(element, restCall); - } - else if (transformRest && !(element.transformFlags & 8388608 /* ContainsSpreadExpression */)) { - // do not emit until we have a complete bundle of ES2015 syntax - bindingElements.push(element); - } - else { - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName); + if (ts.isComputedPropertyName(propertyName)) { + computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression); } - // Rewrite element to a declaration with an initializer that fetches property - var propName = element.propertyName || element.name; - emitBindingElement(element, createDestructuringPropertyAccess(value, propName)); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element); } } - if (bindingElements.length) { - emitRestAssignment(bindingElements, value, target, target); - bindingElements = []; + else if (i === numElements - 1) { + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; + } + var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); } } - function createDefaultValueCheck(value, defaultValue, location) { - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment); - return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54 /* QuestionToken */), defaultValue, ts.createToken(55 /* ColonToken */), value); + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); } - /** - * Creates either a PropertyAccessExpression or an ElementAccessExpression for the - * right-hand side of a transformed destructuring assignment. - * - * @param expression The right-hand expression that is the source of the property. - * @param propertyName The destructuring property name. - */ - function createDestructuringPropertyAccess(expression, propertyName) { - if (ts.isComputedPropertyName(propertyName)) { - return ts.createElementAccess(expression, ensureIdentifier(propertyName.expression, /*reuseIdentifierExpressions*/ false, /*location*/ propertyName, emitTempVariableAssignment)); - } - else if (ts.isLiteralExpression(propertyName)) { - var clone_2 = ts.getSynthesizedClone(propertyName); - clone_2.text = ts.unescapeIdentifier(clone_2.text); - return ts.createElementAccess(expression, clone_2); - } - else { - if (ts.isGeneratedIdentifier(propertyName)) { - var clone_3 = ts.getSynthesizedClone(propertyName); - clone_3.text = ts.unescapeIdentifier(clone_3.text); - return ts.createPropertyAccess(expression, clone_3); + } + /** + * Flattens an ArrayBindingOrAssignmentPattern into zero or more bindings or assignments. + * + * @param flattenContext Options used to control flattening. + * @param parent The parent element of the pattern. + * @param pattern The ArrayBindingOrAssignmentPattern to flatten. + * @param value The current RHS value to assign to the element. + * @param location The location to use for source maps and comments. + */ + function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1 && (flattenContext.level < 1 /* ObjectRest */ || numElements === 0)) { + // For anything other than a single-element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. Additionally, if we have zero elements + // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, + // so in that case, we'll intentionally create that temporary. + var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var restContainingElements; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (flattenContext.level >= 1 /* ObjectRest */) { + // If an array pattern contains an ObjectRest, we must cache the result so that we + // can perform the ObjectRest destructuring in a different declaration + if (element.transformFlags & 1048576 /* ContainsObjectRest */) { + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + } + restContainingElements = ts.append(restContainingElements, [temp, element]); + bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp)); } else { - return ts.createPropertyAccess(expression, ts.createIdentifier(ts.unescapeIdentifier(propertyName.text))); + bindingElements = ts.append(bindingElements, element); } } + else if (ts.isOmittedExpression(element)) { + continue; + } + else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var rhsValue = ts.createElementAccess(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element); + } + else if (i === numElements - 1) { + var rhsValue = ts.createArraySlice(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element); + } + } + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern); + } + if (restContainingElements) { + for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) { + var _a = restContainingElements_1[_i], id = _a[0], element = _a[1]; + flattenBindingOrAssignmentElement(flattenContext, element, id, element); + } + } + } + /** + * Creates an expression used to provide a default value if a value is `undefined` at runtime. + * + * @param flattenContext Options used to control flattening. + * @param value The RHS value to test. + * @param defaultValue The default value to use if `value` is `undefined` at runtime. + * @param location The location to use for source maps and comments. + */ + function createDefaultValueCheck(flattenContext, value, defaultValue, location) { + value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location); + return ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value); + } + /** + * Creates either a PropertyAccessExpression or an ElementAccessExpression for the + * right-hand side of a transformed destructuring assignment. + * + * @link https://tc39.github.io/ecma262/#sec-runtime-semantics-keyeddestructuringassignmentevaluation + * + * @param flattenContext Options used to control flattening. + * @param value The RHS value that is the source of the property. + * @param propertyName The destructuring property name. + */ + function createDestructuringPropertyAccess(flattenContext, value, propertyName) { + if (ts.isComputedPropertyName(propertyName)) { + var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, /*reuseIdentifierExpressions*/ false, /*location*/ propertyName); + return ts.createElementAccess(value, argumentExpression); + } + else if (ts.isStringOrNumericLiteral(propertyName)) { + var argumentExpression = ts.getSynthesizedClone(propertyName); + argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text); + return ts.createElementAccess(value, argumentExpression); + } + else { + var name_31 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name_31); } } /** @@ -44872,24 +45245,75 @@ var ts; * This function is useful to ensure that the expression's value can be read from in subsequent expressions. * Unless 'reuseIdentifierExpressions' is false, 'value' will be returned if it is just an identifier. * + * @param flattenContext Options used to control flattening. * @param value the expression whose value needs to be bound. * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; - * false if it is necessary to always emit an identifier. + * false if it is necessary to always emit an identifier. * @param location The location to use for source maps and comments. - * @param emitTempVariableAssignment A callback used to emit a temporary variable. - * @param visitor An optional callback used to visit the value. */ - function ensureIdentifier(value, reuseIdentifierExpressions, location, emitTempVariableAssignment, visitor) { + function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { if (ts.isIdentifier(value) && reuseIdentifierExpressions) { return value; } else { - if (visitor) { - value = ts.visitNode(value, visitor, ts.isExpression); + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + flattenContext.emitExpression(ts.createAssignment(temp, value, location)); } - return emitTempVariableAssignment(value, location); + else { + flattenContext.emitBindingOrAssignment(temp, value, location, /*original*/ undefined); + } + return temp; } } + function makeArrayBindingPattern(elements) { + ts.Debug.assertEachNode(elements, ts.isArrayBindingElement); + return ts.createArrayBindingPattern(elements); + } + function makeArrayAssignmentPattern(elements) { + return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement)); + } + function makeObjectBindingPattern(elements) { + ts.Debug.assertEachNode(elements, ts.isBindingElement); + return ts.createObjectBindingPattern(elements); + } + function makeObjectAssignmentPattern(elements) { + return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement)); + } + function makeBindingElement(name) { + return ts.createBindingElement(/*propertyName*/ undefined, /*dotDotDotToken*/ undefined, name); + } + function makeAssignmentElement(name) { + return name; + } + var restHelper = { + name: "typescript:rest", + scoped: false, + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + }; + /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement + * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/ + function createRestCall(context, value, elements, computedTempVariables, location) { + context.requestEmitHelper(restHelper); + var propertyNames = []; + var computedTempVariableOffset = 0; + for (var i = 0; i < elements.length - 1; i++) { + var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]); + if (propertyName) { + if (ts.isComputedPropertyName(propertyName)) { + var temp = computedTempVariables[computedTempVariableOffset]; + computedTempVariableOffset++; + // typeof _tmp === "symbol" ? _tmp : _tmp + "" + propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral("")))); + } + else { + propertyNames.push(ts.createLiteral(propertyName)); + } + } + } + return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + } })(ts || (ts = {})); /// /// @@ -44911,7 +45335,7 @@ var ts; TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NonQualifiedEnumMembers"] = 8] = "NonQualifiedEnumMembers"; })(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {})); function transformTypeScript(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); @@ -44931,7 +45355,6 @@ var ts; var currentNamespaceContainerName; var currentScope; var currentScopeFirstDeclarationsOfName; - var currentExternalHelpersModuleName; /** * Keeps track of whether expression substitution has been enabled for specific edge cases. * They are persisted between each SourceFile transformation and should not be reset. @@ -44957,7 +45380,11 @@ var ts; if (ts.isDeclarationFile(node)) { return node; } - return ts.visitNode(node, visitor, ts.isSourceFile); + currentSourceFile = node; + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } /** * Visits a node, saving and restoring state variables on the stack. @@ -44978,6 +45405,29 @@ var ts; currentScope = savedCurrentScope; return visited; } + /** + * Performs actions that should always occur immediately before visiting a node. + * + * @param node The node to visit. + */ + function onBeforeVisitNode(node) { + switch (node.kind) { + case 261 /* SourceFile */: + case 232 /* CaseBlock */: + case 231 /* ModuleBlock */: + case 204 /* Block */: + currentScope = node; + currentScopeFirstDeclarationsOfName = undefined; + break; + case 226 /* ClassDeclaration */: + case 225 /* FunctionDeclaration */: + if (ts.hasModifier(node, 2 /* Ambient */)) { + break; + } + recordEmittedDeclarationInScope(node); + break; + } + } /** * General-purpose node visitor. * @@ -44992,10 +45442,7 @@ var ts; * @param node The node to visit. */ function visitorWorker(node) { - if (node.kind === 261 /* SourceFile */) { - return visitSourceFile(node); - } - else if (node.transformFlags & 1 /* TypeScript */) { + if (node.transformFlags & 1 /* TypeScript */) { // This node is explicitly marked as TypeScript, so we should transform the node. return visitTypeScript(node); } @@ -45164,7 +45611,8 @@ var ts; case 228 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. case 147 /* PropertyDeclaration */: - // TypeScript property declarations are elided. + // TypeScript property declarations are elided. + return undefined; case 150 /* Constructor */: return visitConstructor(node); case 227 /* InterfaceDeclaration */: @@ -45265,67 +45713,9 @@ var ts; return ts.visitEachChild(node, visitor, context); } } - /** - * Performs actions that should always occur immediately before visiting a node. - * - * @param node The node to visit. - */ - function onBeforeVisitNode(node) { - switch (node.kind) { - case 261 /* SourceFile */: - case 232 /* CaseBlock */: - case 231 /* ModuleBlock */: - case 204 /* Block */: - currentScope = node; - currentScopeFirstDeclarationsOfName = undefined; - break; - case 226 /* ClassDeclaration */: - case 225 /* FunctionDeclaration */: - if (ts.hasModifier(node, 2 /* Ambient */)) { - break; - } - recordEmittedDeclarationInScope(node); - break; - } - } function visitSourceFile(node) { - currentSourceFile = node; - // ensure "use strict" is emitted in all scenarios in alwaysStrict mode - // There is no need to emit "use strict" in the following cases: - // 1. The file is an external module and target is es2015 or higher - // or 2. The file is an external module and module-kind is es6 or es2015 as such value is not allowed when targeting es5 or lower - if (compilerOptions.alwaysStrict && - !(ts.isExternalModule(node) && (compilerOptions.target >= 2 /* ES2015 */ || compilerOptions.module === ts.ModuleKind.ES2015))) { - node = ts.ensureUseStrict(node); - } - // If the source file requires any helpers and is an external module, and - // the importHelpers compiler option is enabled, emit a synthesized import - // statement for the helpers library. - if (node.flags & 64512 /* EmitHelperFlags */ - && compilerOptions.importHelpers - && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); - var externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText); - var externalHelpersModuleImport = ts.createImportDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); - externalHelpersModuleImport.parent = node; - externalHelpersModuleImport.flags &= ~8 /* Synthesized */; - statements.push(externalHelpersModuleImport); - currentExternalHelpersModuleName = externalHelpersModuleName; - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); - currentExternalHelpersModuleName = undefined; - node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); - node.externalHelpersModuleName = externalHelpersModuleName; - } - else { - node = ts.visitEachChild(node, sourceElementVisitor, context); - } - ts.setEmitFlags(node, 1 /* EmitEmitHelpers */ | ts.getEmitFlags(node)); - return node; + var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); + return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict)); } /** * Tests whether we should emit a __decorate call for a class declaration. @@ -45402,7 +45792,7 @@ var ts; if (statements.length > 1) { // Add a DeclarationMarker as a marker for the end of the declaration statements.push(ts.createEndOfDeclarationMarker(node)); - ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432 /* HasEndOfDeclarationMarker */); + ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152 /* HasEndOfDeclarationMarker */); } return ts.singleOrMany(statements); } @@ -45425,7 +45815,7 @@ var ts; // To better align with the old emitter, we should not emit a trailing source map // entry if the class has static properties. if (hasStaticProperties) { - emitFlags |= 1024 /* NoTrailingSourceMap */; + emitFlags |= 32 /* NoTrailingSourceMap */; } ts.setOriginalNode(classDeclaration, node); ts.setEmitFlags(classDeclaration, emitFlags); @@ -45570,7 +45960,7 @@ var ts; } // To preserve the behavior of the old emitter, we explicitly indent // the body of a class with static initializers. - ts.setEmitFlags(classExpression, 524288 /* Indented */ | ts.getEmitFlags(classExpression)); + ts.setEmitFlags(classExpression, 32768 /* Indented */ | ts.getEmitFlags(classExpression)); expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression))); ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp)); expressions.push(ts.startOnNewLine(temp)); @@ -45604,7 +45994,7 @@ var ts; // If there is a property assignment, we need to emit constructor whether users define it or not // If there is no property assignment, we can omit constructor if users do not define it var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty); - var hasParameterPropertyAssignments = node.transformFlags & 4194304 /* ContainsParameterPropertyAssignments */; + var hasParameterPropertyAssignments = node.transformFlags & 262144 /* ContainsParameterPropertyAssignments */; var constructor = ts.getFirstConstructorWithBody(node); // If the class does not contain nodes that require a synthesized constructor, // accept the current constructor if it exists. @@ -45644,9 +46034,8 @@ var ts; // downlevel the '...args' portion less efficiently by naively copying the contents of 'arguments' to an array. // Instead, we'll avoid using a rest parameter and spread into the super call as // 'super(...arguments)' instead of 'super(...args)', as you can see in "transformConstructorBody". - return constructor - ? ts.visitNodes(constructor.parameters, visitor, ts.isParameter) - : []; + return ts.visitParameterList(constructor && constructor.parameters, visitor, context) + || []; } /** * Transforms (or creates) a constructor body for a class with parameter property @@ -45659,8 +46048,7 @@ var ts; function transformConstructorBody(node, constructor, hasExtendsClause) { var statements = []; var indexOfFirstStatement = 0; - // The body of a constructor is a new lexical environment - startLexicalEnvironment(); + resumeLexicalEnvironment(); if (constructor) { indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements); // Add parameters with property assignments. Transforms this: @@ -45704,9 +46092,10 @@ var ts; } // End the lexical environment. ts.addRange(statements, endLexicalEnvironment()); - return ts.setMultiLine(ts.createBlock(ts.createNodeArray(statements, + return ts.createBlock(ts.createNodeArray(statements, /*location*/ constructor ? constructor.body.statements : node.members), - /*location*/ constructor ? constructor.body : undefined), true); + /*location*/ constructor ? constructor.body : undefined, + /*multiLine*/ true); } /** * Adds super call and preceding prologue directives into the list of statements. @@ -45758,9 +46147,9 @@ var ts; ts.Debug.assert(ts.isIdentifier(node.name)); var name = node.name; var propertyName = ts.getMutableClone(name); - ts.setEmitFlags(propertyName, 49152 /* NoComments */ | 1536 /* NoSourceMap */); + ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 48 /* NoSourceMap */); var localName = ts.getMutableClone(name); - ts.setEmitFlags(localName, 49152 /* NoComments */); + ts.setEmitFlags(localName, 1536 /* NoComments */); return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, /*location*/ node.name), localName), /*location*/ ts.moveRangePos(node, -1))); @@ -45808,8 +46197,8 @@ var ts; * @param receiver The receiver on which each property should be assigned. */ function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { - var property = properties_7[_i]; + for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { + var property = properties_8[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -45824,8 +46213,8 @@ var ts; */ function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { - var property = properties_8[_i]; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -45954,10 +46343,11 @@ var ts; return undefined; } var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; - if (accessor !== firstAccessor) { + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + var decorators = firstAccessorWithDecorators.decorators; var parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -45998,14 +46388,14 @@ var ts; * @param node The declaration node. * @param allDecorators An object containing all of the decorators for the declaration. */ - function transformAllDecoratorsOfDeclaration(node, allDecorators) { + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (!allDecorators) { return undefined; } var decoratorExpressions = []; ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } /** @@ -46052,7 +46442,7 @@ var ts; */ function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -46072,13 +46462,13 @@ var ts; // __metadata("design:type", Function), // __metadata("design:paramtypes", [Object]), // __metadata("design:returntype", void 0) - // ], C.prototype, "method", undefined); + // ], C.prototype, "method", null); // // The emit for an accessor is: // // __decorate([ // dec - // ], C.prototype, "accessor", undefined); + // ], C.prototype, "accessor", null); // // The emit for a property is: // @@ -46093,8 +46483,8 @@ var ts; ? ts.createVoidZero() : ts.createNull() : undefined; - var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); - ts.setEmitFlags(helper, 49152 /* NoComments */); + var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); + ts.setEmitFlags(helper, 1536 /* NoComments */); return helper; } /** @@ -46115,15 +46505,15 @@ var ts; */ function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)]; var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); - var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName); + var decorate = createDecorateHelper(context, decoratorExpressions, localName); var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate); - ts.setEmitFlags(expression, 49152 /* NoComments */); + ts.setEmitFlags(expression, 1536 /* NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node)); return expression; } @@ -46147,9 +46537,9 @@ var ts; expressions = []; for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) { var decorator = decorators_1[_i]; - var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset, + var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, /*location*/ decorator.expression); - ts.setEmitFlags(helper, 49152 /* NoComments */); + ts.setEmitFlags(helper, 1536 /* NoComments */); expressions.push(helper); } } @@ -46161,41 +46551,41 @@ var ts; * @param node The declaration node. * @param decoratorExpressions The destination array to which to add new decorator expressions. */ - function addTypeMetadata(node, decoratorExpressions) { + function addTypeMetadata(node, container, decoratorExpressions) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node, decoratorExpressions) { + function addOldTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } } } - function addNewTypeMetadata(node, decoratorExpressions) { + function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeReturnTypeOfNode(node)))); } if (properties) { - decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true))); + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true))); } } } @@ -46231,12 +46621,16 @@ var ts; * @param node The node to test. */ function shouldAddParamTypesMetadata(node) { - var kind = node.kind; - return kind === 226 /* ClassDeclaration */ - || kind === 197 /* ClassExpression */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */; + switch (node.kind) { + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return true; + } + return false; } /** * Serializes the type of a node for use with decorator type metadata. @@ -46259,29 +46653,12 @@ var ts; return ts.createVoidZero(); } } - /** - * Gets the most likely element type for a TypeNode. This is not an exhaustive test - * as it assumes a rest argument can only be an array type (either T[], or Array). - * - * @param node The type node. - */ - function getRestParameterElementType(node) { - if (node && node.kind === 162 /* ArrayType */) { - return node.elementType; - } - else if (node && node.kind === 157 /* TypeReference */) { - return ts.singleOrUndefined(node.typeArguments); - } - else { - return undefined; - } - } /** * Serializes the types of the parameters of a node for use with decorator type metadata. * * @param node The node that should have its parameter types serialized. */ - function serializeParameterTypesOfNode(node) { + function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) @@ -46289,7 +46666,7 @@ var ts; : undefined; var expressions = []; if (valueDeclaration) { - var parameters = valueDeclaration.parameters; + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; @@ -46297,7 +46674,7 @@ var ts; continue; } if (parameter.dotDotDotToken) { - expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type))); + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); } else { expressions.push(serializeTypeOfNode(parameter)); @@ -46306,6 +46683,15 @@ var ts; } return ts.createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 151 /* GetAccessor */) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } /** * Serializes the return type of a node for use with decorator type metadata. * @@ -46435,7 +46821,7 @@ var ts; case ts.TypeReferenceSerializationKind.Unknown: var serialized = serializeEntityNameAsExpression(node.typeName, /*useFallback*/ true); var temp = ts.createTempVariable(hoistVariableDeclaration); - return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictEquality(ts.createTypeOf(ts.createAssignment(temp, serialized)), ts.createLiteral("function")), temp), ts.createIdentifier("Object")); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object")); case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: return serializeEntityNameAsExpression(node.typeName, /*useFallback*/ false); case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType: @@ -46473,14 +46859,14 @@ var ts; case 70 /* Identifier */: // Create a clone of the name with a new parent, and treat it as if it were // a source tree node for the purposes of the checker. - var name_31 = ts.getMutableClone(node); - name_31.flags &= ~8 /* Synthesized */; - name_31.original = undefined; - name_31.parent = currentScope; + var name_32 = ts.getMutableClone(node); + name_32.flags &= ~8 /* Synthesized */; + name_32.original = undefined; + name_32.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_31), ts.createLiteral("undefined")), name_31); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_32), ts.createLiteral("undefined")), name_32); } - return name_31; + return name_32; case 141 /* QualifiedName */: return serializeQualifiedNameAsExpression(node, useFallback); } @@ -46511,7 +46897,7 @@ var ts; * available. */ function getGlobalSymbolNameWithFallback() { - return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54 /* QuestionToken */), ts.createIdentifier("Symbol"), ts.createToken(55 /* ColonToken */), ts.createIdentifier("Object")); + return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object")); } /** * Gets an expression that represents a property name. For a computed property, a @@ -46527,7 +46913,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeIdentifier(name.text)); } else { return ts.getSynthesizedClone(name); @@ -46613,17 +46999,17 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - var method = ts.createMethod( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - // While we emit the source map for the node after skipping decorators and modifiers, - // we need to emit the comments for the original range. - ts.setCommentRange(method, node); - ts.setSourceMapRange(method, ts.moveRangePastDecorators(node)); - ts.setOriginalNode(method, node); - return method; + var updated = ts.updateMethod(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context)); + if (updated !== node) { + // While we emit the source map for the node after skipping decorators and modifiers, + // we need to emit the comments for the original range. + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } /** * Determines whether to emit an accessor declaration. We should not emit the @@ -46647,16 +47033,16 @@ var ts; if (!shouldEmitAccessorDeclaration(node)) { return undefined; } - var accessor = ts.createGetAccessor( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), - /*location*/ node); - // While we emit the source map for the node after skipping decorators and modifiers, - // we need to emit the comments for the original range. - ts.setOriginalNode(accessor, node); - ts.setCommentRange(accessor, node); - ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node)); - return accessor; + var updated = ts.updateGetAccessor(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + if (updated !== node) { + // While we emit the source map for the node after skipping decorators and modifiers, + // we need to emit the comments for the original range. + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } /** * Visits a set accessor declaration of a class. @@ -46671,15 +47057,15 @@ var ts; if (!shouldEmitAccessorDeclaration(node)) { return undefined; } - var accessor = ts.createSetAccessor( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), - /*location*/ node); - // While we emit the source map for the node after skipping decorators and modifiers, - // we need to emit the comments for the original range. - ts.setOriginalNode(accessor, node); - ts.setCommentRange(accessor, node); - ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node)); - return accessor; + var updated = ts.updateSetAccessor(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + if (updated !== node) { + // While we emit the source map for the node after skipping decorators and modifiers, + // we need to emit the comments for the original range. + ts.setCommentRange(updated, node); + ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); + } + return updated; } /** * Visits a function declaration. @@ -46695,18 +47081,16 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createNotEmittedStatement(node); } - var func = ts.createFunctionDeclaration( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); + var updated = ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isNamespaceExport(node)) { - var statements = [func]; + var statements = [updated]; addExportMemberAssignment(statements, node); return statements; } - return func; + return updated; } /** * Visits a function expression node. @@ -46720,12 +47104,10 @@ var ts; if (ts.nodeIsMissing(node.body)) { return ts.createOmittedExpression(); } - var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); - return func; + var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context)); + return updated; } /** * @remarks @@ -46733,51 +47115,10 @@ var ts; * - The node has type annotations */ function visitArrowFunction(node) { - var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, node.equalsGreaterThanToken, transformConciseBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); - return func; - } - function transformFunctionBody(node) { - return transformFunctionBodyWorker(node.body); - } - function transformFunctionBodyWorker(body, start) { - if (start === void 0) { start = 0; } - var savedCurrentScope = currentScope; - var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; - currentScope = body; - currentScopeFirstDeclarationsOfName = ts.createMap(); - startLexicalEnvironment(); - var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start); - var visited = ts.updateBlock(body, statements); - var declarations = endLexicalEnvironment(); - currentScope = savedCurrentScope; - currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - } - function transformConciseBody(node) { - return transformConciseBodyWorker(node.body, /*forceBlockFunctionBody*/ false); - } - function transformConciseBodyWorker(body, forceBlockFunctionBody) { - if (ts.isBlock(body)) { - return transformFunctionBodyWorker(body); - } - else { - startLexicalEnvironment(); - var visited = ts.visitNode(body, visitor, ts.isConciseBody); - var declarations = endLexicalEnvironment(); - var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - if (forceBlockFunctionBody && !ts.isBlock(merged)) { - return ts.createBlock([ - ts.createReturn(merged) - ]); - } - else { - return merged; - } - } + var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context)); + return updated; } /** * Visits a parameter declaration node. @@ -46804,7 +47145,7 @@ var ts; ts.setOriginalNode(parameter, node); ts.setCommentRange(parameter, node); ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); - ts.setEmitFlags(parameter.name, 1024 /* NoTrailingSourceMap */); + ts.setEmitFlags(parameter.name, 32 /* NoTrailingSourceMap */); return parameter; } /** @@ -46830,7 +47171,8 @@ var ts; function transformInitializedVariable(node) { var name = node.name; if (ts.isBindingPattern(name)) { - return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor); + return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, + /*needsValue*/ false, createNamespaceExportExpression); } else { return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), @@ -46910,14 +47252,14 @@ var ts; var statements = []; // We request to be advised when the printer is about to print this node. This allows // us to set up the correct state for later substitutions. - var emitFlags = 64 /* AdviseOnEmitNode */; + var emitFlags = 2 /* AdviseOnEmitNode */; // If needed, we should emit a variable declaration for the enum. If we emit // a leading variable declaration, we should not emit leading comments for the // enum body. if (addVarForEnumOrModuleDeclaration(statements, node)) { // We should still emit the comments if we are emitting a system module. if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= 16384 /* NoLeadingComments */; + emitFlags |= 512 /* NoLeadingComments */; } } // `parameterName` is the declaration name used inside of the enum. @@ -47050,9 +47392,9 @@ var ts; */ function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_32 = node.symbol && node.symbol.name; - if (name_32) { - return currentScopeFirstDeclarationsOfName[name_32] === node; + var name_33 = node.symbol && node.symbol.name; + if (name_33) { + return currentScopeFirstDeclarationsOfName[name_33] === node; } } return false; @@ -47094,7 +47436,7 @@ var ts; // })(m1 || (m1 = {})); // trailing comment module // ts.setCommentRange(statement, node); - ts.setEmitFlags(statement, 32768 /* NoTrailingComments */ | 33554432 /* HasEndOfDeclarationMarker */); + ts.setEmitFlags(statement, 1024 /* NoTrailingComments */ | 2097152 /* HasEndOfDeclarationMarker */); statements.push(statement); return true; } @@ -47104,7 +47446,7 @@ var ts; // begin/end semantics of the declararation and to properly handle exports // we wrap the leading variable declaration in a `MergeDeclarationMarker`. var mergeMarker = ts.createMergeDeclarationMarker(statement); - ts.setEmitFlags(mergeMarker, 49152 /* NoComments */ | 33554432 /* HasEndOfDeclarationMarker */); + ts.setEmitFlags(mergeMarker, 1536 /* NoComments */ | 2097152 /* HasEndOfDeclarationMarker */); statements.push(mergeMarker); return false; } @@ -47125,14 +47467,14 @@ var ts; var statements = []; // We request to be advised when the printer is about to print this node. This allows // us to set up the correct state for later substitutions. - var emitFlags = 64 /* AdviseOnEmitNode */; + var emitFlags = 2 /* AdviseOnEmitNode */; // If needed, we should emit a variable declaration for the module. If we emit // a leading variable declaration, we should not emit leading comments for the // module body. if (addVarForEnumOrModuleDeclaration(statements, node)) { // We should still emit the comments if we are emitting a system module. if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) { - emitFlags |= 16384 /* NoLeadingComments */; + emitFlags |= 512 /* NoLeadingComments */; } } // `parameterName` is the declaration name used inside of the namespace. @@ -47235,7 +47577,7 @@ var ts; // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. if (body.kind !== 231 /* ModuleBlock */) { - ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152 /* NoComments */); + ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } @@ -47384,7 +47726,7 @@ var ts; return undefined; } var moduleReference = ts.createExpressionFromEntityName(node.moduleReference); - ts.setEmitFlags(moduleReference, 49152 /* NoComments */ | 65536 /* NoNestedComments */); + ts.setEmitFlags(moduleReference, 1536 /* NoComments */ | 2048 /* NoNestedComments */); if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { // export var ${name} = ${moduleReference}; // var ${name} = ${moduleReference}; @@ -47560,16 +47902,16 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2 /* NamespaceExports */) { - var name_33 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_33); + var name_34 = node.name; + var exportedName = trySubstituteNamespaceExportedName(name_34); if (exportedName) { // A shorthand property with an assignment initializer is probably part of a // destructuring assignment if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_33, initializer, /*location*/ node); + return ts.createPropertyAssignment(name_34, initializer, /*location*/ node); } - return ts.createPropertyAssignment(name_33, exportedName, /*location*/ node); + return ts.createPropertyAssignment(name_34, exportedName, /*location*/ node); } } return node; @@ -47602,10 +47944,10 @@ var ts; if (declaration) { var classAlias = classAliases[declaration.id]; if (classAlias) { - var clone_4 = ts.getSynthesizedClone(classAlias); - ts.setSourceMapRange(clone_4, node); - ts.setCommentRange(clone_4, node); - return clone_4; + var clone_2 = ts.getSynthesizedClone(classAlias); + ts.setSourceMapRange(clone_2, node); + ts.setCommentRange(clone_2, node); + return clone_2; } } } @@ -47614,7 +47956,7 @@ var ts; } function trySubstituteNamespaceExportedName(node) { // If this is explicitly a local name, do not substitute. - if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) { + if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); @@ -47661,13 +48003,335 @@ var ts; } } ts.transformTypeScript = transformTypeScript; + var paramHelper = { + name: "typescript:param", + scoped: false, + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + }; + function createParamHelper(context, expression, parameterOffset, location) { + context.requestEmitHelper(paramHelper); + return ts.createCall(ts.getHelperName("__param"), + /*typeArguments*/ undefined, [ + ts.createLiteral(parameterOffset), + expression + ], location); + } + var metadataHelper = { + name: "typescript:metadata", + scoped: false, + priority: 3, + text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" + }; + function createMetadataHelper(context, metadataKey, metadataValue) { + context.requestEmitHelper(metadataHelper); + return ts.createCall(ts.getHelperName("__metadata"), + /*typeArguments*/ undefined, [ + ts.createLiteral(metadataKey), + metadataValue + ]); + } + var decorateHelper = { + name: "typescript:decorate", + scoped: false, + priority: 2, + text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" + }; + function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { + context.requestEmitHelper(decorateHelper); + var argumentsArray = []; + argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + return ts.createCall(ts.getHelperName("__decorate"), /*typeArguments*/ undefined, argumentsArray, location); + } })(ts || (ts = {})); /// /// /*@internal*/ var ts; (function (ts) { - var entities = createEntitiesMap(); + function transformESNext(context) { + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + function visitor(node) { + return visitorWorker(node, /*noDestructuringValue*/ false); + } + function visitorNoDestructuringValue(node) { + return visitorWorker(node, /*noDestructuringValue*/ true); + } + function visitorWorker(node, noDestructuringValue) { + if ((node.transformFlags & 8 /* ContainsESNext */) === 0) { + return node; + } + switch (node.kind) { + case 176 /* ObjectLiteralExpression */: + return visitObjectLiteralExpression(node); + case 192 /* BinaryExpression */: + return visitBinaryExpression(node, noDestructuringValue); + case 223 /* VariableDeclaration */: + return visitVariableDeclaration(node); + case 213 /* ForOfStatement */: + return visitForOfStatement(node); + case 211 /* ForStatement */: + return visitForStatement(node); + case 188 /* VoidExpression */: + return visitVoidExpression(node); + case 150 /* Constructor */: + return visitConstructorDeclaration(node); + case 149 /* MethodDeclaration */: + return visitMethodDeclaration(node); + case 151 /* GetAccessor */: + return visitGetAccessorDeclaration(node); + case 152 /* SetAccessor */: + return visitSetAccessorDeclaration(node); + case 225 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 184 /* FunctionExpression */: + return visitFunctionExpression(node); + case 185 /* ArrowFunction */: + return visitArrowFunction(node); + case 144 /* Parameter */: + return visitParameter(node); + case 207 /* ExpressionStatement */: + return visitExpressionStatement(node); + case 183 /* ParenthesizedExpression */: + return visitParenthesizedExpression(node, noDestructuringValue); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function chunkObjectLiteralElements(elements) { + var chunkObject; + var objects = []; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var e = elements_3[_i]; + if (e.kind === 259 /* SpreadAssignment */) { + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + chunkObject = undefined; + } + var target = e.expression; + objects.push(ts.visitNode(target, visitor, ts.isExpression)); + } + else { + if (!chunkObject) { + chunkObject = []; + } + if (e.kind === 257 /* PropertyAssignment */) { + var p = e; + chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); + } + else { + chunkObject.push(e); + } + } + } + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + } + return objects; + } + function visitObjectLiteralExpression(node) { + if (node.transformFlags & 1048576 /* ContainsObjectSpread */) { + // spread elements emit like so: + // non-spread elements are chunked together into object literals, and then all are passed to __assign: + // { a, ...o, b } => __assign({a}, o, {b}); + // If the first element is a spread element, then the first argument to __assign is {}: + // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) + var objects = chunkObjectLiteralElements(node.properties); + if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) { + objects.unshift(ts.createObjectLiteral()); + } + return createAssignHelper(context, objects); + } + return ts.visitEachChild(node, visitor, context); + } + function visitExpressionStatement(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + function visitParenthesizedExpression(node, noDestructuringValue) { + return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context); + } + /** + * Visits a BinaryExpression that contains a destructuring assignment. + * + * @param node A BinaryExpression node. + */ + function visitBinaryExpression(node, noDestructuringValue) { + if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576 /* ContainsObjectRest */) { + return ts.flattenDestructuringAssignment(node, visitor, context, 1 /* ObjectRest */, !noDestructuringValue); + } + else if (node.operatorToken.kind === 25 /* CommaToken */) { + return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + /** + * Visits a VariableDeclaration node with a binding pattern. + * + * @param node A VariableDeclaration node. + */ + function visitVariableDeclaration(node) { + // If we are here it is because the name contains a binding pattern with a rest somewhere in it. + if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576 /* ContainsObjectRest */) { + return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */); + } + return ts.visitEachChild(node, visitor, context); + } + function visitForStatement(node) { + return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement)); + } + function visitVoidExpression(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + /** + * Visits a ForOfStatement and converts it into a ES2015-compatible ForOfStatement. + * + * @param node A ForOfStatement. + */ + function visitForOfStatement(node) { + var leadingStatements; + var temp; + var initializer = ts.skipParentheses(node.initializer); + if (initializer.transformFlags & 1048576 /* ContainsObjectRest */) { + if (ts.isVariableDeclarationList(initializer)) { + temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + var firstDeclaration = ts.firstOrUndefined(initializer.declarations); + var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1 /* ObjectRest */, temp, + /*doNotRecordTempVariablesInLine*/ false, + /*skipInitializer*/ true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.updateVariableDeclarationList(initializer, declarations), + /*location*/ initializer); + leadingStatements = ts.append(leadingStatements, statement); + } + } + else if (ts.isAssignmentPattern(initializer)) { + temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, /*location*/ node.initializer)), visitor, context, 1 /* ObjectRest */); + leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, /*location*/ node.initializer)); + } + } + if (temp) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var block = ts.isBlock(statement) + ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements)) + : ts.createBlock(ts.append(leadingStatements, statement), statement, /*multiLine*/ true); + return ts.updateForOf(node, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(temp, /*type*/ undefined, /*initializer*/ undefined, node.initializer) + ], node.initializer, 1 /* Let */), expression, block); + } + return ts.visitEachChild(node, visitor, context); + } + function visitParameter(node) { + if (node.transformFlags & 1048576 /* ContainsObjectRest */) { + // Binding patterns are converted into a generated name and are + // evaluated inside the function body. + return ts.updateParameter(node, + /*decorators*/ undefined, + /*modifiers*/ undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), + /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + function visitConstructorDeclaration(node) { + return ts.updateConstructor(node, + /*decorators*/ undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + } + function visitGetAccessorDeclaration(node) { + return ts.updateGetAccessor(node, + /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node)); + } + function visitSetAccessorDeclaration(node) { + return ts.updateSetAccessor(node, + /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + } + function visitMethodDeclaration(node) { + return ts.updateMethod(node, + /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node)); + } + function visitFunctionDeclaration(node) { + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, node.modifiers, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node)); + } + function visitArrowFunction(node) { + return ts.updateArrowFunction(node, node.modifiers, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node)); + } + function visitFunctionExpression(node) { + return ts.updateFunctionExpression(node, node.modifiers, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node)); + } + function transformFunctionBody(node) { + resumeLexicalEnvironment(); + var leadingStatements; + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (parameter.transformFlags & 1048576 /* ContainsObjectRest */) { + var temp = ts.getGeneratedNameForNode(parameter); + var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1 /* ObjectRest */, temp, + /*doNotRecordTempVariablesInLine*/ false, + /*skipInitializer*/ true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList(declarations)); + ts.setEmitFlags(statement, 524288 /* CustomPrologue */); + leadingStatements = ts.append(leadingStatements, statement); + } + } + } + var body = ts.visitNode(node.body, visitor, ts.isConciseBody); + var trailingStatements = endLexicalEnvironment(); + if (ts.some(leadingStatements) || ts.some(trailingStatements)) { + var block = ts.convertToFunctionBody(body, /*multiLine*/ true); + return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements)); + } + return body; + } + } + ts.transformESNext = transformESNext; + var assignHelper = { + name: "typescript:assign", + scoped: false, + priority: 1, + text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" + }; + function createAssignHelper(context, attributesSegments) { + context.requestEmitHelper(assignHelper); + return ts.createCall(ts.getHelperName("__assign"), + /*typeArguments*/ undefined, attributesSegments); + } + ts.createAssignHelper = createAssignHelper; +})(ts || (ts = {})); +/// +/// +/// +/*@internal*/ +var ts; +(function (ts) { function transformJsx(context) { var compilerOptions = context.getCompilerOptions(); var currentSourceFile; @@ -47682,17 +48346,15 @@ var ts; return node; } currentSourceFile = node; - node = ts.visitEachChild(node, visitor, context); + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; - return node; + return visited; } function visitor(node) { - if (node.transformFlags & 4 /* Jsx */) { + if (node.transformFlags & 4 /* ContainsJsx */) { return visitorWorker(node); } - else if (node.transformFlags & 8 /* ContainsJsx */) { - return ts.visitEachChild(node, visitor, context); - } else { return node; } @@ -47706,8 +48368,7 @@ var ts; case 252 /* JsxExpression */: return visitJsxExpression(node); default: - ts.Debug.failBadSyntaxKind(node); - return undefined; + return ts.visitEachChild(node, visitor, context); } } function transformJsxChildToExpression(node) { @@ -47752,8 +48413,10 @@ var ts; } // Either emit one big object literal (no spread attribs), or // a call to the __assign helper. - objectProperties = ts.singleOrUndefined(segments) - || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments); + objectProperties = ts.singleOrUndefined(segments); + if (!objectProperties) { + objectProperties = ts.createAssignHelper(context, segments); + } } var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location); if (isChild) { @@ -47863,12 +48526,12 @@ var ts; return getTagName(node.openingElement); } else { - var name_34 = node.tagName; - if (ts.isIdentifier(name_34) && ts.isIntrinsicJsxName(name_34.text)) { - return ts.createLiteral(name_34.text); + var name_35 = node.tagName; + if (ts.isIdentifier(name_35) && ts.isIntrinsicJsxName(name_35.text)) { + return ts.createLiteral(name_35.text); } else { - return ts.createExpressionFromEntityName(name_34); + return ts.createExpressionFromEntityName(name_35); } } } @@ -47891,517 +48554,284 @@ var ts; } } ts.transformJsx = transformJsx; - function createEntitiesMap() { - return ts.createMap({ - "quot": 0x0022, - "amp": 0x0026, - "apos": 0x0027, - "lt": 0x003C, - "gt": 0x003E, - "nbsp": 0x00A0, - "iexcl": 0x00A1, - "cent": 0x00A2, - "pound": 0x00A3, - "curren": 0x00A4, - "yen": 0x00A5, - "brvbar": 0x00A6, - "sect": 0x00A7, - "uml": 0x00A8, - "copy": 0x00A9, - "ordf": 0x00AA, - "laquo": 0x00AB, - "not": 0x00AC, - "shy": 0x00AD, - "reg": 0x00AE, - "macr": 0x00AF, - "deg": 0x00B0, - "plusmn": 0x00B1, - "sup2": 0x00B2, - "sup3": 0x00B3, - "acute": 0x00B4, - "micro": 0x00B5, - "para": 0x00B6, - "middot": 0x00B7, - "cedil": 0x00B8, - "sup1": 0x00B9, - "ordm": 0x00BA, - "raquo": 0x00BB, - "frac14": 0x00BC, - "frac12": 0x00BD, - "frac34": 0x00BE, - "iquest": 0x00BF, - "Agrave": 0x00C0, - "Aacute": 0x00C1, - "Acirc": 0x00C2, - "Atilde": 0x00C3, - "Auml": 0x00C4, - "Aring": 0x00C5, - "AElig": 0x00C6, - "Ccedil": 0x00C7, - "Egrave": 0x00C8, - "Eacute": 0x00C9, - "Ecirc": 0x00CA, - "Euml": 0x00CB, - "Igrave": 0x00CC, - "Iacute": 0x00CD, - "Icirc": 0x00CE, - "Iuml": 0x00CF, - "ETH": 0x00D0, - "Ntilde": 0x00D1, - "Ograve": 0x00D2, - "Oacute": 0x00D3, - "Ocirc": 0x00D4, - "Otilde": 0x00D5, - "Ouml": 0x00D6, - "times": 0x00D7, - "Oslash": 0x00D8, - "Ugrave": 0x00D9, - "Uacute": 0x00DA, - "Ucirc": 0x00DB, - "Uuml": 0x00DC, - "Yacute": 0x00DD, - "THORN": 0x00DE, - "szlig": 0x00DF, - "agrave": 0x00E0, - "aacute": 0x00E1, - "acirc": 0x00E2, - "atilde": 0x00E3, - "auml": 0x00E4, - "aring": 0x00E5, - "aelig": 0x00E6, - "ccedil": 0x00E7, - "egrave": 0x00E8, - "eacute": 0x00E9, - "ecirc": 0x00EA, - "euml": 0x00EB, - "igrave": 0x00EC, - "iacute": 0x00ED, - "icirc": 0x00EE, - "iuml": 0x00EF, - "eth": 0x00F0, - "ntilde": 0x00F1, - "ograve": 0x00F2, - "oacute": 0x00F3, - "ocirc": 0x00F4, - "otilde": 0x00F5, - "ouml": 0x00F6, - "divide": 0x00F7, - "oslash": 0x00F8, - "ugrave": 0x00F9, - "uacute": 0x00FA, - "ucirc": 0x00FB, - "uuml": 0x00FC, - "yacute": 0x00FD, - "thorn": 0x00FE, - "yuml": 0x00FF, - "OElig": 0x0152, - "oelig": 0x0153, - "Scaron": 0x0160, - "scaron": 0x0161, - "Yuml": 0x0178, - "fnof": 0x0192, - "circ": 0x02C6, - "tilde": 0x02DC, - "Alpha": 0x0391, - "Beta": 0x0392, - "Gamma": 0x0393, - "Delta": 0x0394, - "Epsilon": 0x0395, - "Zeta": 0x0396, - "Eta": 0x0397, - "Theta": 0x0398, - "Iota": 0x0399, - "Kappa": 0x039A, - "Lambda": 0x039B, - "Mu": 0x039C, - "Nu": 0x039D, - "Xi": 0x039E, - "Omicron": 0x039F, - "Pi": 0x03A0, - "Rho": 0x03A1, - "Sigma": 0x03A3, - "Tau": 0x03A4, - "Upsilon": 0x03A5, - "Phi": 0x03A6, - "Chi": 0x03A7, - "Psi": 0x03A8, - "Omega": 0x03A9, - "alpha": 0x03B1, - "beta": 0x03B2, - "gamma": 0x03B3, - "delta": 0x03B4, - "epsilon": 0x03B5, - "zeta": 0x03B6, - "eta": 0x03B7, - "theta": 0x03B8, - "iota": 0x03B9, - "kappa": 0x03BA, - "lambda": 0x03BB, - "mu": 0x03BC, - "nu": 0x03BD, - "xi": 0x03BE, - "omicron": 0x03BF, - "pi": 0x03C0, - "rho": 0x03C1, - "sigmaf": 0x03C2, - "sigma": 0x03C3, - "tau": 0x03C4, - "upsilon": 0x03C5, - "phi": 0x03C6, - "chi": 0x03C7, - "psi": 0x03C8, - "omega": 0x03C9, - "thetasym": 0x03D1, - "upsih": 0x03D2, - "piv": 0x03D6, - "ensp": 0x2002, - "emsp": 0x2003, - "thinsp": 0x2009, - "zwnj": 0x200C, - "zwj": 0x200D, - "lrm": 0x200E, - "rlm": 0x200F, - "ndash": 0x2013, - "mdash": 0x2014, - "lsquo": 0x2018, - "rsquo": 0x2019, - "sbquo": 0x201A, - "ldquo": 0x201C, - "rdquo": 0x201D, - "bdquo": 0x201E, - "dagger": 0x2020, - "Dagger": 0x2021, - "bull": 0x2022, - "hellip": 0x2026, - "permil": 0x2030, - "prime": 0x2032, - "Prime": 0x2033, - "lsaquo": 0x2039, - "rsaquo": 0x203A, - "oline": 0x203E, - "frasl": 0x2044, - "euro": 0x20AC, - "image": 0x2111, - "weierp": 0x2118, - "real": 0x211C, - "trade": 0x2122, - "alefsym": 0x2135, - "larr": 0x2190, - "uarr": 0x2191, - "rarr": 0x2192, - "darr": 0x2193, - "harr": 0x2194, - "crarr": 0x21B5, - "lArr": 0x21D0, - "uArr": 0x21D1, - "rArr": 0x21D2, - "dArr": 0x21D3, - "hArr": 0x21D4, - "forall": 0x2200, - "part": 0x2202, - "exist": 0x2203, - "empty": 0x2205, - "nabla": 0x2207, - "isin": 0x2208, - "notin": 0x2209, - "ni": 0x220B, - "prod": 0x220F, - "sum": 0x2211, - "minus": 0x2212, - "lowast": 0x2217, - "radic": 0x221A, - "prop": 0x221D, - "infin": 0x221E, - "ang": 0x2220, - "and": 0x2227, - "or": 0x2228, - "cap": 0x2229, - "cup": 0x222A, - "int": 0x222B, - "there4": 0x2234, - "sim": 0x223C, - "cong": 0x2245, - "asymp": 0x2248, - "ne": 0x2260, - "equiv": 0x2261, - "le": 0x2264, - "ge": 0x2265, - "sub": 0x2282, - "sup": 0x2283, - "nsub": 0x2284, - "sube": 0x2286, - "supe": 0x2287, - "oplus": 0x2295, - "otimes": 0x2297, - "perp": 0x22A5, - "sdot": 0x22C5, - "lceil": 0x2308, - "rceil": 0x2309, - "lfloor": 0x230A, - "rfloor": 0x230B, - "lang": 0x2329, - "rang": 0x232A, - "loz": 0x25CA, - "spades": 0x2660, - "clubs": 0x2663, - "hearts": 0x2665, - "diams": 0x2666 - }); - } -})(ts || (ts = {})); -/// -/// -/*@internal*/ -var ts; -(function (ts) { - function transformESNext(context) { - var hoistVariableDeclaration = context.hoistVariableDeclaration; - var currentSourceFile; - return transformSourceFile; - function transformSourceFile(node) { - currentSourceFile = node; - return ts.visitEachChild(node, visitor, context); - } - function visitor(node) { - if (node.transformFlags & 16 /* ESNext */) { - return visitorWorker(node); - } - else if (node.transformFlags & 32 /* ContainsESNext */) { - return ts.visitEachChild(node, visitor, context); - } - else { - return node; - } - } - function visitorWorker(node) { - switch (node.kind) { - case 176 /* ObjectLiteralExpression */: - return visitObjectLiteralExpression(node); - case 192 /* BinaryExpression */: - return visitBinaryExpression(node); - case 223 /* VariableDeclaration */: - return visitVariableDeclaration(node); - case 213 /* ForOfStatement */: - return visitForOfStatement(node); - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - return node; - case 225 /* FunctionDeclaration */: - return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: - return visitFunctionExpression(node); - case 185 /* ArrowFunction */: - return visitArrowFunction(node); - case 144 /* Parameter */: - return visitParameter(node); - default: - ts.Debug.failBadSyntaxKind(node); - return ts.visitEachChild(node, visitor, context); - } - } - function chunkObjectLiteralElements(elements) { - var chunkObject; - var objects = []; - for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { - var e = elements_3[_i]; - if (e.kind === 259 /* SpreadAssignment */) { - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - chunkObject = undefined; - } - var target = e.expression; - objects.push(ts.visitNode(target, visitor, ts.isExpression)); - } - else { - if (!chunkObject) { - chunkObject = []; - } - if (e.kind === 257 /* PropertyAssignment */) { - var p = e; - chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); - } - else { - chunkObject.push(e); - } - } - } - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - } - return objects; - } - function visitObjectLiteralExpression(node) { - // spread elements emit like so: - // non-spread elements are chunked together into object literals, and then all are passed to __assign: - // { a, ...o, b } => __assign({a}, o, {b}); - // If the first element is a spread element, then the first argument to __assign is {}: - // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) - var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) { - objects.unshift(ts.createObjectLiteral()); - } - return ts.createCall(ts.createIdentifier("__assign"), undefined, objects); - } - /** - * Visits a BinaryExpression that contains a destructuring assignment. - * - * @param node A BinaryExpression node. - */ - function visitBinaryExpression(node) { - if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48 /* AssertESNext */) { - return ts.flattenDestructuringAssignment(context, node, /*needsDestructuringValue*/ true, hoistVariableDeclaration, visitor, /*transformRest*/ true); - } - return ts.visitEachChild(node, visitor, context); - } - /** - * Visits a VariableDeclaration node with a binding pattern. - * - * @param node A VariableDeclaration node. - */ - function visitVariableDeclaration(node) { - // If we are here it is because the name contains a binding pattern with a rest somewhere in it. - if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48 /* AssertESNext */) { - var result = ts.flattenVariableDestructuring(node, /*value*/ undefined, visitor, /*recordTempVariable*/ undefined, /*transformRest*/ true); - return result; - } - return ts.visitEachChild(node, visitor, context); - } - /** - * Visits a ForOfStatement and converts it into a ES2015-compatible ForOfStatement. - * - * @param node A ForOfStatement. - */ - function visitForOfStatement(node) { - // The following ESNext code: - // - // for (let { x, y, ...rest } of expr) { } - // - // should be emitted as - // - // for (var _a of expr) { - // let { x, y } = _a, rest = __rest(_a, ["x", "y"]); - // } - // - // where _a is a temp emitted to capture the RHS. - // When the left hand side is an expression instead of a let declaration, - // the `let` before the `{ x, y }` is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. - // for ( of ) - // where is [let] variabledeclarationlist | expression - var initializer = node.initializer; - if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) { - return ts.visitEachChild(node, visitor, context); - } - return ts.convertForOf(node, undefined, visitor, ts.noop, context, /*transformRest*/ true); - } - function isRestBindingPattern(initializer) { - if (ts.isVariableDeclarationList(initializer)) { - var declaration = ts.firstOrUndefined(initializer.declarations); - return declaration && declaration.name && - declaration.name.kind === 172 /* ObjectBindingPattern */ && - !!(declaration.name.transformFlags & 8388608 /* ContainsSpreadExpression */); - } - return false; - } - function isRestAssignment(initializer) { - return initializer.kind === 176 /* ObjectLiteralExpression */ && - initializer.transformFlags & 8388608 /* ContainsSpreadExpression */; - } - function visitParameter(node) { - if (isObjectRestParameter(node)) { - // Binding patterns are converted into a generated name and are - // evaluated inside the function body. - return ts.setOriginalNode(ts.createParameter( - /*decorators*/ undefined, - /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, ts.getGeneratedNameForNode(node), - /*questionToken*/ undefined, - /*type*/ undefined, node.initializer, - /*location*/ node), - /*original*/ node); - } - else { - return node; - } - } - function isObjectRestParameter(node) { - return node.name && - node.name.kind === 172 /* ObjectBindingPattern */ && - !!(node.name.transformFlags & 8388608 /* ContainsSpreadExpression */); - } - function visitFunctionDeclaration(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) : - ts.visitEachChild(node.body, visitor, context); - return ts.setOriginalNode(ts.createFunctionDeclaration( - /*decorators*/ undefined, node.modifiers, node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, body, - /*location*/ node), - /*original*/ node); - } - function visitArrowFunction(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) : - ts.visitEachChild(node.body, visitor, context); - var func = ts.setOriginalNode(ts.createArrowFunction( - /*modifiers*/ undefined, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, node.equalsGreaterThanToken, body, - /*location*/ node), - /*original*/ node); - ts.setEmitFlags(func, 256 /* CapturesThis */); - return func; - } - function visitFunctionExpression(node) { - var hasRest = ts.forEach(node.parameters, isObjectRestParameter); - var body = hasRest ? - ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) : - ts.visitEachChild(node.body, visitor, context); - return ts.setOriginalNode(ts.createFunctionExpression( - /*modifiers*/ undefined, node.asteriskToken, name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, body, - /*location*/ node), - /*original*/ node); - } - } - ts.transformESNext = transformESNext; + var entities = ts.createMap({ + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + }); })(ts || (ts = {})); /// /// /*@internal*/ var ts; (function (ts) { + var ES2017SubstitutionFlags; + (function (ES2017SubstitutionFlags) { + /** Enables substitutions for async methods with `super` calls. */ + ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); function transformES2017(context) { - var ES2017SubstitutionFlags; - (function (ES2017SubstitutionFlags) { - /** Enables substitutions for async methods with `super` calls. */ - ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; - })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var resolver = context.getEmitResolver(); var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); // These variables contain state that changes as we descend into the tree. - var currentSourceFileExternalHelpersModuleName; + var currentSourceFile; /** * Keeps track of whether expression substitution has been enabled for specific edge cases. * They are persisted between each SourceFile transformation and should not be reset. */ var enabledSubstitutions; - /** - * Keeps track of whether we are within any containing namespaces when performing - * just-in-time substitution while printing an expression identifier. - */ - var applicableSubstitutions; /** * This keeps track of containers where `super` is valid, for use with * just-in-time substitution for `super` expressions inside of async methods. @@ -48413,25 +48843,21 @@ var ts; // Set new transformation hooks. context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - var currentScope; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } - currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName; - return ts.visitEachChild(node, visitor, context); + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } function visitor(node) { - if (node.transformFlags & 64 /* ES2017 */) { - return visitorWorker(node); + if ((node.transformFlags & 16 /* ContainsES2017 */) === 0) { + return node; } - else if (node.transformFlags & 128 /* ContainsES2017 */) { - return ts.visitEachChild(node, visitor, context); - } - return node; - } - function visitorWorker(node) { switch (node.kind) { case 119 /* AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 @@ -48452,16 +48878,15 @@ var ts; // ES2017 arrow functions may be 'async' return visitArrowFunction(node); default: - ts.Debug.failBadSyntaxKind(node); - return node; + return ts.visitEachChild(node, visitor, context); } } /** - * Visits an await expression. + * Visits an AwaitExpression node. * * This function will be called any time a ES2017 await expression is encountered. * - * @param node The await expression node. + * @param node The node to visit. */ function visitAwaitExpression(node) { return ts.setOriginalNode(ts.createYield( @@ -48469,106 +48894,73 @@ var ts; /*location*/ node), node); } /** - * Visits a method declaration of a class. + * Visits a MethodDeclaration node. * * This function will be called when one of the following conditions are met: * - The node is marked as async * - * @param node The method node. + * @param node The node to visit. */ function visitMethodDeclaration(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var method = ts.createMethod( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - // While we emit the source map for the node after skipping decorators and modifiers, - // we need to emit the comments for the original range. - ts.setCommentRange(method, node); - ts.setSourceMapRange(method, ts.moveRangePastDecorators(node)); - ts.setOriginalNode(method, node); - return method; + return ts.updateMethod(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } /** - * Visits a function declaration. + * Visits a FunctionDeclaration node. * * This function will be called when one of the following conditions are met: * - The node is marked async * - * @param node The function node. + * @param node The node to visit. */ function visitFunctionDeclaration(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var func = ts.createFunctionDeclaration( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); - return func; + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } /** - * Visits a function expression node. + * Visits a FunctionExpression node. * * This function will be called when one of the following conditions are met: * - The node is marked async * - * @param node The function expression node. + * @param node The node to visit. */ function visitFunctionExpression(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } if (ts.nodeIsMissing(node.body)) { return ts.createOmittedExpression(); } - var func = ts.createFunctionExpression( - /*modifiers*/ undefined, node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, transformFunctionBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); - return func; + return ts.updateFunctionExpression(node, + /*modifiers*/ undefined, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } /** - * @remarks + * Visits an ArrowFunction. + * * This function will be called when one of the following conditions are met: * - The node is marked async + * + * @param node The node to visit. */ function visitArrowFunction(node) { - if (!ts.isAsyncFunctionLike(node)) { - return node; - } - var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, node.equalsGreaterThanToken, transformConciseBody(node), - /*location*/ node); - ts.setOriginalNode(func, node); - return func; - } - function transformFunctionBody(node) { - return transformAsyncFunctionBody(node); - } - function transformConciseBody(node) { - return transformAsyncFunctionBody(node); - } - function transformFunctionBodyWorker(body, start) { - if (start === void 0) { start = 0; } - var savedCurrentScope = currentScope; - currentScope = body; - startLexicalEnvironment(); - var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start); - var visited = ts.updateBlock(body, statements); - var declarations = endLexicalEnvironment(); - currentScope = savedCurrentScope; - return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.isAsyncFunctionLike(node) + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; @@ -48582,54 +48974,51 @@ var ts; if (!isArrowFunction) { var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor); - statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(statements, /*location*/ node.body, /*multiLine*/ true); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. if (languageVersion >= 2 /* ES2015 */) { if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { enableSubstitutionForAsyncMethodsWithSuper(); - ts.setEmitFlags(block, 8 /* EmitAdvancedSuperHelper */); + ts.addEmitHelper(block, advancedAsyncSuperHelper); } else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { enableSubstitutionForAsyncMethodsWithSuper(); - ts.setEmitFlags(block, 4 /* EmitSuperHelper */); + ts.addEmitHelper(block, asyncSuperHelper); } } return block; } else { - return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, /*forceBlockFunctionBody*/ true)); + var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(expression); + return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements)); + } + return expression; } } - function transformConciseBodyWorker(body, forceBlockFunctionBody) { + function transformFunctionBodyWorker(body, start) { if (ts.isBlock(body)) { - return transformFunctionBodyWorker(body); + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); } else { startLexicalEnvironment(); - var visited = ts.visitNode(body, visitor, ts.isConciseBody); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); var declarations = endLexicalEnvironment(); - var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations); - if (forceBlockFunctionBody && !ts.isBlock(merged)) { - return ts.createBlock([ - ts.createReturn(merged) - ]); - } - else { - return merged; - } + return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); } } function getPromiseConstructor(type) { - if (type) { - var typeName = ts.getEntityNameFromTypeNode(type); - if (typeName && ts.isEntityName(typeName)) { - var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); - if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue - || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { - return typeName; - } + var typeName = type && ts.getEntityNameFromTypeNode(type); + if (typeName && ts.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { + return typeName; } } return undefined; @@ -48713,16 +49102,17 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(emitContext, node, emitCallback) { - var savedApplicableSubstitutions = applicableSubstitutions; - var savedCurrentSuperContainer = currentSuperContainer; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) { + var savedCurrentSuperContainer = currentSuperContainer; currentSuperContainer = node; + previousOnEmitNode(emitContext, node, emitCallback); + currentSuperContainer = savedCurrentSuperContainer; + } + else { + previousOnEmitNode(emitContext, node, emitCallback); } - previousOnEmitNode(emitContext, node, emitCallback); - applicableSubstitutions = savedApplicableSubstitutions; - currentSuperContainer = savedCurrentSuperContainer; } /** * Hooks node substitutions. @@ -48754,6 +49144,40 @@ var ts; } } ts.transformES2017 = transformES2017; + function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(awaiterHelper); + var generatorFunc = ts.createFunctionExpression( + /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */), + /*name*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, body); + // Mark this node as originally an async function + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */; + return ts.createCall(ts.getHelperName("__awaiter"), + /*typeArguments*/ undefined, [ + ts.createThis(), + hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), + promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), + generatorFunc + ]); + } + var awaiterHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };" + }; + var asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: "\n const _super = name => super[name];" + }; + var advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" + }; })(ts || (ts = {})); /// /// @@ -48770,64 +49194,60 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitor(node) { - if (node.transformFlags & 256 /* ES2016 */) { - return visitorWorker(node); - } - else if (node.transformFlags & 512 /* ContainsES2016 */) { - return ts.visitEachChild(node, visitor, context); - } - else { + if ((node.transformFlags & 32 /* ContainsES2016 */) === 0) { return node; } - } - function visitorWorker(node) { switch (node.kind) { case 192 /* BinaryExpression */: return visitBinaryExpression(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitBinaryExpression(node) { - // We are here because ES2016 adds support for the exponentiation operator. + switch (node.operatorToken.kind) { + case 61 /* AsteriskAsteriskEqualsToken */: + return visitExponentiationAssignmentExpression(node); + case 39 /* AsteriskAsteriskToken */: + return visitExponentiationExpression(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function visitExponentiationAssignmentExpression(node) { + var target; + var value; var left = ts.visitNode(node.left, visitor, ts.isExpression); var right = ts.visitNode(node.right, visitor, ts.isExpression); - if (node.operatorToken.kind === 61 /* AsteriskAsteriskEqualsToken */) { - var target = void 0; - var value = void 0; - if (ts.isElementAccessExpression(left)) { - // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)` - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression), - /*location*/ left); - value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, - /*location*/ left); - } - else if (ts.isPropertyAccessExpression(left)) { - // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)` - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name, - /*location*/ left); - value = ts.createPropertyAccess(expressionTemp, left.name, - /*location*/ left); - } - else { - // Transforms `a **= b` into `a = Math.pow(a, b)` - target = left; - value = left; - } - return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node); + if (ts.isElementAccessExpression(left)) { + // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)` + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression), + /*location*/ left); + value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, + /*location*/ left); } - else if (node.operatorToken.kind === 39 /* AsteriskAsteriskToken */) { - // Transforms `a ** b` into `Math.pow(a, b)` - return ts.createMathPow(left, right, /*location*/ node); + else if (ts.isPropertyAccessExpression(left)) { + // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)` + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name, + /*location*/ left); + value = ts.createPropertyAccess(expressionTemp, left.name, + /*location*/ left); } else { - ts.Debug.failBadSyntaxKind(node); - return ts.visitEachChild(node, visitor, context); + // Transforms `a **= b` into `a = Math.pow(a, b)` + target = left; + value = left; } + return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node); + } + function visitExponentiationExpression(node) { + // Transforms `a ** b` into `Math.pow(a, b)` + var left = ts.visitNode(node.left, visitor, ts.isExpression); + var right = ts.visitNode(node.right, visitor, ts.isExpression); + return ts.createMathPow(left, right, /*location*/ node); } } ts.transformES2016 = transformES2016; @@ -48880,7 +49300,7 @@ var ts; SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn"; })(SuperCaptureResult || (SuperCaptureResult = {})); function transformES2015(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -48914,7 +49334,11 @@ var ts; } currentSourceFile = node; currentText = node.text; - return ts.visitNode(node, visitor, ts.isSourceFile); + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + currentText = undefined; + return visited; } function visitor(node) { return saveStateAndInvoke(node, dispatcher); @@ -48954,6 +49378,41 @@ var ts; currentNode = savedCurrentNode; return visited; } + function onBeforeVisitNode(node) { + if (currentNode) { + if (ts.isBlockScope(currentNode, currentParent)) { + enclosingBlockScopeContainer = currentNode; + enclosingBlockScopeContainerParent = currentParent; + } + if (ts.isFunctionLike(currentNode)) { + enclosingFunction = currentNode; + if (currentNode.kind !== 185 /* ArrowFunction */) { + enclosingNonArrowFunction = currentNode; + if (!(ts.getEmitFlags(currentNode) & 131072 /* 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 205 /* VariableStatement */: + enclosingVariableStatement = currentNode; + break; + case 224 /* VariableDeclarationList */: + case 223 /* VariableDeclaration */: + case 174 /* BindingElement */: + case 172 /* ObjectBindingPattern */: + case 173 /* ArrayBindingPattern */: + break; + default: + enclosingVariableStatement = undefined; + } + } + currentParent = currentNode; + currentNode = node; + } function returnCapturedThis(node) { return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } @@ -48961,7 +49420,7 @@ var ts; return isInConstructorWithCapturedSuper && node.kind === 216 /* ReturnStatement */ && !node.expression; } function shouldCheckNode(node) { - return (node.transformFlags & 1024 /* ES2015 */) !== 0 || + return (node.transformFlags & 64 /* ES2015 */) !== 0 || node.kind === 219 /* LabeledStatement */ || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } @@ -48972,10 +49431,10 @@ var ts; else if (shouldCheckNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 2048 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { + else if (node.transformFlags & 128 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { // we want to dive in this branch either if node has children with ES2015 specific syntax // or we are inside constructor that captures result of the super call so all returns without expression should be - // rewritten. Note: we skip expressions since returns should never appear there + // rewritten. Note: we skip expressions since returns should never appear there return ts.visitEachChild(node, visitor, context); } else { @@ -49075,6 +49534,8 @@ var ts; return visitTemplateExpression(node); case 195 /* YieldExpression */: return visitYieldExpression(node); + case 196 /* SpreadElement */: + return visitSpreadElement(node); case 96 /* SuperKeyword */: return visitSuperKeyword(); case 195 /* YieldExpression */: @@ -49082,8 +49543,6 @@ var ts; return ts.visitEachChild(node, visitor, context); case 149 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 261 /* SourceFile */: - return visitSourceFileNode(node); case 205 /* VariableStatement */: return visitVariableStatement(node); default: @@ -49091,40 +49550,14 @@ var ts; return ts.visitEachChild(node, visitor, context); } } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185 /* ArrowFunction */) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 2097152 /* 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 205 /* VariableStatement */: - enclosingVariableStatement = currentNode; - break; - case 224 /* VariableDeclarationList */: - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; + function visitSourceFile(node) { + var statements = []; + startLexicalEnvironment(); + var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); + addCaptureThisForNodeIfNeeded(statements, node); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + ts.addRange(statements, endLexicalEnvironment()); + return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); } function visitSwitchStatement(node) { ts.Debug.assert(convertedLoopState !== undefined); @@ -49249,10 +49682,10 @@ var ts; statements.push(exportStatement); } var emitFlags = ts.getEmitFlags(node); - if ((emitFlags & 33554432 /* HasEndOfDeclarationMarker */) === 0) { + if ((emitFlags & 2097152 /* HasEndOfDeclarationMarker */) === 0) { // Add a DeclarationMarker as a marker for the end of the declaration statements.push(ts.createEndOfDeclarationMarker(node)); - ts.setEmitFlags(statement, emitFlags | 33554432 /* HasEndOfDeclarationMarker */); + ts.setEmitFlags(statement, emitFlags | 2097152 /* HasEndOfDeclarationMarker */); } return ts.singleOrMany(statements); } @@ -49314,17 +49747,17 @@ var ts; // To preserve the behavior of the old emitter, we explicitly indent // the body of the function here if it was requested in an earlier // transformation. - if (ts.getEmitFlags(node) & 524288 /* Indented */) { - ts.setEmitFlags(classFunction, 524288 /* Indented */); + if (ts.getEmitFlags(node) & 32768 /* Indented */) { + ts.setEmitFlags(classFunction, 32768 /* Indented */); } // "inner" and "outer" below are added purely to preserve source map locations from // the old emitter var inner = ts.createPartiallyEmittedExpression(classFunction); inner.end = node.end; - ts.setEmitFlags(inner, 49152 /* NoComments */); + ts.setEmitFlags(inner, 1536 /* NoComments */); var outer = ts.createPartiallyEmittedExpression(inner); outer.end = ts.skipTrivia(currentText, node.pos); - ts.setEmitFlags(outer, 49152 /* NoComments */); + ts.setEmitFlags(outer, 1536 /* NoComments */); return ts.createParen(ts.createCall(outer, /*typeArguments*/ undefined, extendsClauseElement ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)] @@ -49349,14 +49782,14 @@ var ts; // emit with the original emitter. var outer = ts.createPartiallyEmittedExpression(localName); outer.end = closingBraceLocation.end; - ts.setEmitFlags(outer, 49152 /* NoComments */); + ts.setEmitFlags(outer, 1536 /* NoComments */); var statement = ts.createReturn(outer); statement.pos = closingBraceLocation.pos; - ts.setEmitFlags(statement, 49152 /* NoComments */ | 12288 /* NoTokenSourceMaps */); + ts.setEmitFlags(statement, 1536 /* NoComments */ | 384 /* NoTokenSourceMaps */); statements.push(statement); ts.addRange(statements, endLexicalEnvironment()); var block = ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), /*location*/ undefined, /*multiLine*/ true); - ts.setEmitFlags(block, 49152 /* NoComments */); + ts.setEmitFlags(block, 1536 /* NoComments */); return block; } /** @@ -49368,7 +49801,7 @@ var ts; */ function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { - statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)), + statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), /*location*/ extendsClauseElement)); } } @@ -49390,7 +49823,7 @@ var ts; /*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), /*location*/ constructor || node); if (extendsClauseElement) { - ts.setEmitFlags(constructorFunction, 256 /* CapturesThis */); + ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */); } statements.push(constructorFunction); } @@ -49407,10 +49840,8 @@ var ts; // `super` call. // If this is the case, we do not include the synthetic `...args` parameter and // will instead use the `arguments` object in ES5/3. - if (constructor && !hasSynthesizedSuper) { - return ts.visitNodes(constructor.parameters, visitor, ts.isParameter); - } - return []; + return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) + || []; } /** * Transforms the body of a constructor declaration of a class. @@ -49423,21 +49854,21 @@ var ts; */ function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { var statements = []; - startLexicalEnvironment(); + resumeLexicalEnvironment(); var statementOffset = -1; if (hasSynthesizedSuper) { // If a super call has already been synthesized, // we're going to assume that we should just transform everything after that. // The assumption is that no prior step in the pipeline has added any prologue directives. - statementOffset = 1; + statementOffset = 0; } else if (constructor) { // Otherwise, try to emit all potential prologue directives first. statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, /*ensureUseStrict*/ false, visitor); } if (constructor) { - ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, /*convertObjectRest*/ false); - ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + addDefaultValueAssignmentsIfNeeded(statements, constructor); + addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); @@ -49465,7 +49896,7 @@ var ts; /*location*/ constructor ? constructor.body : node, /*multiLine*/ true); if (!constructor) { - ts.setEmitFlags(block, 49152 /* NoComments */); + ts.setEmitFlags(block, 1536 /* NoComments */); } return block; } @@ -49503,7 +49934,7 @@ var ts; // If this isn't a derived class, just capture 'this' for arrow functions if necessary. if (!hasExtendsClause) { if (ctor) { - ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis); + addCaptureThisForNodeIfNeeded(statements, ctor); } return 0 /* NoReplacement */; } @@ -49518,7 +49949,7 @@ var ts; // for something like property initializers. // Create a captured '_this' variable and assume it will subsequently be used. if (hasSynthesizedSuper) { - ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); + captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); enableSubstitutionsForCapturedThis(); return 1 /* ReplaceSuperCapture */; } @@ -49549,13 +49980,23 @@ var ts; superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); } } - // Return the result if we have an immediate super() call on the last statement. - if (superCallExpression && statementOffset === ctorStatements.length - 1) { - statements.push(ts.createReturn(superCallExpression)); + // Return the result if we have an immediate super() call on the last statement, + // but only if the constructor itself doesn't use 'this' elsewhere. + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 /* ContainsLexicalThis */ | 32768 /* ContainsCapturedLexicalThis */))) { + var returnStatement = ts.createReturn(superCallExpression); + if (superCallExpression.kind !== 192 /* BinaryExpression */ + || superCallExpression.left.kind !== 179 /* CallExpression */) { + ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); + } + // Shift comments from the original super call to the return statement. + ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536 /* NoComments */))); + statements.push(returnStatement); return 2 /* ReplaceWithReturn */; } // Perform the capture. - ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement); + captureThisForNode(statements, ctor, superCallExpression, firstStatement); // If we're actually replacing the original statement, we need to signal this to the caller. if (superCallExpression) { return 1 /* ReplaceSuperCapture */; @@ -49564,7 +50005,7 @@ var ts; } function createDefaultSuperCallOrThis() { var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 128 /* NoSubstitution */); + ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); return ts.createLogicalOr(superCall, actualThis); } @@ -49607,6 +50048,160 @@ var ts; return node; } } + /** + * Gets a value indicating whether we need to add default value assignments for a + * function-like node. + * + * @param node A function-like node. + */ + function shouldAddDefaultValueAssignments(node) { + return (node.transformFlags & 131072 /* ContainsDefaultValueAssignments */) !== 0; + } + /** + * Adds statements to the body of a function-like node if it contains parameters with + * binding patterns or initializers. + * + * @param statements The statements for the new function body. + * @param node A function-like node. + */ + function addDefaultValueAssignmentsIfNeeded(statements, node) { + if (!shouldAddDefaultValueAssignments(node)) { + return; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + var name_36 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + // A rest parameter cannot have a binding pattern or an initializer, + // so let's just ignore it. + if (dotDotDotToken) { + continue; + } + if (ts.isBindingPattern(name_36)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name_36, initializer); + } + else if (initializer) { + addDefaultValueAssignmentForInitializer(statements, parameter, name_36, initializer); + } + } + } + /** + * Adds statements to the body of a function-like node for parameters with binding patterns + * + * @param statements The statements for the new function body. + * @param parameter The parameter for the function. + * @param name The name of the parameter. + * @param initializer The initializer for the parameter. + */ + function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) { + var temp = ts.getGeneratedNameForNode(parameter); + // In cases where a binding pattern is simply '[]' or '{}', + // we usually don't want to emit a var declaration; however, in the presence + // of an initializer, we must emit that expression to preserve side effects. + if (name.elements.length > 0) { + statements.push(ts.setEmitFlags(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, temp))), 524288 /* CustomPrologue */)); + } + else if (initializer) { + statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288 /* CustomPrologue */)); + } + } + /** + * Adds statements to the body of a function-like node for parameters with initializers. + * + * @param statements The statements for the new function body. + * @param parameter The parameter for the function. + * @param name The name of the parameter. + * @param initializer The initializer for the parameter. + */ + function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { + initializer = ts.visitNode(initializer, visitor, ts.isExpression); + var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48 /* NoSourceMap */), ts.setEmitFlags(initializer, 48 /* NoSourceMap */ | ts.getEmitFlags(initializer)), + /*location*/ parameter)) + ], /*location*/ parameter), 1 /* SingleLine */ | 32 /* NoTrailingSourceMap */ | 384 /* NoTokenSourceMaps */), + /*elseStatement*/ undefined, + /*location*/ parameter); + statement.startsOnNewLine = true; + ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 524288 /* CustomPrologue */); + statements.push(statement); + } + /** + * Gets a value indicating whether we need to add statements to handle a rest parameter. + * + * @param node A ParameterDeclaration node. + * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is + * part of a constructor declaration with a + * synthesized call to `super` + */ + function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { + return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper; + } + /** + * Adds statements to the body of a function-like node if it contains a rest parameter. + * + * @param statements The statements for the new function body. + * @param node A function-like node. + * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is + * part of a constructor declaration with a + * synthesized call to `super` + */ + function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { + var parameter = ts.lastOrUndefined(node.parameters); + if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { + return; + } + // `declarationName` is the name of the local declaration for the parameter. + var declarationName = ts.getMutableClone(parameter.name); + ts.setEmitFlags(declarationName, 48 /* NoSourceMap */); + // `expressionName` is the name of the parameter used in expressions. + var expressionName = ts.getSynthesizedClone(parameter.name); + var restIndex = node.parameters.length - 1; + var temp = ts.createLoopVariable(); + // var param = []; + statements.push(ts.setEmitFlags(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(declarationName, + /*type*/ undefined, ts.createArrayLiteral([])) + ]), + /*location*/ parameter), 524288 /* CustomPrologue */)); + // for (var _i = restIndex; _i < arguments.length; _i++) { + // param[_i - restIndex] = arguments[_i]; + // } + var forStatement = ts.createFor(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(temp, /*type*/ undefined, ts.createLiteral(restIndex)) + ], /*location*/ parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), + /*location*/ parameter), ts.createPostfixIncrement(temp, /*location*/ parameter), ts.createBlock([ + ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 + ? temp + : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), + /*location*/ parameter)) + ])); + ts.setEmitFlags(forStatement, 524288 /* CustomPrologue */); + ts.startOnNewLine(forStatement); + statements.push(forStatement); + } + /** + * Adds a statement to capture the `this` of a function declaration if it is needed. + * + * @param statements The statements for the new function body. + * @param node A node. + */ + function addCaptureThisForNodeIfNeeded(statements, node) { + if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) { + captureThisForNode(statements, node, ts.createThis()); + } + } + function captureThisForNode(statements, node, initializer, originalStatement) { + enableSubstitutionsForCapturedThis(); + var captureThisStatement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_this", + /*type*/ undefined, initializer) + ]), originalStatement); + ts.setEmitFlags(captureThisStatement, 1536 /* NoComments */ | 524288 /* CustomPrologue */); + ts.setSourceMapRange(captureThisStatement, node); + statements.push(captureThisStatement); + } /** * Adds statements to the class body function for a class to define the members of the * class. @@ -49657,18 +50252,18 @@ var ts; function transformClassMethodDeclarationToStatement(receiver, member) { var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); - var func = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); - ts.setEmitFlags(func, 49152 /* NoComments */); - ts.setSourceMapRange(func, sourceMapRange); - var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), - /*location*/ member.name), func), + var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), /*location*/ member.name); + var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); + ts.setEmitFlags(memberFunction, 1536 /* NoComments */); + ts.setSourceMapRange(memberFunction, sourceMapRange); + var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), /*location*/ member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); // The location for the statement is used to emit comments only. // No source map should be emitted for this statement to align with the // old emitter. - ts.setEmitFlags(statement, 1536 /* NoSourceMap */); + ts.setEmitFlags(statement, 48 /* NoSourceMap */); return statement; } /** @@ -49683,7 +50278,7 @@ var ts; // The location for the statement is used to emit source maps only. // No comments should be emitted for this statement to align with the // old emitter. - ts.setEmitFlags(statement, 49152 /* NoComments */); + ts.setEmitFlags(statement, 1536 /* NoComments */); return statement; } /** @@ -49697,16 +50292,16 @@ var ts; // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. var target = ts.getMutableClone(receiver); - ts.setEmitFlags(target, 49152 /* NoComments */ | 1024 /* NoTrailingSourceMap */); + ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */); ts.setSourceMapRange(target, firstAccessor.name); var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName)); - ts.setEmitFlags(propertyName, 49152 /* NoComments */ | 512 /* NoLeadingSourceMap */); + ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */); ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); - ts.setEmitFlags(getterFunction, 16384 /* NoLeadingComments */); + ts.setEmitFlags(getterFunction, 512 /* NoLeadingComments */); var getter = ts.createPropertyAssignment("get", getterFunction); ts.setCommentRange(getter, ts.getCommentRange(getAccessor)); properties.push(getter); @@ -49714,7 +50309,7 @@ var ts; if (setAccessor) { var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); - ts.setEmitFlags(setterFunction, 16384 /* NoLeadingComments */); + ts.setEmitFlags(setterFunction, 512 /* NoLeadingComments */); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); properties.push(setter); @@ -49737,11 +50332,17 @@ var ts; * @param node An ArrowFunction node. */ function visitArrowFunction(node) { - if (node.transformFlags & 262144 /* ContainsLexicalThis */) { + if (node.transformFlags & 16384 /* ContainsLexicalThis */) { enableSubstitutionsForCapturedThis(); } - var func = transformFunctionLikeToExpression(node, /*location*/ node, /*name*/ undefined); - ts.setEmitFlags(func, 256 /* CapturesThis */); + var func = ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformFunctionBody(node), node); + ts.setOriginalNode(func, node); + ts.setEmitFlags(func, 8 /* CapturesThis */); return func; } /** @@ -49750,7 +50351,12 @@ var ts; * @param node a FunctionExpression node. */ function visitFunctionExpression(node) { - return transformFunctionLikeToExpression(node, /*location*/ node, node.name); + return ts.updateFunctionExpression(node, + /*modifiers*/ undefined, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + ? transformFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } /** * Visits a FunctionDeclaration node. @@ -49758,12 +50364,12 @@ var ts; * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node) { - return ts.setOriginalNode(ts.createFunctionDeclaration( - /*decorators*/ undefined, node.modifiers, node.asteriskToken, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis), - /*location*/ node), - /*original*/ node); + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, node.modifiers, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + ? transformFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); } /** * Transforms a function-like node into a FunctionExpression. @@ -49779,12 +50385,86 @@ var ts; } var expression = ts.setOriginalNode(ts.createFunctionExpression( /*modifiers*/ undefined, node.asteriskToken, name, - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), - /*type*/ undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, saveStateAndInvoke(node, transformFunctionBody), location), /*original*/ node); enclosingNonArrowFunction = savedContainingNonArrowFunction; return expression; } + /** + * Transforms the body of a function-like node. + * + * @param node A function-like node. + */ + function transformFunctionBody(node) { + var multiLine = false; // indicates whether the block *must* be emitted as multiple lines + var singleLine = false; // indicates whether the block *may* be emitted as a single line + var statementsLocation; + var closeBraceLocation; + var statements = []; + var body = node.body; + var statementOffset; + resumeLexicalEnvironment(); + if (ts.isBlock(body)) { + // ensureUseStrict is false because no new prologue-directive should be added. + // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array + statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); + } + addCaptureThisForNodeIfNeeded(statements, node); + addDefaultValueAssignmentsIfNeeded(statements, node); + addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false); + // If we added any generated statements, this must be a multi-line block. + if (!multiLine && statements.length > 0) { + multiLine = true; + } + if (ts.isBlock(body)) { + statementsLocation = body.statements; + ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); + // If the original body was a multi-line block, this must be a multi-line block. + if (!multiLine && body.multiLine) { + multiLine = true; + } + } + else { + ts.Debug.assert(node.kind === 185 /* ArrowFunction */); + // To align with the old emitter, we use a synthetic end position on the location + // for the statement list we synthesize when we down-level an arrow function with + // an expression function body. This prevents both comments and source maps from + // being emitted for the end position only. + statementsLocation = ts.moveRangeEnd(body, -1); + var equalsGreaterThanToken = node.equalsGreaterThanToken; + if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { + if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { + singleLine = true; + } + else { + multiLine = true; + } + } + var expression = ts.visitNode(body, visitor, ts.isExpression); + var returnStatement = ts.createReturn(expression, /*location*/ body); + ts.setEmitFlags(returnStatement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 1024 /* NoTrailingComments */); + statements.push(returnStatement); + // To align with the source map emit for the old emitter, we set a custom + // source map location for the close brace. + closeBraceLocation = body; + } + var lexicalEnvironment = context.endLexicalEnvironment(); + ts.addRange(statements, lexicalEnvironment); + // If we added any final generated statements, this must be a multi-line block + if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { + multiLine = true; + } + var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine); + if (!multiLine && singleLine) { + ts.setEmitFlags(block, 1 /* SingleLine */); + } + if (closeBraceLocation) { + ts.setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation); + } + ts.setOriginalNode(block, node.body); + return block; + } /** * Visits an ExpressionStatement that contains a destructuring assignment. * @@ -49809,14 +50489,12 @@ var ts; */ function visitParenthesizedExpression(node, needsDestructuringValue) { // If we are here it is most likely because our expression is a destructuring assignment. - if (needsDestructuringValue) { + if (!needsDestructuringValue) { switch (node.expression.kind) { case 183 /* ParenthesizedExpression */: - return ts.createParen(visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ true), - /*location*/ node); + return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); case 192 /* BinaryExpression */: - return ts.createParen(visitBinaryExpression(node.expression, /*needsDestructuringValue*/ true), - /*location*/ node); + return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } } return ts.visitEachChild(node, visitor, context); @@ -49830,8 +50508,9 @@ var ts; */ function visitBinaryExpression(node, needsDestructuringValue) { // If we are here it is because this is a destructuring assignment. - ts.Debug.assert(ts.isDestructuringAssignment(node)); - return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor); + if (ts.isDestructuringAssignment(node)) { + return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, needsDestructuringValue); + } } function visitVariableStatement(node) { if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) == 0) { @@ -49843,7 +50522,7 @@ var ts; if (decl.initializer) { var assignment = void 0; if (ts.isBindingPattern(decl.name)) { - assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, /*createAssignmentCallback*/ undefined, visitor); + assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */); } else { assignment = ts.createBinary(decl.name, 57 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression)); @@ -49876,7 +50555,7 @@ var ts; var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node); ts.setOriginalNode(declarationList, node); ts.setCommentRange(declarationList, node); - if (node.transformFlags & 67108864 /* ContainsBindingPattern */ + if (node.transformFlags & 8388608 /* ContainsBindingPattern */ && (ts.isBindingPattern(node.declarations[0].name) || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { // If the first or last declaration is a binding pattern, we need to modify @@ -49964,9 +50643,9 @@ var ts; return visitVariableDeclaration(node); } if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) { - var clone_5 = ts.getMutableClone(node); - clone_5.initializer = ts.createVoidZero(); - return clone_5; + var clone_3 = ts.getMutableClone(node); + clone_3.initializer = ts.createVoidZero(); + return clone_3; } return ts.visitEachChild(node, visitor, context); } @@ -49978,9 +50657,10 @@ var ts; function visitVariableDeclaration(node) { // If we are here it is because the name contains a binding pattern. if (ts.isBindingPattern(node.name)) { - var recordTempVariablesInLine = !enclosingVariableStatement - || !ts.hasModifier(enclosingVariableStatement, 1 /* Export */); - return ts.flattenVariableDestructuring(node, /*value*/ undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration); + var hoistTempVariables = enclosingVariableStatement + && ts.hasModifier(enclosingVariableStatement, 1 /* Export */); + return ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, + /*value*/ undefined, hoistTempVariables); } return ts.visitEachChild(node, visitor, context); } @@ -50024,7 +50704,118 @@ var ts; return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); } function convertForOfToFor(node, convertedLoopBodyStatements) { - return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, /*transformRest*/ false); + // The following ES6 code: + // + // for (let v of expr) { } + // + // should be emitted as + // + // for (var _i = 0, _a = expr; _i < _a.length; _i++) { + // var v = _a[_i]; + // } + // + // where _a and _i are temps emitted to capture the RHS and the counter, + // respectively. + // When the left hand side is an expression instead of a let declaration, + // the "let v" is not emitted. + // When the left hand side is a let/const, the v is renamed if there is + // another v in scope. + // Note that all assignments to the LHS are emitted in the body, including + // all destructuring. + // Note also that because an extra statement is needed to assign to the LHS, + // for-of bodies are always emitted as blocks. + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var initializer = node.initializer; + var statements = []; + // In the case where the user wrote an identifier as the RHS, like this: + // + // for (let v of arr) { } + // + // we don't want to emit a temporary variable for the RHS, just use it directly. + var counter = ts.createLoopVariable(); + var rhsReference = expression.kind === 70 /* Identifier */ + ? ts.createUniqueName(expression.text) + : ts.createTempVariable(/*recordTempVariable*/ undefined); + var elementAccess = ts.createElementAccess(rhsReference, counter); + // Initialize LHS + // var v = _a[_i]; + if (ts.isVariableDeclarationList(initializer)) { + if (initializer.flags & 3 /* BlockScoped */) { + enableSubstitutionsForBlockScopedBindings(); + } + var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); + if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { + // This works whether the declaration is a var, let, or const. + // It will use rhsIterationValue _a[_i] as the initializer. + var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0 /* All */, elementAccess); + var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ initializer); + ts.setOriginalNode(declarationList, initializer); + // Adjust the source map range for the first declaration to align with the old + // emitter. + var firstDeclaration = declarations[0]; + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, declarationList)); + } + else { + // The following call does not include the initializer, so we have + // to emit it separately. + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, ts.setOriginalNode(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(/*recordTempVariable*/ undefined), + /*type*/ undefined, ts.createElementAccess(rhsReference, counter)) + ], /*location*/ ts.moveRangePos(initializer, -1)), initializer), + /*location*/ ts.moveRangeEnd(initializer, -1))); + } + } + else { + // Initializer is an expression. Emit the expression in the body, so that it's + // evaluated on every iteration. + var assignment = ts.createAssignment(initializer, elementAccess); + if (ts.isDestructuringAssignment(assignment)) { + // This is a destructuring pattern, so we flatten the destructuring instead. + statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0 /* All */))); + } + else { + // Currently there is not way to check that assignment is binary expression of destructing assignment + // so we have to cast never type to binaryExpression + assignment.end = initializer.end; + statements.push(ts.createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1))); + } + } + var bodyLocation; + var statementsLocation; + if (convertedLoopBodyStatements) { + ts.addRange(statements, convertedLoopBodyStatements); + } + else { + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + if (ts.isBlock(statement)) { + ts.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; + } + else { + statements.push(statement); + } + } + // The old emitter does not emit source maps for the expression + ts.setEmitFlags(expression, 48 /* NoSourceMap */ | ts.getEmitFlags(expression)); + // The old emitter does not emit source maps for the block. + // We add the location to preserve comments. + var body = ts.createBlock(ts.createNodeArray(statements, /*location*/ statementsLocation), + /*location*/ bodyLocation); + ts.setEmitFlags(body, 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */); + var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(counter, /*type*/ undefined, ts.createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)), + ts.createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression) + ], /*location*/ node.expression), 1048576 /* NoHoisting */), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), + /*location*/ node.expression), ts.createPostfixIncrement(counter, /*location*/ node.expression), body, + /*location*/ node); + // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. + ts.setEmitFlags(forStatement, 256 /* NoTokenTrailingSourceMaps */); + return forStatement; } /** * Visits an ObjectLiteralExpression with computed propety names. @@ -50040,7 +50831,7 @@ var ts; var numInitialProperties = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 134217728 /* ContainsYield */ + if (property.transformFlags & 16777216 /* ContainsYield */ || property.name.kind === 142 /* ComputedPropertyName */) { numInitialProperties = i; break; @@ -50053,7 +50844,7 @@ var ts; // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. var expressions = []; var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), - /*location*/ undefined, node.multiLine), 524288 /* Indented */)); + /*location*/ undefined, node.multiLine), 32768 /* Indented */)); if (node.multiLine) { assignment.startsOnNewLine = true; } @@ -50147,26 +50938,31 @@ var ts; convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; } } + startLexicalEnvironment(); var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { - var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_3); - loopBody = ts.createBlock(statements_3, /*location*/ undefined, /*multiline*/ true); + if (loopOutParameters.length || lexicalEnvironment) { + var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, /*location*/ undefined, /*multiline*/ true); } if (!ts.isBlock(loopBody)) { loopBody = ts.createBlock([loopBody], /*location*/ undefined, /*multiline*/ true); } var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152 /* AsyncFunctionBody */) !== 0 - && (node.statement.transformFlags & 134217728 /* ContainsYield */) !== 0; + && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072 /* AsyncFunctionBody */) !== 0 + && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { - loopBodyFlags |= 256 /* CapturesThis */; + loopBodyFlags |= 8 /* CapturesThis */; } if (isAsyncBlockContainingAwait) { - loopBodyFlags |= 2097152 /* AsyncFunctionBody */; + loopBodyFlags |= 131072 /* AsyncFunctionBody */; } var convertedLoopVariable = ts.createVariableStatement( /*modifiers*/ undefined, ts.setEmitFlags(ts.createVariableDeclarationList([ @@ -50176,7 +50972,7 @@ var ts; /*name*/ undefined, /*typeParameters*/ undefined, loopParameters, /*type*/ undefined, loopBody), loopBodyFlags)) - ]), 16777216 /* NoHoisting */)); + ]), 1048576 /* NoHoisting */)); var statements = [convertedLoopVariable]; var extraVariableDeclarations; // propagate state from the inner loop to the outer loop if necessary @@ -50457,7 +51253,7 @@ var ts; ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); var temp = ts.createTempVariable(undefined); var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenVariableDestructuring(node.variableDeclaration, temp, visitor); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp); var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags); var destructure = ts.createVariableStatement(undefined, list); return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); @@ -50478,7 +51274,7 @@ var ts; // Methods with computed property names are handled in visitObjectLiteralExpression. ts.Debug.assert(!ts.isComputedPropertyName(node.name)); var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined); - ts.setEmitFlags(functionExpression, 16384 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression)); + ts.setEmitFlags(functionExpression, 512 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression)); return ts.createPropertyAssignment(node.name, functionExpression, /*location*/ node); } @@ -50525,10 +51321,10 @@ var ts; // because we contain a SpreadElementExpression. var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; if (node.expression.kind === 96 /* SuperKeyword */) { - ts.setEmitFlags(thisArg, 128 /* NoSubstitution */); + ts.setEmitFlags(thisArg, 4 /* NoSubstitution */); } var resultingCall; - if (node.transformFlags & 8388608 /* ContainsSpreadExpression */) { + if (node.transformFlags & 524288 /* ContainsSpread */) { // [source] // f(...a, b) // x.m(...a, b) @@ -50559,7 +51355,7 @@ var ts; } if (node.expression.kind === 96 /* SuperKeyword */) { var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 128 /* NoSubstitution */); + ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var initializer = ts.createLogicalOr(resultingCall, actualThis); return assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) @@ -50574,7 +51370,7 @@ var ts; */ function visitNewExpression(node) { // We are here because we contain a SpreadElementExpression. - ts.Debug.assert((node.transformFlags & 8388608 /* ContainsSpreadExpression */) !== 0); + ts.Debug.assert((node.transformFlags & 524288 /* ContainsSpread */) !== 0); // [source] // new C(...a) // @@ -50624,6 +51420,9 @@ var ts; return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, /*location*/ undefined, hasTrailingComma), visitor, ts.isExpression), /*location*/ undefined, multiLine); } + function visitSpreadElement(node) { + return ts.visitNode(node.expression, visitor, ts.isExpression); + } /** * Transforms the expression of a SpreadExpression node. * @@ -50790,18 +51589,6 @@ var ts; ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } - function visitSourceFileNode(node) { - var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1]; - var statements = []; - startLexicalEnvironment(); - ts.addRange(statements, prologue); - ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis); - ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement)); - ts.addRange(statements, endLexicalEnvironment()); - var clone = ts.getMutableClone(node); - clone.statements = ts.createNodeArray(statements, /*location*/ node.statements); - return clone; - } /** * Called by the printer just before a node is printed. * @@ -50927,7 +51714,7 @@ var ts; function substituteThisKeyword(node) { if (enabledSubstitutions & 1 /* CapturedThis */ && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 256 /* CapturesThis */) { + && ts.getEmitFlags(enclosingFunction) & 8 /* CapturesThis */) { return ts.createIdentifier("_this", /*location*/ node); } return node; @@ -50940,8 +51727,7 @@ var ts; if (!constructor || !hasExtendsClause) { return false; } - var parameter = ts.singleOrUndefined(constructor.parameters); - if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) { + if (ts.some(constructor.parameters)) { return false; } var statement = ts.firstOrUndefined(constructor.body.statements); @@ -50961,10 +51747,24 @@ var ts; return false; } var expression = callArgument.expression; - return ts.isIdentifier(expression) && expression === parameter.name; + return ts.isIdentifier(expression) && expression.text === "arguments"; } } ts.transformES2015 = transformES2015; + function createExtendsHelper(context, name) { + context.requestEmitHelper(extendsHelper); + return ts.createCall(ts.getHelperName("__extends"), + /*typeArguments*/ undefined, [ + name, + ts.createIdentifier("_super") + ]); + } + var extendsHelper = { + name: "typescript:extends", + scoped: false, + priority: 0, + text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + }; })(ts || (ts = {})); /// /// @@ -51146,7 +51946,7 @@ var ts; _a[7 /* Endfinally */] = "endfinally", _a)); function transformGenerators(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var resolver = context.getEmitResolver(); @@ -51196,15 +51996,15 @@ var ts; var withBlockStack; // A stack containing `with` blocks. return transformSourceFile; function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { + if (ts.isDeclarationFile(node) + || (node.transformFlags & 512 /* ContainsGenerator */) === 0) { return node; } - if (node.transformFlags & 8192 /* ContainsGenerator */) { - currentSourceFile = node; - node = ts.visitEachChild(node, visitor, context); - currentSourceFile = undefined; - } - return node; + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; } /** * Visits a node. @@ -51219,10 +52019,10 @@ var ts; else if (inGeneratorFunctionBody) { return visitJavaScriptInGeneratorFunctionBody(node); } - else if (transformFlags & 4096 /* Generator */) { + else if (transformFlags & 256 /* Generator */) { return visitGenerator(node); } - else if (transformFlags & 8192 /* ContainsGenerator */) { + else if (transformFlags & 512 /* ContainsGenerator */) { return ts.visitEachChild(node, visitor, context); } else { @@ -51275,10 +52075,10 @@ var ts; case 216 /* ReturnStatement */: return visitReturnStatement(node); default: - if (node.transformFlags & 134217728 /* ContainsYield */) { + if (node.transformFlags & 16777216 /* ContainsYield */) { return visitJavaScriptContainingYield(node); } - else if (node.transformFlags & (8192 /* ContainsGenerator */ | 268435456 /* ContainsHoistedDeclarationOrCompletion */)) { + else if (node.transformFlags & (512 /* ContainsGenerator */ | 33554432 /* ContainsHoistedDeclarationOrCompletion */)) { return ts.visitEachChild(node, visitor, context); } else { @@ -51340,12 +52140,11 @@ var ts; */ function visitFunctionDeclaration(node) { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) { + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { node = ts.setOriginalNode(ts.createFunctionDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, + /*decorators*/ undefined, node.modifiers, /*asteriskToken*/ undefined, node.name, - /*typeParameters*/ undefined, node.parameters, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, transformGeneratorFunctionBody(node.body), /*location*/ node), node); } @@ -51379,11 +52178,11 @@ var ts; */ function visitFunctionExpression(node) { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) { + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { node = ts.setOriginalNode(ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, node.name, - /*typeParameters*/ undefined, node.parameters, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, transformGeneratorFunctionBody(node.body), /*location*/ node), node); } @@ -51452,7 +52251,7 @@ var ts; operationLocations = undefined; state = ts.createTempVariable(/*recordTempVariable*/ undefined); // Build the generator - startLexicalEnvironment(); + resumeLexicalEnvironment(); var statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); @@ -51483,13 +52282,13 @@ var ts; * @param node The node to visit. */ function visitVariableStatement(node) { - if (node.transformFlags & 134217728 /* ContainsYield */) { + if (node.transformFlags & 16777216 /* ContainsYield */) { transformAndEmitVariableDeclarationList(node.declarationList); return undefined; } else { // Do not hoist custom prologues. - if (ts.getEmitFlags(node) & 8388608 /* CustomPrologue */) { + if (ts.getEmitFlags(node) & 524288 /* CustomPrologue */) { return node; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { @@ -51606,10 +52405,10 @@ var ts; // _a = a(); // .yield resumeLabel // _a + %sent% + c() - var clone_6 = ts.getMutableClone(node); - clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_6; + var clone_4 = ts.getMutableClone(node); + clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_4; } return ts.visitEachChild(node, visitor, context); } @@ -51762,7 +52561,7 @@ var ts; * @param node The node to visit. */ function visitArrayLiteralExpression(node) { - return visitElements(node.elements, node.multiLine); + return visitElements(node.elements, /*leadingElement*/ undefined, /*location*/ undefined, node.multiLine); } /** * Visits an array of expressions containing one or more YieldExpression nodes @@ -51771,7 +52570,7 @@ var ts; * @param elements The elements to visit. * @param multiLine Whether array literals created should be emitted on multiple lines. */ - function visitElements(elements, _multiLine) { + function visitElements(elements, leadingElement, location, multiLine) { // [source] // ar = [1, yield, 2]; // @@ -51785,19 +52584,24 @@ var ts; var temp = declareLocal(); var hasAssignedTemp = false; if (numInitialElements > 0) { - emitAssignment(temp, ts.createArrayLiteral(ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements))); + var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); + emitAssignment(temp, ts.createArrayLiteral(leadingElement + ? [leadingElement].concat(initialElements) : initialElements)); + leadingElement = undefined; hasAssignedTemp = true; } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); return hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)]) - : ts.createArrayLiteral(expressions); + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine); function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { emitAssignment(temp, hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)]) - : ts.createArrayLiteral(expressions)); + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, + /*location*/ undefined, multiLine)); hasAssignedTemp = true; + leadingElement = undefined; expressions = []; } expressions.push(ts.visitNode(element, visitor, ts.isExpression)); @@ -51863,10 +52667,10 @@ var ts; // .yield resumeLabel // .mark resumeLabel // a = _a[%sent%] - var clone_7 = ts.getMutableClone(node); - clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_7; + var clone_5 = ts.getMutableClone(node); + clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -51901,7 +52705,8 @@ var ts; // .mark resumeLabel // new (_b.apply(_a, _c.concat([%sent%, 2]))); var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)), + return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, + /*leadingElement*/ ts.createVoidZero())), /*typeArguments*/ undefined, [], /*location*/ node), node); } @@ -52524,7 +53329,7 @@ var ts; } } function containsYield(node) { - return node && (node.transformFlags & 134217728 /* ContainsYield */) !== 0; + return node && (node.transformFlags & 16777216 /* ContainsYield */) !== 0; } function countInitialNodesWithoutYield(nodes) { var numNodes = nodes.length; @@ -52554,12 +53359,12 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_35 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_35) { - var clone_8 = ts.getMutableClone(name_35); - ts.setSourceMapRange(clone_8, node); - ts.setCommentRange(clone_8, node); - return clone_8; + var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_37) { + var clone_6 = ts.getMutableClone(name_37); + ts.setSourceMapRange(clone_6, node); + ts.setCommentRange(clone_6, node); + return clone_6; } } } @@ -53145,18 +53950,14 @@ var ts; currentExceptionBlock = undefined; withBlockStack = undefined; var buildResult = buildStatements(); - return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), - /*typeArguments*/ undefined, [ - ts.createThis(), - ts.setEmitFlags(ts.createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)], - /*type*/ undefined, ts.createBlock(buildResult, - /*location*/ undefined, - /*multiLine*/ buildResult.length > 0)), 4194304 /* ReuseTempVariableScope */) - ]); + return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)], + /*type*/ undefined, ts.createBlock(buildResult, + /*location*/ undefined, + /*multiLine*/ buildResult.length > 0)), 262144 /* ReuseTempVariableScope */)); } /** * Builds the statements for the generator function body. @@ -53527,6 +54328,76 @@ var ts; } } ts.transformGenerators = transformGenerators; + function createGeneratorHelper(context, body) { + context.requestEmitHelper(generatorHelper); + return ts.createCall(ts.getHelperName("__generator"), + /*typeArguments*/ undefined, [ts.createThis(), body]); + } + // The __generator helper is used by down-level transformations to emulate the runtime + // semantics of an ES2015 generator function. When called, this helper returns an + // object that implements the Iterator protocol, in that it has `next`, `return`, and + // `throw` methods that step through the generator when invoked. + // + // parameters: + // thisArg The value to use as the `this` binding for the transformed generator body. + // body A function that acts as the transformed generator body. + // + // variables: + // _ Persistent state for the generator that is shared between the helper and the + // generator body. The state object has the following members: + // sent() - A method that returns or throws the current completion value. + // label - The next point at which to resume evaluation of the generator body. + // trys - A stack of protected regions (try/catch/finally blocks). + // ops - A stack of pending instructions when inside of a finally block. + // f A value indicating whether the generator is executing. + // y An iterator to delegate for a yield*. + // t A temporary variable that holds one of the following values (note that these + // cases do not overlap): + // - The completion value when resuming from a `yield` or `yield*`. + // - The error value for a catch block. + // - The current protected region (array of try/catch/finally/end labels). + // - The verb (`next`, `throw`, or `return` method) to delegate to the expression + // of a `yield*`. + // - The result of evaluating the verb delegated to the expression of a `yield*`. + // + // functions: + // verb(n) Creates a bound callback to the `step` function for opcode `n`. + // step(op) Evaluates opcodes in a generator body until execution is suspended or + // completed. + // + // The __generator helper understands a limited set of instructions: + // 0: next(value?) - Start or resume the generator with the specified value. + // 1: throw(error) - Resume the generator with an exception. If the generator is + // suspended inside of one or more protected regions, evaluates + // any intervening finally blocks between the current label and + // the nearest catch block or function boundary. If uncaught, the + // exception is thrown to the caller. + // 2: return(value?) - Resume the generator as if with a return. If the generator is + // suspended inside of one or more protected regions, evaluates any + // intervening finally blocks. + // 3: break(label) - Jump to the specified label. If the label is outside of the + // current protected region, evaluates any intervening finally + // blocks. + // 4: yield(value?) - Yield execution to the caller with an optional value. When + // resumed, the generator will continue at the next label. + // 5: yield*(value) - Delegates evaluation to the supplied iterator. When + // delegation completes, the generator will continue at the next + // label. + // 6: catch(error) - Handles an exception thrown from within the generator body. If + // the current label is inside of one or more protected regions, + // evaluates any intervening finally blocks between the current + // label and the nearest catch block or function boundary. If + // uncaught, the exception is thrown to the caller. + // 7: endfinally - Ends a finally block, resuming the last instruction prior to + // entering a finally block. + // + // For examples of how these are used, see the comments in ./transformers/generators.ts + var generatorHelper = { + name: "typescript:generator", + scoped: false, + priority: 6, + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + }; var _a; })(ts || (ts = {})); /// @@ -53615,13 +54486,32 @@ var ts; (function (ts) { function transformES2015Module(context) { var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.enableEmitNotification(261 /* SourceFile */); + context.enableSubstitution(70 /* Identifier */); + var currentSourceFile; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - return ts.visitEachChild(node, visitor, context); + var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); + if (externalHelpersModuleName) { + var statements = []; + var statementOffset = ts.addPrologueDirectives(statements, node.statements); + ts.append(statements, ts.createImportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + } + else { + return ts.visitEachChild(node, visitor, context); + } } return node; } @@ -53639,6 +54529,51 @@ var ts; // Elide `export=` as it is not legal with --module ES6 return node.isExportEquals ? undefined : node; } + // + // Emit Notification + // + /** + * Hook for node emit. + * + * @param emitContext A context hint for the emitter. + * @param node The node to emit. + * @param emit A callback used to emit the node in the printer. + */ + function onEmitNode(emitContext, node, emitCallback) { + if (ts.isSourceFile(node)) { + currentSourceFile = node; + previousOnEmitNode(emitContext, node, emitCallback); + currentSourceFile = undefined; + } + else { + previousOnEmitNode(emitContext, node, emitCallback); + } + } + // + // Substitutions + // + /** + * Hooks node substitutions. + * + * @param emitContext A context hint for the emitter. + * @param node The node to substitute. + */ + function onSubstituteNode(emitContext, node) { + node = previousOnSubstituteNode(emitContext, node); + if (ts.isIdentifier(node) && emitContext === 1 /* Expression */) { + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096 /* HelperName */) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + } + return node; + } } ts.transformES2015Module = transformES2015Module; })(ts || (ts = {})); @@ -53700,13 +54635,14 @@ var ts; // The only exception in this rule is postfix unary operators, // see comment to 'substitutePostfixUnaryExpression' for more details // Collect information about the external module and dependency groups. - moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver); + moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); // Make sure that the name of the 'exports' function does not conflict with // existing identifiers. exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); contextObject = ts.createUniqueName("context"); // Add the body of the module. var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); + var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); var moduleBodyFunction = ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, @@ -53715,19 +54651,21 @@ var ts; ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction), ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject) ], - /*type*/ undefined, createSystemModuleBody(node, dependencyGroups)); + /*type*/ undefined, moduleBodyBlock); // Write the call to `System.register` // Clear the emit-helpers flag for later passes since we'll have already used it in the module body // So the helper will be emit at the correct position instead of at the top of the source-file var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray([ + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.createNodeArray([ ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), /*typeArguments*/ undefined, moduleName ? [moduleName, dependencies, moduleBodyFunction] : [dependencies, moduleBodyFunction])) - ], node.statements)); - ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1 /* EmitEmitHelpers */); + ], node.statements)), 1024 /* NoTrailingComments */); + if (!(compilerOptions.outFile || compilerOptions.out)) { + ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); + } if (noSubstitution) { noSubstitutionMap[id] = noSubstitution; noSubstitution = undefined; @@ -53827,6 +54765,8 @@ var ts; ts.createVariableDeclaration("__moduleName", /*type*/ undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) ]))); + // Visit the synthetic external helpers import declaration if present + ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true); // Visit the statements of the source file, emitting any transformations into // the `executeStatements` array. We do this *before* we fill the `setters` array // as we both emit transformations as well as aggregate some data used when creating @@ -53853,9 +54793,7 @@ var ts; /*multiLine*/ true))) ]), /*multiLine*/ true))); - var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true); - ts.setEmitFlags(body, 1 /* EmitEmitHelpers */); - return body; + return ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true); } /** * Adds an exportStar function to a statement list if it is needed for the file. @@ -53940,7 +54878,8 @@ var ts; var exports = ts.createIdentifier("exports"); var condition = ts.createStrictInequality(n, ts.createLiteral("default")); if (localNames) { - condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n))); + condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), + /*typeArguments*/ undefined, [n]))); } return ts.createFunctionDeclaration( /*decorators*/ undefined, @@ -53956,7 +54895,7 @@ var ts; ts.createForIn(ts.createVariableDeclarationList([ ts.createVariableDeclaration(n, /*type*/ undefined) ]), m, ts.createBlock([ - ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32 /* SingleLine */) + ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1 /* SingleLine */) ])), ts.createStatement(ts.createCall(exportFunction, /*typeArguments*/ undefined, [exports])) @@ -54229,7 +55168,7 @@ var ts; */ function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file - return (ts.getEmitFlags(node) & 16777216 /* NoHoisting */) === 0 + return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 && (enclosingBlockScopedContainer.kind === 261 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } @@ -54242,7 +55181,8 @@ var ts; function transformInitializedVariable(node, isExportedDeclaration) { var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; return ts.isBindingPattern(node.name) - ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor) + ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, + /*needsValue*/ false, createAssignment) : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); } /** @@ -54306,7 +55246,7 @@ var ts; * @param node The node to test. */ function hasAssociatedEndOfDeclarationMarker(node) { - return (ts.getEmitFlags(node) & 33554432 /* HasEndOfDeclarationMarker */) !== 0; + return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0; } /** * Visits a DeclarationMarker used as a placeholder for the end of a transformed @@ -54507,7 +55447,7 @@ var ts; var statement = ts.createStatement(createExportExpression(name, value)); ts.startOnNewLine(statement); if (!allowComments) { - ts.setEmitFlags(statement, 49152 /* NoComments */); + ts.setEmitFlags(statement, 1536 /* NoComments */); } return statement; } @@ -54565,9 +55505,9 @@ var ts; return visitCatchClause(node); case 204 /* Block */: return visitBlock(node); - case 294 /* MergeDeclarationMarker */: + case 295 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 295 /* EndOfDeclarationMarker */: + case 296 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -54746,11 +55686,11 @@ var ts; * @param node The node to visit. */ function destructuringVisitor(node) { - if (node.transformFlags & 16384 /* DestructuringAssignment */ + if (node.transformFlags & 1024 /* DestructuringAssignment */ && node.kind === 192 /* BinaryExpression */) { return visitDestructuringAssignment(node); } - else if (node.transformFlags & 32768 /* ContainsDestructuringAssignment */) { + else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) { return ts.visitEachChild(node, destructuringVisitor, context); } else { @@ -54764,7 +55704,8 @@ var ts; */ function visitDestructuringAssignment(node) { if (hasExportedReferenceInDestructuringTarget(node.left)) { - return ts.flattenDestructuringAssignment(context, node, /*needsValue*/ true, hoistVariableDeclaration, destructuringVisitor); + return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, + /*needsValue*/ true); } return ts.visitEachChild(node, destructuringVisitor, context); } @@ -54888,6 +55829,13 @@ var ts; * @param node The node to substitute. */ function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096 /* HelperName */) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + return node; + } // When we see an identifier in an expression position that // points to an imported symbol, we should substitute a qualified // reference to the imported symbol if one is needed. @@ -55035,7 +55983,7 @@ var ts; _a[ts.ModuleKind.AMD] = transformAMDModule, _a[ts.ModuleKind.UMD] = transformUMDModule, _a)); - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var host = context.getEmitHost(); @@ -55069,7 +56017,7 @@ var ts; return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver); + currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); // Perform the transformation. var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; var updated = transformModule(node); @@ -55086,12 +56034,13 @@ var ts; startLexicalEnvironment(); var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false); var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); if (currentModuleInfo.hasExportStarsToExportValues) { - ts.setEmitFlags(updated, 2 /* EmitExportStar */ | ts.getEmitFlags(node)); + ts.addEmitHelper(updated, exportStarHelper); } return updated; } @@ -55111,8 +56060,7 @@ var ts; * @param node The SourceFile node. */ function transformUMDModule(node) { - var define = ts.createIdentifier("define"); - ts.setEmitFlags(define, 16 /* UMDDefine */); + var define = ts.createRawExpression(umdHelper); return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false); } /** @@ -55209,7 +56157,7 @@ var ts; if (includeNonAmdDependencies && importAliasName) { // Set emitFlags on the name of the classDeclaration // This is so that when printer will not substitute the identifier - ts.setEmitFlags(importAliasName, 128 /* NoSubstitution */); + ts.setEmitFlags(importAliasName, 4 /* NoSubstitution */); aliasedModuleNames.push(externalModuleName); importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName)); } @@ -55229,6 +56177,7 @@ var ts; var statements = []; var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); // Visit each statement of the module body. + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); // End the lexical environment for the module body // and merge any new lexical declarations. @@ -55239,7 +56188,7 @@ var ts; if (currentModuleInfo.hasExportStarsToExportValues) { // If we have any `export * from ...` declarations // we need to inform the emitter to add the __export helper. - ts.setEmitFlags(body, 2 /* EmitExportStar */); + ts.addEmitHelper(body, exportStarHelper); } return body; } @@ -55256,13 +56205,13 @@ var ts; if (emitAsReturn) { var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, /*location*/ currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 49152 /* NoComments */); + ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 1536 /* NoComments */); statements.push(statement); } else { var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), /*location*/ currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 49152 /* NoComments */); + ts.setEmitFlags(statement, 1536 /* NoComments */); statements.push(statement); } } @@ -55291,9 +56240,9 @@ var ts; return visitFunctionDeclaration(node); case 226 /* ClassDeclaration */: return visitClassDeclaration(node); - case 294 /* MergeDeclarationMarker */: + case 295 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 295 /* EndOfDeclarationMarker */: + case 296 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: // This visitor does not descend into the tree, as export/import statements @@ -55582,7 +56531,9 @@ var ts; */ function transformInitializedVariable(node) { if (ts.isBindingPattern(node.name)) { - return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression); + return ts.flattenDestructuringAssignment(node, + /*visitor*/ undefined, context, 0 /* All */, + /*needsValue*/ false, createExportExpression); } else { return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, @@ -55615,7 +56566,7 @@ var ts; * @param node The node to test. */ function hasAssociatedEndOfDeclarationMarker(node) { - return (ts.getEmitFlags(node) & 33554432 /* HasEndOfDeclarationMarker */) !== 0; + return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0; } /** * Visits a DeclarationMarker used as a placeholder for the end of a transformed @@ -55818,7 +56769,7 @@ var ts; var statement = ts.createStatement(createExportExpression(name, value), location); ts.startOnNewLine(statement); if (!allowComments) { - ts.setEmitFlags(statement, 49152 /* NoComments */); + ts.setEmitFlags(statement, 1536 /* NoComments */); } return statement; } @@ -55939,6 +56890,13 @@ var ts; * @param node The node to substitute. */ function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096 /* HelperName */) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + return node; + } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { @@ -55952,8 +56910,8 @@ var ts; /*location*/ node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_36 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_36), + var name_38 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), /*location*/ node); } } @@ -56049,6 +57007,14 @@ var ts; var _a; } ts.transformModule = transformModule; + // emit output for the __export helper function + var exportStarHelper = { + name: "typescript:export-star", + scoped: true, + text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" + }; + // emit output for the UMD helper function. + var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); /// /// @@ -56118,23 +57084,29 @@ var ts; * @param transforms An array of Transformers. */ function transformFiles(resolver, host, sourceFiles, transformers) { + var enabledSyntaxKindFeatures = new Array(298 /* Count */); + var lexicalEnvironmentDisabled = false; + var lexicalEnvironmentVariableDeclarations; + var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; var lexicalEnvironmentFunctionDeclarationsStack = []; - var enabledSyntaxKindFeatures = new Array(296 /* Count */); var lexicalEnvironmentStackOffset = 0; - var hoistedVariableDeclarations; - var hoistedFunctionDeclarations; - var lexicalEnvironmentDisabled; + var lexicalEnvironmentSuspended = false; + var emitHelpers; // The transformation context is provided to each transformer as part of transformer // initialization. var context = { getCompilerOptions: function () { return host.getCompilerOptions(); }, getEmitResolver: function () { return resolver; }, getEmitHost: function () { return host; }, + startLexicalEnvironment: startLexicalEnvironment, + suspendLexicalEnvironment: suspendLexicalEnvironment, + resumeLexicalEnvironment: resumeLexicalEnvironment, + endLexicalEnvironment: endLexicalEnvironment, hoistVariableDeclaration: hoistVariableDeclaration, hoistFunctionDeclaration: hoistFunctionDeclaration, - startLexicalEnvironment: startLexicalEnvironment, - endLexicalEnvironment: endLexicalEnvironment, + requestEmitHelper: requestEmitHelper, + readEmitHelpers: readEmitHelpers, onSubstituteNode: function (_emitContext, node) { return node; }, enableSubstitution: enableSubstitution, isSubstitutionEnabled: isSubstitutionEnabled, @@ -56175,7 +57147,7 @@ var ts; */ function isSubstitutionEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 1 /* Substitution */) !== 0 - && (ts.getEmitFlags(node) & 128 /* NoSubstitution */) === 0; + && (ts.getEmitFlags(node) & 4 /* NoSubstitution */) === 0; } /** * Emits a node with possible substitution. @@ -56208,7 +57180,7 @@ var ts; */ function isEmitNotificationEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 2 /* EmitNotifications */) !== 0 - || (ts.getEmitFlags(node) & 64 /* AdviseOnEmitNode */) !== 0; + || (ts.getEmitFlags(node) & 2 /* AdviseOnEmitNode */) !== 0; } /** * Emits a node with possible emit notification. @@ -56233,11 +57205,11 @@ var ts; function hoistVariableDeclaration(name) { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); var decl = ts.createVariableDeclaration(name); - if (!hoistedVariableDeclarations) { - hoistedVariableDeclarations = [decl]; + if (!lexicalEnvironmentVariableDeclarations) { + lexicalEnvironmentVariableDeclarations = [decl]; } else { - hoistedVariableDeclarations.push(decl); + lexicalEnvironmentVariableDeclarations.push(decl); } } /** @@ -56245,11 +57217,11 @@ var ts; */ function hoistFunctionDeclaration(func) { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = [func]; + if (!lexicalEnvironmentFunctionDeclarations) { + lexicalEnvironmentFunctionDeclarations = [func]; } else { - hoistedFunctionDeclarations.push(func); + lexicalEnvironmentFunctionDeclarations.push(func); } } /** @@ -56258,15 +57230,28 @@ var ts; */ function startLexicalEnvironment() { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); // Save the current lexical environment. Rather than resizing the array we adjust the // stack size variable. This allows us to reuse existing array slots we've // already allocated between transformations to avoid allocation and GC overhead during // transformation. - lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedVariableDeclarations; - lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedFunctionDeclarations; + lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations; + lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations; lexicalEnvironmentStackOffset++; - hoistedVariableDeclarations = undefined; - hoistedFunctionDeclarations = undefined; + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + } + /** Suspends the current lexical environment, usually after visiting a parameter list. */ + function suspendLexicalEnvironment() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); + lexicalEnvironmentSuspended = true; + } + /** Resumes a suspended lexical environment, usually before visiting a function body. */ + function resumeLexicalEnvironment() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); + lexicalEnvironmentSuspended = false; } /** * Ends a lexical environment. The previous set of hoisted declarations are restored and @@ -56274,14 +57259,15 @@ var ts; */ function endLexicalEnvironment() { ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; - if (hoistedVariableDeclarations || hoistedFunctionDeclarations) { - if (hoistedFunctionDeclarations) { - statements = hoistedFunctionDeclarations.slice(); + if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { + if (lexicalEnvironmentFunctionDeclarations) { + statements = lexicalEnvironmentFunctionDeclarations.slice(); } - if (hoistedVariableDeclarations) { + if (lexicalEnvironmentVariableDeclarations) { var statement = ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList(hoistedVariableDeclarations)); + /*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations)); if (!statements) { statements = [statement]; } @@ -56292,10 +57278,25 @@ var ts; } // Restore the previous lexical environment. lexicalEnvironmentStackOffset--; - hoistedVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; - hoistedFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + if (lexicalEnvironmentStackOffset === 0) { + lexicalEnvironmentVariableDeclarationsStack = []; + lexicalEnvironmentFunctionDeclarationsStack = []; + } return statements; } + function requestEmitHelper(helper) { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); + emitHelpers = ts.append(emitHelpers, helper); + } + function readEmitHelpers() { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + var helpers = emitHelpers; + emitHelpers = undefined; + return helpers; + } } ts.transformFiles = transformFiles; var _a; @@ -56520,12 +57521,12 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 292 /* NotEmittedStatement */ - && (emitFlags & 512 /* NoLeadingSourceMap */) === 0 + if (node.kind !== 293 /* NotEmittedStatement */ + && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); } - if (emitFlags & 2048 /* NoNestedSourceMaps */) { + if (emitFlags & 64 /* NoNestedSourceMaps */) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -56533,8 +57534,8 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 292 /* NotEmittedStatement */ - && (emitFlags & 1024 /* NoTrailingSourceMap */) === 0 + if (node.kind !== 293 /* NotEmittedStatement */ + && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); } @@ -56556,13 +57557,13 @@ var ts; var emitFlags = emitNode && emitNode.flags; var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos); - if ((emitFlags & 4096 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) { + if ((emitFlags & 128 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) { emitPos(tokenPos); } tokenPos = emitCallback(token, tokenPos); if (range) tokenPos = range.end; - if ((emitFlags & 8192 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) { + if ((emitFlags & 256 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) { emitPos(tokenPos); } return tokenPos; @@ -56603,7 +57604,7 @@ var ts; return; } encodeLastRecordedSourceMapSpan(); - return ts.stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, @@ -56699,7 +57700,7 @@ var ts; var emitFlags = ts.getEmitFlags(node); if ((pos < 0 && end < 0) || (pos === end)) { // Both pos and end are synthesized, so just emit the node without comments. - if (emitFlags & 65536 /* NoNestedComments */) { + if (emitFlags & 2048 /* NoNestedComments */) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -56712,9 +57713,9 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 292 /* NotEmittedStatement */; - var skipLeadingComments = pos < 0 || (emitFlags & 16384 /* NoLeadingComments */) !== 0; - var skipTrailingComments = end < 0 || (emitFlags & 32768 /* NoTrailingComments */) !== 0; + var isEmittedNode = node.kind !== 293 /* NotEmittedStatement */; + var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0; + var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { @@ -56738,7 +57739,7 @@ var ts; if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & 65536 /* NoNestedComments */) { + if (emitFlags & 2048 /* NoNestedComments */) { disabled = true; emitCallback(emitContext, node); disabled = false; @@ -56770,15 +57771,15 @@ var ts; } var pos = detachedRange.pos, end = detachedRange.end; var emitFlags = ts.getEmitFlags(node); - var skipLeadingComments = pos < 0 || (emitFlags & 16384 /* NoLeadingComments */) !== 0; - var skipTrailingComments = disabled || end < 0 || (emitFlags & 32768 /* NoTrailingComments */) !== 0; + var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0; + var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0; if (!skipLeadingComments) { emitDetachedCommentsAndUpdateCommentsInfo(detachedRange); } if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments"); } - if (emitFlags & 65536 /* NoNestedComments */ && !disabled) { + if (emitFlags & 2048 /* NoNestedComments */ && !disabled) { disabled = true; emitCallback(node); disabled = false; @@ -56791,6 +57792,9 @@ var ts; } if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); @@ -57100,6 +58104,7 @@ var ts; writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -57233,15 +58238,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { - var node = nodes_2[_i]; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { - var node = nodes_3[_i]; + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -57256,7 +58261,7 @@ var ts; } function writeJsDocComments(declaration) { if (declaration) { - var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText); + var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText); ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); // jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space ts.emitComments(currentText, currentLineMap, writer, jsDocComments, /*leadingSeparator*/ false, /*trailingSeparator*/ true, newLine, ts.writeCommentRange); @@ -57451,9 +58456,9 @@ var ts; var count = 0; while (true) { count++; - var name_37 = baseName + "_" + count; - if (!(name_37 in currentIdentifiers)) { - return name_37; + var name_39 = baseName + "_" + count; + if (!(name_39 in currentIdentifiers)) { + return name_39; } } } @@ -57864,6 +58869,9 @@ var ts; case 225 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; + case 228 /* TypeAliasDeclaration */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; + break; default: ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); } @@ -57960,7 +58968,10 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false); + var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); + if (interfaceExtendsTypes && interfaceExtendsTypes.length) { + emitHeritageClause(interfaceExtendsTypes, /*isImplementsList*/ false); + } write(" {"); writeLine(); increaseIndent(); @@ -58395,6 +59406,11 @@ var ts; return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 155 /* IndexSignature */: + // Interfaces cannot have parameter types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* Static */)) { @@ -58611,87 +59627,6 @@ var ts; function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { var delimiters = createDelimiterMap(); var brackets = createBracketsMap(); - // emit output for the __extends helper function - var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; - // Emit output for the __assign helper function. - // This is typically used for JSX spread attributes, - // and can be used for object literal spread properties. - var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; - var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};"; - // emit output for the __decorate helper function - var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; - // emit output for the __metadata helper function - var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - // emit output for the __param helper function - var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - // emit output for the __awaiter helper function - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};"; - // The __generator helper is used by down-level transformations to emulate the runtime - // semantics of an ES2015 generator function. When called, this helper returns an - // object that implements the Iterator protocol, in that it has `next`, `return`, and - // `throw` methods that step through the generator when invoked. - // - // parameters: - // thisArg The value to use as the `this` binding for the transformed generator body. - // body A function that acts as the transformed generator body. - // - // variables: - // _ Persistent state for the generator that is shared between the helper and the - // generator body. The state object has the following members: - // sent() - A method that returns or throws the current completion value. - // label - The next point at which to resume evaluation of the generator body. - // trys - A stack of protected regions (try/catch/finally blocks). - // ops - A stack of pending instructions when inside of a finally block. - // f A value indicating whether the generator is executing. - // y An iterator to delegate for a yield*. - // t A temporary variable that holds one of the following values (note that these - // cases do not overlap): - // - The completion value when resuming from a `yield` or `yield*`. - // - The error value for a catch block. - // - The current protected region (array of try/catch/finally/end labels). - // - The verb (`next`, `throw`, or `return` method) to delegate to the expression - // of a `yield*`. - // - The result of evaluating the verb delegated to the expression of a `yield*`. - // - // functions: - // verb(n) Creates a bound callback to the `step` function for opcode `n`. - // step(op) Evaluates opcodes in a generator body until execution is suspended or - // completed. - // - // The __generator helper understands a limited set of instructions: - // 0: next(value?) - Start or resume the generator with the specified value. - // 1: throw(error) - Resume the generator with an exception. If the generator is - // suspended inside of one or more protected regions, evaluates - // any intervening finally blocks between the current label and - // the nearest catch block or function boundary. If uncaught, the - // exception is thrown to the caller. - // 2: return(value?) - Resume the generator as if with a return. If the generator is - // suspended inside of one or more protected regions, evaluates any - // intervening finally blocks. - // 3: break(label) - Jump to the specified label. If the label is outside of the - // current protected region, evaluates any intervening finally - // blocks. - // 4: yield(value?) - Yield execution to the caller with an optional value. When - // resumed, the generator will continue at the next label. - // 5: yield*(value) - Delegates evaluation to the supplied iterator. When - // delegation completes, the generator will continue at the next - // label. - // 6: catch(error) - Handles an exception thrown from within the generator body. If - // the current label is inside of one or more protected regions, - // evaluates any intervening finally blocks between the current - // label and the nearest catch block or function boundary. If - // uncaught, the exception is thrown to the caller. - // 7: endfinally - Ends a finally block, resuming the last instruction prior to - // entering a finally block. - // - // For examples of how these are used, see the comments in ./transformers/generators.ts - var generatorHelper = "\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};"; - // emit output for the __export helper function - var exportStarHelper = "\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}"; - // emit output for the UMD helper function. - var umdHelper = "\n(function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n})"; - var superHelper = "\nconst _super = name => super[name];"; - var advancedSuperHelper = "\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"; var compilerOptions = host.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); @@ -58713,12 +59648,7 @@ var ts; var currentSourceFile; var currentText; var currentFileIdentifiers; - var extendsEmitted; - var assignEmitted; - var restEmitted; - var decorateEmitted; - var paramEmitted; - var awaiterEmitted; + var bundledHelpers; var isOwnFileEmit; var emitSkipped = false; var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); @@ -58771,12 +59701,13 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNameSet = ts.createMap(); + bundledHelpers = isBundledEmit ? ts.createMap() : undefined; isOwnFileEmit = !isBundledEmit; // Emit helpers from all the files if (isBundledEmit && moduleKind) { for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { var sourceFile = sourceFiles_5[_a]; - emitEmitHelpers(sourceFile); + emitHelpers(sourceFile, /*isBundle*/ true); } } // Print each transformed source file. @@ -58788,14 +59719,14 @@ var ts; } // Write the source map if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false); + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles); } // Record source map data for the test harness. if (sourceMapDataList) { sourceMapDataList.push(sourceMap.getSourceMapData()); } // Write the output file - ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM); + ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); // Reset state sourceMap.reset(); comments.reset(); @@ -58803,11 +59734,6 @@ var ts; tempFlags = 0 /* Auto */; currentSourceFile = undefined; currentText = undefined; - extendsEmitted = false; - assignEmitted = false; - decorateEmitted = false; - paramEmitted = false; - awaiterEmitted = false; isOwnFileEmit = false; } function printSourceFile(node) { @@ -59271,8 +60197,10 @@ var ts; case 247 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); // Transformation nodes - case 293 /* PartiallyEmittedExpression */: + case 294 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); + case 297 /* RawExpression */: + return writeLines(node.text); } } // @@ -59305,12 +60233,7 @@ var ts; // Identifiers // function emitIdentifier(node) { - if (ts.getEmitFlags(node) & 16 /* UMDDefine */) { - writeLines(umdHelper); - } - else { - write(getTextOfNode(node, /*includeTrivia*/ false)); - } + write(getTextOfNode(node, /*includeTrivia*/ false)); } // // Names @@ -59571,7 +60494,7 @@ var ts; write("{}"); } else { - var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */; + var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */; if (indentedFlag) { increaseIndent(); } @@ -59586,7 +60509,7 @@ var ts; function emitPropertyAccessExpression(node) { var indentBeforeDot = false; var indentAfterDot = false; - if (!(ts.getEmitFlags(node) & 1048576 /* NoIndentation */)) { + if (!(ts.getEmitFlags(node) & 65536 /* NoIndentation */)) { var dotRangeStart = node.expression.end; var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1; var dotToken = { kind: 22 /* DotToken */, pos: dotRangeStart, end: dotRangeEnd }; @@ -59793,7 +60716,7 @@ var ts; } } function emitBlockStatements(node) { - if (ts.getEmitFlags(node) & 32 /* SingleLine */) { + if (ts.getEmitFlags(node) & 1 /* SingleLine */) { emitList(node, node.statements, 384 /* SingleLineBlockStatements */); } else { @@ -59972,11 +60895,11 @@ var ts; var body = node.body; if (body) { if (ts.isBlock(body)) { - var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */; + var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */; if (indentedFlag) { increaseIndent(); } - if (ts.getEmitFlags(node) & 4194304 /* ReuseTempVariableScope */) { + if (ts.getEmitFlags(node) & 262144 /* ReuseTempVariableScope */) { emitSignatureHead(node); emitBlockFunctionBody(body); } @@ -60014,7 +60937,7 @@ var ts; // * The body is explicitly marked as multi-line. // * A non-synthesized body's start and end position are on different lines. // * Any statement in the body starts on a new line. - if (ts.getEmitFlags(body) & 32 /* SingleLine */) { + if (ts.getEmitFlags(body) & 1 /* SingleLine */) { return true; } if (body.multiLine) { @@ -60070,7 +60993,7 @@ var ts; emitModifiers(node, node.modifiers); write("class"); emitNodeWithPrefix(" ", node.name, emitIdentifierName); - var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */; + var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */; if (indentedFlag) { increaseIndent(); } @@ -60350,7 +61273,7 @@ var ts; // "comment1" is not considered to be leading comment for node.initializer // but rather a trailing comment on the previous node. var initializer = node.initializer; - if ((ts.getEmitFlags(initializer) & 16384 /* NoLeadingComments */) === 0) { + if ((ts.getEmitFlags(initializer) & 512 /* NoLeadingComments */) === 0) { var commentRange = ts.getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos); } @@ -60416,78 +61339,37 @@ var ts; } return statements.length; } - function emitHelpers(node) { - var emitFlags = ts.getEmitFlags(node); + function emitHelpers(node, isBundle) { + var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile; + var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); + var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit; var helpersEmitted = false; - if (emitFlags & 1 /* EmitEmitHelpers */) { - helpersEmitted = emitEmitHelpers(currentSourceFile); - } - if (emitFlags & 2 /* EmitExportStar */) { - writeLines(exportStarHelper); - helpersEmitted = true; - } - if (emitFlags & 4 /* EmitSuperHelper */) { - writeLines(superHelper); - helpersEmitted = true; - } - if (emitFlags & 8 /* EmitAdvancedSuperHelper */) { - writeLines(advancedSuperHelper); - helpersEmitted = true; - } - return helpersEmitted; - } - function emitEmitHelpers(node) { - // Only emit helpers if the user did not say otherwise. - if (compilerOptions.noEmitHelpers) { - return false; - } - // Don't emit helpers if we can import them. - if (compilerOptions.importHelpers - && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) { - return false; - } - var helpersEmitted = false; - // Only Emit __extends function when target ES5. - // For target ES6 and above, we can emit classDeclaration as is. - if ((languageVersion < 2 /* ES2015 */) && (!extendsEmitted && node.flags & 1024 /* HasClassExtends */)) { - writeLines(extendsHelper); - extendsEmitted = true; - helpersEmitted = true; - } - if ((languageVersion < 5 /* ESNext */ || currentSourceFile.scriptKind === 2 /* JSX */ || currentSourceFile.scriptKind === 4 /* TSX */) && - compilerOptions.jsx !== 1 /* Preserve */ && - !assignEmitted && - node.flags & 16384 /* HasSpreadAttribute */) { - writeLines(assignHelper); - assignEmitted = true; - } - if (languageVersion < 5 /* ESNext */ && !restEmitted && node.flags & 32768 /* HasRestAttribute */) { - writeLines(restHelper); - restEmitted = true; - } - if (!decorateEmitted && node.flags & 2048 /* HasDecorators */) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); + var helpers = ts.getEmitHelpers(node); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + // Skip the helper if it can be skipped and the noEmitHelpers compiler + // option is set, or if it can be imported and the importHelpers compiler + // option is set. + if (shouldSkip) + continue; + // Skip the helper if it can be bundled but hasn't already been emitted and we + // are emitting a bundled module. + if (shouldBundle) { + if (bundledHelpers[helper.name]) { + continue; + } + bundledHelpers[helper.name] = true; + } + } + else if (isBundle) { + // Skip the helper if it is scoped and we are emitting bundled helpers + continue; + } + writeLines(helper.text); + helpersEmitted = true; } - decorateEmitted = true; - helpersEmitted = true; - } - if (!paramEmitted && node.flags & 4096 /* HasParamDecorators */) { - writeLines(paramHelper); - paramEmitted = true; - helpersEmitted = true; - } - // Only emit __awaiter function when target ES5/ES6. - // Only emit __generator function when target ES5. - // For target ES2017 and above, we can emit async/await as is. - if ((languageVersion < 4 /* ES2017 */) && (!awaiterEmitted && node.flags & 8192 /* HasAsyncFunctions */)) { - writeLines(awaiterHelper); - if (languageVersion < 2 /* ES2015 */) { - writeLines(generatorHelper); - } - awaiterEmitted = true; - helpersEmitted = true; } if (helpersEmitted) { writeLine(); @@ -60495,9 +61377,10 @@ var ts; return helpersEmitted; } function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); for (var i = 0; i < lines.length; i++) { - var line = lines[i]; + var line = indentation ? lines[i].slice(indentation) : lines[i]; if (line.length) { if (i > 0) { writeLine(); @@ -60506,6 +61389,21 @@ var ts; } } } + function guessIndentation(lines) { + var indentation; + for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { + var line = lines_1[_a]; + for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { + if (!ts.isWhiteSpace(line.charCodeAt(i))) { + if (indentation === undefined || i < indentation) { + indentation = i; + break; + } + } + } + } + return indentation; + } // // Helpers // @@ -60873,10 +61771,10 @@ var ts; */ function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_38 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_38)) { + var name_40 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_40)) { tempFlags |= flags; - return name_38; + return name_40; } } while (true) { @@ -60884,11 +61782,11 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_39 = count < 26 + var name_41 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_39)) { - return name_39; + if (isUniqueName(name_41)) { + return name_41; } } } @@ -61113,8 +62011,6 @@ var ts; /// var ts; (function (ts) { - /** The version of the TypeScript compiler release */ - ts.version = "2.2.0"; var emptyArray = []; function findConfigFile(searchPath, fileExists, configName) { if (configName === void 0) { configName = "tsconfig.json"; } @@ -61341,10 +62237,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_40 = names_1[_i]; - var result = name_40 in cache - ? cache[name_40] - : cache[name_40] = loader(name_40, containingFile); + var name_42 = names_1[_i]; + var result = name_42 in cache + ? cache[name_42] + : cache[name_42] = loader(name_42, containingFile); resolutions.push(result); } return resolutions; @@ -61414,7 +62310,8 @@ var ts; var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host); if (typeReferences.length) { // This containingFilename needs to match with the one used in managed-side - var containingFilename = ts.combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts"); + var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); + var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts"); var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename); for (var i = 0; i < typeReferences.length; i++) { processTypeReferenceDirective(typeReferences[i], resolutions[i]); @@ -61995,8 +62892,8 @@ var ts; } break; } - for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) { - var node = nodes_4[_b]; + for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { + var node = nodes_6[_b]; walk(node); } } @@ -62911,7 +63808,7 @@ var ts; "es2017": 4 /* ES2017 */, "esnext": 5 /* ESNext */, }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, paramType: ts.Diagnostics.VERSION, }, { @@ -63100,11 +63997,18 @@ var ts; } ]; /* @internal */ - ts.typingOptionDeclarations = [ + ts.typeAcquisitionDeclarations = [ { + /* @deprecated typingOptions.enableAutoDiscovery + * Use typeAcquisition.enable instead. + */ name: "enableAutoDiscovery", type: "boolean", }, + { + name: "enable", + type: "boolean", + }, { name: "include", type: "list", @@ -63131,6 +64035,20 @@ var ts; }; var optionNameMapCache; /* @internal */ + function convertEnableAutoDiscoveryToEnable(typeAcquisition) { + // Convert deprecated typingOptions.enableAutoDiscovery to typeAcquisition.enable + if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { + var result = { + enable: typeAcquisition.enableAutoDiscovery, + include: typeAcquisition.include || [], + exclude: typeAcquisition.exclude || [] + }; + return result; + } + return typeAcquisition; + } + ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; + /* @internal */ function getOptionNameMap() { if (optionNameMapCache) { return optionNameMapCache; @@ -63155,14 +64073,7 @@ var ts; ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; /* @internal */ function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; /* @internal */ @@ -63186,7 +64097,6 @@ var ts; } } ts.parseListTypeOption = parseListTypeOption; - /* @internal */ function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -63371,11 +64281,11 @@ var ts; function serializeCompilerOptions(options) { var result = ts.createMap(); var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_41 in options) { - if (ts.hasProperty(options, name_41)) { + for (var name_43 in options) { + if (ts.hasProperty(options, name_43)) { // tsconfig only options cannot be specified via command line, // so we can assume that only types that can appear here string | number | boolean - switch (name_41) { + switch (name_43) { case "init": case "watch": case "version": @@ -63383,14 +64293,14 @@ var ts; case "project": break; default: - var value = options[name_41]; - var optionDefinition = optionsNameMap[name_41.toLowerCase()]; + var value = options[name_43]; + var optionDefinition = optionsNameMap[name_43.toLowerCase()]; if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { // There is no map associated with this compiler option then use the value as-is // This is the case if the value is expect to be string, number, boolean or list of string - result[name_41] = value; + result[name_43] = value; } else { if (optionDefinition.type === "list") { @@ -63399,11 +64309,11 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_41] = convertedValue; + result[name_43] = convertedValue; } else { // There is a typeMap associated with this command-line option so use it to map value back to its name - result[name_41] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name_43] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -63446,9 +64356,10 @@ var ts; * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); @@ -63456,14 +64367,17 @@ var ts; return { options: {}, fileNames: [], - typingOptions: {}, + typeAcquisition: {}, raw: json, errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))], wildcardDirectories: {} }; } var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + // typingOptions has been deprecated and is only supported for backward compatibility purposes. + // It should be removed in future releases - use typeAcquisition instead. + var jsonOptions = json["typeAcquisition"] || json["typingOptions"]; + var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); if (json["extends"]) { var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3]; if (typeof json["extends"] === "string") { @@ -63490,7 +64404,7 @@ var ts; return { options: options, fileNames: fileNames, - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, raw: json, errors: errors, wildcardDirectories: wildcardDirectories, @@ -63499,7 +64413,7 @@ var ts; function tryExtendsName(extendedConfig) { // If the path isn't a rooted or relative path, don't try to resolve it (we reserve the right to special case module-id like paths in the future) if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted)); + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); return; } var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName); @@ -63563,8 +64477,8 @@ var ts; errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); } else { - // By default, exclude common package folders and the outDir - excludeSpecs = ["node_modules", "bower_components", "jspm_packages"]; + // If no includes were specified, exclude common package folders and the outDir + excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"]; var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; if (outDir) { excludeSpecs.push(outDir); @@ -63573,7 +64487,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -63599,12 +64513,12 @@ var ts; return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; - function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { var errors = []; - var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } - ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } @@ -63612,9 +64526,10 @@ var ts; convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); return options; } - function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; - convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); + convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors); return options; } function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { @@ -63749,7 +64664,7 @@ var ts; * @param host The host used to resolve files and directories. * @param errors An array for diagnostic reporting. */ - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); // The exclude spec list is converted into a regular expression, which allows us to quickly // test whether a file or directory should be excluded before recursively traversing the @@ -63776,7 +64691,7 @@ var ts; var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); // Rather than requery this for each file and filespec, we query the supported extensions // once and store it on the expansion context. - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); // Literal files are always included verbatim. An "include" or "exclude" specification cannot // remove a literal file. if (fileNames) { @@ -63973,7 +64888,9 @@ var ts; this.text = text; } StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); }; StringScriptSnapshot.prototype.getLength = function () { return this.text.length; @@ -64519,7 +65436,7 @@ var ts; case 243 /* ExportSpecifier */: case 237 /* NamespaceImport */: return ts.ScriptElementKind.alias; - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -64755,7 +65672,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 291 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 292 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -65065,11 +65982,11 @@ var ts; } } if (node) { - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - if (jsDocComment.tags) { - for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) { + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + if (jsDoc.tags) { + for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; if (tag.pos <= position && position <= tag.end) { return tag; @@ -65246,6 +66163,7 @@ var ts; writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, + writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName); }, writeSymbol: writeSymbol, writeLine: writeLine, increaseIndent: function () { indent++; }, @@ -65408,7 +66326,7 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - else if (ts.isStringOrNumericLiteral(location.kind) && + else if (ts.isStringOrNumericLiteral(location) && location.parent.kind === 142 /* ComputedPropertyName */) { return location.text; } @@ -66145,16 +67063,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 280 /* JSDocParameterTag */: + case 281 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 283 /* JSDocTemplateTag */: + case 284 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 282 /* JSDocTypeTag */: + case 283 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 281 /* JSDocReturnTag */: + case 282 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -66432,14 +67350,14 @@ var ts; function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var nameTable = ts.getNameTable(sourceFile); - for (var name_42 in nameTable) { + for (var name_44 in nameTable) { // Skip identifiers produced only from the current location - if (nameTable[name_42] === position) { + if (nameTable[name_44] === position) { continue; } - if (!uniqueNames[name_42]) { - uniqueNames[name_42] = name_42; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_42), compilerOptions.target, /*performCharacterChecks*/ true); + if (!uniqueNames[name_44]) { + uniqueNames[name_44] = name_44; + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_44), compilerOptions.target, /*performCharacterChecks*/ true); if (displayName) { var entry = { name: displayName, @@ -66952,11 +67870,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_14 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_14) { + var parent_13 = ts.getDirectoryPath(currentDir); + if (currentDir === parent_13) { break; } - currentDir = parent_14; + currentDir = parent_13; } else { break; @@ -67037,14 +67955,14 @@ var ts; // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_2 = completionData.location; + var symbols = completionData.symbols, location_3 = completionData.location; // Find the symbol with the matching entry name. // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; }); + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_2, location_2, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), @@ -67072,12 +67990,12 @@ var ts; // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_3 = completionData.location; + var symbols = completionData.symbols, location_4 = completionData.location; // Find the symbol with the matching entry name. // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; }); + return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_4) === entryName ? s : undefined; }); } return undefined; } @@ -67108,9 +68026,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 282 /* JSDocTypeTag */: - case 280 /* JSDocParameterTag */: - case 281 /* JSDocReturnTag */: + case 283 /* JSDocTypeTag */: + case 281 /* JSDocParameterTag */: + case 282 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -67155,13 +68073,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_15 = contextToken.parent, kind = contextToken.kind; + var parent_14 = contextToken.parent, kind = contextToken.kind; if (kind === 22 /* DotToken */) { - if (parent_15.kind === 177 /* PropertyAccessExpression */) { + if (parent_14.kind === 177 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_15.kind === 141 /* QualifiedName */) { + else if (parent_14.kind === 141 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -67548,9 +68466,9 @@ var ts; switch (contextToken.kind) { case 16 /* OpenBraceToken */: // const x = { | case 25 /* CommaToken */: - var parent_16 = contextToken.parent; - if (parent_16 && (parent_16.kind === 176 /* ObjectLiteralExpression */ || parent_16.kind === 172 /* ObjectBindingPattern */)) { - return parent_16; + var parent_15 = contextToken.parent; + if (parent_15 && (parent_15.kind === 176 /* ObjectLiteralExpression */ || parent_15.kind === 172 /* ObjectBindingPattern */)) { + return parent_15; } break; } @@ -67577,37 +68495,37 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_17 = contextToken.parent; + var parent_16 = contextToken.parent; switch (contextToken.kind) { case 27 /* LessThanSlashToken */: case 40 /* SlashToken */: case 70 /* Identifier */: case 250 /* JsxAttribute */: case 251 /* JsxSpreadAttribute */: - if (parent_17 && (parent_17.kind === 247 /* JsxSelfClosingElement */ || parent_17.kind === 248 /* JsxOpeningElement */)) { - return parent_17; + if (parent_16 && (parent_16.kind === 247 /* JsxSelfClosingElement */ || parent_16.kind === 248 /* JsxOpeningElement */)) { + return parent_16; } - else if (parent_17.kind === 250 /* JsxAttribute */) { - return parent_17.parent; + else if (parent_16.kind === 250 /* JsxAttribute */) { + return parent_16.parent; } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_17 && ((parent_17.kind === 250 /* JsxAttribute */) || (parent_17.kind === 251 /* JsxSpreadAttribute */))) { - return parent_17.parent; + if (parent_16 && ((parent_16.kind === 250 /* JsxAttribute */) || (parent_16.kind === 251 /* JsxSpreadAttribute */))) { + return parent_16.parent; } break; case 17 /* CloseBraceToken */: - if (parent_17 && - parent_17.kind === 252 /* JsxExpression */ && - parent_17.parent && - (parent_17.parent.kind === 250 /* JsxAttribute */)) { - return parent_17.parent.parent; + if (parent_16 && + parent_16.kind === 252 /* JsxExpression */ && + parent_16.parent && + (parent_16.parent.kind === 250 /* JsxAttribute */)) { + return parent_16.parent.parent; } - if (parent_17 && parent_17.kind === 251 /* JsxSpreadAttribute */) { - return parent_17.parent; + if (parent_16 && parent_16.kind === 251 /* JsxSpreadAttribute */) { + return parent_16.parent; } break; } @@ -67744,8 +68662,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_43 = element.propertyName || element.name; - existingImportsOrExports[name_43.text] = true; + var name_45 = element.propertyName || element.name; + existingImportsOrExports[name_45.text] = true; } if (!ts.someProperties(existingImportsOrExports)) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); @@ -68104,19 +69022,19 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_18 = child.parent; - if (ts.isFunctionBlock(parent_18) || parent_18.kind === 261 /* SourceFile */) { - return parent_18; + var parent_17 = child.parent; + if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261 /* SourceFile */) { + return parent_17; } // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. - if (parent_18.kind === 221 /* TryStatement */) { - var tryStatement = parent_18; + if (parent_17.kind === 221 /* TryStatement */) { + var tryStatement = parent_17; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_18; + child = parent_17; } return undefined; } @@ -69073,24 +69991,24 @@ var ts; // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface var containingTypeReference = getContainingTypeReference(refNode); if (containingTypeReference) { - var parent_19 = containingTypeReference.parent; - if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); + var parent_18 = containingTypeReference.parent; + if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); } - else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { - if (parent_19.body.kind === 204 /* Block */) { - ts.forEachReturnStatement(parent_19.body, function (returnStatement) { + else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { + if (parent_18.body.kind === 204 /* Block */) { + ts.forEachReturnStatement(parent_18.body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); } }); } - else if (isImplementationExpression(parent_19.body)) { - maybeAdd(getReferenceEntryFromNode(parent_19.body)); + else if (isImplementationExpression(parent_18.body)) { + maybeAdd(getReferenceEntryFromNode(parent_18.body)); } } - else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_19.expression)); + else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { + maybeAdd(getReferenceEntryFromNode(parent_18.expression)); } } } @@ -69392,8 +70310,8 @@ var ts; if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { return; } - var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); - if (type_2 === searchType) { + var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + if (type_1 === searchType) { references.push(getReferenceEntryFromNode(node_2)); } } @@ -69585,9 +70503,9 @@ var ts; return undefined; } } - var result_3 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3, /*previousIterationSymbolsCache*/ ts.createMap()); - return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result_4 = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ ts.createMap()); + return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); } return undefined; }); @@ -69596,7 +70514,7 @@ var ts; if (node.name.kind === 142 /* ComputedPropertyName */) { var nameExpression = node.name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal - if (ts.isStringOrNumericLiteral(nameExpression.kind)) { + if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; } return undefined; @@ -69608,20 +70526,20 @@ var ts; var contextualType = typeChecker.getContextualType(objectLiteral); var name = getNameFromObjectLiteralElement(node); if (name && contextualType) { - var result_4 = []; + var result_5 = []; var symbol_2 = contextualType.getProperty(name); if (symbol_2) { - result_4.push(symbol_2); + result_5.push(symbol_2); } if (contextualType.flags & 65536 /* Union */) { ts.forEach(contextualType.types, function (t) { var symbol = t.getProperty(name); if (symbol) { - result_4.push(symbol); + result_5.push(symbol); } }); } - return result_4; + return result_5; } return undefined; } @@ -69888,13 +70806,13 @@ var ts; return undefined; } if (type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */)) { - var result_5 = []; + var result_6 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(/*to*/ result_5, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node)); + ts.addRange(/*to*/ result_6, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node)); } }); - return result_5; + return result_6; } if (!type.symbol) { return undefined; @@ -70077,6 +70995,7 @@ var ts; "lends", "link", "memberOf", + "method", "name", "namespace", "param", @@ -70105,7 +71024,7 @@ var ts; // from Array - Array and Array var documentationComment = []; forEachUnique(declarations, function (declaration) { - var comments = ts.getJSDocComments(declaration, /*checkParentVariableStatement*/ true); + var comments = ts.getCommentsFromJSDoc(declaration); if (!comments) { return; } @@ -70214,13 +71133,19 @@ var ts; var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; for (var i = 0, numParams = parameters.length; i < numParams; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 /* Identifier */ ? currentName.text : "param" + i; - docParams += indentationStr + " * @param " + paramName + newLine; + if (isJavaScriptFile) { + docParams += indentationStr + " * @param {any} " + paramName + newLine; + } + else { + docParams += indentationStr + " * @param " + paramName + newLine; + } } // A doc comment consists of the following // * The opening comment line @@ -70312,13 +71237,13 @@ var ts; * @param projectRootPath is the path to the project root directory * @param safeListPath is the path used to retrieve the safe list * @param packageNameToTypingLocation is the map of package names to their cached typing locations - * @param typingOptions are used to customize the typing inference process + * @param typeAcquisition is used to customize the typing acquisition process * @param compilerOptions are used as a source for typing inference */ - function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) { + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { // A typing name to typing file path mapping var inferredTypings = ts.createMap(); - if (!typingOptions || !typingOptions.enableAutoDiscovery) { + if (!typeAcquisition || !typeAcquisition.enable) { return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; } // Only infer typings for .js and .jsx files @@ -70334,8 +71259,8 @@ var ts; // Directories to search for package.json, bower.json and other typing information var searchDirs = []; var exclude = []; - mergeTypings(typingOptions.include); - exclude = typingOptions.exclude || []; + mergeTypings(typeAcquisition.include); + exclude = typeAcquisition.exclude || []; var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); if (projectRootPath) { possibleSearchDirs.push(projectRootPath); @@ -70362,9 +71287,9 @@ var ts; } } // Add the cached typing locations for inferred typings that are already installed - for (var name_44 in packageNameToTypingLocation) { - if (name_44 in inferredTypings && !inferredTypings[name_44]) { - inferredTypings[name_44] = packageNameToTypingLocation[name_44]; + for (var name_46 in packageNameToTypingLocation) { + if (name_46 in inferredTypings && !inferredTypings[name_46]) { + inferredTypings[name_46] = packageNameToTypingLocation[name_46]; } } // Remove typings that the user has added to the exclude list @@ -70502,12 +71427,12 @@ var ts; return; } var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_45 in nameToDeclarations) { - var declarations = nameToDeclarations[name_45]; + for (var name_47 in nameToDeclarations) { + var declarations = nameToDeclarations[name_47]; if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_45); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_47); if (!matches) { continue; } @@ -70520,14 +71445,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_45); + matches = patternMatcher.getMatches(containers, name_47); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_45, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_47, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -70816,9 +71741,9 @@ var ts; case 174 /* BindingElement */: case 223 /* VariableDeclaration */: var decl = node; - var name_46 = decl.name; - if (ts.isBindingPattern(name_46)) { - addChildrenRecursively(name_46); + var name_48 = decl.name; + if (ts.isBindingPattern(name_48)) { + addChildrenRecursively(name_48); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { // For `const x = function() {}`, just use the function node, not the const. @@ -70865,9 +71790,9 @@ var ts; addLeafNode(node); break; default: - ts.forEach(node.jsDocComments, function (jsDocComment) { - ts.forEach(jsDocComment.tags, function (tag) { - if (tag.kind === 284 /* JSDocTypedefTag */) { + ts.forEach(node.jsDoc, function (jsDoc) { + ts.forEach(jsDoc.tags, function (tag) { + if (tag.kind === 285 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -70997,7 +71922,7 @@ var ts; case 185 /* ArrowFunction */: case 197 /* ClassExpression */: return getFunctionOrClassName(node); - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; @@ -71040,7 +71965,7 @@ var ts; return "()"; case 155 /* IndexSignature */: return "[]"; - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -71088,7 +72013,7 @@ var ts; case 230 /* ModuleDeclaration */: case 261 /* SourceFile */: case 228 /* TypeAliasDeclaration */: - case 284 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return true; case 150 /* Constructor */: case 149 /* MethodDeclaration */: @@ -71325,28 +72250,28 @@ var ts; switch (n.kind) { case 204 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_20 = n.parent; + var parent_19 = n.parent; var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_20.kind === 209 /* DoStatement */ || - parent_20.kind === 212 /* ForInStatement */ || - parent_20.kind === 213 /* ForOfStatement */ || - parent_20.kind === 211 /* ForStatement */ || - parent_20.kind === 208 /* IfStatement */ || - parent_20.kind === 210 /* WhileStatement */ || - parent_20.kind === 217 /* WithStatement */ || - parent_20.kind === 256 /* CatchClause */) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + if (parent_19.kind === 209 /* DoStatement */ || + parent_19.kind === 212 /* ForInStatement */ || + parent_19.kind === 213 /* ForOfStatement */ || + parent_19.kind === 211 /* ForStatement */ || + parent_19.kind === 208 /* IfStatement */ || + parent_19.kind === 210 /* WhileStatement */ || + parent_19.kind === 217 /* WithStatement */ || + parent_19.kind === 256 /* CatchClause */) { + addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_20.kind === 221 /* TryStatement */) { + if (parent_19.kind === 221 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_20; + var tryStatement = parent_19; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -73439,9 +74364,9 @@ var ts; return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { + for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { // Reached source file or module block - if (parent_21.kind === 261 /* SourceFile */ || parent_21.kind === 231 /* ModuleBlock */) { + if (parent_20.kind === 261 /* SourceFile */ || parent_20.kind === 231 /* ModuleBlock */) { return false; } } @@ -73552,7 +74477,7 @@ var ts; return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_4 = function (opt) { + var _loop_3 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -73571,7 +74496,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_4(opt); + _loop_3(opt); } return options; } @@ -74046,7 +74971,7 @@ var ts; function RuleOperationContext() { var funcs = []; for (var _i = 0; _i < arguments.length; _i++) { - funcs[_i - 0] = arguments[_i]; + funcs[_i] = arguments[_i]; } this.customContextChecks = funcs; } @@ -74317,9 +75242,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_47 in o) { - if (o[name_47] === rule) { - return name_47; + for (var name_49 in o) { + if (o[name_49] === rule) { + return name_49; } } throw new Error("Unknown rule"); @@ -75707,11 +76632,23 @@ var ts; else { var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); - if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) { + if (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) { recordReplace(startLinePosition, tokenStart.character, indentationString); } } } + function characterToColumn(startLinePosition, characterInLine) { + var column = 0; + for (var i = 0; i < characterInLine; i++) { + if (sourceFile.text.charCodeAt(startLinePosition + i) === 9 /* tab */) { + column += options.tabSize - column % options.tabSize; + } + else { + column++; + } + } + return column; + } function indentationIsDifferent(indentationString, startLinePosition) { return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); } @@ -76500,7 +77437,666 @@ var ts; }); })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + var ModuleSpecifierComparison; + (function (ModuleSpecifierComparison) { + ModuleSpecifierComparison[ModuleSpecifierComparison["Better"] = 0] = "Better"; + ModuleSpecifierComparison[ModuleSpecifierComparison["Equal"] = 1] = "Equal"; + ModuleSpecifierComparison[ModuleSpecifierComparison["Worse"] = 2] = "Worse"; + })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); + var ImportCodeActionMap = (function () { + function ImportCodeActionMap() { + this.symbolIdToActionMap = ts.createMap(); + } + ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { + if (!newAction) { + return; + } + if (!this.symbolIdToActionMap[symbolId]) { + this.symbolIdToActionMap[symbolId] = [newAction]; + return; + } + if (newAction.kind === "CodeChange") { + this.symbolIdToActionMap[symbolId].push(newAction); + return; + } + var updatedNewImports = []; + for (var _i = 0, _a = this.symbolIdToActionMap[symbolId]; _i < _a.length; _i++) { + var existingAction = _a[_i]; + if (existingAction.kind === "CodeChange") { + // only import actions should compare + updatedNewImports.push(existingAction); + continue; + } + switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) { + case ModuleSpecifierComparison.Better: + // the new one is not worth considering if it is a new improt. + // However if it is instead a insertion into existing import, the user might want to use + // the module specifier even it is worse by our standards. So keep it. + if (newAction.kind === "NewImport") { + return; + } + case ModuleSpecifierComparison.Equal: + // the current one is safe. But it is still possible that the new one is worse + // than another existing one. For example, you may have new imports from "./foo/bar" + // and "bar", when the new one is "bar/bar2" and the current one is "./foo/bar". The new + // one and the current one are not comparable (one relative path and one absolute path), + // but the new one is worse than the other one, so should not add to the list. + updatedNewImports.push(existingAction); + break; + case ModuleSpecifierComparison.Worse: + // the existing one is worse, remove from the list. + continue; + } + } + // if we reach here, it means the new one is better or equal to all of the existing ones. + updatedNewImports.push(newAction); + this.symbolIdToActionMap[symbolId] = updatedNewImports; + }; + ImportCodeActionMap.prototype.addActions = function (symbolId, newActions) { + for (var _i = 0, newActions_1 = newActions; _i < newActions_1.length; _i++) { + var newAction = newActions_1[_i]; + this.addAction(symbolId, newAction); + } + }; + ImportCodeActionMap.prototype.getAllActions = function () { + var result = []; + for (var symbolId in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + } + return result; + }; + ImportCodeActionMap.prototype.compareModuleSpecifiers = function (moduleSpecifier1, moduleSpecifier2) { + if (moduleSpecifier1 === moduleSpecifier2) { + return ModuleSpecifierComparison.Equal; + } + // if moduleSpecifier1 (ms1) is a substring of ms2, then it is better + if (moduleSpecifier2.indexOf(moduleSpecifier1) === 0) { + return ModuleSpecifierComparison.Better; + } + if (moduleSpecifier1.indexOf(moduleSpecifier2) === 0) { + return ModuleSpecifierComparison.Worse; + } + // if both are relative paths, and ms1 has fewer levels, then it is better + if (ts.isExternalModuleNameRelative(moduleSpecifier1) && ts.isExternalModuleNameRelative(moduleSpecifier2)) { + var regex = new RegExp(ts.directorySeparator, "g"); + var moduleSpecifier1LevelCount = (moduleSpecifier1.match(regex) || []).length; + var moduleSpecifier2LevelCount = (moduleSpecifier2.match(regex) || []).length; + return moduleSpecifier1LevelCount < moduleSpecifier2LevelCount + ? ModuleSpecifierComparison.Better + : moduleSpecifier1LevelCount === moduleSpecifier2LevelCount + ? ModuleSpecifierComparison.Equal + : ModuleSpecifierComparison.Worse; + } + // the equal cases include when the two specifiers are not comparable. + return ModuleSpecifierComparison.Equal; + }; + return ImportCodeActionMap; + }()); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var checker = context.program.getTypeChecker(); + var allSourceFiles = context.program.getSourceFiles(); + var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + var name = token.getText(); + var symbolIdActionMap = new ImportCodeActionMap(); + // this is a module id -> module import declaration map + var cachedImportDeclarations = ts.createMap(); + var cachedNewImportInsertPosition; + var allPotentialModules = checker.getAmbientModules(); + for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { + var otherSourceFile = allSourceFiles_1[_i]; + if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) { + allPotentialModules.push(otherSourceFile.symbol); + } + } + var currentTokenMeaning = ts.getMeaningFromLocation(token); + for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { + var moduleSymbol = allPotentialModules_1[_a]; + context.cancellationToken.throwIfCancellationRequested(); + // check the default export + var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); + if (defaultExport) { + var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport); + if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { + // check if this symbol is already used + var symbolId = getUniqueSymbolId(localSymbol); + symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, /*isDefault*/ true)); + } + } + // check exports with the same name + var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol); + if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) { + var symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName); + symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol)); + } + } + return symbolIdActionMap.getAllActions(); + function getImportDeclarations(moduleSymbol) { + var moduleSymbolId = getUniqueSymbolId(moduleSymbol); + if (cachedImportDeclarations[moduleSymbolId]) { + return cachedImportDeclarations[moduleSymbolId]; + } + var existingDeclarations = []; + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var importModuleSpecifier = _a[_i]; + var importSymbol = checker.getSymbolAtLocation(importModuleSpecifier); + if (importSymbol === moduleSymbol) { + existingDeclarations.push(getImportDeclaration(importModuleSpecifier)); + } + } + cachedImportDeclarations[moduleSymbolId] = existingDeclarations; + return existingDeclarations; + function getImportDeclaration(moduleSpecifier) { + var node = moduleSpecifier; + while (node) { + if (node.kind === 235 /* ImportDeclaration */) { + return node; + } + if (node.kind === 234 /* ImportEqualsDeclaration */) { + return node; + } + node = node.parent; + } + return undefined; + } + } + function getUniqueSymbolId(symbol) { + if (symbol.flags & 8388608 /* Alias */) { + return ts.getSymbolId(checker.getAliasedSymbol(symbol)); + } + return ts.getSymbolId(symbol); + } + function checkSymbolHasMeaning(symbol, meaning) { + var declarations = symbol.getDeclarations(); + return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; + } + function getCodeActionForImport(moduleSymbol, isDefault) { + var existingDeclarations = getImportDeclarations(moduleSymbol); + if (existingDeclarations.length > 0) { + // With an existing import statement, there are more than one actions the user can do. + return getCodeActionsForExistingImport(existingDeclarations); + } + else { + return [getCodeActionForNewImport()]; + } + function getCodeActionsForExistingImport(declarations) { + var actions = []; + // It is possible that multiple import statements with the same specifier exist in the file. + // e.g. + // + // import * as ns from "foo"; + // import { member1, member2 } from "foo"; + // + // member3/**/ <-- cusor here + // + // in this case we should provie 2 actions: + // 1. change "member3" to "ns.member3" + // 2. add "member3" to the second import statement's import list + // and it is up to the user to decide which one fits best. + var namespaceImportDeclaration; + var namedImportDeclaration; + var existingModuleSpecifier; + for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { + var declaration = declarations_11[_i]; + if (declaration.kind === 235 /* ImportDeclaration */) { + var namedBindings = declaration.importClause && declaration.importClause.namedBindings; + if (namedBindings && namedBindings.kind === 237 /* NamespaceImport */) { + // case: + // import * as ns from "foo" + namespaceImportDeclaration = declaration; + } + else { + // cases: + // import default from "foo" + // import { bar } from "foo" or combination with the first one + // import "foo" + namedImportDeclaration = declaration; + } + existingModuleSpecifier = declaration.moduleSpecifier.getText(); + } + else { + // case: + // import foo = require("foo") + namespaceImportDeclaration = declaration; + existingModuleSpecifier = getModuleSpecifierFromImportEqualsDeclaration(declaration); + } + } + if (namespaceImportDeclaration) { + actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); + } + if (namedImportDeclaration && namedImportDeclaration.importClause && + (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { + /** + * If the existing import declaration already has a named import list, just + * insert the identifier into that list. + */ + var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); + var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); + actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); + } + else { + // we need to create a new import statement, but the existing module specifier can be reused. + actions.push(getCodeActionForNewImport(existingModuleSpecifier)); + } + return actions; + function getModuleSpecifierFromImportEqualsDeclaration(declaration) { + if (declaration.moduleReference && declaration.moduleReference.kind === 245 /* ExternalModuleReference */) { + return declaration.moduleReference.expression.getText(); + } + return declaration.moduleReference.getText(); + } + function getTextChangeForImportClause(importClause) { + var newImportText = isDefault ? "default as " + name : name; + var importList = importClause.namedBindings; + // case 1: + // original text: import default from "module" + // change to: import default, { name } from "module" + if (!importList && importClause.name) { + var start = importClause.name.getEnd(); + return { + newText: ", { " + newImportText + " }", + span: { start: start, length: 0 } + }; + } + // case 2: + // original text: import {} from "module" + // change to: import { name } from "module" + if (importList.elements.length === 0) { + var start = importList.getStart(); + return { + newText: "{ " + newImportText + " }", + span: { start: start, length: importList.getEnd() - start } + }; + } + // case 3: + // original text: import { foo, bar } from "module" + // change to: import { foo, bar, name } from "module" + var insertPoint = importList.elements[importList.elements.length - 1].getEnd(); + /** + * If the import list has one import per line, preserve that. Otherwise, insert on same line as last element + * import { + * foo + * } from "./module"; + */ + var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart()); + var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd()); + var oneImportPerLine = endLine - startLine > importList.elements.length; + return { + newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText, + span: { start: insertPoint, length: 0 } + }; + } + function getCodeActionForNamespaceImport(declaration) { + var namespacePrefix; + if (declaration.kind === 235 /* ImportDeclaration */) { + namespacePrefix = declaration.importClause.namedBindings.name.getText(); + } + else { + namespacePrefix = declaration.name.getText(); + } + namespacePrefix = ts.stripQuotes(namespacePrefix); + /** + * Cases: + * import * as ns from "mod" + * import default, * as ns from "mod" + * import ns = require("mod") + * + * Because there is no import list, we alter the reference to include the + * namespace instead of altering the import declaration. For example, "foo" would + * become "ns.foo" + */ + return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange"); + } + } + function getCodeActionForNewImport(moduleSpecifier) { + if (!cachedNewImportInsertPosition) { + // insert after any existing imports + var lastModuleSpecifierEnd = -1; + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var moduleSpecifier_1 = _a[_i]; + var end = moduleSpecifier_1.getEnd(); + if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) { + lastModuleSpecifierEnd = end; + } + } + cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart(); + } + var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); + var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); + var importStatementText = isDefault + ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" + : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; + // if this file doesn't have any import statements, insert an import statement and then insert a new line + // between the only import statement and user code. Otherwise just insert the statement because chances + // are there are already a new line seperating code and import statements. + var newText = cachedNewImportInsertPosition === sourceFile.getStart() + ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter + : "" + context.newLineCharacter + importStatementText + ";"; + return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes); + function getModuleSpecifierForNewImport() { + var fileName = sourceFile.path; + var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path; + var sourceDirectory = ts.getDirectoryPath(fileName); + var options = context.program.getCompilerOptions(); + return tryGetModuleNameFromAmbientModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || + tryGetModuleNameFromTypeRoots() || + tryGetModuleNameAsNodeModule() || + ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); + function tryGetModuleNameFromAmbientModule() { + if (moduleSymbol.valueDeclaration.kind !== 261 /* SourceFile */) { + return moduleSymbol.name; + } + } + function tryGetModuleNameFromBaseUrl() { + if (!options.baseUrl) { + return undefined; + } + var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName); + var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl); + if (!relativeName) { + return undefined; + } + relativeName = removeExtensionAndIndexPostFix(relativeName); + if (options.paths) { + for (var key in options.paths) { + for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { + var pattern = _a[_i]; + var indexOfStar = pattern.indexOf("*"); + if (indexOfStar === 0 && pattern.length === 1) { + continue; + } + else if (indexOfStar !== -1) { + var prefix = pattern.substr(0, indexOfStar); + var suffix = pattern.substr(indexOfStar + 1); + if (relativeName.length >= prefix.length + suffix.length && + ts.startsWith(relativeName, prefix) && + ts.endsWith(relativeName, suffix)) { + var matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length); + return key.replace("\*", matchedStar); + } + } + else if (pattern === relativeName) { + return key; + } + } + } + } + return relativeName; + } + function tryGetModuleNameFromRootDirs() { + if (options.rootDirs) { + var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, /*basePath*/ undefined, getCanonicalFileName); }); + var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs); + var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs); + if (normalizedTargetPath !== undefined) { + var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath; + return ts.removeFileExtension(relativePath); + } + } + return undefined; + } + function tryGetModuleNameFromTypeRoots() { + var typeRoots = ts.getEffectiveTypeRoots(options, context.host); + if (typeRoots) { + var normalizedTypeRoots = ts.map(typeRoots, function (typeRoot) { return ts.toPath(typeRoot, /*basePath*/ undefined, getCanonicalFileName); }); + for (var _i = 0, normalizedTypeRoots_1 = normalizedTypeRoots; _i < normalizedTypeRoots_1.length; _i++) { + var typeRoot = normalizedTypeRoots_1[_i]; + if (ts.startsWith(moduleFileName, typeRoot)) { + var relativeFileName = moduleFileName.substring(typeRoot.length + 1); + return removeExtensionAndIndexPostFix(relativeFileName); + } + } + } + } + function tryGetModuleNameAsNodeModule() { + if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) { + // nothing to do here + return undefined; + } + var indexOfNodeModules = moduleFileName.indexOf("node_modules"); + if (indexOfNodeModules < 0) { + return undefined; + } + var relativeFileName; + if (sourceDirectory.indexOf(moduleFileName.substring(0, indexOfNodeModules - 1)) === 0) { + // if node_modules folder is in this folder or any of its parent folder, no need to keep it. + relativeFileName = moduleFileName.substring(indexOfNodeModules + 13 /* "node_modules\".length */); + } + else { + relativeFileName = getRelativePath(moduleFileName, sourceDirectory); + } + relativeFileName = ts.removeFileExtension(relativeFileName); + if (ts.endsWith(relativeFileName, "/index")) { + relativeFileName = ts.getDirectoryPath(relativeFileName); + } + else { + try { + var moduleDirectory = ts.getDirectoryPath(moduleFileName); + var packageJsonContent = JSON.parse(context.host.readFile(ts.combinePaths(moduleDirectory, "package.json"))); + if (packageJsonContent) { + var mainFile = packageJsonContent.main || packageJsonContent.typings; + if (mainFile) { + var mainExportFile = ts.toPath(mainFile, moduleDirectory, getCanonicalFileName); + if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(moduleFileName)) { + relativeFileName = ts.getDirectoryPath(relativeFileName); + } + } + } + } + catch (e) { } + } + return relativeFileName; + } + } + function getPathRelativeToRootDirs(path, rootDirs) { + for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) { + var rootDir = rootDirs_2[_i]; + var relativeName = tryRemoveParentDirectoryName(path, rootDir); + if (relativeName !== undefined) { + return relativeName; + } + } + return undefined; + } + function removeExtensionAndIndexPostFix(fileName) { + fileName = ts.removeFileExtension(fileName); + if (ts.endsWith(fileName, "/index")) { + fileName = fileName.substr(0, fileName.length - 6 /* "/index".length */); + } + return fileName; + } + function getRelativePath(path, directoryPath) { + var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); + return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath; + } + function tryRemoveParentDirectoryName(path, parentDirectory) { + var index = path.indexOf(parentDirectory); + if (index === 0) { + return ts.endsWith(parentDirectory, ts.directorySeparator) + ? path.substring(parentDirectory.length) + : path.substring(parentDirectory.length + 1); + } + return undefined; + } + } + } + function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) { + return { + description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)), + changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }], + kind: kind, + moduleSpecifier: moduleSpecifier + }; + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + // this handles var ["computed"] = 12; + if (token.kind === 20 /* OpenBracketToken */) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70 /* Identifier */: + switch (token.parent.kind) { + case 223 /* VariableDeclaration */: + switch (token.parent.parent.parent.kind) { + case 211 /* ForStatement */: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); + } + else { + return removeSingleItem(forInitializer.declarations, token); + } + case 213 /* ForOfStatement */: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { + var forOfInitializer = forOfStatement.initializer; + return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); + } + break; + case 212 /* ForInStatement */: + // There is no valid fix in the case of: + // for .. in + return undefined; + case 256 /* CatchClause */: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return createCodeFix("", parameter.pos, parameter.end - parameter.pos); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); + } + else { + var declarations = variableStatement.declarationList.declarations; + return removeSingleItem(declarations, token); + } + } + case 143 /* TypeParameter */: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); + } + else { + return removeSingleItem(typeParameters, token); + } + case 144 /* Parameter */: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else { + return removeSingleItem(functionDeclaration.parameters, token); + } + // handle case where 'import a = A;' + case 234 /* ImportEqualsDeclaration */: + var importEquals = findImportDeclaration(token); + return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); + case 239 /* ImportSpecifier */: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + // Only 1 import and it is unused. So the entire declaration should be removed. + var importSpec = findImportDeclaration(token); + return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); + } + else { + return removeSingleItem(namedImports.elements, token); + } + // handle case where "import d, * as ns from './file'" + // or "'import {a, b as ns} from './file'" + case 236 /* ImportClause */: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = findImportDeclaration(importClause); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); + } + case 237 /* NamespaceImport */: + var namespaceImport = token.parent; + if (namespaceImport.name == token && !namespaceImport.parent.name) { + var importDecl = findImportDeclaration(namespaceImport); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + var start_4 = namespaceImport.parent.name.end; + return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); + } + } + break; + case 147 /* PropertyDeclaration */: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + case 237 /* NamespaceImport */: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + if (ts.isDeclarationName(token)) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); + } + else { + return undefined; + } + function findImportDeclaration(token) { + var importDecl = token; + while (importDecl.kind != 235 /* ImportDeclaration */ && importDecl.parent) { + importDecl = importDecl.parent; + } + return importDecl; + } + function createCodeFix(newText, start, length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ newText: newText, span: { start: start, length: length } }] + }] + }]; + } + function removeSingleItem(elements, token) { + if (elements[0] === token.parent) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + else { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + } + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); /// +/// +/// /// /// /// @@ -76591,11 +78187,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(291 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(292 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var node = nodes_5[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -76614,7 +78210,7 @@ var ts; ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 290 /* LastJSDocTagNode */; + var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 291 /* LastJSDocTagNode */; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -76633,8 +78229,8 @@ var ts; pos_3 = nodes.end; }; // jsDocComments need to be the first children - if (this.jsDocComments) { - for (var _i = 0, _a = this.jsDocComments; _i < _a.length; _i++) { + if (this.jsDoc) { + for (var _i = 0, _a = this.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; processNode(jsDocComment); } @@ -76858,6 +78454,20 @@ var ts; SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) { return ts.getPositionOfLineAndCharacter(this, line, character); }; + SourceFileObject.prototype.getLineEndOfPosition = function (pos) { + var line = this.getLineAndCharacterOfPosition(pos).line; + var lineStarts = this.getLineStarts(); + var lastCharPos; + if (line + 1 >= lineStarts.length) { + lastCharPos = this.getEnd(); + } + if (!lastCharPos) { + lastCharPos = lineStarts[line + 1] - 1; + } + var fullText = this.getFullText(); + // if the new line is "\r\n", we should return the last non-new-line-character position + return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos; + }; SourceFileObject.prototype.getNamedDeclarations = function () { if (!this.namedDeclarations) { this.namedDeclarations = this.computeNamedDeclarations(); @@ -76879,9 +78489,9 @@ var ts; } function getDeclarationName(declaration) { if (declaration.name) { - var result_6 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_6 !== undefined) { - return result_6; + var result_7 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_7 !== undefined) { + return result_7; } if (declaration.name.kind === 142 /* ComputedPropertyName */) { var expr = declaration.name.expression; @@ -76925,8 +78535,8 @@ var ts; else { declarations.push(functionDeclaration); } - ts.forEachChild(node, visit); } + ts.forEachChild(node, visit); break; case 226 /* ClassDeclaration */: case 197 /* ClassExpression */: @@ -77453,7 +79063,7 @@ var ts; return program; } function cleanupSemanticCache() { - // TODO: Should we jettison the program (or it's type checker) here? + program = undefined; } function dispose() { if (program) { @@ -77837,7 +79447,9 @@ var ts; sourceFile: sourceFile, span: span, program: program, - newLineCharacter: newLineChar + newLineCharacter: newLineChar, + host: host, + cancellationToken: cancellationToken }; var fixes = ts.codefix.getFixes(context); if (fixes) { @@ -77861,7 +79473,7 @@ var ts; } var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Check if in a context where we don't want to perform any insertion - if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + if (ts.isInString(sourceFile, position)) { return false; } if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { @@ -78079,10 +79691,10 @@ var ts; break; default: ts.forEachChild(node, walk); - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - ts.forEachChild(jsDocComment, walk); + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + ts.forEachChild(jsDoc, walk); } } } @@ -79408,7 +81020,7 @@ var ts; if (result.error) { return { options: {}, - typingOptions: {}, + typeAcquisition: {}, files: [], raw: {}, errors: [realizeDiagnostic(result.error, "\r\n")] @@ -79418,7 +81030,7 @@ var ts; var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName); return { options: configFile.options, - typingOptions: configFile.typingOptions, + typeAcquisition: configFile.typeAcquisition, files: configFile.fileNames, raw: configFile.raw, errors: realizeDiagnostics(configFile.errors, "\r\n") @@ -79433,7 +81045,7 @@ var ts; var getCanonicalFileName = ts.createGetCanonicalFileName(/*useCaseSensitivefileNames:*/ false); return this.forwardJSONCall("discoverTypings()", function () { var info = JSON.parse(discoverTypingsJson); - return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.unresolvedImports); + return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports); }); }; return CoreServicesShimObject; diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 70b4424c200..d8cd324a8d2 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -136,6 +136,9 @@ var ts; })(performance = ts.performance || (ts.performance = {})); })(ts || (ts = {})); var ts; +(function (ts) { + ts.version = "2.2.0"; +})(ts || (ts = {})); (function (ts) { var createObject = Object.create; ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; @@ -606,7 +609,7 @@ var ts; if (value === undefined) return to; if (to === undefined) - to = []; + return [value]; to.push(value); return to; } @@ -621,6 +624,14 @@ var ts; return to; } ts.addRange = addRange; + function stableSort(array, comparer) { + if (comparer === void 0) { comparer = compareValues; } + return array + .map(function (_, i) { return i; }) + .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); }) + .map(function (i) { return array[i]; }); + } + ts.stableSort = stableSort; function rangeEquals(array1, array2, pos, end) { while (pos < end) { if (array1[pos] !== array2[pos]) { @@ -775,6 +786,15 @@ var ts; } } ts.copyProperties = copyProperties; + function appendProperty(map, key, value) { + if (key === undefined || value === undefined) + return map; + if (map === undefined) + map = createMap(); + map[key] = value; + return map; + } + ts.appendProperty = appendProperty; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -798,15 +818,6 @@ var ts; return result; } ts.reduceProperties = reduceProperties; - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -1227,6 +1238,14 @@ var ts; getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS; } ts.getEmitModuleKind = getEmitModuleKind; + function getEmitModuleResolutionKind(compilerOptions) { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + } + return moduleResolution; + } + ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind; function hasZeroOrOneAsteriskCharacter(str) { var seenAsterisk = false; for (var i = 0; i < str.length; i++) { @@ -1645,8 +1664,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (needAllExtensions || extInfo.scriptKind === 3) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -1657,11 +1687,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -1777,6 +1807,16 @@ var ts; } Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); + function orderedRemoveItem(array, item) { + for (var i = 0; i < array.length; i++) { + if (array[i] === item) { + orderedRemoveItemAt(array, i); + return true; + } + } + return false; + } + ts.orderedRemoveItem = orderedRemoveItem; function orderedRemoveItemAt(array, index) { for (var i = index; i < array.length - 1; i++) { array[i] = array[i + 1]; @@ -2591,6 +2631,7 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2634,6 +2675,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -2644,6 +2686,7 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, @@ -2811,7 +2854,7 @@ var ts; Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." }, - Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." }, + Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." }, Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." }, Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." }, Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." }, @@ -2876,7 +2919,8 @@ var ts; An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, - An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." }, + The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, + _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2947,7 +2991,10 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, @@ -2989,7 +3036,7 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -3150,6 +3197,7 @@ var ts; type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, + Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", message: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, @@ -3160,9 +3208,10 @@ var ts; A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, - Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." }, + Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, - The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." }, + A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, @@ -3174,6 +3223,9 @@ var ts; Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, }; })(ts || (ts = {})); var ts; @@ -4994,7 +5046,7 @@ var ts; "es2017": 4, "esnext": 5, }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, paramType: ts.Diagnostics.VERSION, }, { @@ -5175,11 +5227,15 @@ var ts; description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file } ]; - ts.typingOptionDeclarations = [ + ts.typeAcquisitionDeclarations = [ { name: "enableAutoDiscovery", type: "boolean", }, + { + name: "enable", + type: "boolean", + }, { name: "include", type: "list", @@ -5204,6 +5260,18 @@ var ts; sourceMap: false, }; var optionNameMapCache; + function convertEnableAutoDiscoveryToEnable(typeAcquisition) { + if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { + var result = { + enable: typeAcquisition.enableAutoDiscovery, + include: typeAcquisition.include || [], + exclude: typeAcquisition.exclude || [] + }; + return result; + } + return typeAcquisition; + } + ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; function getOptionNameMap() { if (optionNameMapCache) { return optionNameMapCache; @@ -5226,14 +5294,7 @@ var ts; } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; function parseListTypeOption(opt, value, errors) { @@ -5473,9 +5534,10 @@ var ts; } return output; } - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); @@ -5483,14 +5545,15 @@ var ts; return { options: {}, fileNames: [], - typingOptions: {}, + typeAcquisition: {}, raw: json, errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))], wildcardDirectories: {} }; } var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + var jsonOptions = json["typeAcquisition"] || json["typingOptions"]; + var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); if (json["extends"]) { var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3]; if (typeof json["extends"] === "string") { @@ -5517,7 +5580,7 @@ var ts; return { options: options, fileNames: fileNames, - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, raw: json, errors: errors, wildcardDirectories: wildcardDirectories, @@ -5525,7 +5588,7 @@ var ts; }; function tryExtendsName(extendedConfig) { if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted)); + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); return; } var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName); @@ -5588,7 +5651,7 @@ var ts; errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); } else { - excludeSpecs = ["node_modules", "bower_components", "jspm_packages"]; + excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"]; var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; if (outDir) { excludeSpecs.push(outDir); @@ -5597,7 +5660,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -5623,12 +5686,12 @@ var ts; return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; - function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { var errors = []; - var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } - ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } @@ -5636,9 +5699,10 @@ var ts; convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); return options; } - function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; - convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors); + function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); + convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors); return options; } function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { @@ -5700,7 +5764,7 @@ var ts; var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; var literalFileMap = ts.createMap(); @@ -5712,7 +5776,7 @@ var ts; exclude = validateSpecs(exclude, errors, true); } var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); if (fileNames) { for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; @@ -5857,9 +5921,9 @@ var ts; "constants", "process", "v8", "timers", "console" ]; var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); - function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) { + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { var inferredTypings = ts.createMap(); - if (!typingOptions || !typingOptions.enableAutoDiscovery) { + if (!typeAcquisition || !typeAcquisition.enable) { return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; } fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { @@ -5873,8 +5937,8 @@ var ts; var filesToWatch = []; var searchDirs = []; var exclude = []; - mergeTypings(typingOptions.include); - exclude = typingOptions.exclude || []; + mergeTypings(typeAcquisition.include); + exclude = typeAcquisition.exclude || []; var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); if (projectRootPath) { possibleSearchDirs.push(projectRootPath); @@ -6007,7 +6071,8 @@ var ts; (function (server) { server.ActionSet = "action::set"; server.ActionInvalidate = "action::invalidate"; - server.EventInstall = "event::install"; + server.EventBeginInstallTypes = "event::beginInstallTypes"; + server.EventEndInstallTypes = "event::endInstallTypes"; var Arguments; (function (Arguments) { Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation"; @@ -6057,6 +6122,7 @@ var ts; function moduleHasNonRelativeName(moduleName) { return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } + ts.moduleHasNonRelativeName = moduleHasNonRelativeName; function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { @@ -6618,9 +6684,17 @@ var ts; isEnabled: function () { return false; }, writeLine: ts.noop }; - function typingToFileName(cachePath, packageName, installTypingHost) { - var result = ts.resolveModuleName(packageName, ts.combinePaths(cachePath, "index.d.ts"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, installTypingHost); - return result.resolvedModule && result.resolvedModule.resolvedFileName; + function typingToFileName(cachePath, packageName, installTypingHost, log) { + try { + var result = ts.resolveModuleName(packageName, ts.combinePaths(cachePath, "index.d.ts"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, installTypingHost); + return result.resolvedModule && result.resolvedModule.resolvedFileName; + } + catch (e) { + if (log.isEnabled()) { + log.writeLine("Failed to resolve " + packageName + " in folder '" + cachePath + "': " + e.message); + } + return undefined; + } } var PackageNameValidationResult; (function (PackageNameValidationResult) { @@ -6656,13 +6730,12 @@ var ts; } typingsInstaller.validatePackageName = validatePackageName; var TypingsInstaller = (function () { - function TypingsInstaller(installTypingHost, globalCachePath, safeListPath, throttleLimit, telemetryEnabled, log) { + function TypingsInstaller(installTypingHost, globalCachePath, safeListPath, throttleLimit, log) { if (log === void 0) { log = nullLog; } this.installTypingHost = installTypingHost; this.globalCachePath = globalCachePath; this.safeListPath = safeListPath; this.throttleLimit = throttleLimit; - this.telemetryEnabled = telemetryEnabled; this.log = log; this.packageNameToTypingLocation = ts.createMap(); this.missingTypingsSet = ts.createMap(); @@ -6709,7 +6782,7 @@ var ts; } this.processCacheLocation(req.cachePath); } - var discoverTypingsResult = ts.JsTyping.discoverTypings(this.installTypingHost, req.fileNames, req.projectRootPath, this.safeListPath, this.packageNameToTypingLocation, req.typingOptions, req.unresolvedImports); + var discoverTypingsResult = ts.JsTyping.discoverTypings(this.installTypingHost, req.fileNames, req.projectRootPath, this.safeListPath, this.packageNameToTypingLocation, req.typeAcquisition, req.unresolvedImports); if (this.log.isEnabled()) { this.log.writeLine("Finished typings discovery: " + JSON.stringify(discoverTypingsResult)); } @@ -6749,8 +6822,9 @@ var ts; if (!packageName) { continue; } - var typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost); + var typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost, this.log); if (!typingFile) { + this.missingTypingsSet[packageName] = true; continue; } var existingTypingFile = this.packageNameToTypingLocation[packageName]; @@ -6781,7 +6855,7 @@ var ts; var result = []; for (var _i = 0, typingsToInstall_1 = typingsToInstall; _i < typingsToInstall_1.length; _i++) { var typing = typingsToInstall_1[_i]; - if (this.missingTypingsSet[typing]) { + if (this.missingTypingsSet[typing] || this.packageNameToTypingLocation[typing]) { continue; } var validationResult = validatePackageName(typing); @@ -6852,47 +6926,55 @@ var ts; this.ensurePackageDirectoryExists(cachePath); var requestId = this.installRunCount; this.installRunCount++; + this.sendResponse({ + kind: server.EventBeginInstallTypes, + eventId: requestId, + typingsInstallerVersion: ts.version, + projectName: req.projectName + }); this.installTypingsAsync(requestId, scopedTypings, cachePath, function (ok) { - if (_this.telemetryEnabled) { + try { + if (!ok) { + if (_this.log.isEnabled()) { + _this.log.writeLine("install request failed, marking packages as missing to prevent repeated requests: " + JSON.stringify(filteredTypings)); + } + for (var _i = 0, filteredTypings_1 = filteredTypings; _i < filteredTypings_1.length; _i++) { + var typing = filteredTypings_1[_i]; + _this.missingTypingsSet[typing] = true; + } + return; + } + if (_this.log.isEnabled()) { + _this.log.writeLine("Installed typings " + JSON.stringify(scopedTypings)); + } + var installedTypingFiles = []; + for (var _a = 0, filteredTypings_2 = filteredTypings; _a < filteredTypings_2.length; _a++) { + var packageName = filteredTypings_2[_a]; + var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost, _this.log); + if (!typingFile) { + _this.missingTypingsSet[packageName] = true; + continue; + } + if (!_this.packageNameToTypingLocation[packageName]) { + _this.packageNameToTypingLocation[packageName] = typingFile; + } + installedTypingFiles.push(typingFile); + } + if (_this.log.isEnabled()) { + _this.log.writeLine("Installed typing files " + JSON.stringify(installedTypingFiles)); + } + _this.sendResponse(_this.createSetTypings(req, currentlyCachedTypings.concat(installedTypingFiles))); + } + finally { _this.sendResponse({ - kind: server.EventInstall, + kind: server.EventEndInstallTypes, + eventId: requestId, + projectName: req.projectName, packagesToInstall: scopedTypings, - installSuccess: ok + installSuccess: ok, + typingsInstallerVersion: ts.version }); } - if (!ok) { - if (_this.log.isEnabled()) { - _this.log.writeLine("install request failed, marking packages as missing to prevent repeated requests: " + JSON.stringify(filteredTypings)); - } - for (var _i = 0, filteredTypings_1 = filteredTypings; _i < filteredTypings_1.length; _i++) { - var typing = filteredTypings_1[_i]; - _this.missingTypingsSet[typing] = true; - } - return; - } - if (_this.log.isEnabled()) { - _this.log.writeLine("Requested to install typings " + JSON.stringify(scopedTypings) + ", installed typings " + JSON.stringify(scopedTypings)); - } - var installedTypingFiles = []; - for (var _a = 0, scopedTypings_1 = scopedTypings; _a < scopedTypings_1.length; _a++) { - var t = scopedTypings_1[_a]; - var packageName = ts.getBaseFileName(t); - if (!packageName) { - continue; - } - var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost); - if (!typingFile) { - continue; - } - if (!_this.packageNameToTypingLocation[packageName]) { - _this.packageNameToTypingLocation[packageName] = typingFile; - } - installedTypingFiles.push(typingFile); - } - if (_this.log.isEnabled()) { - _this.log.writeLine("Installed typing files " + JSON.stringify(installedTypingFiles)); - } - _this.sendResponse(_this.createSetTypings(req, currentlyCachedTypings.concat(installedTypingFiles))); }); }; TypingsInstaller.prototype.ensureDirectoryExists = function (directory, host) { @@ -6930,7 +7012,7 @@ var ts; TypingsInstaller.prototype.createSetTypings = function (request, typings) { return { projectName: request.projectName, - typingOptions: request.typingOptions, + typeAcquisition: request.typeAcquisition, compilerOptions: request.compilerOptions, typings: typings, unresolvedImports: request.unresolvedImports, @@ -7015,20 +7097,19 @@ var ts; } var NodeTypingsInstaller = (function (_super) { __extends(NodeTypingsInstaller, _super); - function NodeTypingsInstaller(globalTypingsCacheLocation, throttleLimit, telemetryEnabled, log) { - var _this = _super.call(this, ts.sys, globalTypingsCacheLocation, ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, telemetryEnabled, log) || this; + function NodeTypingsInstaller(globalTypingsCacheLocation, throttleLimit, log) { + var _this = _super.call(this, ts.sys, globalTypingsCacheLocation, ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, log) || this; if (_this.log.isEnabled()) { _this.log.writeLine("Process id: " + process.pid); } _this.npmPath = getNPMLocation(process.argv[0]); - var execSync; - (_a = require("child_process"), _this.exec = _a.exec, execSync = _a.execSync, _a); + (_this.execSync = require("child_process").execSync); _this.ensurePackageDirectoryExists(globalTypingsCacheLocation); try { if (_this.log.isEnabled()) { _this.log.writeLine("Updating " + TypesRegistryPackageName + " npm package..."); } - execSync(_this.npmPath + " install " + TypesRegistryPackageName, { cwd: globalTypingsCacheLocation, stdio: "ignore" }); + _this.execSync(_this.npmPath + " install " + TypesRegistryPackageName, { cwd: globalTypingsCacheLocation, stdio: "ignore" }); } catch (e) { if (_this.log.isEnabled()) { @@ -7037,7 +7118,6 @@ var ts; } _this.typesRegistry = loadTypesRegistryFile(getTypesRegistryFileLocation(globalTypingsCacheLocation), _this.installTypingHost, _this.log); return _this; - var _a; } NodeTypingsInstaller.prototype.listen = function () { var _this = this; @@ -7061,25 +7141,32 @@ var ts; } }; NodeTypingsInstaller.prototype.installWorker = function (requestId, args, cwd, onRequestCompleted) { - var _this = this; if (this.log.isEnabled()) { this.log.writeLine("#" + requestId + " with arguments'" + JSON.stringify(args) + "'."); } - var command = this.npmPath + " install " + args.join(" ") + " --save-dev"; + var command = this.npmPath + " install " + args.join(" ") + " --save-dev --user-agent=\"typesInstaller/" + ts.version + "\""; var start = Date.now(); - this.exec(command, { cwd: cwd }, function (err, stdout, stderr) { - if (_this.log.isEnabled()) { - _this.log.writeLine("npm install #" + requestId + " took: " + (Date.now() - start) + " ms" + ts.sys.newLine + "stdout: " + stdout + ts.sys.newLine + "stderr: " + stderr); - } - onRequestCompleted(!err); - }); + var stdout; + var stderr; + var hasError = false; + try { + stdout = this.execSync(command, { cwd: cwd }); + } + catch (e) { + stdout = e.stdout; + stderr = e.stderr; + hasError = true; + } + if (this.log.isEnabled()) { + this.log.writeLine("npm install #" + requestId + " took: " + (Date.now() - start) + " ms" + ts.sys.newLine + "stdout: " + (stdout && stdout.toString()) + ts.sys.newLine + "stderr: " + (stderr && stderr.toString())); + } + onRequestCompleted(!hasError); }; return NodeTypingsInstaller; }(typingsInstaller.TypingsInstaller)); typingsInstaller.NodeTypingsInstaller = NodeTypingsInstaller; var logFilePath = server.findArgument(server.Arguments.LogFile); var globalTypingsCacheLocation = server.findArgument(server.Arguments.GlobalCacheLocation); - var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry); var log = new FileLog(logFilePath); if (log.isEnabled()) { process.on("uncaughtException", function (e) { @@ -7092,7 +7179,7 @@ var ts; } process.exit(0); }); - var installer = new NodeTypingsInstaller(globalTypingsCacheLocation, 5, telemetryEnabled, log); + var installer = new NodeTypingsInstaller(globalTypingsCacheLocation, 5, log); installer.listen(); })(typingsInstaller = server.typingsInstaller || (server.typingsInstaller = {})); })(server = ts.server || (ts.server = {})); From f034022e25909061ed5261d10f9095476670a3e4 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 15 Dec 2016 16:31:50 -0800 Subject: [PATCH 068/125] lift multiple statements into block if necessary (#12965) --- src/compiler/transformers/es2015.ts | 7 ++- tests/baselines/reference/nestedLoops.js | 47 +++++++++++++++ tests/baselines/reference/nestedLoops.symbols | 46 +++++++++++++++ tests/baselines/reference/nestedLoops.types | 58 +++++++++++++++++++ tests/cases/compiler/nestedLoops.ts | 18 ++++++ 5 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/nestedLoops.js create mode 100644 tests/baselines/reference/nestedLoops.symbols create mode 100644 tests/baselines/reference/nestedLoops.types create mode 100644 tests/cases/compiler/nestedLoops.ts diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 3c7f3539e76..5dae1da7b74 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -2290,7 +2290,7 @@ namespace ts { } startLexicalEnvironment(); - let loopBody = visitNode(node.statement, visitor, isStatement); + let loopBody = visitNode(node.statement, visitor, isStatement, /*optional*/ false, liftToBlock); const lexicalEnvironment = endLexicalEnvironment(); const currentState = convertedLoopState; @@ -2305,7 +2305,10 @@ namespace ts { loopBody = createBlock(statements, /*location*/ undefined, /*multiline*/ true); } - if (!isBlock(loopBody)) { + if (isBlock(loopBody)) { + loopBody.multiLine = true; + } + else { loopBody = createBlock([loopBody], /*location*/ undefined, /*multiline*/ true); } diff --git a/tests/baselines/reference/nestedLoops.js b/tests/baselines/reference/nestedLoops.js new file mode 100644 index 00000000000..c29311c38de --- /dev/null +++ b/tests/baselines/reference/nestedLoops.js @@ -0,0 +1,47 @@ +//// [nestedLoops.ts] +export class Test { + constructor() { + + let outerArray: Array = [1, 2, 3]; + let innerArray: Array = [1, 2, 3]; + + for (let outer of outerArray) + for (let inner of innerArray) { + this.aFunction((newValue, oldValue) => { + let x = outer + inner + newValue; + }); + } + } + + public aFunction(func: (newValue: any, oldValue: any) => void): void { + } +} + +//// [nestedLoops.js] +"use strict"; +var Test = (function () { + function Test() { + var outerArray = [1, 2, 3]; + var innerArray = [1, 2, 3]; + var _loop_1 = function (outer) { + var _loop_2 = function (inner) { + this_1.aFunction(function (newValue, oldValue) { + var x = outer + inner + newValue; + }); + }; + for (var _i = 0, innerArray_1 = innerArray; _i < innerArray_1.length; _i++) { + var inner = innerArray_1[_i]; + _loop_2(inner); + } + }; + var this_1 = this; + for (var _i = 0, outerArray_1 = outerArray; _i < outerArray_1.length; _i++) { + var outer = outerArray_1[_i]; + _loop_1(outer); + } + } + Test.prototype.aFunction = function (func) { + }; + return Test; +}()); +exports.Test = Test; diff --git a/tests/baselines/reference/nestedLoops.symbols b/tests/baselines/reference/nestedLoops.symbols new file mode 100644 index 00000000000..0ab1c4651a6 --- /dev/null +++ b/tests/baselines/reference/nestedLoops.symbols @@ -0,0 +1,46 @@ +=== tests/cases/compiler/nestedLoops.ts === +export class Test { +>Test : Symbol(Test, Decl(nestedLoops.ts, 0, 0)) + + constructor() { + + let outerArray: Array = [1, 2, 3]; +>outerArray : Symbol(outerArray, Decl(nestedLoops.ts, 3, 11)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + let innerArray: Array = [1, 2, 3]; +>innerArray : Symbol(innerArray, Decl(nestedLoops.ts, 4, 11)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + for (let outer of outerArray) +>outer : Symbol(outer, Decl(nestedLoops.ts, 6, 16)) +>outerArray : Symbol(outerArray, Decl(nestedLoops.ts, 3, 11)) + + for (let inner of innerArray) { +>inner : Symbol(inner, Decl(nestedLoops.ts, 7, 20)) +>innerArray : Symbol(innerArray, Decl(nestedLoops.ts, 4, 11)) + + this.aFunction((newValue, oldValue) => { +>this.aFunction : Symbol(Test.aFunction, Decl(nestedLoops.ts, 12, 5)) +>this : Symbol(Test, Decl(nestedLoops.ts, 0, 0)) +>aFunction : Symbol(Test.aFunction, Decl(nestedLoops.ts, 12, 5)) +>newValue : Symbol(newValue, Decl(nestedLoops.ts, 8, 32)) +>oldValue : Symbol(oldValue, Decl(nestedLoops.ts, 8, 41)) + + let x = outer + inner + newValue; +>x : Symbol(x, Decl(nestedLoops.ts, 9, 23)) +>outer : Symbol(outer, Decl(nestedLoops.ts, 6, 16)) +>inner : Symbol(inner, Decl(nestedLoops.ts, 7, 20)) +>newValue : Symbol(newValue, Decl(nestedLoops.ts, 8, 32)) + + }); + } + } + + public aFunction(func: (newValue: any, oldValue: any) => void): void { +>aFunction : Symbol(Test.aFunction, Decl(nestedLoops.ts, 12, 5)) +>func : Symbol(func, Decl(nestedLoops.ts, 14, 21)) +>newValue : Symbol(newValue, Decl(nestedLoops.ts, 14, 28)) +>oldValue : Symbol(oldValue, Decl(nestedLoops.ts, 14, 42)) + } +} diff --git a/tests/baselines/reference/nestedLoops.types b/tests/baselines/reference/nestedLoops.types new file mode 100644 index 00000000000..f4a743f4aaf --- /dev/null +++ b/tests/baselines/reference/nestedLoops.types @@ -0,0 +1,58 @@ +=== tests/cases/compiler/nestedLoops.ts === +export class Test { +>Test : Test + + constructor() { + + let outerArray: Array = [1, 2, 3]; +>outerArray : number[] +>Array : T[] +>[1, 2, 3] : number[] +>1 : 1 +>2 : 2 +>3 : 3 + + let innerArray: Array = [1, 2, 3]; +>innerArray : number[] +>Array : T[] +>[1, 2, 3] : number[] +>1 : 1 +>2 : 2 +>3 : 3 + + for (let outer of outerArray) +>outer : number +>outerArray : number[] + + for (let inner of innerArray) { +>inner : number +>innerArray : number[] + + this.aFunction((newValue, oldValue) => { +>this.aFunction((newValue, oldValue) => { let x = outer + inner + newValue; }) : void +>this.aFunction : (func: (newValue: any, oldValue: any) => void) => void +>this : this +>aFunction : (func: (newValue: any, oldValue: any) => void) => void +>(newValue, oldValue) => { let x = outer + inner + newValue; } : (newValue: any, oldValue: any) => void +>newValue : any +>oldValue : any + + let x = outer + inner + newValue; +>x : any +>outer + inner + newValue : any +>outer + inner : number +>outer : number +>inner : number +>newValue : any + + }); + } + } + + public aFunction(func: (newValue: any, oldValue: any) => void): void { +>aFunction : (func: (newValue: any, oldValue: any) => void) => void +>func : (newValue: any, oldValue: any) => void +>newValue : any +>oldValue : any + } +} diff --git a/tests/cases/compiler/nestedLoops.ts b/tests/cases/compiler/nestedLoops.ts new file mode 100644 index 00000000000..c480b4b1c68 --- /dev/null +++ b/tests/cases/compiler/nestedLoops.ts @@ -0,0 +1,18 @@ +// @target: es5 +export class Test { + constructor() { + + let outerArray: Array = [1, 2, 3]; + let innerArray: Array = [1, 2, 3]; + + for (let outer of outerArray) + for (let inner of innerArray) { + this.aFunction((newValue, oldValue) => { + let x = outer + inner + newValue; + }); + } + } + + public aFunction(func: (newValue: any, oldValue: any) => void): void { + } +} \ No newline at end of file From 40d08df90b4b38db1ab4878054323a03e0d1a989 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 15 Dec 2016 16:33:49 -0800 Subject: [PATCH 069/125] Do not transform JSX tag names for ES3 --- src/compiler/transformers/es5.ts | 36 +++++++++++++++ tests/baselines/reference/jsxViaImport.2.js | 44 ++++++++++++++++++ .../reference/jsxViaImport.2.symbols | 44 ++++++++++++++++++ .../baselines/reference/jsxViaImport.2.types | 45 +++++++++++++++++++ tests/cases/compiler/jsxViaImport.2.tsx | 23 ++++++++++ 5 files changed, 192 insertions(+) create mode 100644 tests/baselines/reference/jsxViaImport.2.js create mode 100644 tests/baselines/reference/jsxViaImport.2.symbols create mode 100644 tests/baselines/reference/jsxViaImport.2.types create mode 100644 tests/cases/compiler/jsxViaImport.2.tsx diff --git a/src/compiler/transformers/es5.ts b/src/compiler/transformers/es5.ts index 9e5a72c2bad..f051aac98f4 100644 --- a/src/compiler/transformers/es5.ts +++ b/src/compiler/transformers/es5.ts @@ -9,6 +9,20 @@ namespace ts { * @param context Context and state information for the transformation. */ export function transformES5(context: TransformationContext) { + const compilerOptions = context.getCompilerOptions(); + + // enable emit notification only if using --jsx preserve + let previousOnEmitNode: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void; + let noSubstitution: boolean[]; + if (compilerOptions.jsx === JsxEmit.Preserve) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(SyntaxKind.JsxOpeningElement); + context.enableEmitNotification(SyntaxKind.JsxClosingElement); + context.enableEmitNotification(SyntaxKind.JsxSelfClosingElement); + noSubstitution = []; + } + const previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(SyntaxKind.PropertyAccessExpression); @@ -24,6 +38,24 @@ namespace ts { return node; } + /** + * Called by the printer just before a node is printed. + * + * @param node The node to be printed. + */ + function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { + switch (node.kind) { + case SyntaxKind.JsxOpeningElement: + case SyntaxKind.JsxClosingElement: + case SyntaxKind.JsxSelfClosingElement: + const tagName = (node).tagName; + noSubstitution[getOriginalNodeId(tagName)] = true; + break; + } + + previousOnEmitNode(emitContext, node, emitCallback); + } + /** * Hooks node substitutions. * @@ -31,6 +63,10 @@ namespace ts { * @param node The node to substitute. */ function onSubstituteNode(emitContext: EmitContext, node: Node) { + if (node.id && noSubstitution[node.id]) { + return previousOnSubstituteNode(emitContext, node); + } + node = previousOnSubstituteNode(emitContext, node); if (isPropertyAccessExpression(node)) { return substitutePropertyAccessExpression(node); diff --git a/tests/baselines/reference/jsxViaImport.2.js b/tests/baselines/reference/jsxViaImport.2.js new file mode 100644 index 00000000000..19432238e0b --- /dev/null +++ b/tests/baselines/reference/jsxViaImport.2.js @@ -0,0 +1,44 @@ +//// [tests/cases/compiler/jsxViaImport.2.tsx] //// + +//// [component.d.ts] + +declare module JSX { + interface ElementAttributesProperty { props; } +} +declare module React { + class Component { } +} +declare module "BaseComponent" { + export default class extends React.Component { + } +} + +//// [consumer.tsx] +/// +import BaseComponent from 'BaseComponent'; +class TestComponent extends React.Component { + render() { + return ; + } +} + + +//// [consumer.jsx] +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +/// +var BaseComponent_1 = require("BaseComponent"); +var TestComponent = (function (_super) { + __extends(TestComponent, _super); + function TestComponent() { + return _super.apply(this, arguments) || this; + } + TestComponent.prototype.render = function () { + return ; + }; + return TestComponent; +}(React.Component)); diff --git a/tests/baselines/reference/jsxViaImport.2.symbols b/tests/baselines/reference/jsxViaImport.2.symbols new file mode 100644 index 00000000000..5fb24088d2e --- /dev/null +++ b/tests/baselines/reference/jsxViaImport.2.symbols @@ -0,0 +1,44 @@ +=== tests/cases/compiler/consumer.tsx === +/// +import BaseComponent from 'BaseComponent'; +>BaseComponent : Symbol(BaseComponent, Decl(consumer.tsx, 1, 6)) + +class TestComponent extends React.Component { +>TestComponent : Symbol(TestComponent, Decl(consumer.tsx, 1, 42)) +>React.Component : Symbol(React.Component, Decl(component.d.ts, 4, 22)) +>React : Symbol(React, Decl(component.d.ts, 3, 1)) +>Component : Symbol(React.Component, Decl(component.d.ts, 4, 22)) + + render() { +>render : Symbol(TestComponent.render, Decl(consumer.tsx, 2, 54)) + + return ; +>BaseComponent : Symbol(BaseComponent, Decl(consumer.tsx, 1, 6)) + } +} + +=== tests/cases/compiler/component.d.ts === + +declare module JSX { +>JSX : Symbol(JSX, Decl(component.d.ts, 0, 0)) + + interface ElementAttributesProperty { props; } +>ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(component.d.ts, 1, 20)) +>props : Symbol(ElementAttributesProperty.props, Decl(component.d.ts, 2, 39)) +} +declare module React { +>React : Symbol(React, Decl(component.d.ts, 3, 1)) + + class Component { } +>Component : Symbol(Component, Decl(component.d.ts, 4, 22)) +>T : Symbol(T, Decl(component.d.ts, 5, 18)) +>U : Symbol(U, Decl(component.d.ts, 5, 20)) +} +declare module "BaseComponent" { + export default class extends React.Component { +>React.Component : Symbol(React.Component, Decl(component.d.ts, 4, 22)) +>React : Symbol(React, Decl(component.d.ts, 3, 1)) +>Component : Symbol(React.Component, Decl(component.d.ts, 4, 22)) + } +} + diff --git a/tests/baselines/reference/jsxViaImport.2.types b/tests/baselines/reference/jsxViaImport.2.types new file mode 100644 index 00000000000..c1e418c6b32 --- /dev/null +++ b/tests/baselines/reference/jsxViaImport.2.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/consumer.tsx === +/// +import BaseComponent from 'BaseComponent'; +>BaseComponent : typeof BaseComponent + +class TestComponent extends React.Component { +>TestComponent : TestComponent +>React.Component : React.Component +>React : typeof React +>Component : typeof React.Component + + render() { +>render : () => any + + return ; +> : any +>BaseComponent : typeof BaseComponent + } +} + +=== tests/cases/compiler/component.d.ts === + +declare module JSX { +>JSX : any + + interface ElementAttributesProperty { props; } +>ElementAttributesProperty : ElementAttributesProperty +>props : any +} +declare module React { +>React : typeof React + + class Component { } +>Component : Component +>T : T +>U : U +} +declare module "BaseComponent" { + export default class extends React.Component { +>React.Component : React.Component +>React : typeof React +>Component : typeof React.Component + } +} + diff --git a/tests/cases/compiler/jsxViaImport.2.tsx b/tests/cases/compiler/jsxViaImport.2.tsx new file mode 100644 index 00000000000..1849fef6253 --- /dev/null +++ b/tests/cases/compiler/jsxViaImport.2.tsx @@ -0,0 +1,23 @@ +//@jsx: preserve +//@module: commonjs + +//@filename: component.d.ts +declare module JSX { + interface ElementAttributesProperty { props; } +} +declare module React { + class Component { } +} +declare module "BaseComponent" { + export default class extends React.Component { + } +} + +//@filename: consumer.tsx +/// +import BaseComponent from 'BaseComponent'; +class TestComponent extends React.Component { + render() { + return ; + } +} From 14e05cd9375d5a89b6d47f3cd76a6ed42e5ec080 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 15 Dec 2016 16:38:10 -0800 Subject: [PATCH 070/125] Fix condition in onSubstituteNode --- src/compiler/transformers/es5.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/transformers/es5.ts b/src/compiler/transformers/es5.ts index f051aac98f4..6dd875965d9 100644 --- a/src/compiler/transformers/es5.ts +++ b/src/compiler/transformers/es5.ts @@ -63,7 +63,7 @@ namespace ts { * @param node The node to substitute. */ function onSubstituteNode(emitContext: EmitContext, node: Node) { - if (node.id && noSubstitution[node.id]) { + if (node.id && noSubstitution && noSubstitution[node.id]) { return previousOnSubstituteNode(emitContext, node); } From 8ae9c7de21d3ec9a5e41c0e154947ca437fd98b8 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 16 Dec 2016 09:49:29 -0800 Subject: [PATCH 071/125] JSDoc functions are now in scope for instantiation Previously, `isSymbolInScopeOfMappedTypeParameter` did not understand JSDoc, so it would cause generic function declarations in JSDoc not be instantiated. --- src/compiler/checker.ts | 12 ++++++++++-- tests/cases/fourslash/jsDocGenerics2.ts | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/cases/fourslash/jsDocGenerics2.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 26164a528f3..5bcb5f90d55 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6634,7 +6634,7 @@ namespace ts { // Starting with the parent of the symbol's declaration, check if the mapper maps any of // the type parameters introduced by enclosing declarations. We just pick the first // declaration since multiple declarations will all have the same parent anyway. - let node = symbol.declarations[0].parent; + let node: Node = symbol.declarations[0]; while (node) { switch (node.kind) { case SyntaxKind.FunctionType: @@ -6654,7 +6654,7 @@ namespace ts { case SyntaxKind.ClassExpression: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.TypeAliasDeclaration: - const declaration = node; + const declaration = node as DeclarationWithTypeParameters; if (declaration.typeParameters) { for (const d of declaration.typeParameters) { if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) { @@ -6669,6 +6669,14 @@ namespace ts { } } break; + case SyntaxKind.JSDocFunctionType: + const func = node as JSDocFunctionType; + for (const p of func.parameters) { + if (contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; case SyntaxKind.ModuleDeclaration: case SyntaxKind.SourceFile: return false; diff --git a/tests/cases/fourslash/jsDocGenerics2.ts b/tests/cases/fourslash/jsDocGenerics2.ts new file mode 100644 index 00000000000..23deb1a6502 --- /dev/null +++ b/tests/cases/fourslash/jsDocGenerics2.ts @@ -0,0 +1,19 @@ +/// +// @allowNonTsExtensions: true +// @Filename: Foo.js + +/////** +//// * @param {T[]} arr +//// * @param {(function(T):T)} valuator +//// * @template T +//// */ +////function SortFilter(arr,valuator) +////{ +//// return arr; +////} +////var a/*1*/ = SortFilter([0, 1, 2], q/*2*/ => q); +////var b/*3*/ = SortFilter([0, 1, 2], undefined); + +verify.quickInfoAt('1', "var a: number[]"); +verify.quickInfoAt('2', '(parameter) q: number'); +verify.quickInfoAt('3', "var b: number[]"); From 82a2ee644078c5f96437086f195b8d8d454e5663 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 16 Dec 2016 15:01:20 -0800 Subject: [PATCH 072/125] Mapped types assignable to objects with 'any' string index signature --- src/compiler/checker.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5246bbfc700..9155f24ad34 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7730,8 +7730,11 @@ namespace ts { } } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return Ternary.True; + else if (relation !== identityRelation) { + const resolved = resolveStructuredTypeMembers(target); + if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & TypeFlags.Any) { + return Ternary.True; + } } return Ternary.False; } From f834caf27a7900c1e5918d83b2d51c10a7edb913 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 16 Dec 2016 15:01:34 -0800 Subject: [PATCH 073/125] Add tests --- .../types/mapped/mappedTypesAndObjects.ts | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts diff --git a/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts b/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts new file mode 100644 index 00000000000..8023f6e7d8d --- /dev/null +++ b/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts @@ -0,0 +1,35 @@ +// @strictNullChecks: true +// @declaration: true + +function f1(x: Partial, y: Readonly) { + let obj: {}; + obj = x; + obj = y; +} + +function f2(x: Partial, y: Readonly) { + let obj: { [x: string]: any }; + obj = x; + obj = y; +} + +// Repro from #12900 + +interface Base { + foo: { [key: string]: any }; + bar: any; + baz: any; +} + +interface E1 extends Base { + foo: T; +} + +interface Something { name: string, value: string }; +interface E2 extends Base { + foo: Partial; // or other mapped type +} + +interface E3 extends Base { + foo: Partial; // or other mapped type +} \ No newline at end of file From 4a8f340b5ed5f3abc5ee0841b79f233764f631b9 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 16 Dec 2016 15:02:04 -0800 Subject: [PATCH 074/125] Accept new baselines --- .../reference/mappedTypesAndObjects.js | 72 +++++++++++++ .../reference/mappedTypesAndObjects.symbols | 98 +++++++++++++++++ .../reference/mappedTypesAndObjects.types | 102 ++++++++++++++++++ 3 files changed, 272 insertions(+) create mode 100644 tests/baselines/reference/mappedTypesAndObjects.js create mode 100644 tests/baselines/reference/mappedTypesAndObjects.symbols create mode 100644 tests/baselines/reference/mappedTypesAndObjects.types diff --git a/tests/baselines/reference/mappedTypesAndObjects.js b/tests/baselines/reference/mappedTypesAndObjects.js new file mode 100644 index 00000000000..53b39209693 --- /dev/null +++ b/tests/baselines/reference/mappedTypesAndObjects.js @@ -0,0 +1,72 @@ +//// [mappedTypesAndObjects.ts] + +function f1(x: Partial, y: Readonly) { + let obj: {}; + obj = x; + obj = y; +} + +function f2(x: Partial, y: Readonly) { + let obj: { [x: string]: any }; + obj = x; + obj = y; +} + +// Repro from #12900 + +interface Base { + foo: { [key: string]: any }; + bar: any; + baz: any; +} + +interface E1 extends Base { + foo: T; +} + +interface Something { name: string, value: string }; +interface E2 extends Base { + foo: Partial; // or other mapped type +} + +interface E3 extends Base { + foo: Partial; // or other mapped type +} + +//// [mappedTypesAndObjects.js] +function f1(x, y) { + var obj; + obj = x; + obj = y; +} +function f2(x, y) { + var obj; + obj = x; + obj = y; +} +; + + +//// [mappedTypesAndObjects.d.ts] +declare function f1(x: Partial, y: Readonly): void; +declare function f2(x: Partial, y: Readonly): void; +interface Base { + foo: { + [key: string]: any; + }; + bar: any; + baz: any; +} +interface E1 extends Base { + foo: T; +} +interface Something { + name: string; + value: string; +} +interface E2 extends Base { + foo: Partial; +} +interface E3 extends Base { + foo: Partial; +} diff --git a/tests/baselines/reference/mappedTypesAndObjects.symbols b/tests/baselines/reference/mappedTypesAndObjects.symbols new file mode 100644 index 00000000000..1690f1b6b04 --- /dev/null +++ b/tests/baselines/reference/mappedTypesAndObjects.symbols @@ -0,0 +1,98 @@ +=== tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts === + +function f1(x: Partial, y: Readonly) { +>f1 : Symbol(f1, Decl(mappedTypesAndObjects.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 1, 12)) +>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 1, 15)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 1, 12)) +>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 1, 29)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 1, 12)) + + let obj: {}; +>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 2, 7)) + + obj = x; +>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 2, 7)) +>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 1, 15)) + + obj = y; +>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 2, 7)) +>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 1, 29)) +} + +function f2(x: Partial, y: Readonly) { +>f2 : Symbol(f2, Decl(mappedTypesAndObjects.ts, 5, 1)) +>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 7, 12)) +>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 7, 15)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 7, 12)) +>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 7, 29)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 7, 12)) + + let obj: { [x: string]: any }; +>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 8, 7)) +>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 8, 16)) + + obj = x; +>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 8, 7)) +>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 7, 15)) + + obj = y; +>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 8, 7)) +>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 7, 29)) +} + +// Repro from #12900 + +interface Base { +>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1)) + + foo: { [key: string]: any }; +>foo : Symbol(Base.foo, Decl(mappedTypesAndObjects.ts, 15, 16)) +>key : Symbol(key, Decl(mappedTypesAndObjects.ts, 16, 11)) + + bar: any; +>bar : Symbol(Base.bar, Decl(mappedTypesAndObjects.ts, 16, 31)) + + baz: any; +>baz : Symbol(Base.baz, Decl(mappedTypesAndObjects.ts, 17, 12)) +} + +interface E1 extends Base { +>E1 : Symbol(E1, Decl(mappedTypesAndObjects.ts, 19, 1)) +>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 21, 13)) +>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1)) + + foo: T; +>foo : Symbol(E1.foo, Decl(mappedTypesAndObjects.ts, 21, 30)) +>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 21, 13)) +} + +interface Something { name: string, value: string }; +>Something : Symbol(Something, Decl(mappedTypesAndObjects.ts, 23, 1)) +>name : Symbol(Something.name, Decl(mappedTypesAndObjects.ts, 25, 21)) +>value : Symbol(Something.value, Decl(mappedTypesAndObjects.ts, 25, 35)) + +interface E2 extends Base { +>E2 : Symbol(E2, Decl(mappedTypesAndObjects.ts, 25, 52)) +>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1)) + + foo: Partial; // or other mapped type +>foo : Symbol(E2.foo, Decl(mappedTypesAndObjects.ts, 26, 27)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>Something : Symbol(Something, Decl(mappedTypesAndObjects.ts, 23, 1)) +} + +interface E3 extends Base { +>E3 : Symbol(E3, Decl(mappedTypesAndObjects.ts, 28, 1)) +>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 30, 13)) +>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1)) + + foo: Partial; // or other mapped type +>foo : Symbol(E3.foo, Decl(mappedTypesAndObjects.ts, 30, 30)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 30, 13)) +} diff --git a/tests/baselines/reference/mappedTypesAndObjects.types b/tests/baselines/reference/mappedTypesAndObjects.types new file mode 100644 index 00000000000..e6f8e53f558 --- /dev/null +++ b/tests/baselines/reference/mappedTypesAndObjects.types @@ -0,0 +1,102 @@ +=== tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts === + +function f1(x: Partial, y: Readonly) { +>f1 : (x: Partial, y: Readonly) => void +>T : T +>x : Partial +>Partial : Partial +>T : T +>y : Readonly +>Readonly : Readonly +>T : T + + let obj: {}; +>obj : {} + + obj = x; +>obj = x : Partial +>obj : {} +>x : Partial + + obj = y; +>obj = y : Readonly +>obj : {} +>y : Readonly +} + +function f2(x: Partial, y: Readonly) { +>f2 : (x: Partial, y: Readonly) => void +>T : T +>x : Partial +>Partial : Partial +>T : T +>y : Readonly +>Readonly : Readonly +>T : T + + let obj: { [x: string]: any }; +>obj : { [x: string]: any; } +>x : string + + obj = x; +>obj = x : Partial +>obj : { [x: string]: any; } +>x : Partial + + obj = y; +>obj = y : Readonly +>obj : { [x: string]: any; } +>y : Readonly +} + +// Repro from #12900 + +interface Base { +>Base : Base + + foo: { [key: string]: any }; +>foo : { [key: string]: any; } +>key : string + + bar: any; +>bar : any + + baz: any; +>baz : any +} + +interface E1 extends Base { +>E1 : E1 +>T : T +>Base : Base + + foo: T; +>foo : T +>T : T +} + +interface Something { name: string, value: string }; +>Something : Something +>name : string +>value : string + +interface E2 extends Base { +>E2 : E2 +>Base : Base + + foo: Partial; // or other mapped type +>foo : Partial +>Partial : Partial +>Something : Something +} + +interface E3 extends Base { +>E3 : E3 +>T : T +>Base : Base + + foo: Partial; // or other mapped type +>foo : Partial +>Partial : Partial +>T : T +} From 27a60e4580076b544fa7f822df84414b7ea2c357 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 18 Dec 2016 15:44:54 +0900 Subject: [PATCH 075/125] fix linting errors --- src/compiler/binder.ts | 4 ++-- src/compiler/checker.ts | 21 ++++++++++++------- src/compiler/commandLineParser.ts | 4 ++-- src/compiler/core.ts | 18 ++++++++++------ src/compiler/parser.ts | 7 ++++--- src/compiler/program.ts | 12 ++++++----- src/compiler/scanner.ts | 9 ++++---- src/compiler/sys.ts | 2 +- src/compiler/utilities.ts | 12 +++++------ src/harness/harness.ts | 14 +++++++------ src/harness/unittests/incrementalParser.ts | 3 ++- .../unittests/services/colorization.ts | 11 ++++------ .../unittests/services/patternMatcher.ts | 3 ++- src/harness/unittests/versionCache.ts | 3 ++- src/server/scriptVersionCache.ts | 15 +++++++------ src/server/server.ts | 3 ++- src/services/breakpoints.ts | 12 +++++------ src/services/classifier.ts | 11 +++++----- src/services/formatting/formatting.ts | 3 ++- src/services/jsDoc.ts | 6 ++++-- src/services/navigationBar.ts | 2 +- src/services/patternMatcher.ts | 9 +++++--- src/services/services.ts | 3 ++- src/services/shims.ts | 3 ++- src/services/utilities.ts | 6 +++--- tests/webTestServer.ts | 2 +- 26 files changed, 112 insertions(+), 86 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index a6f5993f6c8..a00c2f0efc7 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -283,8 +283,8 @@ namespace ts { // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType); - let functionType = node.parent; - let index = indexOf(functionType.parameters, node); + const functionType = node.parent; + const index = indexOf(functionType.parameters, node); return "arg" + index; case SyntaxKind.JSDocTypedefTag: const parentNode = node.parent && node.parent.parent; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5246bbfc700..c1e2f4fbc91 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5019,7 +5019,8 @@ namespace ts { // If this is a JSDoc construct signature, then skip the first parameter in the // parameter list. The first parameter represents the return type of the construct // signature. - for (let i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + const n = declaration.parameters.length; + for (let i = isJSConstructSignature ? 1 : 0; i < n; i++) { const param = declaration.parameters[i]; let paramSymbol = param.symbol; @@ -5118,7 +5119,8 @@ namespace ts { function getSignaturesOfSymbol(symbol: Symbol): Signature[] { if (!symbol) return emptyArray; const result: Signature[] = []; - for (let i = 0, len = symbol.declarations.length; i < len; i++) { + const len = symbol.declarations.length; + for (let i = 0; i < len; i++) { const node = symbol.declarations[i]; switch (node.kind) { case SyntaxKind.FunctionType: @@ -5768,8 +5770,8 @@ namespace ts { } function isSubtypeOfAny(candidate: Type, types: Type[]): boolean { - for (let i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (const type of types) { + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -7911,7 +7913,8 @@ namespace ts { return Ternary.False; } let result = Ternary.True; - for (let i = 0, len = sourceSignatures.length; i < len; i++) { + const len = sourceSignatures.length; + for (let i = 0; i < len; i++) { const related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return Ternary.False; @@ -18044,7 +18047,8 @@ namespace ts { /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) { if (typeParameterDeclarations) { - for (let i = 0, n = typeParameterDeclarations.length; i < n; i++) { + const n = typeParameterDeclarations.length; + for (let i = 0; i < n; i++) { const node = typeParameterDeclarations[i]; checkTypeParameter(node); @@ -18324,7 +18328,8 @@ namespace ts { // TypeScript 1.0 spec (April 2014): // When a generic interface has multiple declarations, all declarations must have identical type parameter // lists, i.e. identical type parameter names with identical constraints in identical order. - for (let i = 0, len = list1.length; i < len; i++) { + const len = list1.length; + for (let i = 0; i < len; i++) { const tp1 = list1[i]; const tp2 = list2[i]; if (tp1.name.text !== tp2.name.text) { @@ -20761,7 +20766,7 @@ namespace ts { case SyntaxKind.PublicKeyword: case SyntaxKind.ProtectedKeyword: case SyntaxKind.PrivateKeyword: - let text = visibilityToString(modifierToFlag(modifier.kind)); + const text = visibilityToString(modifierToFlag(modifier.kind)); if (modifier.kind === SyntaxKind.ProtectedKeyword) { lastProtected = modifier; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index a4257a610e1..25b5f5416dd 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -620,7 +620,7 @@ namespace ts { break; case "boolean": // boolean flag has optional value true, false, others - let optValue = args[i]; + const optValue = args[i]; options[opt.name] = optValue !== "false"; // consume next argument as boolean flag value if (optValue === "false" || optValue === "true") { @@ -778,7 +778,7 @@ namespace ts { break; default: const value = options[name]; - let optionDefinition = optionsNameMap[name.toLowerCase()]; + const optionDefinition = optionsNameMap[name.toLowerCase()]; if (optionDefinition) { const customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ceff1359579..a94b36c602d 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -119,7 +119,8 @@ namespace ts { */ export function forEach(array: T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined { if (array) { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { const result = callback(array[i], i); if (result) { return result; @@ -143,7 +144,8 @@ namespace ts { */ export function every(array: T[], callback: (element: T, index: number) => boolean): boolean { if (array) { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { if (!callback(array[i], i)) { return false; } @@ -155,7 +157,8 @@ namespace ts { /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */ export function find(array: T[], predicate: (element: T, index: number) => boolean): T | undefined { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { const value = array[i]; if (predicate(value, i)) { return value; @@ -169,7 +172,8 @@ namespace ts { * This is like `forEach`, but never returns undefined. */ export function findMap(array: T[], callback: (element: T, index: number) => U | undefined): U { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { const result = callback(array[i], i); if (result) { return result; @@ -191,7 +195,8 @@ namespace ts { export function indexOf(array: T[], value: T): number { if (array) { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { if (array[i] === value) { return i; } @@ -201,7 +206,8 @@ namespace ts { } export function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number { - for (let i = start || 0, len = text.length; i < len; i++) { + const len = text.length; + for (let i = start || 0; i < len; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2f0d6a4d975..38e967b86d0 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1678,8 +1678,8 @@ namespace ts { // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. - let methodDeclaration = node; - let nameIsConstructor = methodDeclaration.name.kind === SyntaxKind.Identifier && + const methodDeclaration = node; + const nameIsConstructor = methodDeclaration.name.kind === SyntaxKind.Identifier && (methodDeclaration.name).originalKeywordKind === SyntaxKind.ConstructorKeyword; return !nameIsConstructor; @@ -7404,7 +7404,8 @@ namespace ts { if (position >= array.pos && position < array.end) { // position was in this array. Search through this array to see if we find a // viable element. - for (let i = 0, n = array.length; i < n; i++) { + const n = array.length; + for (let i = 0; i < n; i++) { const child = array[i]; if (child) { if (child.pos === position) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 73976d5d02e..5cf573bae4c 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -40,7 +40,8 @@ namespace ts { return; } - for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + const n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (let i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { // Failed to find any common path component @@ -695,7 +696,8 @@ namespace ts { } // update fileName -> file mapping - for (let i = 0, len = newSourceFiles.length; i < len; i++) { + const len = newSourceFiles.length; + for (let i = 0; i < len; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } @@ -952,7 +954,7 @@ namespace ts { } break; case SyntaxKind.HeritageClause: - let heritageClause = node; + const heritageClause = node; if (heritageClause.token === SyntaxKind.ImplementsKeyword) { diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; @@ -971,7 +973,7 @@ namespace ts { diagnostics.push(createDiagnosticForNode(node, Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; case SyntaxKind.TypeAssertionExpression: - let typeAssertionExpression = node; + const typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; } @@ -1170,7 +1172,7 @@ namespace ts { case SyntaxKind.ImportDeclaration: case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.ExportDeclaration: - let moduleNameExpr = getExternalModuleName(node); + const moduleNameExpr = getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) { break; } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 82302e98e37..24ee38b5c4d 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -531,7 +531,7 @@ namespace ts { const ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (let i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (let i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -643,7 +643,7 @@ namespace ts { pos++; continue; case CharacterCodes.slash: - let nextChar = text.charCodeAt(pos + 1); + const nextChar = text.charCodeAt(pos + 1); let hasTrailingNewLine = false; if (nextChar === CharacterCodes.slash || nextChar === CharacterCodes.asterisk) { const kind = nextChar === CharacterCodes.slash ? SyntaxKind.SingleLineCommentTrivia : SyntaxKind.MultiLineCommentTrivia; @@ -766,7 +766,8 @@ namespace ts { return false; } - for (let i = 1, n = name.length; i < n; i++) { + const n = name.length; + for (let i = 1; i < n; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -1563,7 +1564,7 @@ namespace ts { pos++; return token = SyntaxKind.AtToken; case CharacterCodes.backslash: - let cookedChar = peekUnicodeEscape(); + const cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { pos += 6; tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index a1e82a66595..8e140375dd0 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -160,7 +160,7 @@ namespace ts { function getNames(collection: any): string[] { const result: string[] = []; - for (let e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { + for (const e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { result.push(e.item().Name); } return result.sort(); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6f491f6708f..56664517176 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -550,7 +550,7 @@ namespace ts { let errorNode = node; switch (node.kind) { case SyntaxKind.SourceFile: - let pos = skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); + const pos = skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos === sourceFile.text.length) { // file is empty - return span for the beginning of the file return createTextSpan(0, 0); @@ -682,7 +682,7 @@ namespace ts { case SyntaxKind.QualifiedName: case SyntaxKind.PropertyAccessExpression: case SyntaxKind.ThisKeyword: - let parent = node.parent; + const parent = node.parent; if (parent.kind === SyntaxKind.TypeQuery) { return false; } @@ -770,7 +770,7 @@ namespace ts { switch (node.kind) { case SyntaxKind.YieldExpression: visitor(node); - let operand = (node).expression; + const operand = (node).expression; if (operand) { traverse(operand); } @@ -1222,7 +1222,7 @@ namespace ts { case SyntaxKind.NumericLiteral: case SyntaxKind.StringLiteral: case SyntaxKind.ThisKeyword: - let parent = node.parent; + const parent = node.parent; switch (parent.kind) { case SyntaxKind.VariableDeclaration: case SyntaxKind.Parameter: @@ -1244,13 +1244,13 @@ namespace ts { case SyntaxKind.SwitchStatement: return (parent).expression === node; case SyntaxKind.ForStatement: - let forStatement = parent; + const forStatement = parent; return (forStatement.initializer === node && forStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) || forStatement.condition === node || forStatement.incrementor === node; case SyntaxKind.ForInStatement: case SyntaxKind.ForOfStatement: - let forInStatement = parent; + const forInStatement = parent; return (forInStatement.initializer === node && forInStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) || forInStatement.expression === node; case SyntaxKind.TypeAssertionExpression: diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 26a4a6f963d..3c4e452095f 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -85,7 +85,7 @@ namespace Utils { eval(fileContents); break; case ExecutionEnvironment.Node: - let vm = require("vm"); + const vm = require("vm"); if (nodeContext) { vm.runInNewContext(fileContents, nodeContext, fileName); } @@ -175,9 +175,9 @@ namespace Utils { assert.isFalse(array.end > node.end, "array.end > node.end"); assert.isFalse(array.pos < currentPos, "array.pos < currentPos"); - for (let i = 0, n = array.length; i < n; i++) { - assert.isFalse(array[i].pos < currentPos, "array[i].pos < currentPos"); - currentPos = array[i].end; + for (const item of array) { + assert.isFalse(item.pos < currentPos, "array[i].pos < currentPos"); + currentPos = item.end; } currentPos = array.end; @@ -344,7 +344,8 @@ namespace Utils { assert.equal(array1.length, array2.length, "array1.length !== array2.length"); - for (let i = 0, n = array1.length; i < n; i++) { + const n = array1.length; + for (let i = 0; i < n; i++) { const d1 = array1[i]; const d2 = array2[i]; @@ -400,7 +401,8 @@ namespace Utils { assert.equal(array1.end, array2.end, "array1.end !== array2.end"); assert.equal(array1.length, array2.length, "array1.length !== array2.length"); - for (let i = 0, n = array1.length; i < n; i++) { + const n = array1.length; + for (let i = 0; i < n; i++) { assertStructuralEquals(array1[i], array2[i]); } } diff --git a/src/harness/unittests/incrementalParser.ts b/src/harness/unittests/incrementalParser.ts index 6088e5fe082..214ac3a1a58 100644 --- a/src/harness/unittests/incrementalParser.ts +++ b/src/harness/unittests/incrementalParser.ts @@ -28,7 +28,8 @@ namespace ts { const diagnostics2 = file2.parseDiagnostics; assert.equal(diagnostics1.length, diagnostics2.length, "diagnostics1.length !== diagnostics2.length"); - for (let i = 0, n = diagnostics1.length; i < n; i++) { + const n = diagnostics1.length; + for (let i = 0; i < n; i++) { const d1 = diagnostics1[i]; const d2 = diagnostics2[i]; diff --git a/src/harness/unittests/services/colorization.ts b/src/harness/unittests/services/colorization.ts index 0fe63f4ff07..70592ea4151 100644 --- a/src/harness/unittests/services/colorization.ts +++ b/src/harness/unittests/services/colorization.ts @@ -13,8 +13,7 @@ describe("Colorization", function () { function getEntryAtPosition(result: ts.ClassificationResult, position: number) { let entryPosition = 0; - for (let i = 0, n = result.entries.length; i < n; i++) { - const entry = result.entries[i]; + for (const entry of result.entries) { if (entryPosition === position) { return entry; } @@ -43,9 +42,7 @@ describe("Colorization", function () { function testLexicalClassification(text: string, initialEndOfLineState: ts.EndOfLineState, ...expectedEntries: ClassificationEntry[]): void { const result = classifier.getClassificationsForLine(text, initialEndOfLineState, /*syntacticClassifierAbsent*/ false); - for (let i = 0, n = expectedEntries.length; i < n; i++) { - const expectedEntry = expectedEntries[i]; - + for (const expectedEntry of expectedEntries) { if (expectedEntry.classification === undefined) { assert.equal(result.finalLexState, expectedEntry.value, "final endOfLineState does not match expected."); } @@ -352,9 +349,9 @@ describe("Colorization", function () { // Adjusts 'pos' by accounting for the length of each portion of the string, // but only return the last given string function track(...vals: string[]): string { - for (let i = 0, n = vals.length; i < n; i++) { + for (const val of vals) { pos += lastLength; - lastLength = vals[i].length; + lastLength = val.length; } return ts.lastOrUndefined(vals); } diff --git a/src/harness/unittests/services/patternMatcher.ts b/src/harness/unittests/services/patternMatcher.ts index 8a70b38ab5e..3052aa77720 100644 --- a/src/harness/unittests/services/patternMatcher.ts +++ b/src/harness/unittests/services/patternMatcher.ts @@ -502,7 +502,8 @@ describe("PatternMatcher", function () { function assertArrayEquals(array1: T[], array2: T[]) { assert.equal(array1.length, array2.length); - for (let i = 0, n = array1.length; i < n; i++) { + const n = array1.length; + for (let i = 0; i < n; i++) { assert.equal(array1[i], array2[i]); } } diff --git a/src/harness/unittests/versionCache.ts b/src/harness/unittests/versionCache.ts index 7fb01ee770a..b38ac527f51 100644 --- a/src/harness/unittests/versionCache.ts +++ b/src/harness/unittests/versionCache.ts @@ -307,7 +307,8 @@ and grew 1cm per day`; it("Start pos from line", () => { for (let i = 0; i < iterationCount; i++) { - for (let j = 0, llen = lines.length; j < llen; j++) { + const llen = lines.length; + for (let j = 0; j < llen; j++) { const lineInfo = lineIndex.lineNumberToInfo(j + 1); const lineIndexOffset = lineInfo.offset; const lineMapOffset = lineMap[j]; diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index e087c3b6dde..0365dfd5e41 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -113,7 +113,8 @@ namespace ts.server { if (len > 1) { let insertedNodes = new Array(len - 1); let startNode = leafNode; - for (let i = 1, len = lines.length; i < len; i++) { + const n = lines.length + for (let i = 1; i < n; i++) { insertedNodes[i - 1] = new LineLeaf(lines[i]); } let pathIndex = this.startPath.length - 2; @@ -341,8 +342,7 @@ namespace ts.server { let snap = this.versions[this.currentVersionToIndex()]; if (this.changes.length > 0) { let snapIndex = snap.index; - for (let i = 0, len = this.changes.length; i < len; i++) { - const change = this.changes[i]; + for (const change of this.changes) { snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); } snap = new LineIndexSnapshot(this.currentVersion + 1, this); @@ -366,8 +366,7 @@ namespace ts.server { const textChangeRanges: ts.TextChangeRange[] = []; for (let i = oldVersion + 1; i <= newVersion; i++) { const snap = this.versions[this.versionToIndex(i)]; - for (let j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) { - const textChange = snap.changesSincePreviousVersion[j]; + for (const textChange of snap.changesSincePreviousVersion) { textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); } } @@ -471,7 +470,8 @@ namespace ts.server { load(lines: string[]) { if (lines.length > 0) { const leaves: LineLeaf[] = []; - for (let i = 0, len = lines.length; i < len; i++) { + const len = lines.length; + for (let i = 0; i < len; i++) { leaves[i] = new LineLeaf(lines[i]); } this.root = LineIndex.buildTreeFromBottom(leaves); @@ -643,8 +643,7 @@ namespace ts.server { updateCounts() { this.totalChars = 0; this.totalLines = 0; - for (let i = 0, len = this.children.length; i < len; i++) { - const child = this.children[i]; + for (const child of this.children) { this.totalChars += child.charCount(); this.totalLines += child.lineCount(); } diff --git a/src/server/server.ts b/src/server/server.ts index a020ef210fe..0e6f8a85cf1 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -409,7 +409,8 @@ namespace ts.server { function parseLoggingEnvironmentString(logEnvStr: string): LogOptions { const logEnv: LogOptions = { logToFile: true }; const args = logEnvStr.split(" "); - for (let i = 0, len = args.length; i < (len - 1); i += 2) { + const len = args.length; + for (let i = 0; i < (len - 1); i += 2) { const option = args[i]; const value = args[i + 1]; if (option && value) { diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 6825ccb6371..c751cf3871b 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -560,11 +560,11 @@ namespace ts.BreakpointResolver { function spanInOpenBraceToken(node: Node): TextSpan { switch (node.parent.kind) { case SyntaxKind.EnumDeclaration: - let enumDeclaration = node.parent; + const enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); case SyntaxKind.ClassDeclaration: - let classDeclaration = node.parent; + const classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); case SyntaxKind.CaseBlock: @@ -600,8 +600,8 @@ namespace ts.BreakpointResolver { case SyntaxKind.CaseBlock: // breakpoint in last statement of the last clause - let caseBlock = node.parent; - let lastClause = lastOrUndefined(caseBlock.clauses); + const caseBlock = node.parent; + const lastClause = lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(lastOrUndefined(lastClause.statements)); } @@ -609,7 +609,7 @@ namespace ts.BreakpointResolver { case SyntaxKind.ObjectBindingPattern: // Breakpoint in last binding element or binding pattern if it contains no elements - let bindingPattern = node.parent; + const bindingPattern = node.parent; return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern); // Default to parent node @@ -627,7 +627,7 @@ namespace ts.BreakpointResolver { switch (node.parent.kind) { case SyntaxKind.ArrayBindingPattern: // Breakpoint in last binding element or binding pattern if it contains no elements - let bindingPattern = node.parent; + const bindingPattern = node.parent; return textSpan(lastOrUndefined(bindingPattern.elements) || bindingPattern); default: diff --git a/src/services/classifier.ts b/src/services/classifier.ts index c22aec6a786..249511e2aad 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -71,7 +71,8 @@ namespace ts { const dense = classifications.spans; let lastEnd = 0; - for (let i = 0, n = dense.length; i < n; i += 3) { + const n = dense.length; + for (let i = 0; i < n; i += 3) { const start = dense[i]; const length = dense[i + 1]; const type = dense[i + 2]; @@ -605,7 +606,9 @@ namespace ts { Debug.assert(classifications.spans.length % 3 === 0); const dense = classifications.spans; const result: ClassifiedSpan[] = []; - for (let i = 0, n = dense.length; i < n; i += 3) { + + const n = dense.length; + for (let i = 0; i < n; i += 3) { result.push({ textSpan: createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) @@ -972,9 +975,7 @@ namespace ts { if (decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { checkForClassificationCancellation(cancellationToken, element.kind); - const children = element.getChildren(sourceFile); - for (let i = 0, n = children.length; i < n; i++) { - const child = children[i]; + for (const child of element.getChildren(sourceFile)) { if (!tryClassifyNode(child)) { // Recurse into our child nodes. processElement(child); diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index bcd8cebb017..5d7dc665790 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -950,7 +950,8 @@ namespace ts.formatting { // shift all parts on the delta size const delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (let i = startIndex, len = parts.length; i < len; i++ , startLine++) { + const len = parts.length; + for (let i = startIndex; i < len; i++ , startLine++) { const startLinePos = getStartPositionOfLine(startLine, sourceFile); const nonWhitespaceCharacterAndColumn = i === 0 diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 0e65d3b264e..2f08af3127a 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -76,7 +76,8 @@ namespace ts.JsDoc { */ function forEachUnique(array: T[], callback: (element: T, index: number) => U): U { if (array) { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { if (indexOf(array, array[i]) === i) { const result = callback(array[i], i); if (result) { @@ -170,7 +171,8 @@ namespace ts.JsDoc { const isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName); let docParams = ""; - for (let i = 0, numParams = parameters.length; i < numParams; i++) { + const numParams = parameters.length; + for (let i = 0; i < numParams; i++) { const currentName = parameters[i].name; const paramName = currentName.kind === SyntaxKind.Identifier ? (currentName).text : diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 1cbaa3d640f..4e5986abc01 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -146,7 +146,7 @@ namespace ts.NavigationBar { break; case SyntaxKind.ImportClause: - let importClause = node; + const importClause = node; // Handle default import case e.g.: // import d from "mod"; if (importClause.name) { diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index b4f67ca056d..d07e9191309 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -516,7 +516,8 @@ namespace ts { // Assumes 'value' is already lowercase. function indexOfIgnoringCase(string: string, value: string): number { - for (let i = 0, n = string.length - value.length; i <= n; i++) { + const n = string.length - value.length; + for (let i = 0; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -527,7 +528,8 @@ namespace ts { // Assumes 'value' is already lowercase. function startsWithIgnoringCase(string: string, value: string, start: number): boolean { - for (let i = 0, n = value.length; i < n; i++) { + const n = value.length; + for (let i = 0; i < n; i++) { const ch1 = toLowerCase(string.charCodeAt(i + start)); const ch2 = value.charCodeAt(i); @@ -613,7 +615,8 @@ namespace ts { const result: TextSpan[] = []; let wordStart = 0; - for (let i = 1, n = identifier.length; i < n; i++) { + const n = identifier.length; + for (let i = 1; i < n; i++) { const lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); const currentIsDigit = isDigit(identifier.charCodeAt(i)); diff --git a/src/services/services.ts b/src/services/services.ts index cf6df71d45b..43903cec1ff 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1793,7 +1793,8 @@ namespace ts { } let descriptor: TodoCommentDescriptor = undefined; - for (let i = 0, n = descriptors.length; i < n; i++) { + const n = descriptors.length; + for (let i = 0; i < n; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } diff --git a/src/services/shims.ts b/src/services/shims.ts index 6184f1e2ff3..bd13843f751 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1239,7 +1239,8 @@ namespace ts { } public unregisterShim(shim: Shim): void { - for (let i = 0, n = this._shims.length; i < n; i++) { + const n = this._shims.length; + for (let i = 0; i < n; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 2f52d747e23..d3354dc5466 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -675,8 +675,7 @@ namespace ts { } // find the child that contains 'position' - for (let i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - const child = current.getChildAt(i); + for (const child of current.getChildren()) { // all jsDocComment nodes were already visited if (isJSDocNode(child)) { continue; @@ -766,7 +765,8 @@ namespace ts { } const children = n.getChildren(); - for (let i = 0, len = children.length; i < len; i++) { + const len = children.length; + for (let i = 0; i < len; i++) { const child = children[i]; // condition 'position < child.end' checks if child node end after the position // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' diff --git a/tests/webTestServer.ts b/tests/webTestServer.ts index 3d23ef3e961..9063d909b15 100644 --- a/tests/webTestServer.ts +++ b/tests/webTestServer.ts @@ -48,7 +48,7 @@ function log(msg: string) { } -let directorySeparator = "/"; +const directorySeparator = "/"; function getRootLength(path: string): number { if (path.charAt(0) === directorySeparator) { From 27ed5b85047845cb06ca47e0b982ee6e1aa8375b Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 19 Dec 2016 13:30:32 +0900 Subject: [PATCH 076/125] remove preferConstRule.ts --- Jakefile.js | 1 - scripts/tslint/preferConstRule.ts | 204 ------------------------------ 2 files changed, 205 deletions(-) delete mode 100644 scripts/tslint/preferConstRule.ts diff --git a/Jakefile.js b/Jakefile.js index 275303dda13..6cde8ac3c14 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -1179,7 +1179,6 @@ task("update-sublime", ["local", serverFile], function () { var tslintRuleDir = "scripts/tslint"; var tslintRules = [ "nextLineRule", - "preferConstRule", "booleanTriviaRule", "typeOperatorSpacingRule", "noInOperatorRule", diff --git a/scripts/tslint/preferConstRule.ts b/scripts/tslint/preferConstRule.ts deleted file mode 100644 index 28d7446b290..00000000000 --- a/scripts/tslint/preferConstRule.ts +++ /dev/null @@ -1,204 +0,0 @@ -import * as Lint from "tslint/lib"; -import * as ts from "typescript"; - -export class Rule extends Lint.Rules.AbstractRule { - public static FAILURE_STRING_FACTORY = (identifier: string) => `Identifier '${identifier}' never appears on the LHS of an assignment - use const instead of let for its declaration.`; - - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new PreferConstWalker(sourceFile, this.getOptions())); - } -} - -function isLet(node: ts.Node) { - return !!(ts.getCombinedNodeFlags(node) & ts.NodeFlags.Let); -} - -function isExported(node: ts.Node) { - return !!(ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export); -} - -function isAssignmentOperator(token: ts.SyntaxKind): boolean { - return token >= ts.SyntaxKind.FirstAssignment && token <= ts.SyntaxKind.LastAssignment; -} - -function isBindingLiteralExpression(node: ts.Node): node is (ts.ArrayLiteralExpression | ts.ObjectLiteralExpression) { - return (!!node) && (node.kind === ts.SyntaxKind.ObjectLiteralExpression || node.kind === ts.SyntaxKind.ArrayLiteralExpression); -} - -interface DeclarationUsages { - declaration: ts.VariableDeclaration; - usages: number; -} - -class PreferConstWalker extends Lint.RuleWalker { - private inScopeLetDeclarations: ts.MapLike[] = []; - private errors: Lint.RuleFailure[] = []; - private markAssignment(identifier: ts.Identifier) { - const name = identifier.text; - for (let i = this.inScopeLetDeclarations.length - 1; i >= 0; i--) { - const declarations = this.inScopeLetDeclarations[i]; - if (declarations[name]) { - declarations[name].usages++; - break; - } - } - } - - visitSourceFile(node: ts.SourceFile) { - super.visitSourceFile(node); - // Sort errors by position because tslint doesn't - this.errors.sort((a, b) => a.getStartPosition().getPosition() - b.getStartPosition().getPosition()).forEach(e => this.addFailure(e)); - } - - visitBinaryExpression(node: ts.BinaryExpression) { - if (isAssignmentOperator(node.operatorToken.kind)) { - this.visitLeftHandSideExpression(node.left); - } - super.visitBinaryExpression(node); - } - - private visitLeftHandSideExpression(node: ts.Expression) { - while (node.kind === ts.SyntaxKind.ParenthesizedExpression) { - node = (node as ts.ParenthesizedExpression).expression; - } - if (node.kind === ts.SyntaxKind.Identifier) { - this.markAssignment(node as ts.Identifier); - } - else if (isBindingLiteralExpression(node)) { - this.visitBindingLiteralExpression(node as (ts.ArrayLiteralExpression | ts.ObjectLiteralExpression)); - } - } - - private visitBindingLiteralExpression(node: ts.ArrayLiteralExpression | ts.ObjectLiteralExpression) { - if (node.kind === ts.SyntaxKind.ObjectLiteralExpression) { - const pattern = node as ts.ObjectLiteralExpression; - for (const element of pattern.properties) { - const kind = element.kind; - - if (kind === ts.SyntaxKind.ShorthandPropertyAssignment) { - this.markAssignment((element as ts.ShorthandPropertyAssignment).name); - } - else if (kind === ts.SyntaxKind.PropertyAssignment) { - this.visitLeftHandSideExpression((element as ts.PropertyAssignment).initializer); - } - } - } - else if (node.kind === ts.SyntaxKind.ArrayLiteralExpression) { - const pattern = node as ts.ArrayLiteralExpression; - for (const element of pattern.elements) { - this.visitLeftHandSideExpression(element); - } - } - } - - private visitBindingPatternIdentifiers(pattern: ts.BindingPattern) { - for (const element of pattern.elements) { - if (element.kind !== ts.SyntaxKind.BindingElement) { - continue; - } - - const name = (element).name; - if (name.kind === ts.SyntaxKind.Identifier) { - this.markAssignment(name as ts.Identifier); - } - else { - this.visitBindingPatternIdentifiers(name as ts.BindingPattern); - } - } - } - - visitPrefixUnaryExpression(node: ts.PrefixUnaryExpression) { - this.visitAnyUnaryExpression(node); - super.visitPrefixUnaryExpression(node); - } - - visitPostfixUnaryExpression(node: ts.PostfixUnaryExpression) { - this.visitAnyUnaryExpression(node); - super.visitPostfixUnaryExpression(node); - } - - private visitAnyUnaryExpression(node: ts.PrefixUnaryExpression | ts.PostfixUnaryExpression) { - if (node.operator === ts.SyntaxKind.PlusPlusToken || node.operator === ts.SyntaxKind.MinusMinusToken) { - this.visitLeftHandSideExpression(node.operand); - } - } - - visitModuleDeclaration(node: ts.ModuleDeclaration) { - if (node.body.kind === ts.SyntaxKind.ModuleBlock) { - // For some reason module blocks are left out of the visit block traversal - this.visitBlock(node.body as any as ts.Block); - } - super.visitModuleDeclaration(node); - } - - visitForOfStatement(node: ts.ForOfStatement) { - this.visitAnyForStatement(node); - super.visitForOfStatement(node); - this.popDeclarations(); - } - - visitForInStatement(node: ts.ForInStatement) { - this.visitAnyForStatement(node); - super.visitForInStatement(node); - this.popDeclarations(); - } - - private visitAnyForStatement(node: ts.ForOfStatement | ts.ForInStatement) { - const names: ts.MapLike = {}; - if (isLet(node.initializer)) { - if (node.initializer.kind === ts.SyntaxKind.VariableDeclarationList) { - this.collectLetIdentifiers(node.initializer as ts.VariableDeclarationList, names); - } - } - this.inScopeLetDeclarations.push(names); - } - - private popDeclarations() { - const completed = this.inScopeLetDeclarations.pop(); - for (const name in completed) { - if (Object.hasOwnProperty.call(completed, name)) { - const element = completed[name]; - if (element.usages === 0) { - this.errors.push(this.createFailure(element.declaration.getStart(this.getSourceFile()), element.declaration.getWidth(this.getSourceFile()), Rule.FAILURE_STRING_FACTORY(name))); - } - } - } - } - - visitBlock(node: ts.Block) { - const names: ts.MapLike = {}; - for (const statement of node.statements) { - if (statement.kind === ts.SyntaxKind.VariableStatement) { - this.collectLetIdentifiers((statement as ts.VariableStatement).declarationList, names); - } - } - this.inScopeLetDeclarations.push(names); - super.visitBlock(node); - this.popDeclarations(); - } - - private collectLetIdentifiers(list: ts.VariableDeclarationList, ret: ts.MapLike) { - for (const node of list.declarations) { - if (isLet(node) && !isExported(node)) { - this.collectNameIdentifiers(node, node.name, ret); - } - } - } - - private collectNameIdentifiers(declaration: ts.VariableDeclaration, node: ts.Identifier | ts.BindingPattern, table: ts.MapLike) { - if (node.kind === ts.SyntaxKind.Identifier) { - table[(node as ts.Identifier).text] = { declaration, usages: 0 }; - } - else { - this.collectBindingPatternIdentifiers(declaration, node as ts.BindingPattern, table); - } - } - - private collectBindingPatternIdentifiers(value: ts.VariableDeclaration, pattern: ts.BindingPattern, table: ts.MapLike) { - for (const element of pattern.elements) { - if (element.kind === ts.SyntaxKind.BindingElement) { - this.collectNameIdentifiers(value, (element).name, table); - } - } - } -} From 142a6f64200c671b31ecbc9a196dbbd43ccae5bc Mon Sep 17 00:00:00 2001 From: arusakov Date: Mon, 19 Dec 2016 11:36:20 +0300 Subject: [PATCH 077/125] Disallow old style octal literal types --- src/compiler/checker.ts | 9 +++++++-- src/compiler/diagnosticMessages.json | 6 +++++- src/compiler/utilities.ts | 10 ++++++++++ tests/baselines/reference/literals.errors.txt | 8 ++++---- .../reference/objectLiteralErrors.errors.txt | 4 ++-- .../reference/oldStyleOctalLiteralTypes.errors.txt | 12 ++++++++++++ .../baselines/reference/oldStyleOctalLiteralTypes.js | 8 ++++++++ .../reference/scannerNumericLiteral2.errors.txt | 4 ++-- .../reference/scannerNumericLiteral8.errors.txt | 4 ++-- tests/cases/compiler/oldStyleOctalLiteralTypes.ts | 3 +++ 10 files changed, 55 insertions(+), 13 deletions(-) create mode 100644 tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt create mode 100644 tests/baselines/reference/oldStyleOctalLiteralTypes.js create mode 100644 tests/cases/compiler/oldStyleOctalLiteralTypes.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5246bbfc700..90b21506113 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21845,8 +21845,13 @@ namespace ts { function checkGrammarNumericLiteral(node: NumericLiteral): boolean { // Grammar checking - if (node.isOctalLiteral && languageVersion >= ScriptTarget.ES5) { - return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.isOctalLiteral) { + if (languageVersion >= ScriptTarget.ES5) { + return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0o_0, node.text); + } + if (isChildOfLiteralType(node)) { + return grammarErrorOnNode(node, Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0o_0, node.text); + } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b59921c2948..30e2aa29b91 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -227,7 +227,7 @@ "category": "Error", "code": 1084 }, - "Octal literals are not available when targeting ECMAScript 5 and higher.": { + "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o{0}'.": { "category": "Error", "code": 1085 }, @@ -3234,5 +3234,9 @@ "Add {0} to existing import declaration from {1}": { "category": "Message", "code": 90015 + }, + "Octal literal types must use ES2015 syntax. Use the syntax '0o{0}'.": { + "category": "Error", + "code": 8017 } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6f491f6708f..309236e01c1 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -732,6 +732,16 @@ namespace ts { return false; } + export function isChildOfLiteralType(node: Node): boolean { + while (node) { + if (node.kind === SyntaxKind.LiteralType) { + return true; + } + node = node.parent; + } + return false; + } + // Warning: This has the same semantics as the forEach family of functions, // in that traversal terminates in the event that 'visitor' supplies a truthy value. export function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T { diff --git a/tests/baselines/reference/literals.errors.txt b/tests/baselines/reference/literals.errors.txt index d43e89bb4db..2920498bde4 100644 --- a/tests/baselines/reference/literals.errors.txt +++ b/tests/baselines/reference/literals.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/expressions/literals/literals.ts(9,10): error TS2362: Th tests/cases/conformance/expressions/literals/literals.ts(9,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(10,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'. +tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. ==== tests/cases/conformance/expressions/literals/literals.ts (6 errors) ==== @@ -36,14 +36,14 @@ tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: O var n = 1e4; var n = 001; // Error in ES5 ~~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'. var n = 0x1; var n = -1; var n = -1.0; var n = -1e-4; var n = -003; // Error in ES5 ~~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. var n = -0x1; var s: string; diff --git a/tests/baselines/reference/objectLiteralErrors.errors.txt b/tests/baselines/reference/objectLiteralErrors.errors.txt index 234ac24a8fd..03b4b74eacd 100644 --- a/tests/baselines/reference/objectLiteralErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralErrors.errors.txt @@ -12,7 +12,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,21) tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,19): error TS2300: Duplicate identifier '0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,19): error TS2300: Duplicate identifier '0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS2300: Duplicate identifier '0x0'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS2300: Duplicate identifier '000'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,23): error TS2300: Duplicate identifier '1e2'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,22): error TS2300: Duplicate identifier '3.2e1'. @@ -125,7 +125,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,55) !!! error TS2300: Duplicate identifier '0x0'. var e14 = { 0: 0, 000: 0 }; ~~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'. ~~~ !!! error TS2300: Duplicate identifier '000'. var e15 = { "100": 0, 1e2: 0 }; diff --git a/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt b/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt new file mode 100644 index 00000000000..4dc81f370a4 --- /dev/null +++ b/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/oldStyleOctalLiteralTypes.ts(1,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'. +tests/cases/compiler/oldStyleOctalLiteralTypes.ts(2,9): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o20'. + + +==== tests/cases/compiler/oldStyleOctalLiteralTypes.ts (2 errors) ==== + let x: 010; + ~~~ +!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'. + let y: -020; + ~~~ +!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o20'. + \ No newline at end of file diff --git a/tests/baselines/reference/oldStyleOctalLiteralTypes.js b/tests/baselines/reference/oldStyleOctalLiteralTypes.js new file mode 100644 index 00000000000..28b275774c3 --- /dev/null +++ b/tests/baselines/reference/oldStyleOctalLiteralTypes.js @@ -0,0 +1,8 @@ +//// [oldStyleOctalLiteralTypes.ts] +let x: 010; +let y: -020; + + +//// [oldStyleOctalLiteralTypes.js] +var x; +var y; diff --git a/tests/baselines/reference/scannerNumericLiteral2.errors.txt b/tests/baselines/reference/scannerNumericLiteral2.errors.txt index 5860be78c1b..faf5429f8b7 100644 --- a/tests/baselines/reference/scannerNumericLiteral2.errors.txt +++ b/tests/baselines/reference/scannerNumericLiteral2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral2.ts(1,1): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral2.ts(1,1): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'. ==== tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral2.ts (1 errors) ==== 01 ~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. \ No newline at end of file +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'. \ No newline at end of file diff --git a/tests/baselines/reference/scannerNumericLiteral8.errors.txt b/tests/baselines/reference/scannerNumericLiteral8.errors.txt index 94916626fe6..5aad01449f2 100644 --- a/tests/baselines/reference/scannerNumericLiteral8.errors.txt +++ b/tests/baselines/reference/scannerNumericLiteral8.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts(1,2): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts(1,2): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. ==== tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts (1 errors) ==== -03 ~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. \ No newline at end of file +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. \ No newline at end of file diff --git a/tests/cases/compiler/oldStyleOctalLiteralTypes.ts b/tests/cases/compiler/oldStyleOctalLiteralTypes.ts new file mode 100644 index 00000000000..c5a5475e300 --- /dev/null +++ b/tests/cases/compiler/oldStyleOctalLiteralTypes.ts @@ -0,0 +1,3 @@ +// @target: ES3 +let x: 010; +let y: -020; From 720a3bfa166335374e3c83a93be8196558c23903 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 19 Dec 2016 08:10:05 -0800 Subject: [PATCH 078/125] Skip files from package.json "main" or "types" if they have an unsupported extension. --- src/compiler/diagnosticMessages.json | 4 ++ src/compiler/moduleNameResolver.ts | 49 +++++++++++++------ ...duleResolutionWithExtensions_unexpected.js | 17 +++++++ ...esolutionWithExtensions_unexpected.symbols | 4 ++ ...lutionWithExtensions_unexpected.trace.json | 29 +++++++++++ ...eResolutionWithExtensions_unexpected.types | 4 ++ ...uleResolutionWithExtensions_unexpected2.js | 17 +++++++ ...solutionWithExtensions_unexpected2.symbols | 4 ++ ...utionWithExtensions_unexpected2.trace.json | 29 +++++++++++ ...ResolutionWithExtensions_unexpected2.types | 4 ++ ...duleResolutionWithExtensions_unexpected.ts | 12 +++++ ...uleResolutionWithExtensions_unexpected2.ts | 12 +++++ 12 files changed, 169 insertions(+), 16 deletions(-) create mode 100644 tests/baselines/reference/moduleResolutionWithExtensions_unexpected.js create mode 100644 tests/baselines/reference/moduleResolutionWithExtensions_unexpected.symbols create mode 100644 tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json create mode 100644 tests/baselines/reference/moduleResolutionWithExtensions_unexpected.types create mode 100644 tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.js create mode 100644 tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.symbols create mode 100644 tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json create mode 100644 tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.types create mode 100644 tests/cases/compiler/moduleResolutionWithExtensions_unexpected.ts create mode 100644 tests/cases/compiler/moduleResolutionWithExtensions_unexpected2.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b59921c2948..7dec5d3382c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2685,6 +2685,10 @@ "category": "Message", "code": 6080 }, + "File '{0}' has an unsupported extension, so skipping it.": { + "category": "Message", + "code": 6081 + }, "Only 'amd' and 'system' modules are supported alongside --{0}.": { "category": "Error", "code": 6082 diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 0daca9156d1..820abb73787 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -47,11 +47,6 @@ namespace ts { return resolved.path; } - /** Create Resolved from a file with unknown extension. */ - function resolvedFromAnyFile(path: string): Resolved | undefined { - return { path, extension: extensionFromPath(path) }; - } - /** Adds `isExernalLibraryImport` to a Resolved to get a ResolvedModule. */ function resolvedModuleFromResolved({ path, extension }: Resolved, isExternalLibraryImport: boolean): ResolvedModuleFull { return { resolvedFileName: path, extension, isExternalLibraryImport }; @@ -71,7 +66,8 @@ namespace ts { traceEnabled: boolean; } - function tryReadTypesSection(extensions: Extensions, packageJsonPath: string, baseDirectory: string, state: ModuleResolutionState): string { + /** Reads from "main" or "types"/"typings" depending on `extensions`. */ + function tryReadPackageJsonMainOrTypes(extensions: Extensions, packageJsonPath: string, baseDirectory: string, state: ModuleResolutionState): string { const jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { @@ -678,18 +674,21 @@ namespace ts { if (state.traceEnabled) { trace(state.host, Diagnostics.Found_package_json_at_0, packageJsonPath); } - const typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - const onlyRecordFailures = !directoryProbablyExists(getDirectoryPath(typesFile), state.host); + const mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state); + if (mainOrTypesFile) { + const onlyRecordFailures = !directoryProbablyExists(getDirectoryPath(mainOrTypesFile), state.host); // A package.json "typings" may specify an exact filename, or may choose to omit an extension. - const fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures, state); - if (fromFile) { - // Note: this would allow a package.json to specify a ".js" file as typings. Maybe that should be forbidden. - return resolvedFromAnyFile(fromFile); + const fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures, state); + if (fromExactFile) { + const resolved = fromExactFile && resolvedFromSuspiciousFile(extensions, fromExactFile); + if (resolved) { + return resolved; + } + trace(state.host, Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); } - const x = tryAddingExtensions(typesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures, state); - if (x) { - return x; + const resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures, state); + if (resolved) { + return resolved; } } else { @@ -709,6 +708,24 @@ namespace ts { return loadModuleFromFile(extensions, combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); } + /** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */ + function resolvedFromSuspiciousFile(extensions: Extensions, path: string): Resolved | undefined { + const extension = tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path, extension } : undefined; + } + + /** True if `extension` is one of the supported `extensions`. */ + function extensionIsOk(extensions: Extensions, extension: Extension): boolean { + switch (extensions) { + case Extensions.JavaScript: + return extension === Extension.Js || extension === Extension.Jsx; + case Extensions.TypeScript: + return extension === Extension.Ts || extension === Extension.Tsx || extension === Extension.Dts; + case Extensions.DtsOnly: + return extension === Extension.Dts; + } + } + function pathToPackageJson(directory: string): string { return combinePaths(directory, "package.json"); } diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.js b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.js new file mode 100644 index 00000000000..b5d4ae20a4d --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/moduleResolutionWithExtensions_unexpected.ts] //// + +//// [normalize.css] +// This tests that a package.json "main" with an unexpected extension is ignored. + +This file is not read. + +//// [package.json] +{ "main": "normalize.css" } + +//// [a.ts] +import "normalize.css"; + + +//// [a.js] +"use strict"; +require("normalize.css"); diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.symbols b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.symbols new file mode 100644 index 00000000000..a73d58fd7d8 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.symbols @@ -0,0 +1,4 @@ +=== /a.ts === +import "normalize.css"; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json new file mode 100644 index 00000000000..84532e8db7b --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json @@ -0,0 +1,29 @@ +[ + "======== Resolving module 'normalize.css' from '/a.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module 'normalize.css' from 'node_modules' folder.", + "File '/node_modules/normalize.css.ts' does not exist.", + "File '/node_modules/normalize.css.tsx' does not exist.", + "File '/node_modules/normalize.css.d.ts' does not exist.", + "Found 'package.json' at '/node_modules/normalize.css/package.json'.", + "'package.json' does not have a 'types' or 'main' field.", + "File '/node_modules/normalize.css/index.ts' does not exist.", + "File '/node_modules/normalize.css/index.tsx' does not exist.", + "File '/node_modules/normalize.css/index.d.ts' does not exist.", + "File '/node_modules/@types/normalize.css.d.ts' does not exist.", + "File '/node_modules/@types/normalize.css/package.json' does not exist.", + "File '/node_modules/@types/normalize.css/index.d.ts' does not exist.", + "Loading module 'normalize.css' from 'node_modules' folder.", + "File '/node_modules/normalize.css.js' does not exist.", + "File '/node_modules/normalize.css.jsx' does not exist.", + "Found 'package.json' at '/node_modules/normalize.css/package.json'.", + "No types specified in 'package.json', so returning 'main' value of 'normalize.css'", + "File '/node_modules/normalize.css/normalize.css' exist - use it as a name resolution result.", + "File '/node_modules/normalize.css/normalize.css' has an unsupported extension, so skipping it.", + "File '/node_modules/normalize.css/normalize.css.ts' does not exist.", + "File '/node_modules/normalize.css/normalize.css.tsx' does not exist.", + "File '/node_modules/normalize.css/normalize.css.d.ts' does not exist.", + "File '/node_modules/normalize.css/index.js' does not exist.", + "File '/node_modules/normalize.css/index.jsx' does not exist.", + "======== Module name 'normalize.css' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.types b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.types new file mode 100644 index 00000000000..a73d58fd7d8 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.types @@ -0,0 +1,4 @@ +=== /a.ts === +import "normalize.css"; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.js b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.js new file mode 100644 index 00000000000..dc9df79e4df --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/moduleResolutionWithExtensions_unexpected2.ts] //// + +//// [foo.js] +// This tests that a package.json "types" with an unexpected extension is ignored. + +This file is not read. + +//// [package.json] +{ "types": "foo.js" } + +//// [a.ts] +import "foo"; + + +//// [a.js] +"use strict"; +require("foo"); diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.symbols b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.symbols new file mode 100644 index 00000000000..11c9c72cc69 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.symbols @@ -0,0 +1,4 @@ +=== /a.ts === +import "foo"; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json new file mode 100644 index 00000000000..27c9d2243e5 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json @@ -0,0 +1,29 @@ +[ + "======== Resolving module 'foo' from '/a.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/node_modules/foo.ts' does not exist.", + "File '/node_modules/foo.tsx' does not exist.", + "File '/node_modules/foo.d.ts' does not exist.", + "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' has 'types' field 'foo.js' that references '/node_modules/foo/foo.js'.", + "File '/node_modules/foo/foo.js' exist - use it as a name resolution result.", + "File '/node_modules/foo/foo.js' has an unsupported extension, so skipping it.", + "File '/node_modules/foo/foo.js.ts' does not exist.", + "File '/node_modules/foo/foo.js.tsx' does not exist.", + "File '/node_modules/foo/foo.js.d.ts' does not exist.", + "File '/node_modules/foo/index.ts' does not exist.", + "File '/node_modules/foo/index.tsx' does not exist.", + "File '/node_modules/foo/index.d.ts' does not exist.", + "File '/node_modules/@types/foo.d.ts' does not exist.", + "File '/node_modules/@types/foo/package.json' does not exist.", + "File '/node_modules/@types/foo/index.d.ts' does not exist.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/node_modules/foo.js' does not exist.", + "File '/node_modules/foo.jsx' does not exist.", + "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'types' or 'main' field.", + "File '/node_modules/foo/index.js' does not exist.", + "File '/node_modules/foo/index.jsx' does not exist.", + "======== Module name 'foo' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.types b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.types new file mode 100644 index 00000000000..11c9c72cc69 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.types @@ -0,0 +1,4 @@ +=== /a.ts === +import "foo"; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/cases/compiler/moduleResolutionWithExtensions_unexpected.ts b/tests/cases/compiler/moduleResolutionWithExtensions_unexpected.ts new file mode 100644 index 00000000000..3af02eabb76 --- /dev/null +++ b/tests/cases/compiler/moduleResolutionWithExtensions_unexpected.ts @@ -0,0 +1,12 @@ +// @noImplicitReferences: true +// @traceResolution: true +// This tests that a package.json "main" with an unexpected extension is ignored. + +// @Filename: /node_modules/normalize.css/normalize.css +This file is not read. + +// @Filename: /node_modules/normalize.css/package.json +{ "main": "normalize.css" } + +// @Filename: /a.ts +import "normalize.css"; diff --git a/tests/cases/compiler/moduleResolutionWithExtensions_unexpected2.ts b/tests/cases/compiler/moduleResolutionWithExtensions_unexpected2.ts new file mode 100644 index 00000000000..1c960fa67e9 --- /dev/null +++ b/tests/cases/compiler/moduleResolutionWithExtensions_unexpected2.ts @@ -0,0 +1,12 @@ +// @noImplicitReferences: true +// @traceResolution: true +// This tests that a package.json "types" with an unexpected extension is ignored. + +// @Filename: /node_modules/foo/foo.js +This file is not read. + +// @Filename: /node_modules/foo/package.json +{ "types": "foo.js" } + +// @Filename: /a.ts +import "foo"; From 2a941a722285495253e40a0ff0ffb77cf17f37f3 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 20 Dec 2016 03:12:35 +0900 Subject: [PATCH 079/125] inline length --- src/compiler/checker.ts | 15 +++++---------- src/compiler/core.ts | 18 ++++++------------ src/compiler/parser.ts | 3 +-- src/compiler/program.ts | 3 +-- src/compiler/scanner.ts | 3 +-- src/harness/harness.ts | 6 ++---- src/harness/unittests/incrementalParser.ts | 3 +-- .../unittests/services/patternMatcher.ts | 3 +-- src/harness/unittests/versionCache.ts | 3 +-- src/server/scriptVersionCache.ts | 6 ++---- src/server/server.ts | 4 ++-- src/services/classifier.ts | 6 ++---- src/services/formatting/formatting.ts | 3 +-- src/services/jsDoc.ts | 6 ++---- src/services/patternMatcher.ts | 6 ++---- src/services/services.ts | 3 +-- src/services/shims.ts | 3 +-- src/services/utilities.ts | 3 +-- 18 files changed, 33 insertions(+), 64 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c1e2f4fbc91..e7e53c9e7ac 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5019,8 +5019,7 @@ namespace ts { // If this is a JSDoc construct signature, then skip the first parameter in the // parameter list. The first parameter represents the return type of the construct // signature. - const n = declaration.parameters.length; - for (let i = isJSConstructSignature ? 1 : 0; i < n; i++) { + for (let i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { const param = declaration.parameters[i]; let paramSymbol = param.symbol; @@ -5119,8 +5118,7 @@ namespace ts { function getSignaturesOfSymbol(symbol: Symbol): Signature[] { if (!symbol) return emptyArray; const result: Signature[] = []; - const len = symbol.declarations.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < symbol.declarations.length; i++) { const node = symbol.declarations[i]; switch (node.kind) { case SyntaxKind.FunctionType: @@ -7913,8 +7911,7 @@ namespace ts { return Ternary.False; } let result = Ternary.True; - const len = sourceSignatures.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < sourceSignatures.length; i++) { const related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return Ternary.False; @@ -18047,8 +18044,7 @@ namespace ts { /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) { if (typeParameterDeclarations) { - const n = typeParameterDeclarations.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < typeParameterDeclarations.length; i++) { const node = typeParameterDeclarations[i]; checkTypeParameter(node); @@ -18328,8 +18324,7 @@ namespace ts { // TypeScript 1.0 spec (April 2014): // When a generic interface has multiple declarations, all declarations must have identical type parameter // lists, i.e. identical type parameter names with identical constraints in identical order. - const len = list1.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < list1.length; i++) { const tp1 = list1[i]; const tp2 = list2[i]; if (tp1.name.text !== tp2.name.text) { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index a94b36c602d..2daf5c4e564 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -119,8 +119,7 @@ namespace ts { */ export function forEach(array: T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined { if (array) { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { const result = callback(array[i], i); if (result) { return result; @@ -144,8 +143,7 @@ namespace ts { */ export function every(array: T[], callback: (element: T, index: number) => boolean): boolean { if (array) { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -157,8 +155,7 @@ namespace ts { /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */ export function find(array: T[], predicate: (element: T, index: number) => boolean): T | undefined { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { const value = array[i]; if (predicate(value, i)) { return value; @@ -172,8 +169,7 @@ namespace ts { * This is like `forEach`, but never returns undefined. */ export function findMap(array: T[], callback: (element: T, index: number) => U | undefined): U { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { const result = callback(array[i], i); if (result) { return result; @@ -195,8 +191,7 @@ namespace ts { export function indexOf(array: T[], value: T): number { if (array) { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -206,8 +201,7 @@ namespace ts { } export function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number { - const len = text.length; - for (let i = start || 0; i < len; i++) { + for (let i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 38e967b86d0..56dd42a1045 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7404,8 +7404,7 @@ namespace ts { if (position >= array.pos && position < array.end) { // position was in this array. Search through this array to see if we find a // viable element. - const n = array.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < array.length; i++) { const child = array[i]; if (child) { if (child.pos === position) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 5cf573bae4c..99160a1e5e6 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -696,8 +696,7 @@ namespace ts { } // update fileName -> file mapping - const len = newSourceFiles.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 24ee38b5c4d..a2ca6057845 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -766,8 +766,7 @@ namespace ts { return false; } - const n = name.length; - for (let i = 1; i < n; i++) { + for (let i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 3c4e452095f..4094fc773ea 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -344,8 +344,7 @@ namespace Utils { assert.equal(array1.length, array2.length, "array1.length !== array2.length"); - const n = array1.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < array1.length; i++) { const d1 = array1[i]; const d2 = array2[i]; @@ -401,8 +400,7 @@ namespace Utils { assert.equal(array1.end, array2.end, "array1.end !== array2.end"); assert.equal(array1.length, array2.length, "array1.length !== array2.length"); - const n = array1.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < array1.length; i++) { assertStructuralEquals(array1[i], array2[i]); } } diff --git a/src/harness/unittests/incrementalParser.ts b/src/harness/unittests/incrementalParser.ts index 214ac3a1a58..fbd8a60da92 100644 --- a/src/harness/unittests/incrementalParser.ts +++ b/src/harness/unittests/incrementalParser.ts @@ -28,8 +28,7 @@ namespace ts { const diagnostics2 = file2.parseDiagnostics; assert.equal(diagnostics1.length, diagnostics2.length, "diagnostics1.length !== diagnostics2.length"); - const n = diagnostics1.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < diagnostics1.length; i++) { const d1 = diagnostics1[i]; const d2 = diagnostics2[i]; diff --git a/src/harness/unittests/services/patternMatcher.ts b/src/harness/unittests/services/patternMatcher.ts index 3052aa77720..728636e9af2 100644 --- a/src/harness/unittests/services/patternMatcher.ts +++ b/src/harness/unittests/services/patternMatcher.ts @@ -502,8 +502,7 @@ describe("PatternMatcher", function () { function assertArrayEquals(array1: T[], array2: T[]) { assert.equal(array1.length, array2.length); - const n = array1.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < array1.length; i++) { assert.equal(array1[i], array2[i]); } } diff --git a/src/harness/unittests/versionCache.ts b/src/harness/unittests/versionCache.ts index b38ac527f51..17a70f59d59 100644 --- a/src/harness/unittests/versionCache.ts +++ b/src/harness/unittests/versionCache.ts @@ -307,8 +307,7 @@ and grew 1cm per day`; it("Start pos from line", () => { for (let i = 0; i < iterationCount; i++) { - const llen = lines.length; - for (let j = 0; j < llen; j++) { + for (let j = 0; j < lines.length; j++) { const lineInfo = lineIndex.lineNumberToInfo(j + 1); const lineIndexOffset = lineInfo.offset; const lineMapOffset = lineMap[j]; diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index 0365dfd5e41..7f09bcd549b 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -113,8 +113,7 @@ namespace ts.server { if (len > 1) { let insertedNodes = new Array(len - 1); let startNode = leafNode; - const n = lines.length - for (let i = 1; i < n; i++) { + for (let i = 1; i < lines.length; i++) { insertedNodes[i - 1] = new LineLeaf(lines[i]); } let pathIndex = this.startPath.length - 2; @@ -470,8 +469,7 @@ namespace ts.server { load(lines: string[]) { if (lines.length > 0) { const leaves: LineLeaf[] = []; - const len = lines.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < lines.length; i++) { leaves[i] = new LineLeaf(lines[i]); } this.root = LineIndex.buildTreeFromBottom(leaves); diff --git a/src/server/server.ts b/src/server/server.ts index 0e6f8a85cf1..e689a2fc782 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -409,8 +409,8 @@ namespace ts.server { function parseLoggingEnvironmentString(logEnvStr: string): LogOptions { const logEnv: LogOptions = { logToFile: true }; const args = logEnvStr.split(" "); - const len = args.length; - for (let i = 0; i < (len - 1); i += 2) { + const len = args.length - 1; + for (let i = 0; i < len; i += 2) { const option = args[i]; const value = args[i + 1]; if (option && value) { diff --git a/src/services/classifier.ts b/src/services/classifier.ts index 249511e2aad..e8a29977802 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -71,8 +71,7 @@ namespace ts { const dense = classifications.spans; let lastEnd = 0; - const n = dense.length; - for (let i = 0; i < n; i += 3) { + for (let i = 0; i < dense.length; i += 3) { const start = dense[i]; const length = dense[i + 1]; const type = dense[i + 2]; @@ -607,8 +606,7 @@ namespace ts { const dense = classifications.spans; const result: ClassifiedSpan[] = []; - const n = dense.length; - for (let i = 0; i < n; i += 3) { + for (let i = 0; i < dense.length; i += 3) { result.push({ textSpan: createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 5d7dc665790..ba47c420817 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -950,8 +950,7 @@ namespace ts.formatting { // shift all parts on the delta size const delta = indentation - nonWhitespaceColumnInFirstPart.column; - const len = parts.length; - for (let i = startIndex; i < len; i++ , startLine++) { + for (let i = startIndex; i < parts.length; i++ , startLine++) { const startLinePos = getStartPositionOfLine(startLine, sourceFile); const nonWhitespaceCharacterAndColumn = i === 0 diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 2f08af3127a..08a51a63e63 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -76,8 +76,7 @@ namespace ts.JsDoc { */ function forEachUnique(array: T[], callback: (element: T, index: number) => U): U { if (array) { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { if (indexOf(array, array[i]) === i) { const result = callback(array[i], i); if (result) { @@ -171,8 +170,7 @@ namespace ts.JsDoc { const isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName); let docParams = ""; - const numParams = parameters.length; - for (let i = 0; i < numParams; i++) { + for (let i = 0; i < parameters.length; i++) { const currentName = parameters[i].name; const paramName = currentName.kind === SyntaxKind.Identifier ? (currentName).text : diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index d07e9191309..ad638099695 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -528,8 +528,7 @@ namespace ts { // Assumes 'value' is already lowercase. function startsWithIgnoringCase(string: string, value: string, start: number): boolean { - const n = value.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < value.length; i++) { const ch1 = toLowerCase(string.charCodeAt(i + start)); const ch2 = value.charCodeAt(i); @@ -615,8 +614,7 @@ namespace ts { const result: TextSpan[] = []; let wordStart = 0; - const n = identifier.length; - for (let i = 1; i < n; i++) { + for (let i = 1; i < identifier.length; i++) { const lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); const currentIsDigit = isDigit(identifier.charCodeAt(i)); diff --git a/src/services/services.ts b/src/services/services.ts index 43903cec1ff..4ca983529be 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1793,8 +1793,7 @@ namespace ts { } let descriptor: TodoCommentDescriptor = undefined; - const n = descriptors.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < descriptors.length; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } diff --git a/src/services/shims.ts b/src/services/shims.ts index bd13843f751..cf6bceb816c 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1239,8 +1239,7 @@ namespace ts { } public unregisterShim(shim: Shim): void { - const n = this._shims.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < this._shims.length; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index d3354dc5466..c66ff6a8059 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -765,8 +765,7 @@ namespace ts { } const children = n.getChildren(); - const len = children.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < children.length; i++) { const child = children[i]; // condition 'position < child.end' checks if child node end after the position // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' From 1f79741732f5bf517c1fd232ca9036815f3764bb Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 20 Dec 2016 03:14:50 +0900 Subject: [PATCH 080/125] needless newline --- src/services/classifier.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/services/classifier.ts b/src/services/classifier.ts index e8a29977802..4f553924b99 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -605,7 +605,6 @@ namespace ts { Debug.assert(classifications.spans.length % 3 === 0); const dense = classifications.spans; const result: ClassifiedSpan[] = []; - for (let i = 0; i < dense.length; i += 3) { result.push({ textSpan: createTextSpan(dense[i], dense[i + 1]), From 994273dd7297d1b2eb5ffc2a4eefd417f372d838 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 19 Dec 2016 10:24:46 -0800 Subject: [PATCH 081/125] Fix tslint version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fdb85ea764b..2de37b712ab 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "through2": "latest", "travis-fold": "latest", "ts-node": "latest", - "tslint": "next", + "tslint": "4.0.0-dev.3", "typescript": "next" }, "scripts": { From 67e1fd8403095b3181a4a34507f5ca728b0c47ba Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 20 Dec 2016 03:47:55 +0900 Subject: [PATCH 082/125] next again --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2de37b712ab..fdb85ea764b 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "through2": "latest", "travis-fold": "latest", "ts-node": "latest", - "tslint": "4.0.0-dev.3", + "tslint": "next", "typescript": "next" }, "scripts": { From 0649c2272cedecfbc7ee3f921bd0e82c4c6ceddc Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 19 Dec 2016 13:48:45 -0800 Subject: [PATCH 083/125] cache per-folder module resolutions during construction of the program (#13030) --- src/compiler/diagnosticMessages.json | 4 ++ src/compiler/moduleNameResolver.ts | 68 ++++++++++++++----- src/compiler/program.ts | 7 +- tests/baselines/reference/cacheResolutions.js | 27 ++++++++ .../reference/cacheResolutions.symbols | 13 ++++ .../reference/cacheResolutions.trace.json | 43 ++++++++++++ .../reference/cacheResolutions.types | 16 +++++ .../typeReferenceDirectives12.trace.json | 4 +- .../typeReferenceDirectives9.trace.json | 4 +- tests/cases/compiler/cacheResolutions.ts | 12 ++++ 10 files changed, 175 insertions(+), 23 deletions(-) create mode 100644 tests/baselines/reference/cacheResolutions.js create mode 100644 tests/baselines/reference/cacheResolutions.symbols create mode 100644 tests/baselines/reference/cacheResolutions.trace.json create mode 100644 tests/baselines/reference/cacheResolutions.types create mode 100644 tests/cases/compiler/cacheResolutions.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b59921c2948..6963d521339 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2945,6 +2945,10 @@ "category": "Message", "code": 6146 }, + "Resolution for module '{0}' was found in cache": { + "category": "Message", + "code": 6147 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 0daca9156d1..2a805a17494 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -293,33 +293,69 @@ namespace ts { return result; } - export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { + /** + * Cached module resolutions per containing directory. + * This assumes that any module id will have the same resolution for sibling files located in the same folder. + */ + export interface ModuleResolutionCache { + getOrCreateCacheForDirectory(directoryName: string): Map; + } + + export function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string) { + const map = createFileMap>(); + + return { getOrCreateCacheForDirectory }; + + function getOrCreateCacheForDirectory(directoryName: string) { + const path = toPath(directoryName, currentDirectory, getCanonicalFileName); + let perFolderCache = map.get(path); + if (!perFolderCache) { + perFolderCache = createMap(); + map.set(path, perFolderCache); + } + return perFolderCache; + } + } + + export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations { const traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } + let perFolderCache = cache && cache.getOrCreateCacheForDirectory(getDirectoryPath(containingFile)); + let result = perFolderCache && perFolderCache[moduleName]; - let moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = getEmitModuleKind(compilerOptions) === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic; + if (result) { if (traceEnabled) { - trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]); + trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]); + let moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = getEmitModuleKind(compilerOptions) === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]); + } } - } - let result: ResolvedModuleWithFailedLookupLocations; - switch (moduleResolution) { - case ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; + switch (moduleResolution) { + case ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); + break; + case ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host); + break; + } + + if (perFolderCache) { + perFolderCache[moduleName] = result; + } } if (traceEnabled) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 73976d5d02e..4ab709d8455 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -325,6 +325,7 @@ namespace ts { // Map storing if there is emit blocking diagnostics for given input const hasEmitBlockingDiagnostics = createFileMap(getCanonicalFileName); + let moduleResolutionCache: ModuleResolutionCache; let resolveModuleNamesWorker: (moduleNames: string[], containingFile: string) => ResolvedModuleFull[]; if (host.resolveModuleNames) { resolveModuleNamesWorker = (moduleNames, containingFile) => host.resolveModuleNames(moduleNames, containingFile).map(resolved => { @@ -338,7 +339,8 @@ namespace ts { }); } else { - const loader = (moduleName: string, containingFile: string) => resolveModuleName(moduleName, containingFile, options, host).resolvedModule; + moduleResolutionCache = createModuleResolutionCache(currentDirectory, x => host.getCanonicalFileName(x)); + const loader = (moduleName: string, containingFile: string) => resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; resolveModuleNamesWorker = (moduleNames, containingFile) => loadWithLocalCache(moduleNames, containingFile, loader); } @@ -391,6 +393,9 @@ namespace ts { } } + // unconditionally set moduleResolutionCache to undefined to avoid unnecessary leaks + moduleResolutionCache = undefined; + // unconditionally set oldProgram to undefined to prevent it from being captured in closure oldProgram = undefined; diff --git a/tests/baselines/reference/cacheResolutions.js b/tests/baselines/reference/cacheResolutions.js new file mode 100644 index 00000000000..1d0f918bf98 --- /dev/null +++ b/tests/baselines/reference/cacheResolutions.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/cacheResolutions.ts] //// + +//// [app.ts] + +export let x = 1; + +//// [lib1.ts] +export let x = 1; + +//// [lib2.ts] +export let x = 1; + +//// [app.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); +//// [lib1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); +//// [lib2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.x = 1; +}); diff --git a/tests/baselines/reference/cacheResolutions.symbols b/tests/baselines/reference/cacheResolutions.symbols new file mode 100644 index 00000000000..362ce5c308c --- /dev/null +++ b/tests/baselines/reference/cacheResolutions.symbols @@ -0,0 +1,13 @@ +=== /a/b/c/app.ts === + +export let x = 1; +>x : Symbol(x, Decl(app.ts, 1, 10)) + +=== /a/b/c/lib1.ts === +export let x = 1; +>x : Symbol(x, Decl(lib1.ts, 0, 10)) + +=== /a/b/c/lib2.ts === +export let x = 1; +>x : Symbol(x, Decl(lib2.ts, 0, 10)) + diff --git a/tests/baselines/reference/cacheResolutions.trace.json b/tests/baselines/reference/cacheResolutions.trace.json new file mode 100644 index 00000000000..8e7adfb9898 --- /dev/null +++ b/tests/baselines/reference/cacheResolutions.trace.json @@ -0,0 +1,43 @@ +[ + "======== Resolving module 'tslib' from '/a/b/c/app.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "File '/a/b/c/tslib.ts' does not exist.", + "File '/a/b/c/tslib.tsx' does not exist.", + "File '/a/b/c/tslib.d.ts' does not exist.", + "File '/a/b/tslib.ts' does not exist.", + "File '/a/b/tslib.tsx' does not exist.", + "File '/a/b/tslib.d.ts' does not exist.", + "File '/a/tslib.ts' does not exist.", + "File '/a/tslib.tsx' does not exist.", + "File '/a/tslib.d.ts' does not exist.", + "File '/tslib.ts' does not exist.", + "File '/tslib.tsx' does not exist.", + "File '/tslib.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/tslib.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/tslib/package.json' does not exist.", + "File '/a/b/c/node_modules/@types/tslib/index.d.ts' does not exist.", + "File '/a/b/node_modules/@types/tslib.d.ts' does not exist.", + "File '/a/b/node_modules/@types/tslib/package.json' does not exist.", + "File '/a/b/node_modules/@types/tslib/index.d.ts' does not exist.", + "File '/a/node_modules/@types/tslib.d.ts' does not exist.", + "File '/a/node_modules/@types/tslib/package.json' does not exist.", + "File '/a/node_modules/@types/tslib/index.d.ts' does not exist.", + "File '/node_modules/@types/tslib.d.ts' does not exist.", + "File '/node_modules/@types/tslib/package.json' does not exist.", + "File '/node_modules/@types/tslib/index.d.ts' does not exist.", + "File '/a/b/c/tslib.js' does not exist.", + "File '/a/b/c/tslib.jsx' does not exist.", + "File '/a/b/tslib.js' does not exist.", + "File '/a/b/tslib.jsx' does not exist.", + "File '/a/tslib.js' does not exist.", + "File '/a/tslib.jsx' does not exist.", + "File '/tslib.js' does not exist.", + "File '/tslib.jsx' does not exist.", + "======== Module name 'tslib' was not resolved. ========", + "======== Resolving module 'tslib' from '/a/b/c/lib1.ts'. ========", + "Resolution for module 'tslib' was found in cache", + "======== Module name 'tslib' was not resolved. ========", + "======== Resolving module 'tslib' from '/a/b/c/lib2.ts'. ========", + "Resolution for module 'tslib' was found in cache", + "======== Module name 'tslib' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/cacheResolutions.types b/tests/baselines/reference/cacheResolutions.types new file mode 100644 index 00000000000..fdcc0a6c46c --- /dev/null +++ b/tests/baselines/reference/cacheResolutions.types @@ -0,0 +1,16 @@ +=== /a/b/c/app.ts === + +export let x = 1; +>x : number +>1 : 1 + +=== /a/b/c/lib1.ts === +export let x = 1; +>x : number +>1 : 1 + +=== /a/b/c/lib2.ts === +export let x = 1; +>x : number +>1 : 1 + diff --git a/tests/baselines/reference/typeReferenceDirectives12.trace.json b/tests/baselines/reference/typeReferenceDirectives12.trace.json index f232228a351..5f87ab7ea39 100644 --- a/tests/baselines/reference/typeReferenceDirectives12.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives12.trace.json @@ -16,9 +16,7 @@ "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './main' from '/mod1.ts'. ========", - "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/main'.", - "File '/main.ts' exist - use it as a name resolution result.", + "Resolution for module './main' was found in cache", "======== Module name './main' was successfully resolved to '/main.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", "Resolving with primary search path '/types'", diff --git a/tests/baselines/reference/typeReferenceDirectives9.trace.json b/tests/baselines/reference/typeReferenceDirectives9.trace.json index f232228a351..5f87ab7ea39 100644 --- a/tests/baselines/reference/typeReferenceDirectives9.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives9.trace.json @@ -16,9 +16,7 @@ "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './main' from '/mod1.ts'. ========", - "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/main'.", - "File '/main.ts' exist - use it as a name resolution result.", + "Resolution for module './main' was found in cache", "======== Module name './main' was successfully resolved to '/main.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", "Resolving with primary search path '/types'", diff --git a/tests/cases/compiler/cacheResolutions.ts b/tests/cases/compiler/cacheResolutions.ts new file mode 100644 index 00000000000..c6962e25db6 --- /dev/null +++ b/tests/cases/compiler/cacheResolutions.ts @@ -0,0 +1,12 @@ +// @module: amd +// @importHelpers: true +// @traceResolution: true + +// @filename: /a/b/c/app.ts +export let x = 1; + +// @filename: /a/b/c/lib1.ts +export let x = 1; + +// @filename: /a/b/c/lib2.ts +export let x = 1; \ No newline at end of file From 59403796c70ec51d1f40c398befa50768ca7b289 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 29 Nov 2016 12:42:17 -0800 Subject: [PATCH 084/125] Add serialization of typenode for null/undefined/never as part of metadata type Fixes #12684 and #11933 --- src/compiler/transformers/ts.ts | 45 +++++++---- src/compiler/utilities.ts | 4 + .../reference/metadataOfUnionWithNull.js | 78 +++++++++++++++++++ .../reference/metadataOfUnionWithNull.symbols | 56 +++++++++++++ .../reference/metadataOfUnionWithNull.types | 60 ++++++++++++++ .../cases/compiler/metadataOfUnionWithNull.ts | 29 +++++++ 6 files changed, 255 insertions(+), 17 deletions(-) create mode 100644 tests/baselines/reference/metadataOfUnionWithNull.js create mode 100644 tests/baselines/reference/metadataOfUnionWithNull.symbols create mode 100644 tests/baselines/reference/metadataOfUnionWithNull.types create mode 100644 tests/cases/compiler/metadataOfUnionWithNull.ts diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 877131b369c..366c94aa629 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1662,6 +1662,8 @@ namespace ts { switch (node.kind) { case SyntaxKind.VoidKeyword: + case SyntaxKind.UndefinedKeyword: + case SyntaxKind.NullKeyword: return createVoidZero(); case SyntaxKind.ParenthesizedType: @@ -1715,27 +1717,35 @@ namespace ts { case SyntaxKind.UnionType: { const unionOrIntersection = node; - let serializedUnion: Identifier; + let serializedUnion: Identifier | VoidExpression; for (const typeNode of unionOrIntersection.types) { - const serializedIndividual = serializeTypeNode(typeNode) as Identifier; - // Non identifier - if (serializedIndividual.kind !== SyntaxKind.Identifier) { + const serializedIndividual = serializeTypeNode(typeNode); + + if (isIdentifier(serializedIndividual)) { + // One of the individual is global object, return immediately + if (serializedIndividual.text === "Object") { + return serializedIndividual; + } + + // Different types + if (serializedUnion && isIdentifier(serializedUnion) && serializedUnion.text !== serializedIndividual.text) { + serializedUnion = undefined; + break; + } + + serializedUnion = serializedIndividual; + } + else if (isVoidExpression(serializedIndividual)) { + // If we dont have any other type already set, set the initial type + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else { + // Non identifier and undefined/null serializedUnion = undefined; break; } - - // One of the individual is global object, return immediately - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - - // Different types - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - - serializedUnion = serializedIndividual; } // If we were able to find common type @@ -1751,6 +1761,7 @@ namespace ts { case SyntaxKind.TypeLiteral: case SyntaxKind.AnyKeyword: case SyntaxKind.ThisType: + case SyntaxKind.NeverKeyword: break; default: diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6f491f6708f..0914b0d0c24 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3581,6 +3581,10 @@ namespace ts { return node.kind === SyntaxKind.Identifier; } + export function isVoidExpression(node: Node): node is VoidExpression { + return node.kind === SyntaxKind.VoidExpression; + } + export function isGeneratedIdentifier(node: Node): node is GeneratedIdentifier { // Using `>` here catches both `GeneratedIdentifierKind.None` and `undefined`. return isIdentifier(node) && node.autoGenerateKind > GeneratedIdentifierKind.None; diff --git a/tests/baselines/reference/metadataOfUnionWithNull.js b/tests/baselines/reference/metadataOfUnionWithNull.js new file mode 100644 index 00000000000..7b4b734b834 --- /dev/null +++ b/tests/baselines/reference/metadataOfUnionWithNull.js @@ -0,0 +1,78 @@ +//// [metadataOfUnionWithNull.ts] +function PropDeco(target: Object, propKey: string | symbol) { } + +class A { +} + +class B { + @PropDeco + x: "foo" | null; + + @PropDeco + y: true | never; + + @PropDeco + z: "foo" | undefined; + + @PropDeco + a: null; + + @PropDeco + b: never; + + @PropDeco + c: undefined; + + @PropDeco + d: undefined | null; +} + +//// [metadataOfUnionWithNull.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +function PropDeco(target, propKey) { } +var A = (function () { + function A() { + } + return A; +}()); +var B = (function () { + function B() { + } + return B; +}()); +__decorate([ + PropDeco, + __metadata("design:type", String) +], B.prototype, "x"); +__decorate([ + PropDeco, + __metadata("design:type", Object) +], B.prototype, "y"); +__decorate([ + PropDeco, + __metadata("design:type", String) +], B.prototype, "z"); +__decorate([ + PropDeco, + __metadata("design:type", void 0) +], B.prototype, "a"); +__decorate([ + PropDeco, + __metadata("design:type", Object) +], B.prototype, "b"); +__decorate([ + PropDeco, + __metadata("design:type", void 0) +], B.prototype, "c"); +__decorate([ + PropDeco, + __metadata("design:type", void 0) +], B.prototype, "d"); diff --git a/tests/baselines/reference/metadataOfUnionWithNull.symbols b/tests/baselines/reference/metadataOfUnionWithNull.symbols new file mode 100644 index 00000000000..13533a26699 --- /dev/null +++ b/tests/baselines/reference/metadataOfUnionWithNull.symbols @@ -0,0 +1,56 @@ +=== tests/cases/compiler/metadataOfUnionWithNull.ts === +function PropDeco(target: Object, propKey: string | symbol) { } +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) +>target : Symbol(target, Decl(metadataOfUnionWithNull.ts, 0, 18)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>propKey : Symbol(propKey, Decl(metadataOfUnionWithNull.ts, 0, 33)) + +class A { +>A : Symbol(A, Decl(metadataOfUnionWithNull.ts, 0, 63)) +} + +class B { +>B : Symbol(B, Decl(metadataOfUnionWithNull.ts, 3, 1)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + x: "foo" | null; +>x : Symbol(B.x, Decl(metadataOfUnionWithNull.ts, 5, 9)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + y: true | never; +>y : Symbol(B.y, Decl(metadataOfUnionWithNull.ts, 7, 20)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + z: "foo" | undefined; +>z : Symbol(B.z, Decl(metadataOfUnionWithNull.ts, 10, 20)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + a: null; +>a : Symbol(B.a, Decl(metadataOfUnionWithNull.ts, 13, 25)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + b: never; +>b : Symbol(B.b, Decl(metadataOfUnionWithNull.ts, 16, 12)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + c: undefined; +>c : Symbol(B.c, Decl(metadataOfUnionWithNull.ts, 19, 13)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + d: undefined | null; +>d : Symbol(B.d, Decl(metadataOfUnionWithNull.ts, 22, 17)) +} diff --git a/tests/baselines/reference/metadataOfUnionWithNull.types b/tests/baselines/reference/metadataOfUnionWithNull.types new file mode 100644 index 00000000000..e6037e16cb3 --- /dev/null +++ b/tests/baselines/reference/metadataOfUnionWithNull.types @@ -0,0 +1,60 @@ +=== tests/cases/compiler/metadataOfUnionWithNull.ts === +function PropDeco(target: Object, propKey: string | symbol) { } +>PropDeco : (target: Object, propKey: string | symbol) => void +>target : Object +>Object : Object +>propKey : string | symbol + +class A { +>A : A +} + +class B { +>B : B + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + x: "foo" | null; +>x : "foo" +>null : null + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + y: true | never; +>y : true +>true : true + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + z: "foo" | undefined; +>z : "foo" + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + a: null; +>a : null +>null : null + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + b: never; +>b : never + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + c: undefined; +>c : undefined + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + d: undefined | null; +>d : null +>null : null +} diff --git a/tests/cases/compiler/metadataOfUnionWithNull.ts b/tests/cases/compiler/metadataOfUnionWithNull.ts new file mode 100644 index 00000000000..475024229fc --- /dev/null +++ b/tests/cases/compiler/metadataOfUnionWithNull.ts @@ -0,0 +1,29 @@ +// @experimentalDecorators: true +// @emitDecoratorMetadata: true +function PropDeco(target: Object, propKey: string | symbol) { } + +class A { +} + +class B { + @PropDeco + x: "foo" | null; + + @PropDeco + y: true | never; + + @PropDeco + z: "foo" | undefined; + + @PropDeco + a: null; + + @PropDeco + b: never; + + @PropDeco + c: undefined; + + @PropDeco + d: undefined | null; +} \ No newline at end of file From 73a829279ab9534802763bbda02aaf6816e08eaa Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 29 Nov 2016 12:42:17 -0800 Subject: [PATCH 085/125] Support union of non identifier serialized type node with null/undefined/never --- src/compiler/transformers/ts.ts | 91 ++++++++++--------- .../reference/metadataOfUnionWithNull.js | 39 +++++++- .../reference/metadataOfUnionWithNull.symbols | 33 +++++++ .../reference/metadataOfUnionWithNull.types | 37 ++++++++ .../cases/compiler/metadataOfUnionWithNull.ts | 15 +++ 5 files changed, 168 insertions(+), 47 deletions(-) diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 366c94aa629..ecd2e2dfcfd 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1637,6 +1637,8 @@ namespace ts { return createVoidZero(); } + type SerializedTypeNode = SerializedEntityNameAsExpression | VoidExpression | ConditionalExpression; + /** * Serializes a type node for use with decorator type metadata. * @@ -1655,7 +1657,7 @@ namespace ts { * * @param node The type node to serialize. */ - function serializeTypeNode(node: TypeNode): Expression { + function serializeTypeNode(node: TypeNode): SerializedTypeNode { if (node === undefined) { return createIdentifier("Object"); } @@ -1664,6 +1666,7 @@ namespace ts { case SyntaxKind.VoidKeyword: case SyntaxKind.UndefinedKeyword: case SyntaxKind.NullKeyword: + case SyntaxKind.NeverKeyword: return createVoidZero(); case SyntaxKind.ParenthesizedType: @@ -1715,45 +1718,8 @@ namespace ts { case SyntaxKind.IntersectionType: case SyntaxKind.UnionType: - { - const unionOrIntersection = node; - let serializedUnion: Identifier | VoidExpression; - for (const typeNode of unionOrIntersection.types) { - const serializedIndividual = serializeTypeNode(typeNode); + return serializeUnionOrIntersectionType(node); - if (isIdentifier(serializedIndividual)) { - // One of the individual is global object, return immediately - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - - // Different types - if (serializedUnion && isIdentifier(serializedUnion) && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - - serializedUnion = serializedIndividual; - } - else if (isVoidExpression(serializedIndividual)) { - // If we dont have any other type already set, set the initial type - if (!serializedUnion) { - serializedUnion = serializedIndividual; - } - } - else { - // Non identifier and undefined/null - serializedUnion = undefined; - break; - } - } - - // If we were able to find common type - if (serializedUnion) { - return serializedUnion; - } - } - // Fallthrough case SyntaxKind.TypeQuery: case SyntaxKind.TypeOperator: case SyntaxKind.IndexedAccessType: @@ -1761,7 +1727,6 @@ namespace ts { case SyntaxKind.TypeLiteral: case SyntaxKind.AnyKeyword: case SyntaxKind.ThisType: - case SyntaxKind.NeverKeyword: break; default: @@ -1772,13 +1737,48 @@ namespace ts { return createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node: UnionOrIntersectionTypeNode): SerializedTypeNode { + let serializedUnion: SerializedTypeNode; + for (const typeNode of node.types) { + const serializedIndividual = serializeTypeNode(typeNode); + + if (isVoidExpression(serializedIndividual)) { + // If we dont have any other type already set, set the initial type + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + // One of the individual is global object, return immediately + return serializedIndividual; + } + // If there exists union that is not void 0 expression, check if the the common type is identifier. + // anything more complex and we will just default to Object + else if (serializedUnion && !isVoidExpression(serializedUnion)) { + // Different types + if (!isIdentifier(serializedUnion) || + !isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return createIdentifier("Object"); + } + } + else { + // Initialize the union type + serializedUnion = serializedIndividual; + } + } + + // If we were able to find common type, use it + return serializedUnion; + } + /** * Serializes a TypeReferenceNode to an appropriate JS constructor value for use with * decorator type metadata. * * @param node The type reference node. */ - function serializeTypeReferenceNode(node: TypeReferenceNode) { + function serializeTypeReferenceNode(node: TypeReferenceNode): SerializedTypeNode { switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) { case TypeReferenceSerializationKind.Unknown: const serialized = serializeEntityNameAsExpression(node.typeName, /*useFallback*/ true); @@ -1826,6 +1826,7 @@ namespace ts { } } + type SerializedEntityNameAsExpression = Identifier | BinaryExpression | PropertyAccessExpression; /** * Serializes an entity name as an expression for decorator type metadata. * @@ -1833,7 +1834,7 @@ namespace ts { * @param useFallback A value indicating whether to use logical operators to test for the * entity name at runtime. */ - function serializeEntityNameAsExpression(node: EntityName, useFallback: boolean): Expression { + function serializeEntityNameAsExpression(node: EntityName, useFallback: boolean): SerializedEntityNameAsExpression { switch (node.kind) { case SyntaxKind.Identifier: // Create a clone of the name with a new parent, and treat it as if it were @@ -1866,8 +1867,8 @@ namespace ts { * @param useFallback A value indicating whether to use logical operators to test for the * qualified name at runtime. */ - function serializeQualifiedNameAsExpression(node: QualifiedName, useFallback: boolean): Expression { - let left: Expression; + function serializeQualifiedNameAsExpression(node: QualifiedName, useFallback: boolean): PropertyAccessExpression { + let left: SerializedEntityNameAsExpression; if (node.left.kind === SyntaxKind.Identifier) { left = serializeEntityNameAsExpression(node.left, useFallback); } @@ -1892,7 +1893,7 @@ namespace ts { * Gets an expression that points to the global "Symbol" constructor at runtime if it is * available. */ - function getGlobalSymbolNameWithFallback(): Expression { + function getGlobalSymbolNameWithFallback(): ConditionalExpression { return createConditional( createTypeCheck(createIdentifier("Symbol"), "function"), createIdentifier("Symbol"), diff --git a/tests/baselines/reference/metadataOfUnionWithNull.js b/tests/baselines/reference/metadataOfUnionWithNull.js index 7b4b734b834..cc594ae326d 100644 --- a/tests/baselines/reference/metadataOfUnionWithNull.js +++ b/tests/baselines/reference/metadataOfUnionWithNull.js @@ -25,6 +25,21 @@ class B { @PropDeco d: undefined | null; + + @PropDeco + e: symbol | null; + + @PropDeco + f: symbol | A; + + @PropDeco + g: A | null; + + @PropDeco + h: null | B; + + @PropDeco + j: null | symbol; } //// [metadataOfUnionWithNull.js] @@ -54,7 +69,7 @@ __decorate([ ], B.prototype, "x"); __decorate([ PropDeco, - __metadata("design:type", Object) + __metadata("design:type", Boolean) ], B.prototype, "y"); __decorate([ PropDeco, @@ -66,7 +81,7 @@ __decorate([ ], B.prototype, "a"); __decorate([ PropDeco, - __metadata("design:type", Object) + __metadata("design:type", void 0) ], B.prototype, "b"); __decorate([ PropDeco, @@ -76,3 +91,23 @@ __decorate([ PropDeco, __metadata("design:type", void 0) ], B.prototype, "d"); +__decorate([ + PropDeco, + __metadata("design:type", typeof Symbol === "function" ? Symbol : Object) +], B.prototype, "e"); +__decorate([ + PropDeco, + __metadata("design:type", Object) +], B.prototype, "f"); +__decorate([ + PropDeco, + __metadata("design:type", A) +], B.prototype, "g"); +__decorate([ + PropDeco, + __metadata("design:type", B) +], B.prototype, "h"); +__decorate([ + PropDeco, + __metadata("design:type", typeof Symbol === "function" ? Symbol : Object) +], B.prototype, "j"); diff --git a/tests/baselines/reference/metadataOfUnionWithNull.symbols b/tests/baselines/reference/metadataOfUnionWithNull.symbols index 13533a26699..13316bc7cf1 100644 --- a/tests/baselines/reference/metadataOfUnionWithNull.symbols +++ b/tests/baselines/reference/metadataOfUnionWithNull.symbols @@ -53,4 +53,37 @@ class B { d: undefined | null; >d : Symbol(B.d, Decl(metadataOfUnionWithNull.ts, 22, 17)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + e: symbol | null; +>e : Symbol(B.e, Decl(metadataOfUnionWithNull.ts, 25, 24)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + f: symbol | A; +>f : Symbol(B.f, Decl(metadataOfUnionWithNull.ts, 28, 21)) +>A : Symbol(A, Decl(metadataOfUnionWithNull.ts, 0, 63)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + g: A | null; +>g : Symbol(B.g, Decl(metadataOfUnionWithNull.ts, 31, 18)) +>A : Symbol(A, Decl(metadataOfUnionWithNull.ts, 0, 63)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + h: null | B; +>h : Symbol(B.h, Decl(metadataOfUnionWithNull.ts, 34, 16)) +>B : Symbol(B, Decl(metadataOfUnionWithNull.ts, 3, 1)) + + @PropDeco +>PropDeco : Symbol(PropDeco, Decl(metadataOfUnionWithNull.ts, 0, 0)) + + j: null | symbol; +>j : Symbol(B.j, Decl(metadataOfUnionWithNull.ts, 37, 16)) } diff --git a/tests/baselines/reference/metadataOfUnionWithNull.types b/tests/baselines/reference/metadataOfUnionWithNull.types index e6037e16cb3..04a5b162d4c 100644 --- a/tests/baselines/reference/metadataOfUnionWithNull.types +++ b/tests/baselines/reference/metadataOfUnionWithNull.types @@ -56,5 +56,42 @@ class B { d: undefined | null; >d : null +>null : null + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + e: symbol | null; +>e : symbol +>null : null + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + f: symbol | A; +>f : symbol | A +>A : A + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + g: A | null; +>g : A +>A : A +>null : null + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + h: null | B; +>h : B +>null : null +>B : B + + @PropDeco +>PropDeco : (target: Object, propKey: string | symbol) => void + + j: null | symbol; +>j : symbol >null : null } diff --git a/tests/cases/compiler/metadataOfUnionWithNull.ts b/tests/cases/compiler/metadataOfUnionWithNull.ts index 475024229fc..bb4d93189fc 100644 --- a/tests/cases/compiler/metadataOfUnionWithNull.ts +++ b/tests/cases/compiler/metadataOfUnionWithNull.ts @@ -26,4 +26,19 @@ class B { @PropDeco d: undefined | null; + + @PropDeco + e: symbol | null; + + @PropDeco + f: symbol | A; + + @PropDeco + g: A | null; + + @PropDeco + h: null | B; + + @PropDeco + j: null | symbol; } \ No newline at end of file From fa53eb150e73dd666edf13137baac5031199bc9a Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 19 Dec 2016 17:03:59 -0800 Subject: [PATCH 086/125] Improve hierarchy fact tracking --- src/compiler/factory.ts | 24 ++- src/compiler/transformers/es2015.ts | 323 +++++++++++++--------------- src/compiler/utilities.ts | 19 +- 3 files changed, 178 insertions(+), 188 deletions(-) diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 3bd88d78447..761253439fa 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1754,17 +1754,21 @@ namespace ts { // Utilities - export function restoreEnclosingLabels(node: Statement, enclosingLabeledStatements: LabeledStatement[]) { - if (enclosingLabeledStatements) { - for (const labeledStatement of enclosingLabeledStatements) { - node = updateLabel( - labeledStatement, - labeledStatement.label, - node - ); - } + export function restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement, afterRestoreLabelCallback?: (node: LabeledStatement) => void): Statement { + if (!outermostLabeledStatement) { + return node; } - return node; + const updated = updateLabel( + outermostLabeledStatement, + outermostLabeledStatement.label, + outermostLabeledStatement.statement.kind === SyntaxKind.LabeledStatement + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node + ); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; } export interface CallBinding { diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 5f91063beb8..774c6db2cc4 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -164,9 +164,14 @@ namespace ts { type LoopConverter = (node: IterationStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]) => Statement; - // Facts we track as we descend the tree - const enum AncestorFacts { + // Facts we track as we traverse the tree + const enum HierarchyFacts { None = 0, + + // + // Ancestor facts + // + Function = 1 << 0, // Enclosed in a non-arrow function ArrowFunction = 1 << 1, // Enclosed in an arrow function AsyncFunctionBody = 1 << 2, // Enclosed in an async function body @@ -180,6 +185,14 @@ namespace ts { ForStatement = 1 << 10, // Enclosing block-scoped container is a ForStatement ForInOrForOfStatement = 1 << 11, // Enclosing block-scoped container is a ForInStatement or ForOfStatement ConstructorWithCapturedSuper = 1 << 12, // Enclosed in a constructor that captures 'this' for use with 'super' + ComputedPropertyName = 1 << 13, // Enclosed in a computed property name + // NOTE: do not add more ancestor flags without also updating AncestorFactsMask below. + + // + // Ancestor masks + // + + AncestorFactsMask = (ComputedPropertyName << 1) - 1, // We are always in *some* kind of block scope, but only specific block-scope containers are // top-level or Blocks. @@ -192,11 +205,14 @@ namespace ts { // Functions, methods, and accessors are both new lexical scopes and new block scopes. FunctionIncludes = Function | TopLevel, - FunctionExcludes = BlockScopeExcludes & ~TopLevel | ArrowFunction | AsyncFunctionBody | CapturesThis | NonStaticClassElement | ConstructorWithCapturedSuper, + FunctionExcludes = BlockScopeExcludes & ~TopLevel | ArrowFunction | AsyncFunctionBody | CapturesThis | NonStaticClassElement | ConstructorWithCapturedSuper | ComputedPropertyName, + + AsyncFunctionBodyIncludes = FunctionIncludes | AsyncFunctionBody, + AsyncFunctionBodyExcludes = FunctionExcludes & ~NonStaticClassElement, // Arrow functions are lexically scoped to their container, but are new block scopes. ArrowFunctionIncludes = ArrowFunction | TopLevel, - ArrowFunctionExcludes = BlockScopeExcludes & ~TopLevel | ConstructorWithCapturedSuper, + ArrowFunctionExcludes = BlockScopeExcludes & ~TopLevel | ConstructorWithCapturedSuper | ComputedPropertyName, // Constructors are both new lexical scopes and new block scopes. Constructors are also // always considered non-static members of a class. @@ -221,6 +237,25 @@ namespace ts { // Blocks (other than function bodies) are new block scopes. BlockIncludes = Block, BlockExcludes = BlockScopeExcludes & ~Block, + + IterationStatementBlockIncludes = IterationStatementBlock, + IterationStatementBlockExcludes = BlockScopeExcludes, + + // Computed property names track subtree flags differently than their containing members. + ComputedPropertyNameIncludes = ComputedPropertyName, + ComputedPropertyNameExcludes = None, + + // + // Subtree facts + // + + // NOTE: To be added in a later PR + + // + // Subtree masks + // + + SubtreeFactsMask = ~AncestorFactsMask, } export function transformES2015(context: TransformationContext) { @@ -239,7 +274,7 @@ namespace ts { let currentSourceFile: SourceFile; let currentText: string; - let ancestorFacts: AncestorFacts; + let hierarchyFacts: HierarchyFacts; /** * Used to track if we are emitting body of the converted loop @@ -268,49 +303,34 @@ namespace ts { currentSourceFile = undefined; currentText = undefined; - ancestorFacts = AncestorFacts.None; + hierarchyFacts = HierarchyFacts.None; return visited; } - function setAncestorFacts(excludeFacts: AncestorFacts, includeFacts: AncestorFacts, node?: Node, container?: Node) { - if (node) { - switch (node.kind) { - case SyntaxKind.MethodDeclaration: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - if (container && isClassLike(container) && !hasModifier(node, ModifierFlags.Static)) { - includeFacts |= AncestorFacts.NonStaticClassElement; - } - break; + /** + * Sets the `HierarchyFacts` for this node prior to visiting this node's subtree, returning the facts set prior to modification. + * @param excludeFacts The existing `HierarchyFacts` to reset before visiting the subtree. + * @param includeFacts The new `HierarchyFacts` to set before visiting the subtree. + **/ + function enterSubtree(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts) { + const ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & HierarchyFacts.AncestorFactsMask; + return ancestorFacts; + } - case SyntaxKind.FunctionExpression: - const emitFlags = getEmitFlags(node); - if (emitFlags & EmitFlags.CapturesThis) { - includeFacts |= AncestorFacts.CapturesThis; - } - if (emitFlags & EmitFlags.AsyncFunctionBody) { - excludeFacts &= ~AncestorFacts.NonStaticClassElement; - includeFacts |= AncestorFacts.AsyncFunctionBody; - } - break; - case SyntaxKind.FunctionDeclaration: - if (getEmitFlags(node) & EmitFlags.CapturesThis) { - includeFacts |= AncestorFacts.CapturesThis; - } - break; - case SyntaxKind.Block: - if (ancestorFacts & AncestorFacts.IterationStatement) { - includeFacts = includeFacts & ~AncestorFacts.Block | AncestorFacts.IterationStatementBlock; - excludeFacts |= AncestorFacts.Block; - } - break; - } - } - ancestorFacts = ancestorFacts & ~excludeFacts | includeFacts; + /** + * Restores the `HierarchyFacts` for this node's ancestor after visiting this node's + * subtree, propagating specific facts from the subtree. + * @param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree. + * @param excludeFacts The existing `HierarchyFacts` of the subtree that should not be propagated. + * @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated. + **/ + function exitSubtree(ancestorFacts: HierarchyFacts, excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & HierarchyFacts.SubtreeFactsMask | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node: Node): boolean { - return ancestorFacts & AncestorFacts.ConstructorWithCapturedSuper + return hierarchyFacts & HierarchyFacts.ConstructorWithCapturedSuper && node.kind === SyntaxKind.ReturnStatement && !(node).expression; } @@ -318,7 +338,7 @@ namespace ts { function shouldVisitNode(node: Node): boolean { return (node.transformFlags & TransformFlags.ContainsES2015) !== 0 || convertedLoopState !== undefined - || (ancestorFacts & AncestorFacts.ConstructorWithCapturedSuper && isStatement(node)) + || (hierarchyFacts & HierarchyFacts.ConstructorWithCapturedSuper && isStatement(node)) || (isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } @@ -479,15 +499,14 @@ namespace ts { } function visitSourceFile(node: SourceFile): SourceFile { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.SourceFileExcludes, AncestorFacts.SourceFileIncludes); + const ancestorFacts = enterSubtree(HierarchyFacts.SourceFileExcludes, HierarchyFacts.SourceFileIncludes); const statements: Statement[] = []; startLexicalEnvironment(); const statementOffset = addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); addCaptureThisForNodeIfNeeded(statements, node); addRange(statements, visitNodes(node.statements, visitor, isStatement, statementOffset)); addRange(statements, endLexicalEnvironment()); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updateSourceFileNode( node, createNodeArray(statements, node.statements) @@ -507,10 +526,9 @@ namespace ts { } function visitCaseBlock(node: CaseBlock): CaseBlock { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.BlockScopeExcludes, AncestorFacts.BlockScopeIncludes); + const ancestorFacts = enterSubtree(HierarchyFacts.BlockScopeExcludes, HierarchyFacts.BlockScopeIncludes); const updated = visitEachChild(node, visitor, context); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } @@ -545,7 +563,7 @@ namespace ts { function visitThisKeyword(node: Node): Node { if (convertedLoopState) { - if (ancestorFacts & AncestorFacts.ArrowFunction) { + if (hierarchyFacts & HierarchyFacts.ArrowFunction) { // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. convertedLoopState.containsLexicalThis = true; return node; @@ -826,12 +844,9 @@ namespace ts { * @param extendsClauseElement The expression for the class `extends` clause. */ function addConstructor(statements: Statement[], node: ClassExpression | ClassDeclaration, extendsClauseElement: ExpressionWithTypeArguments): void { - const savedAncestorFacts = ancestorFacts; const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.ConstructorExcludes, AncestorFacts.ConstructorIncludes); convertedLoopState = undefined; - + const ancestorFacts = enterSubtree(HierarchyFacts.ConstructorExcludes, HierarchyFacts.ConstructorIncludes); const constructor = getFirstConstructorWithBody(node); const hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); const constructorFunction = @@ -852,8 +867,7 @@ namespace ts { } statements.push(constructorFunction); - - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; } @@ -915,7 +929,7 @@ namespace ts { if (constructor) { if (superCaptureStatus === SuperCaptureResult.ReplaceSuperCapture) { - ancestorFacts |= AncestorFacts.ConstructorWithCapturedSuper; + hierarchyFacts |= HierarchyFacts.ConstructorWithCapturedSuper; } addRange(statements, visitNodes(constructor.body.statements, visitor, isStatement, /*start*/ statementOffset)); @@ -1431,6 +1445,7 @@ namespace ts { * @param member The MethodDeclaration node. */ function transformClassMethodDeclarationToStatement(receiver: LeftHandSideExpression, member: MethodDeclaration, container: Node) { + const ancestorFacts = enterSubtree(HierarchyFacts.None, HierarchyFacts.None); const commentRange = getCommentRange(member); const sourceMapRange = getSourceMapRange(member); const memberName = createMemberAccessForPropertyName(receiver, visitNode(member.name, visitor, isPropertyName), /*location*/ member.name); @@ -1450,6 +1465,8 @@ namespace ts { // No source map should be emitted for this statement to align with the // old emitter. setEmitFlags(statement, EmitFlags.NoSourceMap); + + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return statement; } @@ -1479,6 +1496,8 @@ namespace ts { * @param receiver The receiver for the member. */ function transformAccessorsToExpression(receiver: LeftHandSideExpression, { firstAccessor, getAccessor, setAccessor }: AllAccessorDeclarations, container: Node, startsOnNewLine: boolean): Expression { + const ancestorFacts = enterSubtree(HierarchyFacts.None, HierarchyFacts.None); + // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. const target = getMutableClone(receiver); @@ -1525,6 +1544,8 @@ namespace ts { if (startsOnNewLine) { call.startsOnNewLine = true; } + + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return call; } @@ -1537,13 +1558,9 @@ namespace ts { if (node.transformFlags & TransformFlags.ContainsLexicalThis) { enableSubstitutionsForCapturedThis(); } - - const savedAncestorFacts = ancestorFacts; const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.ArrowFunctionExcludes, AncestorFacts.ArrowFunctionIncludes); convertedLoopState = undefined; - + const ancestorFacts = enterSubtree(HierarchyFacts.ArrowFunctionExcludes, HierarchyFacts.ArrowFunctionIncludes); const func = createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, @@ -1554,10 +1571,9 @@ namespace ts { transformFunctionBody(node), node ); - setOriginalNode(func, node); setEmitFlags(func, EmitFlags.CapturesThis); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; return func; } @@ -1568,12 +1584,11 @@ namespace ts { * @param node a FunctionExpression node. */ function visitFunctionExpression(node: FunctionExpression): Expression { - const savedAncestorFacts = ancestorFacts; + const ancestorFacts = getEmitFlags(node) & EmitFlags.AsyncFunctionBody + ? enterSubtree(HierarchyFacts.AsyncFunctionBodyExcludes, HierarchyFacts.AsyncFunctionBodyIncludes) + : enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes); const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); convertedLoopState = undefined; - const updated = updateFunctionExpression( node, /*modifiers*/ undefined, @@ -1585,8 +1600,7 @@ namespace ts { ? transformFunctionBody(node) : visitFunctionBody(node.body, functionBodyVisitor, context) ); - - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; return updated; } @@ -1597,12 +1611,9 @@ namespace ts { * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node: FunctionDeclaration): FunctionDeclaration { - const savedAncestorFacts = ancestorFacts; const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); convertedLoopState = undefined; - + const ancestorFacts = enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes); const updated = updateFunctionDeclaration( node, /*decorators*/ undefined, @@ -1616,7 +1627,7 @@ namespace ts { : visitFunctionBody(node.body, functionBodyVisitor, context) ); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; return updated; } @@ -1629,12 +1640,11 @@ namespace ts { * @param name The name of the new FunctionExpression. */ function transformFunctionLikeToExpression(node: FunctionLikeDeclaration, location: TextRange, name: Identifier, container: Node): FunctionExpression { - const savedAncestorFacts = ancestorFacts; const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node, container); convertedLoopState = undefined; - + const ancestorFacts = container && isClassLike(container) && !hasModifier(node, ModifierFlags.Static) + ? enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes | HierarchyFacts.NonStaticClassElement) + : enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes); const expression = setOriginalNode( createFunctionExpression( /*modifiers*/ undefined, @@ -1648,8 +1658,7 @@ namespace ts { ), /*original*/ node ); - - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; return expression; } @@ -1745,16 +1754,16 @@ namespace ts { } function visitBlock(node: Block, isFunctionBody: boolean): Block { - if (!isFunctionBody) { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.BlockExcludes, AncestorFacts.BlockIncludes, node); - const updated = visitEachChild(node, visitor, context); - ancestorFacts = savedAncestorFacts; - return updated; + if (isFunctionBody) { + // A function body is not a block scope. + return visitEachChild(node, visitor, context); } - - // A function body is not a block scope. - return visitEachChild(node, visitor, context); + const ancestorFacts = hierarchyFacts & HierarchyFacts.IterationStatement + ? enterSubtree(HierarchyFacts.IterationStatementBlockExcludes, HierarchyFacts.IterationStatementBlockIncludes) + : enterSubtree(HierarchyFacts.BlockExcludes, HierarchyFacts.BlockIncludes); + const updated = visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); + return updated; } /** @@ -1814,13 +1823,9 @@ namespace ts { } function visitVariableStatement(node: VariableStatement): Statement { - const savedAncestorFacts = ancestorFacts; - if (hasModifier(node, ModifierFlags.Export)) { - ancestorFacts |= AncestorFacts.ExportedVariableStatement; - } - + const ancestorFacts = enterSubtree(HierarchyFacts.None, hasModifier(node, ModifierFlags.Export) ? HierarchyFacts.ExportedVariableStatement : HierarchyFacts.None); let updated: Statement; - if (convertedLoopState && (getCombinedNodeFlags(node.declarationList) & NodeFlags.BlockScoped) == 0) { + if (convertedLoopState && (node.declarationList.flags & NodeFlags.BlockScoped) === 0) { // we are inside a converted loop - hoist variable declarations let assignments: Expression[]; for (const decl of node.declarationList.declarations) { @@ -1853,7 +1858,7 @@ namespace ts { updated = visitEachChild(node, visitor, context); } - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } @@ -1942,18 +1947,18 @@ namespace ts { const isCapturedInFunction = flags & NodeCheckFlags.CapturedBlockScopedBinding; const isDeclaredInLoop = flags & NodeCheckFlags.BlockScopedBindingInLoop; const emittedAsTopLevel = - (ancestorFacts & AncestorFacts.TopLevel) !== 0 + (hierarchyFacts & HierarchyFacts.TopLevel) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && (ancestorFacts & AncestorFacts.IterationStatementBlock) !== 0); + && (hierarchyFacts & HierarchyFacts.IterationStatementBlock) !== 0); const emitExplicitInitializer = !emittedAsTopLevel - && (ancestorFacts & AncestorFacts.ForInOrForOfStatement) === 0 + && (hierarchyFacts & HierarchyFacts.ForInOrForOfStatement) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && (ancestorFacts & (AncestorFacts.ForStatement | AncestorFacts.ForInOrForOfStatement)) === 0)); + && (hierarchyFacts & (HierarchyFacts.ForStatement | HierarchyFacts.ForInOrForOfStatement)) === 0)); return emitExplicitInitializer; } @@ -1987,9 +1992,7 @@ namespace ts { * @param node A VariableDeclaration node. */ function visitVariableDeclaration(node: VariableDeclaration): VisitResult { - const savedAncestorFacts = ancestorFacts; - ancestorFacts &= ~AncestorFacts.ExportedVariableStatement; - + const ancestorFacts = enterSubtree(HierarchyFacts.ExportedVariableStatement, HierarchyFacts.None); let updated: VisitResult; if (isBindingPattern(node.name)) { updated = flattenDestructuringBinding( @@ -1998,91 +2001,70 @@ namespace ts { context, FlattenLevel.All, /*value*/ undefined, - (savedAncestorFacts & AncestorFacts.ExportedVariableStatement) !== 0 + (ancestorFacts & HierarchyFacts.ExportedVariableStatement) !== 0 ); } else { updated = visitEachChild(node, visitor, context); } - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } - function visitLabeledStatement(node: LabeledStatement): VisitResult { - const statement = unwrapInnermostStatmentOfLabel(node); - return isIterationStatement(statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(statement) - ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) - : restoreEnclosingLabel(visitNode(statement, visitor, isStatement), node); + function recordLabel(node: LabeledStatement) { + convertedLoopState.labels[node.label.text] = node.label.text; } - function unwrapInnermostStatmentOfLabel(node: LabeledStatement) { + function resetLabel(node: LabeledStatement) { + convertedLoopState.labels[node.label.text] = undefined; + } + + function visitLabeledStatement(node: LabeledStatement): VisitResult { if (convertedLoopState && !convertedLoopState.labels) { convertedLoopState.labels = createMap(); } - while (true) { - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = node.label.text; - } - if (node.statement.kind !== SyntaxKind.LabeledStatement) { - return node.statement; - } - node = node.statement; - } + const statement = unwrapInnermostStatmentOfLabel(node, convertedLoopState && recordLabel); + return isIterationStatement(statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(statement) + ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) + : restoreEnclosingLabel(visitNode(statement, visitor, isStatement), node, convertedLoopState && resetLabel); } - function restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement): Statement { - if (!outermostLabeledStatement) { - return node; - } - if (convertedLoopState) { - convertedLoopState.labels[outermostLabeledStatement.label.text] = undefined; - } - return updateLabel( - outermostLabeledStatement, - outermostLabeledStatement.label, - outermostLabeledStatement.statement.kind === SyntaxKind.LabeledStatement - ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) - : node - ); - } - - function visitIterationStatementWithFacts(excludeFacts: AncestorFacts, includeFacts: AncestorFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter) { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(excludeFacts, includeFacts, node); + function visitIterationStatementWithFacts(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter) { + const ancestorFacts = enterSubtree(excludeFacts, includeFacts); const updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } function visitDoOrWhileStatement(node: DoStatement | WhileStatement, outermostLabeledStatement: LabeledStatement) { return visitIterationStatementWithFacts( - AncestorFacts.DoOrWhileStatementExcludes, - AncestorFacts.DoOrWhileStatementIncludes, + HierarchyFacts.DoOrWhileStatementExcludes, + HierarchyFacts.DoOrWhileStatementIncludes, node, outermostLabeledStatement); } function visitForStatement(node: ForStatement, outermostLabeledStatement: LabeledStatement) { return visitIterationStatementWithFacts( - AncestorFacts.ForStatementExcludes, - AncestorFacts.ForStatementIncludes, + HierarchyFacts.ForStatementExcludes, + HierarchyFacts.ForStatementIncludes, node, outermostLabeledStatement); } function visitForInStatement(node: ForInStatement, outermostLabeledStatement: LabeledStatement) { return visitIterationStatementWithFacts( - AncestorFacts.ForInOrForOfStatementExcludes, - AncestorFacts.ForInOrForOfStatementIncludes, + HierarchyFacts.ForInOrForOfStatementExcludes, + HierarchyFacts.ForInOrForOfStatementIncludes, node, outermostLabeledStatement); } function visitForOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement): VisitResult { return visitIterationStatementWithFacts( - AncestorFacts.ForInOrForOfStatementExcludes, - AncestorFacts.ForInOrForOfStatementIncludes, + HierarchyFacts.ForInOrForOfStatementExcludes, + HierarchyFacts.ForInOrForOfStatementIncludes, node, outermostLabeledStatement, convertForOfToFor); @@ -2255,7 +2237,7 @@ namespace ts { // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. setEmitFlags(forStatement, EmitFlags.NoTokenTrailingSourceMaps); - return restoreEnclosingLabel(forStatement, outermostLabeledStatement); + return restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); } function visitIterationStatement(node: IterationStatement, outermostLabeledStatement: LabeledStatement) { @@ -2288,7 +2270,7 @@ namespace ts { let numInitialPropertiesWithoutYield = numProperties; for (let i = 0; i < numProperties; i++) { const property = properties[i]; - if ((property.transformFlags & TransformFlags.ContainsYield && ancestorFacts & AncestorFacts.AsyncFunctionBody) + if ((property.transformFlags & TransformFlags.ContainsYield && hierarchyFacts & HierarchyFacts.AsyncFunctionBody) && i < numInitialPropertiesWithoutYield) { numInitialPropertiesWithoutYield = i; } @@ -2377,7 +2359,7 @@ namespace ts { const result = convert ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined) - : restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement); + : restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; @@ -2453,7 +2435,7 @@ namespace ts { } const isAsyncBlockContainingAwait = - ancestorFacts & AncestorFacts.AsyncFunctionBody + hierarchyFacts & HierarchyFacts.AsyncFunctionBody && (node.statement.transformFlags & TransformFlags.ContainsYield) !== 0; let loopBodyFlags: EmitFlags = 0; @@ -2592,7 +2574,7 @@ namespace ts { // reset and re-aggregate the transform flags clone.transformFlags = 0; aggregateTransformFlags(clone); - loop = restoreEnclosingLabel(clone, outermostLabeledStatement); + loop = restoreEnclosingLabel(clone, outermostLabeledStatement, convertedLoopState && resetLabel); } statements.push(loop); @@ -2839,6 +2821,7 @@ namespace ts { * @param receiver The receiver for the assignment. */ function transformObjectLiteralMethodDeclarationToExpression(method: MethodDeclaration, receiver: Expression, container: Node, startsOnNewLine: boolean) { + const ancestorFacts = enterSubtree(HierarchyFacts.None, HierarchyFacts.None); const expression = createAssignment( createMemberAccessForPropertyName( receiver, @@ -2850,12 +2833,12 @@ namespace ts { if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return expression; } function visitCatchClause(node: CatchClause): CatchClause { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.BlockScopeExcludes, AncestorFacts.BlockScopeIncludes); + const ancestorFacts = enterSubtree(HierarchyFacts.BlockScopeExcludes, HierarchyFacts.BlockScopeIncludes); let updated: CatchClause; if (isBindingPattern(node.variableDeclaration.name)) { const temp = createTempVariable(undefined); @@ -2874,7 +2857,8 @@ namespace ts { else { updated = visitEachChild(node, visitor, context); } - ancestorFacts = savedAncestorFacts; + + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } @@ -2909,15 +2893,12 @@ namespace ts { * @param node An AccessorDeclaration node. */ function visitAccessorDeclaration(node: AccessorDeclaration): AccessorDeclaration { - const savedAncestorFacts = ancestorFacts; + Debug.assert(!isComputedPropertyName(node.name)); const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); convertedLoopState = undefined; - + const ancestorFacts = enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes); const updated = visitEachChild(node, visitor, context); - - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; return updated; } @@ -2936,7 +2917,10 @@ namespace ts { } function visitComputedPropertyName(node: ComputedPropertyName) { - return visitEachChild(node, visitor, context); + const ancestorFacts = enterSubtree(HierarchyFacts.ComputedPropertyNameExcludes, HierarchyFacts.ComputedPropertyNameIncludes); + const updated = visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); + return updated; } /** @@ -3308,7 +3292,7 @@ namespace ts { * Visits the `super` keyword */ function visitSuperKeyword(isExpressionOfCall: boolean): LeftHandSideExpression { - return ancestorFacts & AncestorFacts.NonStaticClassElement + return hierarchyFacts & HierarchyFacts.NonStaticClassElement && !isExpressionOfCall ? createPropertyAccess(createIdentifier("_super"), "prototype") : createIdentifier("_super"); @@ -3322,10 +3306,13 @@ namespace ts { function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis && isFunctionLike(node)) { // If we are tracking a captured `this`, keep track of the enclosing function. - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + const ancestorFacts = enterSubtree( + HierarchyFacts.FunctionExcludes, + getEmitFlags(node) & EmitFlags.CapturesThis + ? HierarchyFacts.FunctionIncludes | HierarchyFacts.CapturesThis + : HierarchyFacts.FunctionIncludes); previousOnEmitNode(emitContext, node, emitCallback); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return; } previousOnEmitNode(emitContext, node, emitCallback); @@ -3456,7 +3443,7 @@ namespace ts { */ function substituteThisKeyword(node: PrimaryExpression): PrimaryExpression { if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis - && ancestorFacts & AncestorFacts.CapturesThis) { + && hierarchyFacts & HierarchyFacts.CapturesThis) { return createIdentifier("_this", /*location*/ node); } return node; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index d068a303cb4..3e10ffdddd4 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -900,16 +900,15 @@ namespace ts { return false; } - export function getAllLabeledStatements(node: LabeledStatement): { statement: Statement; labeledStatements: LabeledStatement[]; } { - switch (node.statement.kind) { - case SyntaxKind.LabeledStatement: - const result = getAllLabeledStatements(node.statement); - if (result) { - result.labeledStatements.push(node); - } - return result; - default: - return { statement: node.statement, labeledStatements: [node] }; + export function unwrapInnermostStatmentOfLabel(node: LabeledStatement, beforeUnwrapLabelCallback?: (node: LabeledStatement) => void) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== SyntaxKind.LabeledStatement) { + return node.statement; + } + node = node.statement; } } From 7bf73be7fe58686309416e817614e5ccf4581e03 Mon Sep 17 00:00:00 2001 From: Andrew Ochsner Date: Mon, 19 Dec 2016 23:05:30 -0600 Subject: [PATCH 087/125] space-before-function-paren Adding option InsertSpaceBeforeFunctionParenthesis Should be optional Typically used to support http://eslint.org/docs/rules/space-before-function-paren Fixes #12234 --- src/server/protocol.ts | 1 + src/server/utilities.ts | 1 + src/services/formatting/rules.ts | 3 ++- src/services/formatting/rulesProvider.ts | 7 +++++++ src/services/types.ts | 2 ++ .../fourslash/formattingSpaceBeforeFunctionParen.ts | 13 +++++++++++++ 6 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/formattingSpaceBeforeFunctionParen.ts diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 39012e49fcd..f38862befce 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -2200,6 +2200,7 @@ namespace ts.server.protocol { insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; } diff --git a/src/server/utilities.ts b/src/server/utilities.ts index 839e79268fa..f15a494b5c4 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -87,6 +87,7 @@ namespace ts.server { insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, + insertSpaceBeforeFunctionParenthesis: false, placeOpenBraceOnNewLineForFunctions: false, placeOpenBraceOnNewLineForControlBlocks: false, }; diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 2095f062bd1..869f84d2653 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -87,6 +87,7 @@ namespace ts.formatting { public SpaceAfterLetConstInVariableDeclaration: Rule; public NoSpaceBeforeOpenParenInFuncCall: Rule; public SpaceAfterFunctionInFuncDecl: Rule; + public SpaceBeforeOpenParenInFuncDecl: Rule; public NoSpaceBeforeOpenParenInFuncDecl: Rule; public SpaceAfterVoidOperator: Rule; @@ -329,6 +330,7 @@ namespace ts.formatting { this.SpaceAfterLetConstInVariableDeclaration = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.LetKeyword, SyntaxKind.ConstKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), RuleAction.Space)); this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), RuleAction.Delete)); this.SpaceAfterFunctionInFuncDecl = new Rule(RuleDescriptor.create3(SyntaxKind.FunctionKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space)); + this.SpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Space)); this.NoSpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Delete)); this.SpaceAfterVoidOperator = new Rule(RuleDescriptor.create3(SyntaxKind.VoidKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), RuleAction.Space)); @@ -462,7 +464,6 @@ namespace ts.formatting { this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; diff --git a/src/services/formatting/rulesProvider.ts b/src/services/formatting/rulesProvider.ts index 4a2c9d0f155..f999b780e87 100644 --- a/src/services/formatting/rulesProvider.ts +++ b/src/services/formatting/rulesProvider.ts @@ -128,6 +128,13 @@ namespace ts.formatting { rules.push(this.globalRules.NoSpaceAfterBinaryOperator); } + if (options.insertSpaceBeforeFunctionParenthesis) { + rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl); + } + else { + rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl); + } + if (options.placeOpenBraceOnNewLineForControlBlocks) { rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); } diff --git a/src/services/types.ts b/src/services/types.ts index 3865fe7fac9..ac7d422a299 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -426,6 +426,7 @@ namespace ts { InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; InsertSpaceAfterTypeAssertion?: boolean; + InsertSpaceBeforeFunctionParenthesis?: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; } @@ -442,6 +443,7 @@ namespace ts { insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; insertSpaceAfterTypeAssertion?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; } diff --git a/tests/cases/fourslash/formattingSpaceBeforeFunctionParen.ts b/tests/cases/fourslash/formattingSpaceBeforeFunctionParen.ts new file mode 100644 index 00000000000..4b21a3f0389 --- /dev/null +++ b/tests/cases/fourslash/formattingSpaceBeforeFunctionParen.ts @@ -0,0 +1,13 @@ +/// + +/////*1*/function foo() { } +/////*2*/function boo () { } + +format.setOption("InsertSpaceBeforeFunctionParenthesis", true); + +format.document(); + +goTo.marker('1'); +verify.currentLineContentIs('function foo () { }'); +goTo.marker('2'); +verify.currentLineContentIs('function boo () { }'); \ No newline at end of file From 3b3d71542c045f5f8228f8c795ff2a18db36df66 Mon Sep 17 00:00:00 2001 From: Andrew Ochsner Date: Tue, 20 Dec 2016 10:05:10 -0600 Subject: [PATCH 088/125] Add InsertSpaceAfterConstructor option & additonal test cases Fixes #12234 --- src/harness/fourslash.ts | 1 + src/server/protocol.ts | 1 + src/server/utilities.ts | 1 + src/services/formatting/rules.ts | 4 +++- src/services/formatting/rulesProvider.ts | 7 +++++++ src/services/types.ts | 2 ++ .../fourslash/formattingSpaceBeforeFunctionParen.ts | 8 +++++++- .../cases/fourslash/formattingSpacesAfterConstructor.ts | 9 ++++++++- 8 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 7c7a06db0b6..653b87236fd 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -341,6 +341,7 @@ namespace FourSlash { insertSpaceAfterCommaDelimiter: true, insertSpaceAfterSemicolonInForStatements: true, insertSpaceBeforeAndAfterBinaryOperators: true, + insertSpaceAfterConstructor: false, insertSpaceAfterKeywordsInControlFlowStatements: true, insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, diff --git a/src/server/protocol.ts b/src/server/protocol.ts index f38862befce..680b81dff99 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -2194,6 +2194,7 @@ namespace ts.server.protocol { insertSpaceAfterCommaDelimiter?: boolean; insertSpaceAfterSemicolonInForStatements?: boolean; insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; diff --git a/src/server/utilities.ts b/src/server/utilities.ts index f15a494b5c4..641ca128e63 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -78,6 +78,7 @@ namespace ts.server { newLineCharacter: host.newLine || "\n", convertTabsToSpaces: true, indentStyle: ts.IndentStyle.Smart, + insertSpaceAfterConstructor: false, insertSpaceAfterCommaDelimiter: true, insertSpaceAfterSemicolonInForStatements: true, insertSpaceBeforeAndAfterBinaryOperators: true, diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 869f84d2653..be592174d2e 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -113,6 +113,7 @@ namespace ts.formatting { // TypeScript-specific rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses + public SpaceAfterConstructor: Rule; public NoSpaceAfterConstructor: Rule; // Use of module as a function call. e.g.: import m2 = module("m2"); @@ -354,6 +355,7 @@ namespace ts.formatting { // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses + this.SpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); this.NoSpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // Use of module as a function call. e.g.: import m2 = module("m2"); @@ -439,7 +441,7 @@ namespace ts.formatting { this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute, // TypeScript-specific rules - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceBeforeArrow, this.SpaceAfterArrow, diff --git a/src/services/formatting/rulesProvider.ts b/src/services/formatting/rulesProvider.ts index f999b780e87..14e08e4857a 100644 --- a/src/services/formatting/rulesProvider.ts +++ b/src/services/formatting/rulesProvider.ts @@ -38,6 +38,13 @@ namespace ts.formatting { private createActiveRules(options: ts.FormatCodeSettings): Rule[] { let rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.insertSpaceAfterConstructor) { + rules.push(this.globalRules.SpaceAfterConstructor); + } + else { + rules.push(this.globalRules.NoSpaceAfterConstructor); + } + if (options.insertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); } diff --git a/src/services/types.ts b/src/services/types.ts index ac7d422a299..88ffe2950ce 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -418,6 +418,7 @@ namespace ts { InsertSpaceAfterCommaDelimiter: boolean; InsertSpaceAfterSemicolonInForStatements: boolean; InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterConstructor?: boolean; InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; @@ -435,6 +436,7 @@ namespace ts { insertSpaceAfterCommaDelimiter?: boolean; insertSpaceAfterSemicolonInForStatements?: boolean; insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; diff --git a/tests/cases/fourslash/formattingSpaceBeforeFunctionParen.ts b/tests/cases/fourslash/formattingSpaceBeforeFunctionParen.ts index 4b21a3f0389..ce85521879e 100644 --- a/tests/cases/fourslash/formattingSpaceBeforeFunctionParen.ts +++ b/tests/cases/fourslash/formattingSpaceBeforeFunctionParen.ts @@ -2,6 +2,8 @@ /////*1*/function foo() { } /////*2*/function boo () { } +/////*3*/var bar = function foo() { }; +/////*4*/var foo = { bar() { } }; format.setOption("InsertSpaceBeforeFunctionParenthesis", true); @@ -10,4 +12,8 @@ format.document(); goTo.marker('1'); verify.currentLineContentIs('function foo () { }'); goTo.marker('2'); -verify.currentLineContentIs('function boo () { }'); \ No newline at end of file +verify.currentLineContentIs('function boo () { }'); +goTo.marker('3'); +verify.currentLineContentIs('var bar = function foo () { };'); +goTo.marker('4'); +verify.currentLineContentIs('var foo = { bar () { } };'); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingSpacesAfterConstructor.ts b/tests/cases/fourslash/formattingSpacesAfterConstructor.ts index 8df762def20..2195d74adbc 100644 --- a/tests/cases/fourslash/formattingSpacesAfterConstructor.ts +++ b/tests/cases/fourslash/formattingSpacesAfterConstructor.ts @@ -3,4 +3,11 @@ /////*1*/class test { constructor () { } } format.document(); goTo.marker("1"); -verify.currentLineContentIs("class test { constructor() { } }"); \ No newline at end of file +verify.currentLineContentIs("class test { constructor() { } }"); + +/////*2*/class test { constructor () { } } +format.setOption("InsertSpaceAfterConstructor", true); + +format.document(); +goTo.marker("2"); +verify.currentLineContentIs("class test { constructor () { } }"); \ No newline at end of file From 47bcfb3ddbdbf5e1df805884d8534b68332256af Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 20 Dec 2016 10:27:08 -0800 Subject: [PATCH 089/125] Guard against missing constraint in getModifiersTypeFromMappedType --- src/compiler/checker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1c22fc36207..36b952dd046 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4612,8 +4612,8 @@ namespace ts { // the modifiers type is T. Otherwise, the modifiers type is {}. const declaredType = getTypeFromMappedTypeNode(type.declaration); const constraint = getConstraintTypeFromMappedType(declaredType); - const extendedConstraint = constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint.flags & TypeFlags.Index ? instantiateType((extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType; + const extendedConstraint = constraint && constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & TypeFlags.Index ? instantiateType((extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType; } } return type.modifiersType; From e569edd8e6b80e6c1b7b8cca65b09deb1d88817d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 20 Dec 2016 10:27:34 -0800 Subject: [PATCH 090/125] Add regression test --- .../reference/mappedTypeErrors.errors.txt | 24 +++++++++++-- tests/baselines/reference/mappedTypeErrors.js | 35 ++++++++++++++++++- .../types/mapped/mappedTypeErrors.ts | 15 +++++++- 3 files changed, 70 insertions(+), 4 deletions(-) diff --git a/tests/baselines/reference/mappedTypeErrors.errors.txt b/tests/baselines/reference/mappedTypeErrors.errors.txt index f98a11dbaf9..94644a96af9 100644 --- a/tests/baselines/reference/mappedTypeErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeErrors.errors.txt @@ -45,9 +45,11 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(130,5): error TS2322: T tests/cases/conformance/types/mapped/mappedTypeErrors.ts(131,5): error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'. Types of property 'a' are incompatible. Type 'string' is not assignable to type 'number | undefined'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(137,16): error TS2322: Type '{}' is not assignable to type 'string'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(137,21): error TS2536: Type 'P' cannot be used to index type 'T'. -==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (24 errors) ==== +==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (26 errors) ==== interface Shape { name: string; @@ -249,4 +251,22 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(131,5): error TS2322: T ~~ !!! error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'. !!! error TS2322: Types of property 'a' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. + + // Repro from #13044 + + type Foo2 = { + pf: {[P in F]?: T[P]}, + pt: {[P in T]?: T[P]}, // note: should be in keyof T + ~ +!!! error TS2322: Type '{}' is not assignable to type 'string'. + ~~~~ +!!! error TS2536: Type 'P' cannot be used to index type 'T'. + }; + type O = {x: number, y: boolean}; + let o: O = {x: 5, y: false}; + let f: Foo2 = { + pf: {x: 7}, + pt: {x: 7, y: false}, + }; + \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeErrors.js b/tests/baselines/reference/mappedTypeErrors.js index 83dc235c705..f194b6193fc 100644 --- a/tests/baselines/reference/mappedTypeErrors.js +++ b/tests/baselines/reference/mappedTypeErrors.js @@ -129,7 +129,21 @@ type T2 = { a?: number, [key: string]: any }; let x1: T2 = { a: 'no' }; // Error let x2: Partial = { a: 'no' }; // Error -let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error +let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error + +// Repro from #13044 + +type Foo2 = { + pf: {[P in F]?: T[P]}, + pt: {[P in T]?: T[P]}, // note: should be in keyof T +}; +type O = {x: number, y: boolean}; +let o: O = {x: 5, y: false}; +let f: Foo2 = { + pf: {x: 7}, + pt: {x: 7, y: false}, +}; + //// [mappedTypeErrors.js] function f1(x) { @@ -204,6 +218,11 @@ c.setState({ c: true }); // Error var x1 = { a: 'no' }; // Error var x2 = { a: 'no' }; // Error var x3 = { a: 'no' }; // Error +var o = { x: 5, y: false }; +var f = { + pf: { x: 7 }, + pt: { x: 7, y: false } +}; //// [mappedTypeErrors.d.ts] @@ -268,3 +287,17 @@ declare let x2: Partial; declare let x3: { [P in keyof T2]: T2[P]; }; +declare type Foo2 = { + pf: { + [P in F]?: T[P]; + }; + pt: { + [P in T]?: T[P]; + }; +}; +declare type O = { + x: number; + y: boolean; +}; +declare let o: O; +declare let f: Foo2; diff --git a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts index 458dbe9caa4..cec1fbf8395 100644 --- a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts +++ b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts @@ -130,4 +130,17 @@ type T2 = { a?: number, [key: string]: any }; let x1: T2 = { a: 'no' }; // Error let x2: Partial = { a: 'no' }; // Error -let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error \ No newline at end of file +let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error + +// Repro from #13044 + +type Foo2 = { + pf: {[P in F]?: T[P]}, + pt: {[P in T]?: T[P]}, // note: should be in keyof T +}; +type O = {x: number, y: boolean}; +let o: O = {x: 5, y: false}; +let f: Foo2 = { + pf: {x: 7}, + pt: {x: 7, y: false}, +}; From bf94a4ae415c77d0159e383eb691837400418f54 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 20 Dec 2016 12:39:56 -0800 Subject: [PATCH 091/125] Change function name --- src/compiler/moduleNameResolver.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 820abb73787..4291f05f24b 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -680,7 +680,7 @@ namespace ts { // A package.json "typings" may specify an exact filename, or may choose to omit an extension. const fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures, state); if (fromExactFile) { - const resolved = fromExactFile && resolvedFromSuspiciousFile(extensions, fromExactFile); + const resolved = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile); if (resolved) { return resolved; } @@ -709,7 +709,7 @@ namespace ts { } /** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */ - function resolvedFromSuspiciousFile(extensions: Extensions, path: string): Resolved | undefined { + function resolvedIfExtensionMatches(extensions: Extensions, path: string): Resolved | undefined { const extension = tryGetExtensionFromPath(path); return extension !== undefined && extensionIsOk(extensions, extension) ? { path, extension } : undefined; } From dc94264220d595ba6fd329612cd90ba9227774af Mon Sep 17 00:00:00 2001 From: Dan Corder Date: Tue, 20 Dec 2016 22:32:37 +0000 Subject: [PATCH 092/125] Fix issue 12218 and linter error --- src/compiler/moduleNameResolver.ts | 2 +- src/services/formatting/rules.ts | 2 +- tests/cases/fourslash/formattingReadonly.ts | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 tests/cases/fourslash/formattingReadonly.ts diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 2a805a17494..09fb8eccbc6 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -322,7 +322,7 @@ namespace ts { if (traceEnabled) { trace(host, Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - let perFolderCache = cache && cache.getOrCreateCacheForDirectory(getDirectoryPath(containingFile)); + const perFolderCache = cache && cache.getOrCreateCacheForDirectory(getDirectoryPath(containingFile)); let result = perFolderCache && perFolderCache[moduleName]; if (result) { diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 2095f062bd1..8468d257dc4 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -358,7 +358,7 @@ namespace ts.formatting { this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword, SyntaxKind.TypeKeyword, SyntaxKind.FromKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.ReadonlyKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword, SyntaxKind.TypeKeyword, SyntaxKind.FromKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.FromKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { diff --git a/tests/cases/fourslash/formattingReadonly.ts b/tests/cases/fourslash/formattingReadonly.ts new file mode 100644 index 00000000000..e9ec9860032 --- /dev/null +++ b/tests/cases/fourslash/formattingReadonly.ts @@ -0,0 +1,12 @@ +/// + +////class C { +//// readonly property1 {};/*1*/ +//// public readonly property2 {};/*2*/ +////} + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs(" readonly property1 {};"); +goTo.marker("2"); +verify.currentLineContentIs(" public readonly property2 {};"); \ No newline at end of file From 1045f3bffb5dd7d5cddd40de22eeda08d8cb95c6 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 20 Dec 2016 19:25:25 -0800 Subject: [PATCH 093/125] detach root files on project close if project language service is disabled (#13077) --- .../unittests/tsserverProjectSystem.ts | 35 +++++++++++++++++++ src/server/project.ts | 5 +-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 13d8a6bf824..d379b5bbf9c 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -1840,6 +1840,41 @@ namespace ts.projectSystem { assert.isFalse(service.externalProjects[0].languageServiceEnabled, "language service should be disabled - 2"); }); + it("files are properly detached when language service is disabled", () => { + const f1 = { + path: "/a/app.js", + content: "var x = 1" + }; + const f2 = { + path: "/a/largefile.js", + content: "" + }; + const f3 = { + path: "/a/lib.js", + content: "var x = 1" + }; + const config = { + path: "/a/tsconfig.json", + content: JSON.stringify({ compilerOptions: { allowJs: true } }) + }; + const host = createServerHost([f1, f2, f3, config]); + const originalGetFileSize = host.getFileSize; + host.getFileSize = (filePath: string) => + filePath === f2.path ? server.maxProgramSizeForNonTsFiles + 1 : originalGetFileSize.call(host, filePath); + + const projectService = createProjectService(host); + projectService.openClientFile(f1.path); + projectService.checkNumberOfProjects({ configuredProjects: 1 }); + + projectService.closeClientFile(f1.path); + projectService.checkNumberOfProjects({}); + + for (const f of [f2, f3]) { + const scriptInfo = projectService.getScriptInfoForNormalizedPath(server.toNormalizedPath(f.path)); + assert.equal(scriptInfo.containingProjects.length, 0, `expect 0 containing projects for '${f.path}'`) + } + }); + it("language service disabled events are triggered", () => { const f1 = { path: "/a/app.js", diff --git a/src/server/project.ts b/src/server/project.ts index 0037a470a49..6085ee05159 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -257,8 +257,9 @@ namespace ts.server { info.detachFromProject(this); } } - else { - // release all root files + if (!this.program || !this.languageServiceEnabled) { + // release all root files either if there is no program or language service is disabled. + // in the latter case set of root files can be larger than the set of files in program. for (const root of this.rootFiles) { root.detachFromProject(this); } From cddc72a25e1a1cf524be872e1c26d3f1c8b13ce0 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 20:58:52 +0900 Subject: [PATCH 094/125] always give container --- src/services/formatting/formatting.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index bcd8cebb017..78ddfa5c6e9 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -566,7 +566,7 @@ namespace ts.formatting { if (tokenInfo.token.end > node.end) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); } function processChildNode( @@ -617,7 +617,7 @@ namespace ts.formatting { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } if (!formattingScanner.isOnToken()) { @@ -673,11 +673,11 @@ namespace ts.formatting { computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } else { // consume any tokens that precede the list as child elements of 'node' using its indentation scope - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent); } } } @@ -697,13 +697,13 @@ namespace ts.formatting { // without this check close paren will be interpreted as list end token for function expression which is wrong if (tokenInfo.token.kind === listEndToken && rangeContainsRange(parent, tokenInfo.token)) { // consume list end token - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } } } } - function consumeTokenAndAdvanceScanner(currentTokenInfo: TokenInfo, parent: Node, dynamicIndentation: DynamicIndentation, container?: Node): void { + function consumeTokenAndAdvanceScanner(currentTokenInfo: TokenInfo, parent: Node, dynamicIndentation: DynamicIndentation, container: Node): void { Debug.assert(rangeContainsRange(parent, currentTokenInfo.token)); const lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); From 54fb29b8b89f09f0c2d02e1679e4c84a26aab17a Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 21:01:03 +0900 Subject: [PATCH 095/125] format generic type alias --- src/services/formatting/rules.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 2095f062bd1..89250820c7c 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -829,6 +829,7 @@ namespace ts.formatting { switch (parent.kind) { case SyntaxKind.TypeReference: case SyntaxKind.TypeAssertionExpression: + case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: case SyntaxKind.InterfaceDeclaration: From bc59d6242b562a8312f66e1e345076fdf6d18e38 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 21:01:28 +0900 Subject: [PATCH 096/125] format [P in keyof T] --- src/services/formatting/rules.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 89250820c7c..408b4683fe9 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -358,7 +358,7 @@ namespace ts.formatting { this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword, SyntaxKind.TypeKeyword, SyntaxKind.FromKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); + this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword, SyntaxKind.TypeKeyword, SyntaxKind.FromKeyword, SyntaxKind.KeyOfKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.FromKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { @@ -575,6 +575,8 @@ namespace ts.formatting { return context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken; // "in" keyword in for (let x in []) { } case SyntaxKind.ForInStatement: + // "in" keyword in [P in keyof T]: T[P] + case SyntaxKind.TypeParameter: return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword; // Technically, "of" is not a binary operator, but format it the same way as "in" case SyntaxKind.ForOfStatement: From f4c33aaec4537deecf4f5a0587616b386be5be2f Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 21:01:47 +0900 Subject: [PATCH 097/125] indent inside mapped type --- src/services/formatting/formatting.ts | 6 ++++-- src/services/formatting/smartIndenter.ts | 1 + tests/cases/fourslash/formattingMappedType.ts | 12 ++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tests/cases/fourslash/formattingMappedType.ts diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 78ddfa5c6e9..8350b2a8dc8 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -488,14 +488,16 @@ namespace ts.formatting { // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent case SyntaxKind.OpenBraceToken: case SyntaxKind.CloseBraceToken: - case SyntaxKind.OpenBracketToken: - case SyntaxKind.CloseBracketToken: case SyntaxKind.OpenParenToken: case SyntaxKind.CloseParenToken: case SyntaxKind.ElseKeyword: case SyntaxKind.WhileKeyword: case SyntaxKind.AtToken: return indentation; + case SyntaxKind.OpenBracketToken: + case SyntaxKind.CloseBracketToken: + return (container.kind === SyntaxKind.MappedType) ? + indentation + getEffectiveDelta(delta, container) : indentation; default: // if token line equals to the line of containing node (this is a first token in the node) - use node indentation return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 84f83a9c7db..eb9e1ba04c5 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -438,6 +438,7 @@ namespace ts.formatting { case SyntaxKind.ModuleBlock: case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.TypeLiteral: + case SyntaxKind.MappedType: case SyntaxKind.TupleType: case SyntaxKind.CaseBlock: case SyntaxKind.DefaultClause: diff --git a/tests/cases/fourslash/formattingMappedType.ts b/tests/cases/fourslash/formattingMappedType.ts new file mode 100644 index 00000000000..a33d948a9c3 --- /dev/null +++ b/tests/cases/fourslash/formattingMappedType.ts @@ -0,0 +1,12 @@ +/// + +/////*generic*/type t < T > = { +/////*map*/ [ P in keyof T ] : T [ P ] +////}; + + +format.document(); +goTo.marker("generic"); +verify.currentLineContentIs("type t = {"); +goTo.marker("map"); +verify.currentLineContentIs(" [P in keyof T]: T[P]"); \ No newline at end of file From a4ec7d66eb94a651b739b057fd6e2b39552e8137 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 21:50:45 +0900 Subject: [PATCH 098/125] unindent dangling closing token --- src/services/formatting/formatting.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 78ddfa5c6e9..41630a77935 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -496,10 +496,19 @@ namespace ts.formatting { case SyntaxKind.WhileKeyword: case SyntaxKind.AtToken: return indentation; - default: - // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case SyntaxKind.SlashToken: + case SyntaxKind.GreaterThanToken: { + if (container.kind === SyntaxKind.JsxOpeningElement || + container.kind === SyntaxKind.JsxClosingElement || + container.kind === SyntaxKind.JsxSelfClosingElement + ) { + return indentation; + } + break; + } } + // if token line equals to the line of containing node (this is a first token in the node) - use node indentation + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: () => indentation, getDelta: child => getEffectiveDelta(delta, child), From ba7c1a13c3b9ea49d034ca07f42317e6a2bb158d Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 21:54:40 +0900 Subject: [PATCH 099/125] do not insert space after function expressions --- src/services/formatting/rules.ts | 9 ++++++++- .../cases/fourslash/formatVariableDeclarationList.ts | 2 +- tests/cases/fourslash/formattingJsxElements.ts | 11 ++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 2095f062bd1..f29890806b5 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -705,11 +705,18 @@ namespace ts.formatting { case SyntaxKind.ClassDeclaration: case SyntaxKind.ModuleDeclaration: case SyntaxKind.EnumDeclaration: - case SyntaxKind.Block: case SyntaxKind.CatchClause: case SyntaxKind.ModuleBlock: case SyntaxKind.SwitchStatement: return true; + case SyntaxKind.Block: { + const blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== SyntaxKind.ArrowFunction && + blockParent.kind !== SyntaxKind.FunctionExpression) + { + return true; + } + } } return false; } diff --git a/tests/cases/fourslash/formatVariableDeclarationList.ts b/tests/cases/fourslash/formatVariableDeclarationList.ts index 37392d38c62..089eceb1684 100644 --- a/tests/cases/fourslash/formatVariableDeclarationList.ts +++ b/tests/cases/fourslash/formatVariableDeclarationList.ts @@ -37,4 +37,4 @@ verify.currentLineContentIs(" x = 'Foo';"); goTo.marker("11"); verify.currentLineContentIs(" return fun;"); goTo.marker("12"); -verify.currentLineContentIs(" } (fun1));"); +verify.currentLineContentIs(" }(fun1));"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingJsxElements.ts b/tests/cases/fourslash/formattingJsxElements.ts index 2b3b396ed4c..a27bc809456 100644 --- a/tests/cases/fourslash/formattingJsxElements.ts +++ b/tests/cases/fourslash/formattingJsxElements.ts @@ -72,6 +72,8 @@ ////) ;/*closingParenInJsxElement2*/ ////;/*jsxExpressionSpaces*/ ////;/*jsxExpressionSpaces2*/ +//// {}}/*jsxExpressionSpaces3*/ +/////>;/*jsxDanglingSelfClosingToken*/ format.document(); goTo.marker("autoformat"); @@ -120,8 +122,7 @@ goTo.marker("expressionIndent"); verify.indentationIs(12); goTo.marker("danglingBracketAutoformat") -// TODO: verify.currentLineContentIs(" >"); -verify.currentLineContentIs(" >"); +verify.currentLineContentIs(" >"); goTo.marker("closingTagAutoformat"); verify.currentLineContentIs("
"); @@ -145,4 +146,8 @@ verify.currentLineContentIs(") ;"); goTo.marker("jsxExpressionSpaces"); verify.currentLineContentIs(";"); goTo.marker("jsxExpressionSpaces2"); -verify.currentLineContentIs(";"); \ No newline at end of file +verify.currentLineContentIs(";"); +goTo.marker("jsxExpressionSpaces3"); +verify.currentLineContentIs(" { }}"); +goTo.marker("jsxDanglingSelfClosingToken"); +verify.currentLineContentIs("/>;"); \ No newline at end of file From 2576ea1cf5d03f9ffa6471539f338c69279156e9 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 22:16:00 +0900 Subject: [PATCH 100/125] fix linter alert --- src/services/formatting/rules.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index f29890806b5..18125932a11 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -712,8 +712,8 @@ namespace ts.formatting { case SyntaxKind.Block: { const blockParent = context.currentTokenParent.parent; if (blockParent.kind !== SyntaxKind.ArrowFunction && - blockParent.kind !== SyntaxKind.FunctionExpression) - { + blockParent.kind !== SyntaxKind.FunctionExpression + ) { return true; } } From 32568b3fc2f6a33b739db0251b034fb36a893e17 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Dec 2016 09:45:04 -0800 Subject: [PATCH 101/125] Test case when module member is object spread pattern --- .../unusedLocalsAndObjectSpread2.errors.txt | 35 ++++++++++++++++++ .../reference/unusedLocalsAndObjectSpread2.js | 37 +++++++++++++++++++ .../compiler/unusedLocalsAndObjectSpread2.ts | 18 +++++++++ 3 files changed, 90 insertions(+) create mode 100644 tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt create mode 100644 tests/baselines/reference/unusedLocalsAndObjectSpread2.js create mode 100644 tests/cases/compiler/unusedLocalsAndObjectSpread2.ts diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt new file mode 100644 index 00000000000..0908f5ce3b9 --- /dev/null +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt @@ -0,0 +1,35 @@ +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(4,5): error TS6133: 'children' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(5,13): error TS6133: '_a' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(6,6): error TS6133: 'rest' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(9,10): error TS6133: 'foo' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(13,8): error TS6133: 'rest' is declared but never used. + + +==== tests/cases/compiler/unusedLocalsAndObjectSpread2.ts (5 errors) ==== + + declare let props: any; + const { + children, // here! + ~~~~~~~~ +!!! error TS6133: 'children' is declared but never used. + active: _a, // here! + ~~ +!!! error TS6133: '_a' is declared but never used. + ...rest, + ~~~~ +!!! error TS6133: 'rest' is declared but never used. + } = props; + + function foo() { + ~~~ +!!! error TS6133: 'foo' is declared but never used. + const { + children, + active: _a, + ...rest, + ~~~~ +!!! error TS6133: 'rest' is declared but never used. + } = props; + } + + export const asdf = 123; \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread2.js b/tests/baselines/reference/unusedLocalsAndObjectSpread2.js new file mode 100644 index 00000000000..e6cd890abb7 --- /dev/null +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread2.js @@ -0,0 +1,37 @@ +//// [unusedLocalsAndObjectSpread2.ts] + +declare let props: any; +const { + children, // here! + active: _a, // here! + ...rest, +} = props; + +function foo() { + const { + children, + active: _a, + ...rest, + } = props; +} + +export const asdf = 123; + +//// [unusedLocalsAndObjectSpread2.js] +"use strict"; +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var children = props.children, // here! +_a = props.active, // here! +rest = __rest(props, ["children", "active"]); +function foo() { + var children = props.children, _a = props.active, rest = __rest(props, ["children", "active"]); +} +exports.asdf = 123; diff --git a/tests/cases/compiler/unusedLocalsAndObjectSpread2.ts b/tests/cases/compiler/unusedLocalsAndObjectSpread2.ts new file mode 100644 index 00000000000..e55c2042a41 --- /dev/null +++ b/tests/cases/compiler/unusedLocalsAndObjectSpread2.ts @@ -0,0 +1,18 @@ +//@noUnusedLocals:true + +declare let props: any; +const { + children, // here! + active: _a, // here! + ...rest, +} = props; + +function foo() { + const { + children, + active: _a, + ...rest, + } = props; +} + +export const asdf = 123; \ No newline at end of file From 330cceda17dcb2fbad6d85b257093e57603265bf Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 21 Dec 2016 10:02:28 -0800 Subject: [PATCH 102/125] cache results of module resolution for non-relative module names (#13047) * cache results of module resolution for non-relative module names * use cache to short-circuit failures --- src/compiler/moduleNameResolver.ts | 206 +++++++++++++++--- .../reference/cachedModuleResolution1.js | 16 ++ .../reference/cachedModuleResolution1.symbols | 13 ++ .../cachedModuleResolution1.trace.json | 46 ++++ .../reference/cachedModuleResolution1.types | 13 ++ .../reference/cachedModuleResolution2.js | 17 ++ .../reference/cachedModuleResolution2.symbols | 13 ++ .../cachedModuleResolution2.trace.json | 46 ++++ .../reference/cachedModuleResolution2.types | 13 ++ .../reference/cachedModuleResolution3.js | 16 ++ .../reference/cachedModuleResolution3.symbols | 13 ++ .../cachedModuleResolution3.trace.json | 21 ++ .../reference/cachedModuleResolution3.types | 13 ++ .../reference/cachedModuleResolution4.js | 17 ++ .../reference/cachedModuleResolution4.symbols | 13 ++ .../cachedModuleResolution4.trace.json | 21 ++ .../reference/cachedModuleResolution4.types | 13 ++ .../reference/cachedModuleResolution5.js | 16 ++ .../reference/cachedModuleResolution5.symbols | 13 ++ .../cachedModuleResolution5.trace.json | 46 ++++ .../reference/cachedModuleResolution5.types | 13 ++ .../cachedModuleResolution6.errors.txt | 14 ++ .../reference/cachedModuleResolution6.js | 13 ++ .../cachedModuleResolution6.trace.json | 102 +++++++++ .../cachedModuleResolution7.errors.txt | 15 ++ .../reference/cachedModuleResolution7.js | 14 ++ .../cachedModuleResolution7.trace.json | 92 ++++++++ .../cachedModuleResolution8.errors.txt | 14 ++ .../reference/cachedModuleResolution8.js | 13 ++ .../cachedModuleResolution8.trace.json | 57 +++++ .../cachedModuleResolution9.errors.txt | 16 ++ .../reference/cachedModuleResolution9.js | 15 ++ .../cachedModuleResolution9.trace.json | 47 ++++ .../cases/compiler/cachedModuleResolution1.ts | 11 + .../cases/compiler/cachedModuleResolution2.ts | 11 + .../cases/compiler/cachedModuleResolution3.ts | 11 + .../cases/compiler/cachedModuleResolution4.ts | 11 + .../cases/compiler/cachedModuleResolution5.ts | 11 + .../cases/compiler/cachedModuleResolution6.ts | 8 + .../cases/compiler/cachedModuleResolution7.ts | 8 + .../cases/compiler/cachedModuleResolution8.ts | 8 + .../cases/compiler/cachedModuleResolution9.ts | 9 + 42 files changed, 1067 insertions(+), 31 deletions(-) create mode 100644 tests/baselines/reference/cachedModuleResolution1.js create mode 100644 tests/baselines/reference/cachedModuleResolution1.symbols create mode 100644 tests/baselines/reference/cachedModuleResolution1.trace.json create mode 100644 tests/baselines/reference/cachedModuleResolution1.types create mode 100644 tests/baselines/reference/cachedModuleResolution2.js create mode 100644 tests/baselines/reference/cachedModuleResolution2.symbols create mode 100644 tests/baselines/reference/cachedModuleResolution2.trace.json create mode 100644 tests/baselines/reference/cachedModuleResolution2.types create mode 100644 tests/baselines/reference/cachedModuleResolution3.js create mode 100644 tests/baselines/reference/cachedModuleResolution3.symbols create mode 100644 tests/baselines/reference/cachedModuleResolution3.trace.json create mode 100644 tests/baselines/reference/cachedModuleResolution3.types create mode 100644 tests/baselines/reference/cachedModuleResolution4.js create mode 100644 tests/baselines/reference/cachedModuleResolution4.symbols create mode 100644 tests/baselines/reference/cachedModuleResolution4.trace.json create mode 100644 tests/baselines/reference/cachedModuleResolution4.types create mode 100644 tests/baselines/reference/cachedModuleResolution5.js create mode 100644 tests/baselines/reference/cachedModuleResolution5.symbols create mode 100644 tests/baselines/reference/cachedModuleResolution5.trace.json create mode 100644 tests/baselines/reference/cachedModuleResolution5.types create mode 100644 tests/baselines/reference/cachedModuleResolution6.errors.txt create mode 100644 tests/baselines/reference/cachedModuleResolution6.js create mode 100644 tests/baselines/reference/cachedModuleResolution6.trace.json create mode 100644 tests/baselines/reference/cachedModuleResolution7.errors.txt create mode 100644 tests/baselines/reference/cachedModuleResolution7.js create mode 100644 tests/baselines/reference/cachedModuleResolution7.trace.json create mode 100644 tests/baselines/reference/cachedModuleResolution8.errors.txt create mode 100644 tests/baselines/reference/cachedModuleResolution8.js create mode 100644 tests/baselines/reference/cachedModuleResolution8.trace.json create mode 100644 tests/baselines/reference/cachedModuleResolution9.errors.txt create mode 100644 tests/baselines/reference/cachedModuleResolution9.js create mode 100644 tests/baselines/reference/cachedModuleResolution9.trace.json create mode 100644 tests/cases/compiler/cachedModuleResolution1.ts create mode 100644 tests/cases/compiler/cachedModuleResolution2.ts create mode 100644 tests/cases/compiler/cachedModuleResolution3.ts create mode 100644 tests/cases/compiler/cachedModuleResolution4.ts create mode 100644 tests/cases/compiler/cachedModuleResolution5.ts create mode 100644 tests/cases/compiler/cachedModuleResolution6.ts create mode 100644 tests/cases/compiler/cachedModuleResolution7.ts create mode 100644 tests/cases/compiler/cachedModuleResolution8.ts create mode 100644 tests/cases/compiler/cachedModuleResolution9.ts diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index c2fcbddaa61..be8f4d6f0cb 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -149,6 +149,7 @@ namespace ts { if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -237,7 +238,8 @@ namespace ts { if (traceEnabled) { trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + const result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, /*cache*/ undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -293,24 +295,120 @@ namespace ts { * Cached module resolutions per containing directory. * This assumes that any module id will have the same resolution for sibling files located in the same folder. */ - export interface ModuleResolutionCache { + export interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache { getOrCreateCacheForDirectory(directoryName: string): Map; } - export function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string) { - const map = createFileMap>(); + /** + * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory + * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive. + */ + export interface NonRelativeModuleNameResolutionCache { + getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache; + } - return { getOrCreateCacheForDirectory }; + export interface PerModuleNameCache { + get(directory: string): ResolvedModuleWithFailedLookupLocations; + set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void; + } + + export function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache { + const directoryToModuleNameMap = createFileMap>(); + const moduleNameToDirectoryMap = createMap(); + + return { getOrCreateCacheForDirectory, getOrCreateCacheForModuleName }; function getOrCreateCacheForDirectory(directoryName: string) { const path = toPath(directoryName, currentDirectory, getCanonicalFileName); - let perFolderCache = map.get(path); + let perFolderCache = directoryToModuleNameMap.get(path); if (!perFolderCache) { perFolderCache = createMap(); - map.set(path, perFolderCache); + directoryToModuleNameMap.set(path, perFolderCache); } return perFolderCache; } + + function getOrCreateCacheForModuleName(nonRelativeModuleName: string) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + let perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + if (!perModuleNameCache) { + moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + } + return perModuleNameCache; + } + + function createPerModuleNameCache(): PerModuleNameCache { + const directoryPathMap = createFileMap(); + + return { get, set }; + + function get(directory: string): ResolvedModuleWithFailedLookupLocations { + return directoryPathMap.get(toPath(directory, currentDirectory, getCanonicalFileName)); + } + + /** + * At first this function add entry directory -> module resolution result to the table. + * Then it computes the set of parent folders for 'directory' that should have the same module resolution result + * and for every parent folder in set it adds entry: parent -> module resolution. . + * Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts. + * Set of parent folders that should have the same result will be: + * [ + * /a/b/c/d, /a/b/c, /a/b + * ] + * this means that request for module resolution from file in any of these folder will be immediately found in cache. + */ + function set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void { + const path = toPath(directory, currentDirectory, getCanonicalFileName); + // if entry is already in cache do nothing + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + + const resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + // find common prefix between directory and resolved file name + // this common prefix should be the shorted path that has the same resolution + // directory: /a/b/c/d/e + // resolvedFileName: /a/b/foo.d.ts + const commonPrefix = getCommonPrefix(path, resolvedFileName); + let current = path; + while (true) { + const parent = getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { + break; + } + directoryPathMap.set(parent, result); + current = parent; + + if (current == commonPrefix) { + break; + } + } + } + + function getCommonPrefix(directory: Path, resolution: string) { + if (resolution === undefined) { + return undefined; + } + const resolutionDirectory = toPath(getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + + // find first position where directory and resolution differs + let i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + + // find last directory separator before position i + const sep = directory.lastIndexOf(directorySeparator, i); + if (sep < 0) { + return undefined; + } + + return directory.substr(0, sep); + } + } } export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations { @@ -318,7 +416,8 @@ namespace ts { if (traceEnabled) { trace(host, Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - const perFolderCache = cache && cache.getOrCreateCacheForDirectory(getDirectoryPath(containingFile)); + const containingDirectory = getDirectoryPath(containingFile); + let perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); let result = perFolderCache && perFolderCache[moduleName]; if (result) { @@ -342,15 +441,20 @@ namespace ts { switch (moduleResolution) { case ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); break; case ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); break; } if (perFolderCache) { perFolderCache[moduleName] = result; + // put result in per-module name cache + const perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } } @@ -574,7 +678,7 @@ namespace ts { } } - export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { + export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations { const containingDirectory = getDirectoryPath(containingFile); const traceEnabled = isTraceEnabled(compilerOptions, host); @@ -582,30 +686,30 @@ namespace ts { const state: ModuleResolutionState = { compilerOptions, host, traceEnabled }; const result = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); - if (result) { - const { resolved, isExternalLibraryImport } = result; + if (result && result.value) { + const { resolved, isExternalLibraryImport } = result.value; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations }; - function tryResolve(extensions: Extensions): { resolved: Resolved, isExternalLibraryImport: boolean } | undefined { + function tryResolve(extensions: Extensions): SearchResult<{ resolved: Resolved, isExternalLibraryImport: boolean }> { const resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); if (resolved) { - return { resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { trace(host, Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); } - const resolved = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); + const resolved = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. - return resolved && { resolved: { path: realpath(resolved.path, host, traceEnabled), extension: resolved.extension }, isExternalLibraryImport: true }; + return resolved && { value: resolved.value && { resolved: { path: realpath(resolved.value.path, host, traceEnabled), extension: resolved.value.extension }, isExternalLibraryImport: true } }; } else { const candidate = normalizePath(combinePaths(containingDirectory, moduleName)); const resolved = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); - return resolved && { resolved, isExternalLibraryImport: false }; + return resolved && toSearchResult({ resolved, isExternalLibraryImport: false }); } } } @@ -775,18 +879,23 @@ namespace ts { loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState): Resolved | undefined { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false); + function loadModuleFromNodeModules(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState, cache: NonRelativeModuleNameResolutionCache): SearchResult { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false, cache); } - function loadModuleFromNodeModulesAtTypes(moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState): Resolved | undefined { + function loadModuleFromNodeModulesAtTypes(moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState): SearchResult { // Extensions parameter here doesn't actually matter, because typesOnly ensures we're just doing @types lookup, which is always DtsOnly. - return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true, /*cache*/ undefined); } - function loadModuleFromNodeModulesWorker(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState, typesOnly: boolean): Resolved | undefined { + function loadModuleFromNodeModulesWorker(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState, typesOnly: boolean, cache: NonRelativeModuleNameResolutionCache): SearchResult { + const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(normalizeSlashes(directory), ancestorDirectory => { if (getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } @@ -802,26 +911,41 @@ namespace ts { } } - export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { + function tryFindNonRelativeModuleNameInCache(cache: PerModuleNameCache | undefined, moduleName: string, containingDirectory: string, traceEnabled: boolean, host: ModuleResolutionHost): SearchResult { + const result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName) + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; + } + } + + export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations { const traceEnabled = isTraceEnabled(compilerOptions, host); const state: ModuleResolutionState = { compilerOptions, host, traceEnabled }; const failedLookupLocations: string[] = []; const containingDirectory = getDirectoryPath(containingFile); const resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); - return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ false, failedLookupLocations); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations); - function tryResolve(extensions: Extensions): Resolved | undefined { + function tryResolve(extensions: Extensions): SearchResult { const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { // Climb up parent directories looking for a module. const resolved = forEachAncestorDirectory(containingDirectory, directory => { + const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } const searchName = normalizePath(combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state)); }); if (resolved) { return resolved; @@ -833,7 +957,7 @@ namespace ts { } else { const candidate = normalizePath(combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state)); } } } @@ -854,8 +978,28 @@ namespace ts { return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations); } + /** + * Represents result of search. Normally when searching among several alternatives we treat value `undefined` as indicator + * that search fails and we should try another option. + * However this does not allow us to represent final result that should be used instead of further searching (i.e. a final result that was found in cache). + * SearchResult is used to deal with this issue, its values represents following outcomes: + * - undefined - not found, continue searching + * - { value: undefined } - not found - stop searching + * - { value: } - found - stop searching + */ + type SearchResult = { value: T | undefined } | undefined; + + /** + * Wraps value to SearchResult. + * @returns undefined if value is undefined or { value } otherwise + */ + function toSearchResult(value: T | undefined): SearchResult { + return value !== undefined ? { value } : undefined; + } + + /** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */ - function forEachAncestorDirectory(directory: string, callback: (directory: string) => T | undefined): T | undefined { + function forEachAncestorDirectory(directory: string, callback: (directory: string) => SearchResult): SearchResult { while (true) { const result = callback(directory); if (result !== undefined) { diff --git a/tests/baselines/reference/cachedModuleResolution1.js b/tests/baselines/reference/cachedModuleResolution1.js new file mode 100644 index 00000000000..9071b60d6c1 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution1.js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/cachedModuleResolution1.ts] //// + +//// [foo.d.ts] + +export declare let x: number + +//// [app.ts] +import {x} from "foo"; + +//// [lib.ts] +import {x} from "foo"; + +//// [app.js] +"use strict"; +//// [lib.js] +"use strict"; diff --git a/tests/baselines/reference/cachedModuleResolution1.symbols b/tests/baselines/reference/cachedModuleResolution1.symbols new file mode 100644 index 00000000000..f7d3c474a56 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution1.symbols @@ -0,0 +1,13 @@ +=== /a/b/node_modules/foo.d.ts === + +export declare let x: number +>x : Symbol(x, Decl(foo.d.ts, 1, 18)) + +=== /a/b/c/d/e/app.ts === +import {x} from "foo"; +>x : Symbol(x, Decl(app.ts, 0, 8)) + +=== /a/b/c/lib.ts === +import {x} from "foo"; +>x : Symbol(x, Decl(lib.ts, 0, 8)) + diff --git a/tests/baselines/reference/cachedModuleResolution1.trace.json b/tests/baselines/reference/cachedModuleResolution1.trace.json new file mode 100644 index 00000000000..dbb0e6068be --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution1.trace.json @@ -0,0 +1,46 @@ +[ + "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/a/b/c/d/e/node_modules/foo.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/d/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/node_modules/foo.ts' does not exist.", + "File '/a/b/c/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/node_modules/foo.ts' does not exist.", + "File '/a/b/node_modules/foo.tsx' does not exist.", + "File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========", + "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "Resolution for module 'foo' was found in cache", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution1.types b/tests/baselines/reference/cachedModuleResolution1.types new file mode 100644 index 00000000000..c041e8cc340 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution1.types @@ -0,0 +1,13 @@ +=== /a/b/node_modules/foo.d.ts === + +export declare let x: number +>x : number + +=== /a/b/c/d/e/app.ts === +import {x} from "foo"; +>x : number + +=== /a/b/c/lib.ts === +import {x} from "foo"; +>x : number + diff --git a/tests/baselines/reference/cachedModuleResolution2.js b/tests/baselines/reference/cachedModuleResolution2.js new file mode 100644 index 00000000000..7c84a92abaf --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution2.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/cachedModuleResolution2.ts] //// + +//// [foo.d.ts] + +export declare let x: number + +//// [lib.ts] +import {x} from "foo"; + +//// [app.ts] +import {x} from "foo"; + + +//// [lib.js] +"use strict"; +//// [app.js] +"use strict"; diff --git a/tests/baselines/reference/cachedModuleResolution2.symbols b/tests/baselines/reference/cachedModuleResolution2.symbols new file mode 100644 index 00000000000..c8356eadb11 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution2.symbols @@ -0,0 +1,13 @@ +=== /a/b/node_modules/foo.d.ts === + +export declare let x: number +>x : Symbol(x, Decl(foo.d.ts, 1, 18)) + +=== /a/b/c/lib.ts === +import {x} from "foo"; +>x : Symbol(x, Decl(lib.ts, 0, 8)) + +=== /a/b/c/d/e/app.ts === +import {x} from "foo"; +>x : Symbol(x, Decl(app.ts, 0, 8)) + diff --git a/tests/baselines/reference/cachedModuleResolution2.trace.json b/tests/baselines/reference/cachedModuleResolution2.trace.json new file mode 100644 index 00000000000..1d4b40bbc08 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution2.trace.json @@ -0,0 +1,46 @@ +[ + "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/a/b/c/node_modules/foo.ts' does not exist.", + "File '/a/b/c/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/node_modules/foo.ts' does not exist.", + "File '/a/b/node_modules/foo.tsx' does not exist.", + "File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========", + "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/a/b/c/d/e/node_modules/foo.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/d/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", + "Resolution for module 'foo' was found in cache", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution2.types b/tests/baselines/reference/cachedModuleResolution2.types new file mode 100644 index 00000000000..c5069e681c4 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution2.types @@ -0,0 +1,13 @@ +=== /a/b/node_modules/foo.d.ts === + +export declare let x: number +>x : number + +=== /a/b/c/lib.ts === +import {x} from "foo"; +>x : number + +=== /a/b/c/d/e/app.ts === +import {x} from "foo"; +>x : number + diff --git a/tests/baselines/reference/cachedModuleResolution3.js b/tests/baselines/reference/cachedModuleResolution3.js new file mode 100644 index 00000000000..032c1afee0e --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution3.js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/cachedModuleResolution3.ts] //// + +//// [foo.d.ts] + +export declare let x: number + +//// [app.ts] +import {x} from "foo"; + +//// [lib.ts] +import {x} from "foo"; + +//// [app.js] +"use strict"; +//// [lib.js] +"use strict"; diff --git a/tests/baselines/reference/cachedModuleResolution3.symbols b/tests/baselines/reference/cachedModuleResolution3.symbols new file mode 100644 index 00000000000..799ac6d8d84 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution3.symbols @@ -0,0 +1,13 @@ +=== /a/b/foo.d.ts === + +export declare let x: number +>x : Symbol(x, Decl(foo.d.ts, 1, 18)) + +=== /a/b/c/d/e/app.ts === +import {x} from "foo"; +>x : Symbol(x, Decl(app.ts, 0, 8)) + +=== /a/b/c/lib.ts === +import {x} from "foo"; +>x : Symbol(x, Decl(lib.ts, 0, 8)) + diff --git a/tests/baselines/reference/cachedModuleResolution3.trace.json b/tests/baselines/reference/cachedModuleResolution3.trace.json new file mode 100644 index 00000000000..2dbaea53f47 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution3.trace.json @@ -0,0 +1,21 @@ +[ + "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "File '/a/b/c/d/e/foo.ts' does not exist.", + "File '/a/b/c/d/e/foo.tsx' does not exist.", + "File '/a/b/c/d/e/foo.d.ts' does not exist.", + "File '/a/b/c/d/foo.ts' does not exist.", + "File '/a/b/c/d/foo.tsx' does not exist.", + "File '/a/b/c/d/foo.d.ts' does not exist.", + "File '/a/b/c/foo.ts' does not exist.", + "File '/a/b/c/foo.tsx' does not exist.", + "File '/a/b/c/foo.d.ts' does not exist.", + "File '/a/b/foo.ts' does not exist.", + "File '/a/b/foo.tsx' does not exist.", + "File '/a/b/foo.d.ts' exist - use it as a name resolution result.", + "======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========", + "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "Resolution for module 'foo' was found in cache", + "======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution3.types b/tests/baselines/reference/cachedModuleResolution3.types new file mode 100644 index 00000000000..f87abf1519e --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution3.types @@ -0,0 +1,13 @@ +=== /a/b/foo.d.ts === + +export declare let x: number +>x : number + +=== /a/b/c/d/e/app.ts === +import {x} from "foo"; +>x : number + +=== /a/b/c/lib.ts === +import {x} from "foo"; +>x : number + diff --git a/tests/baselines/reference/cachedModuleResolution4.js b/tests/baselines/reference/cachedModuleResolution4.js new file mode 100644 index 00000000000..6089de9706b --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution4.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/cachedModuleResolution4.ts] //// + +//// [foo.d.ts] + +export declare let x: number + +//// [lib.ts] +import {x} from "foo"; + +//// [app.ts] +import {x} from "foo"; + + +//// [lib.js] +"use strict"; +//// [app.js] +"use strict"; diff --git a/tests/baselines/reference/cachedModuleResolution4.symbols b/tests/baselines/reference/cachedModuleResolution4.symbols new file mode 100644 index 00000000000..a30e6bf74e5 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution4.symbols @@ -0,0 +1,13 @@ +=== /a/b/foo.d.ts === + +export declare let x: number +>x : Symbol(x, Decl(foo.d.ts, 1, 18)) + +=== /a/b/c/lib.ts === +import {x} from "foo"; +>x : Symbol(x, Decl(lib.ts, 0, 8)) + +=== /a/b/c/d/e/app.ts === +import {x} from "foo"; +>x : Symbol(x, Decl(app.ts, 0, 8)) + diff --git a/tests/baselines/reference/cachedModuleResolution4.trace.json b/tests/baselines/reference/cachedModuleResolution4.trace.json new file mode 100644 index 00000000000..7249d948e1c --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution4.trace.json @@ -0,0 +1,21 @@ +[ + "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "File '/a/b/c/foo.ts' does not exist.", + "File '/a/b/c/foo.tsx' does not exist.", + "File '/a/b/c/foo.d.ts' does not exist.", + "File '/a/b/foo.ts' does not exist.", + "File '/a/b/foo.tsx' does not exist.", + "File '/a/b/foo.d.ts' exist - use it as a name resolution result.", + "======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========", + "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "File '/a/b/c/d/e/foo.ts' does not exist.", + "File '/a/b/c/d/e/foo.tsx' does not exist.", + "File '/a/b/c/d/e/foo.d.ts' does not exist.", + "File '/a/b/c/d/foo.ts' does not exist.", + "File '/a/b/c/d/foo.tsx' does not exist.", + "File '/a/b/c/d/foo.d.ts' does not exist.", + "Resolution for module 'foo' was found in cache", + "======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution4.types b/tests/baselines/reference/cachedModuleResolution4.types new file mode 100644 index 00000000000..3689e57ca6d --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution4.types @@ -0,0 +1,13 @@ +=== /a/b/foo.d.ts === + +export declare let x: number +>x : number + +=== /a/b/c/lib.ts === +import {x} from "foo"; +>x : number + +=== /a/b/c/d/e/app.ts === +import {x} from "foo"; +>x : number + diff --git a/tests/baselines/reference/cachedModuleResolution5.js b/tests/baselines/reference/cachedModuleResolution5.js new file mode 100644 index 00000000000..33561e8eae2 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution5.js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/cachedModuleResolution5.ts] //// + +//// [foo.d.ts] + +export declare let x: number + +//// [app.ts] +import {x} from "foo"; + +//// [lib.ts] +import {x} from "foo"; + +//// [app.js] +"use strict"; +//// [lib.js] +"use strict"; diff --git a/tests/baselines/reference/cachedModuleResolution5.symbols b/tests/baselines/reference/cachedModuleResolution5.symbols new file mode 100644 index 00000000000..eb72f0c7a27 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution5.symbols @@ -0,0 +1,13 @@ +=== /a/b/node_modules/foo.d.ts === + +export declare let x: number +>x : Symbol(x, Decl(foo.d.ts, 1, 18)) + +=== /a/b/c/d/e/app.ts === +import {x} from "foo"; +>x : Symbol(x, Decl(app.ts, 0, 8)) + +=== /a/b/lib.ts === +import {x} from "foo"; +>x : Symbol(x, Decl(lib.ts, 0, 8)) + diff --git a/tests/baselines/reference/cachedModuleResolution5.trace.json b/tests/baselines/reference/cachedModuleResolution5.trace.json new file mode 100644 index 00000000000..d263465ff12 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution5.trace.json @@ -0,0 +1,46 @@ +[ + "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/a/b/c/d/e/node_modules/foo.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/d/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/node_modules/foo.ts' does not exist.", + "File '/a/b/c/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/node_modules/foo.ts' does not exist.", + "File '/a/b/node_modules/foo.tsx' does not exist.", + "File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========", + "======== Resolving module 'foo' from '/a/b/lib.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "Resolution for module 'foo' was found in cache", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution5.types b/tests/baselines/reference/cachedModuleResolution5.types new file mode 100644 index 00000000000..ad2640402f7 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution5.types @@ -0,0 +1,13 @@ +=== /a/b/node_modules/foo.d.ts === + +export declare let x: number +>x : number + +=== /a/b/c/d/e/app.ts === +import {x} from "foo"; +>x : number + +=== /a/b/lib.ts === +import {x} from "foo"; +>x : number + diff --git a/tests/baselines/reference/cachedModuleResolution6.errors.txt b/tests/baselines/reference/cachedModuleResolution6.errors.txt new file mode 100644 index 00000000000..b272ff29b9d --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution6.errors.txt @@ -0,0 +1,14 @@ +/a/b/c/d/e/app.ts(2,17): error TS2307: Cannot find module 'foo'. +/a/b/c/lib.ts(1,17): error TS2307: Cannot find module 'foo'. + + +==== /a/b/c/d/e/app.ts (1 errors) ==== + + import {x} from "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo'. + +==== /a/b/c/lib.ts (1 errors) ==== + import {x} from "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution6.js b/tests/baselines/reference/cachedModuleResolution6.js new file mode 100644 index 00000000000..f21f491a921 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution6.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/cachedModuleResolution6.ts] //// + +//// [app.ts] + +import {x} from "foo"; + +//// [lib.ts] +import {x} from "foo"; + +//// [app.js] +"use strict"; +//// [lib.js] +"use strict"; diff --git a/tests/baselines/reference/cachedModuleResolution6.trace.json b/tests/baselines/reference/cachedModuleResolution6.trace.json new file mode 100644 index 00000000000..02d52befc94 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution6.trace.json @@ -0,0 +1,102 @@ +[ + "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/a/b/c/d/e/node_modules/foo.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/d/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/node_modules/foo.ts' does not exist.", + "File '/a/b/c/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/node_modules/foo.ts' does not exist.", + "File '/a/b/node_modules/foo.tsx' does not exist.", + "File '/a/b/node_modules/foo.d.ts' does not exist.", + "File '/a/b/node_modules/foo/package.json' does not exist.", + "File '/a/b/node_modules/foo/index.ts' does not exist.", + "File '/a/b/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/node_modules/foo.ts' does not exist.", + "File '/a/node_modules/foo.tsx' does not exist.", + "File '/a/node_modules/foo.d.ts' does not exist.", + "File '/a/node_modules/foo/package.json' does not exist.", + "File '/a/node_modules/foo/index.ts' does not exist.", + "File '/a/node_modules/foo/index.tsx' does not exist.", + "File '/a/node_modules/foo/index.d.ts' does not exist.", + "File '/a/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/node_modules/@types/foo/package.json' does not exist.", + "File '/a/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/node_modules/foo.ts' does not exist.", + "File '/node_modules/foo.tsx' does not exist.", + "File '/node_modules/foo.d.ts' does not exist.", + "File '/node_modules/foo/package.json' does not exist.", + "File '/node_modules/foo/index.ts' does not exist.", + "File '/node_modules/foo/index.tsx' does not exist.", + "File '/node_modules/foo/index.d.ts' does not exist.", + "File '/node_modules/@types/foo.d.ts' does not exist.", + "File '/node_modules/@types/foo/package.json' does not exist.", + "File '/node_modules/@types/foo/index.d.ts' does not exist.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/a/b/c/d/e/node_modules/foo.js' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.jsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.js' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.jsx' does not exist.", + "File '/a/b/c/d/node_modules/foo.js' does not exist.", + "File '/a/b/c/d/node_modules/foo.jsx' does not exist.", + "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.js' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.jsx' does not exist.", + "File '/a/b/c/node_modules/foo.js' does not exist.", + "File '/a/b/c/node_modules/foo.jsx' does not exist.", + "File '/a/b/c/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/foo/index.js' does not exist.", + "File '/a/b/c/node_modules/foo/index.jsx' does not exist.", + "File '/a/b/node_modules/foo.js' does not exist.", + "File '/a/b/node_modules/foo.jsx' does not exist.", + "File '/a/b/node_modules/foo/package.json' does not exist.", + "File '/a/b/node_modules/foo/index.js' does not exist.", + "File '/a/b/node_modules/foo/index.jsx' does not exist.", + "File '/a/node_modules/foo.js' does not exist.", + "File '/a/node_modules/foo.jsx' does not exist.", + "File '/a/node_modules/foo/package.json' does not exist.", + "File '/a/node_modules/foo/index.js' does not exist.", + "File '/a/node_modules/foo/index.jsx' does not exist.", + "File '/node_modules/foo.js' does not exist.", + "File '/node_modules/foo.jsx' does not exist.", + "File '/node_modules/foo/package.json' does not exist.", + "File '/node_modules/foo/index.js' does not exist.", + "File '/node_modules/foo/index.jsx' does not exist.", + "======== Module name 'foo' was not resolved. ========", + "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "Resolution for module 'foo' was found in cache", + "======== Module name 'foo' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution7.errors.txt b/tests/baselines/reference/cachedModuleResolution7.errors.txt new file mode 100644 index 00000000000..670c4a665a6 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution7.errors.txt @@ -0,0 +1,15 @@ +/a/b/c/d/e/app.ts(1,17): error TS2307: Cannot find module 'foo'. +/a/b/c/lib.ts(2,17): error TS2307: Cannot find module 'foo'. + + +==== /a/b/c/lib.ts (1 errors) ==== + + import {x} from "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo'. + +==== /a/b/c/d/e/app.ts (1 errors) ==== + import {x} from "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo'. + \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution7.js b/tests/baselines/reference/cachedModuleResolution7.js new file mode 100644 index 00000000000..8b86dcd55af --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution7.js @@ -0,0 +1,14 @@ +//// [tests/cases/compiler/cachedModuleResolution7.ts] //// + +//// [lib.ts] + +import {x} from "foo"; + +//// [app.ts] +import {x} from "foo"; + + +//// [lib.js] +"use strict"; +//// [app.js] +"use strict"; diff --git a/tests/baselines/reference/cachedModuleResolution7.trace.json b/tests/baselines/reference/cachedModuleResolution7.trace.json new file mode 100644 index 00000000000..ce5bf08861d --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution7.trace.json @@ -0,0 +1,92 @@ +[ + "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/a/b/c/node_modules/foo.ts' does not exist.", + "File '/a/b/c/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/node_modules/foo.ts' does not exist.", + "File '/a/b/node_modules/foo.tsx' does not exist.", + "File '/a/b/node_modules/foo.d.ts' does not exist.", + "File '/a/b/node_modules/foo/package.json' does not exist.", + "File '/a/b/node_modules/foo/index.ts' does not exist.", + "File '/a/b/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/node_modules/foo.ts' does not exist.", + "File '/a/node_modules/foo.tsx' does not exist.", + "File '/a/node_modules/foo.d.ts' does not exist.", + "File '/a/node_modules/foo/package.json' does not exist.", + "File '/a/node_modules/foo/index.ts' does not exist.", + "File '/a/node_modules/foo/index.tsx' does not exist.", + "File '/a/node_modules/foo/index.d.ts' does not exist.", + "File '/a/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/node_modules/@types/foo/package.json' does not exist.", + "File '/a/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/node_modules/foo.ts' does not exist.", + "File '/node_modules/foo.tsx' does not exist.", + "File '/node_modules/foo.d.ts' does not exist.", + "File '/node_modules/foo/package.json' does not exist.", + "File '/node_modules/foo/index.ts' does not exist.", + "File '/node_modules/foo/index.tsx' does not exist.", + "File '/node_modules/foo/index.d.ts' does not exist.", + "File '/node_modules/@types/foo.d.ts' does not exist.", + "File '/node_modules/@types/foo/package.json' does not exist.", + "File '/node_modules/@types/foo/index.d.ts' does not exist.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/a/b/c/node_modules/foo.js' does not exist.", + "File '/a/b/c/node_modules/foo.jsx' does not exist.", + "File '/a/b/c/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/foo/index.js' does not exist.", + "File '/a/b/c/node_modules/foo/index.jsx' does not exist.", + "File '/a/b/node_modules/foo.js' does not exist.", + "File '/a/b/node_modules/foo.jsx' does not exist.", + "File '/a/b/node_modules/foo/package.json' does not exist.", + "File '/a/b/node_modules/foo/index.js' does not exist.", + "File '/a/b/node_modules/foo/index.jsx' does not exist.", + "File '/a/node_modules/foo.js' does not exist.", + "File '/a/node_modules/foo.jsx' does not exist.", + "File '/a/node_modules/foo/package.json' does not exist.", + "File '/a/node_modules/foo/index.js' does not exist.", + "File '/a/node_modules/foo/index.jsx' does not exist.", + "File '/node_modules/foo.js' does not exist.", + "File '/node_modules/foo.jsx' does not exist.", + "File '/node_modules/foo/package.json' does not exist.", + "File '/node_modules/foo/index.js' does not exist.", + "File '/node_modules/foo/index.jsx' does not exist.", + "======== Module name 'foo' was not resolved. ========", + "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", + "Explicitly specified module resolution kind: 'NodeJs'.", + "Loading module 'foo' from 'node_modules' folder.", + "File '/a/b/c/d/e/node_modules/foo.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo.tsx' does not exist.", + "File '/a/b/c/d/node_modules/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.ts' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.", + "File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", + "Resolution for module 'foo' was found in cache", + "======== Module name 'foo' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution8.errors.txt b/tests/baselines/reference/cachedModuleResolution8.errors.txt new file mode 100644 index 00000000000..b272ff29b9d --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution8.errors.txt @@ -0,0 +1,14 @@ +/a/b/c/d/e/app.ts(2,17): error TS2307: Cannot find module 'foo'. +/a/b/c/lib.ts(1,17): error TS2307: Cannot find module 'foo'. + + +==== /a/b/c/d/e/app.ts (1 errors) ==== + + import {x} from "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo'. + +==== /a/b/c/lib.ts (1 errors) ==== + import {x} from "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution8.js b/tests/baselines/reference/cachedModuleResolution8.js new file mode 100644 index 00000000000..1c00b171f21 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution8.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/cachedModuleResolution8.ts] //// + +//// [app.ts] + +import {x} from "foo"; + +//// [lib.ts] +import {x} from "foo"; + +//// [app.js] +"use strict"; +//// [lib.js] +"use strict"; diff --git a/tests/baselines/reference/cachedModuleResolution8.trace.json b/tests/baselines/reference/cachedModuleResolution8.trace.json new file mode 100644 index 00000000000..f833f56d819 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution8.trace.json @@ -0,0 +1,57 @@ +[ + "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "File '/a/b/c/d/e/foo.ts' does not exist.", + "File '/a/b/c/d/e/foo.tsx' does not exist.", + "File '/a/b/c/d/e/foo.d.ts' does not exist.", + "File '/a/b/c/d/foo.ts' does not exist.", + "File '/a/b/c/d/foo.tsx' does not exist.", + "File '/a/b/c/d/foo.d.ts' does not exist.", + "File '/a/b/c/foo.ts' does not exist.", + "File '/a/b/c/foo.tsx' does not exist.", + "File '/a/b/c/foo.d.ts' does not exist.", + "File '/a/b/foo.ts' does not exist.", + "File '/a/b/foo.tsx' does not exist.", + "File '/a/b/foo.d.ts' does not exist.", + "File '/a/foo.ts' does not exist.", + "File '/a/foo.tsx' does not exist.", + "File '/a/foo.d.ts' does not exist.", + "File '/foo.ts' does not exist.", + "File '/foo.tsx' does not exist.", + "File '/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/node_modules/@types/foo/package.json' does not exist.", + "File '/a/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/node_modules/@types/foo.d.ts' does not exist.", + "File '/node_modules/@types/foo/package.json' does not exist.", + "File '/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/d/e/foo.js' does not exist.", + "File '/a/b/c/d/e/foo.jsx' does not exist.", + "File '/a/b/c/d/foo.js' does not exist.", + "File '/a/b/c/d/foo.jsx' does not exist.", + "File '/a/b/c/foo.js' does not exist.", + "File '/a/b/c/foo.jsx' does not exist.", + "File '/a/b/foo.js' does not exist.", + "File '/a/b/foo.jsx' does not exist.", + "File '/a/foo.js' does not exist.", + "File '/a/foo.jsx' does not exist.", + "File '/foo.js' does not exist.", + "File '/foo.jsx' does not exist.", + "======== Module name 'foo' was not resolved. ========", + "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "Resolution for module 'foo' was found in cache", + "======== Module name 'foo' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution9.errors.txt b/tests/baselines/reference/cachedModuleResolution9.errors.txt new file mode 100644 index 00000000000..aeec41f0048 --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution9.errors.txt @@ -0,0 +1,16 @@ +/a/b/c/d/e/app.ts(1,17): error TS2307: Cannot find module 'foo'. +/a/b/c/lib.ts(2,17): error TS2307: Cannot find module 'foo'. + + +==== /a/b/c/lib.ts (1 errors) ==== + + import {x} from "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo'. + + +==== /a/b/c/d/e/app.ts (1 errors) ==== + import {x} from "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo'. + \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution9.js b/tests/baselines/reference/cachedModuleResolution9.js new file mode 100644 index 00000000000..32f8848736c --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution9.js @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/cachedModuleResolution9.ts] //// + +//// [lib.ts] + +import {x} from "foo"; + + +//// [app.ts] +import {x} from "foo"; + + +//// [lib.js] +"use strict"; +//// [app.js] +"use strict"; diff --git a/tests/baselines/reference/cachedModuleResolution9.trace.json b/tests/baselines/reference/cachedModuleResolution9.trace.json new file mode 100644 index 00000000000..10a79576bfc --- /dev/null +++ b/tests/baselines/reference/cachedModuleResolution9.trace.json @@ -0,0 +1,47 @@ +[ + "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "File '/a/b/c/foo.ts' does not exist.", + "File '/a/b/c/foo.tsx' does not exist.", + "File '/a/b/c/foo.d.ts' does not exist.", + "File '/a/b/foo.ts' does not exist.", + "File '/a/b/foo.tsx' does not exist.", + "File '/a/b/foo.d.ts' does not exist.", + "File '/a/foo.ts' does not exist.", + "File '/a/foo.tsx' does not exist.", + "File '/a/foo.d.ts' does not exist.", + "File '/foo.ts' does not exist.", + "File '/foo.tsx' does not exist.", + "File '/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/b/node_modules/@types/foo/package.json' does not exist.", + "File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/node_modules/@types/foo.d.ts' does not exist.", + "File '/a/node_modules/@types/foo/package.json' does not exist.", + "File '/a/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/node_modules/@types/foo.d.ts' does not exist.", + "File '/node_modules/@types/foo/package.json' does not exist.", + "File '/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/a/b/c/foo.js' does not exist.", + "File '/a/b/c/foo.jsx' does not exist.", + "File '/a/b/foo.js' does not exist.", + "File '/a/b/foo.jsx' does not exist.", + "File '/a/foo.js' does not exist.", + "File '/a/foo.jsx' does not exist.", + "File '/foo.js' does not exist.", + "File '/foo.jsx' does not exist.", + "======== Module name 'foo' was not resolved. ========", + "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", + "Explicitly specified module resolution kind: 'Classic'.", + "File '/a/b/c/d/e/foo.ts' does not exist.", + "File '/a/b/c/d/e/foo.tsx' does not exist.", + "File '/a/b/c/d/e/foo.d.ts' does not exist.", + "File '/a/b/c/d/foo.ts' does not exist.", + "File '/a/b/c/d/foo.tsx' does not exist.", + "File '/a/b/c/d/foo.d.ts' does not exist.", + "Resolution for module 'foo' was found in cache", + "======== Module name 'foo' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/cases/compiler/cachedModuleResolution1.ts b/tests/cases/compiler/cachedModuleResolution1.ts new file mode 100644 index 00000000000..3ef09ea0ea5 --- /dev/null +++ b/tests/cases/compiler/cachedModuleResolution1.ts @@ -0,0 +1,11 @@ +// @moduleResolution: node +// @traceResolution: true + +// @filename: /a/b/node_modules/foo.d.ts +export declare let x: number + +// @filename: /a/b/c/d/e/app.ts +import {x} from "foo"; + +// @filename: /a/b/c/lib.ts +import {x} from "foo"; \ No newline at end of file diff --git a/tests/cases/compiler/cachedModuleResolution2.ts b/tests/cases/compiler/cachedModuleResolution2.ts new file mode 100644 index 00000000000..38aaf4e609d --- /dev/null +++ b/tests/cases/compiler/cachedModuleResolution2.ts @@ -0,0 +1,11 @@ +// @moduleResolution: node +// @traceResolution: true + +// @filename: /a/b/node_modules/foo.d.ts +export declare let x: number + +// @filename: /a/b/c/lib.ts +import {x} from "foo"; + +// @filename: /a/b/c/d/e/app.ts +import {x} from "foo"; diff --git a/tests/cases/compiler/cachedModuleResolution3.ts b/tests/cases/compiler/cachedModuleResolution3.ts new file mode 100644 index 00000000000..e1e7aebbe86 --- /dev/null +++ b/tests/cases/compiler/cachedModuleResolution3.ts @@ -0,0 +1,11 @@ +// @moduleResolution: classic +// @traceResolution: true + +// @filename: /a/b/foo.d.ts +export declare let x: number + +// @filename: /a/b/c/d/e/app.ts +import {x} from "foo"; + +// @filename: /a/b/c/lib.ts +import {x} from "foo"; \ No newline at end of file diff --git a/tests/cases/compiler/cachedModuleResolution4.ts b/tests/cases/compiler/cachedModuleResolution4.ts new file mode 100644 index 00000000000..98cdd14189a --- /dev/null +++ b/tests/cases/compiler/cachedModuleResolution4.ts @@ -0,0 +1,11 @@ +// @moduleResolution: classic +// @traceResolution: true + +// @filename: /a/b/foo.d.ts +export declare let x: number + +// @filename: /a/b/c/lib.ts +import {x} from "foo"; + +// @filename: /a/b/c/d/e/app.ts +import {x} from "foo"; diff --git a/tests/cases/compiler/cachedModuleResolution5.ts b/tests/cases/compiler/cachedModuleResolution5.ts new file mode 100644 index 00000000000..e37b14fc1a0 --- /dev/null +++ b/tests/cases/compiler/cachedModuleResolution5.ts @@ -0,0 +1,11 @@ +// @moduleResolution: node +// @traceResolution: true + +// @filename: /a/b/node_modules/foo.d.ts +export declare let x: number + +// @filename: /a/b/c/d/e/app.ts +import {x} from "foo"; + +// @filename: /a/b/lib.ts +import {x} from "foo"; \ No newline at end of file diff --git a/tests/cases/compiler/cachedModuleResolution6.ts b/tests/cases/compiler/cachedModuleResolution6.ts new file mode 100644 index 00000000000..2c412e361c6 --- /dev/null +++ b/tests/cases/compiler/cachedModuleResolution6.ts @@ -0,0 +1,8 @@ +// @moduleResolution: node +// @traceResolution: true + +// @filename: /a/b/c/d/e/app.ts +import {x} from "foo"; + +// @filename: /a/b/c/lib.ts +import {x} from "foo"; \ No newline at end of file diff --git a/tests/cases/compiler/cachedModuleResolution7.ts b/tests/cases/compiler/cachedModuleResolution7.ts new file mode 100644 index 00000000000..d297e2a8ecd --- /dev/null +++ b/tests/cases/compiler/cachedModuleResolution7.ts @@ -0,0 +1,8 @@ +// @moduleResolution: node +// @traceResolution: true + +// @filename: /a/b/c/lib.ts +import {x} from "foo"; + +// @filename: /a/b/c/d/e/app.ts +import {x} from "foo"; diff --git a/tests/cases/compiler/cachedModuleResolution8.ts b/tests/cases/compiler/cachedModuleResolution8.ts new file mode 100644 index 00000000000..52c91be7753 --- /dev/null +++ b/tests/cases/compiler/cachedModuleResolution8.ts @@ -0,0 +1,8 @@ +// @moduleResolution: classic +// @traceResolution: true + +// @filename: /a/b/c/d/e/app.ts +import {x} from "foo"; + +// @filename: /a/b/c/lib.ts +import {x} from "foo"; \ No newline at end of file diff --git a/tests/cases/compiler/cachedModuleResolution9.ts b/tests/cases/compiler/cachedModuleResolution9.ts new file mode 100644 index 00000000000..26d71fa86ff --- /dev/null +++ b/tests/cases/compiler/cachedModuleResolution9.ts @@ -0,0 +1,9 @@ +// @moduleResolution: classic +// @traceResolution: true + +// @filename: /a/b/c/lib.ts +import {x} from "foo"; + + +// @filename: /a/b/c/d/e/app.ts +import {x} from "foo"; From 14cce292506b29aa88d26c0ad9ca94d7fb32e6d8 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Dec 2016 09:45:33 -0800 Subject: [PATCH 103/125] Do not report error on unused removed property from object spread Fixes #13076 --- src/compiler/checker.ts | 2 +- .../reference/unusedLocalsAndObjectSpread2.errors.txt | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 36b952dd046..d25c010ccfb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16891,7 +16891,7 @@ namespace ts { if (!local.isReferenced && !local.exportSymbol) { for (const declaration of local.declarations) { if (!isAmbientModule(declaration)) { - error(declaration.name, Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt index 0908f5ce3b9..2d1c36d3cbf 100644 --- a/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt @@ -1,20 +1,14 @@ -tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(4,5): error TS6133: 'children' is declared but never used. -tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(5,13): error TS6133: '_a' is declared but never used. tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(6,6): error TS6133: 'rest' is declared but never used. tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(9,10): error TS6133: 'foo' is declared but never used. tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(13,8): error TS6133: 'rest' is declared but never used. -==== tests/cases/compiler/unusedLocalsAndObjectSpread2.ts (5 errors) ==== +==== tests/cases/compiler/unusedLocalsAndObjectSpread2.ts (3 errors) ==== declare let props: any; const { children, // here! - ~~~~~~~~ -!!! error TS6133: 'children' is declared but never used. active: _a, // here! - ~~ -!!! error TS6133: '_a' is declared but never used. ...rest, ~~~~ !!! error TS6133: 'rest' is declared but never used. From 62426de220f7404508f7a0fd9f22f677d7cfcab2 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Dec 2016 12:11:47 -0800 Subject: [PATCH 104/125] Nit: Moving type aliases for serialized type nodes as per feedback --- src/compiler/transformers/ts.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index ecd2e2dfcfd..f791025807a 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1555,12 +1555,15 @@ namespace ts { return false; } + type SerializedEntityNameAsExpression = Identifier | BinaryExpression | PropertyAccessExpression; + type SerializedTypeNode = SerializedEntityNameAsExpression | VoidExpression | ConditionalExpression; + /** * Serializes the type of a node for use with decorator type metadata. * * @param node The node that should have its type serialized. */ - function serializeTypeOfNode(node: Node): Expression { + function serializeTypeOfNode(node: Node): SerializedTypeNode { switch (node.kind) { case SyntaxKind.PropertyDeclaration: case SyntaxKind.Parameter: @@ -1582,7 +1585,7 @@ namespace ts { * * @param node The node that should have its parameter types serialized. */ - function serializeParameterTypesOfNode(node: Node, container: ClassLikeDeclaration): Expression { + function serializeParameterTypesOfNode(node: Node, container: ClassLikeDeclaration): ArrayLiteralExpression { const valueDeclaration = isClassLike(node) ? getFirstConstructorWithBody(node) @@ -1590,7 +1593,7 @@ namespace ts { ? node : undefined; - const expressions: Expression[] = []; + const expressions: SerializedTypeNode[] = []; if (valueDeclaration) { const parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); const numParameters = parameters.length; @@ -1626,7 +1629,7 @@ namespace ts { * * @param node The node that should have its return type serialized. */ - function serializeReturnTypeOfNode(node: Node): Expression { + function serializeReturnTypeOfNode(node: Node): SerializedTypeNode { if (isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); } @@ -1637,8 +1640,6 @@ namespace ts { return createVoidZero(); } - type SerializedTypeNode = SerializedEntityNameAsExpression | VoidExpression | ConditionalExpression; - /** * Serializes a type node for use with decorator type metadata. * @@ -1826,7 +1827,6 @@ namespace ts { } } - type SerializedEntityNameAsExpression = Identifier | BinaryExpression | PropertyAccessExpression; /** * Serializes an entity name as an expression for decorator type metadata. * From 32c477a4486341b0023ac318ec45539d5a4df321 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Dec 2016 12:28:29 -0800 Subject: [PATCH 105/125] Test case for metadata type of class from a module --- .../reference/metadataOfClassFromModule.js | 44 +++++++++++++++++++ .../metadataOfClassFromModule.symbols | 22 ++++++++++ .../reference/metadataOfClassFromModule.types | 22 ++++++++++ .../compiler/metadataOfClassFromModule.ts | 14 ++++++ 4 files changed, 102 insertions(+) create mode 100644 tests/baselines/reference/metadataOfClassFromModule.js create mode 100644 tests/baselines/reference/metadataOfClassFromModule.symbols create mode 100644 tests/baselines/reference/metadataOfClassFromModule.types create mode 100644 tests/cases/compiler/metadataOfClassFromModule.ts diff --git a/tests/baselines/reference/metadataOfClassFromModule.js b/tests/baselines/reference/metadataOfClassFromModule.js new file mode 100644 index 00000000000..8d9f97489f2 --- /dev/null +++ b/tests/baselines/reference/metadataOfClassFromModule.js @@ -0,0 +1,44 @@ +//// [metadataOfClassFromModule.ts] +module MyModule { + + export function inject(target: any, key: string): void { } + + export class Leg { } + + export class Person { + @inject leftLeg: Leg; + } + +} + +//// [metadataOfClassFromModule.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var MyModule; +(function (MyModule) { + function inject(target, key) { } + MyModule.inject = inject; + var Leg = (function () { + function Leg() { + } + return Leg; + }()); + MyModule.Leg = Leg; + var Person = (function () { + function Person() { + } + return Person; + }()); + __decorate([ + inject, + __metadata("design:type", Object) + ], Person.prototype, "leftLeg", void 0); + MyModule.Person = Person; +})(MyModule || (MyModule = {})); diff --git a/tests/baselines/reference/metadataOfClassFromModule.symbols b/tests/baselines/reference/metadataOfClassFromModule.symbols new file mode 100644 index 00000000000..f430677f0fa --- /dev/null +++ b/tests/baselines/reference/metadataOfClassFromModule.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/metadataOfClassFromModule.ts === +module MyModule { +>MyModule : Symbol(MyModule, Decl(metadataOfClassFromModule.ts, 0, 0)) + + export function inject(target: any, key: string): void { } +>inject : Symbol(inject, Decl(metadataOfClassFromModule.ts, 0, 17)) +>target : Symbol(target, Decl(metadataOfClassFromModule.ts, 2, 27)) +>key : Symbol(key, Decl(metadataOfClassFromModule.ts, 2, 39)) + + export class Leg { } +>Leg : Symbol(Leg, Decl(metadataOfClassFromModule.ts, 2, 62)) + + export class Person { +>Person : Symbol(Person, Decl(metadataOfClassFromModule.ts, 4, 24)) + + @inject leftLeg: Leg; +>inject : Symbol(inject, Decl(metadataOfClassFromModule.ts, 0, 17)) +>leftLeg : Symbol(Person.leftLeg, Decl(metadataOfClassFromModule.ts, 6, 25)) +>Leg : Symbol(Leg, Decl(metadataOfClassFromModule.ts, 2, 62)) + } + +} diff --git a/tests/baselines/reference/metadataOfClassFromModule.types b/tests/baselines/reference/metadataOfClassFromModule.types new file mode 100644 index 00000000000..eeb24bf82aa --- /dev/null +++ b/tests/baselines/reference/metadataOfClassFromModule.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/metadataOfClassFromModule.ts === +module MyModule { +>MyModule : typeof MyModule + + export function inject(target: any, key: string): void { } +>inject : (target: any, key: string) => void +>target : any +>key : string + + export class Leg { } +>Leg : Leg + + export class Person { +>Person : Person + + @inject leftLeg: Leg; +>inject : (target: any, key: string) => void +>leftLeg : Leg +>Leg : Leg + } + +} diff --git a/tests/cases/compiler/metadataOfClassFromModule.ts b/tests/cases/compiler/metadataOfClassFromModule.ts new file mode 100644 index 00000000000..aca356f2247 --- /dev/null +++ b/tests/cases/compiler/metadataOfClassFromModule.ts @@ -0,0 +1,14 @@ +// @experimentalDecorators: true +// @emitDecoratorMetadata: true +// @target: es5 +module MyModule { + + export function inject(target: any, key: string): void { } + + export class Leg { } + + export class Person { + @inject leftLeg: Leg; + } + +} \ No newline at end of file From 08e6b1bc4872374f13acf5d75c3c54643c6137b9 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Dec 2016 12:29:52 -0800 Subject: [PATCH 106/125] Update current scope when visiting namespace elements Fixes #13098 --- src/compiler/transformers/ts.ts | 2 +- tests/baselines/reference/metadataOfClassFromModule.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index f791025807a..775f60355d8 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -2731,7 +2731,7 @@ namespace ts { let blockLocation: TextRange; const body = node.body; if (body.kind === SyntaxKind.ModuleBlock) { - addRange(statements, visitNodes((body).statements, namespaceElementVisitor, isStatement)); + saveStateAndInvoke(body, body => addRange(statements, visitNodes((body).statements, namespaceElementVisitor, isStatement))); statementsLocation = (body).statements; blockLocation = body; } diff --git a/tests/baselines/reference/metadataOfClassFromModule.js b/tests/baselines/reference/metadataOfClassFromModule.js index 8d9f97489f2..8ef120600df 100644 --- a/tests/baselines/reference/metadataOfClassFromModule.js +++ b/tests/baselines/reference/metadataOfClassFromModule.js @@ -38,7 +38,7 @@ var MyModule; }()); __decorate([ inject, - __metadata("design:type", Object) + __metadata("design:type", Leg) ], Person.prototype, "leftLeg", void 0); MyModule.Person = Person; })(MyModule || (MyModule = {})); From db1fda5e7755d3838f3131fc5f15175dc04197f4 Mon Sep 17 00:00:00 2001 From: Alexander Rusakov Date: Tue, 20 Dec 2016 17:55:14 +0300 Subject: [PATCH 107/125] Improve diagnostic message for negative old style literals --- src/compiler/checker.ts | 12 +++++++++--- src/compiler/diagnosticMessages.json | 6 +++--- src/compiler/utilities.ts | 5 +++++ tests/baselines/reference/literals.errors.txt | 6 +++--- .../reference/oldStyleOctalLiteralTypes.errors.txt | 6 +++--- .../reference/scannerNumericLiteral8.errors.txt | 6 +++--- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 16b8c119b63..2b815c40aba 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21857,11 +21857,17 @@ namespace ts { function checkGrammarNumericLiteral(node: NumericLiteral): boolean { // Grammar checking if (node.isOctalLiteral) { + let diagnosticMessage: DiagnosticMessage | undefined; if (languageVersion >= ScriptTarget.ES5) { - return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0o_0, node.text); + diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - if (isChildOfLiteralType(node)) { - return grammarErrorOnNode(node, Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0o_0, node.text); + else if (isChildOfLiteralType(node)) { + diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + if (diagnosticMessage) { + const withMinus = isMinusPrefixUnaryExpression(node.parent); + const literal = `${withMinus ? "-" : ""}0o${node.text}`; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6d19826e951..7b2208e4ca1 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -227,7 +227,7 @@ "category": "Error", "code": 1084 }, - "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o{0}'.": { + "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'.": { "category": "Error", "code": 1085 }, @@ -2952,7 +2952,7 @@ "Resolution for module '{0}' was found in cache": { "category": "Message", "code": 6147 - }, + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 @@ -3243,7 +3243,7 @@ "category": "Message", "code": 90015 }, - "Octal literal types must use ES2015 syntax. Use the syntax '0o{0}'.": { + "Octal literal types must use ES2015 syntax. Use the syntax '{0}'.": { "category": "Error", "code": 8017 } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index c542fdb74f8..f272805ced2 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -742,6 +742,11 @@ namespace ts { return false; } + export function isMinusPrefixUnaryExpression(node: Node): boolean { + return node.kind === SyntaxKind.PrefixUnaryExpression && + (node as PrefixUnaryExpression).operator === SyntaxKind.MinusToken; + } + // Warning: This has the same semantics as the forEach family of functions, // in that traversal terminates in the event that 'visitor' supplies a truthy value. export function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T { diff --git a/tests/baselines/reference/literals.errors.txt b/tests/baselines/reference/literals.errors.txt index 2920498bde4..6fa1d7d3abd 100644 --- a/tests/baselines/reference/literals.errors.txt +++ b/tests/baselines/reference/literals.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/expressions/literals/literals.ts(9,17): error TS2363: Th tests/cases/conformance/expressions/literals/literals.ts(10,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'. -tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. +tests/cases/conformance/expressions/literals/literals.ts(25,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'. ==== tests/cases/conformance/expressions/literals/literals.ts (6 errors) ==== @@ -42,8 +42,8 @@ tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: O var n = -1.0; var n = -1e-4; var n = -003; // Error in ES5 - ~~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. + ~~~~ +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'. var n = -0x1; var s: string; diff --git a/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt b/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt index 4dc81f370a4..7d42963b05d 100644 --- a/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt +++ b/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/oldStyleOctalLiteralTypes.ts(1,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'. -tests/cases/compiler/oldStyleOctalLiteralTypes.ts(2,9): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o20'. +tests/cases/compiler/oldStyleOctalLiteralTypes.ts(2,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '-0o20'. ==== tests/cases/compiler/oldStyleOctalLiteralTypes.ts (2 errors) ==== @@ -7,6 +7,6 @@ tests/cases/compiler/oldStyleOctalLiteralTypes.ts(2,9): error TS8017: Octal lite ~~~ !!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'. let y: -020; - ~~~ -!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o20'. + ~~~~ +!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '-0o20'. \ No newline at end of file diff --git a/tests/baselines/reference/scannerNumericLiteral8.errors.txt b/tests/baselines/reference/scannerNumericLiteral8.errors.txt index 5aad01449f2..6545050afc2 100644 --- a/tests/baselines/reference/scannerNumericLiteral8.errors.txt +++ b/tests/baselines/reference/scannerNumericLiteral8.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts(1,2): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. +tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts(1,1): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'. ==== tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts (1 errors) ==== -03 - ~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. \ No newline at end of file + ~~~ +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'. \ No newline at end of file From 23faaff03284d1414ce5374fddf59df4686cc06a Mon Sep 17 00:00:00 2001 From: arusakov Date: Thu, 22 Dec 2016 00:56:39 +0300 Subject: [PATCH 108/125] isMinusPrefixUnaryExpression() -> isPrefixUnaryExpression() after code review --- src/compiler/checker.ts | 2 +- src/compiler/utilities.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2b815c40aba..425d149db39 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21865,7 +21865,7 @@ namespace ts { diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } if (diagnosticMessage) { - const withMinus = isMinusPrefixUnaryExpression(node.parent); + const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === SyntaxKind.MinusToken; const literal = `${withMinus ? "-" : ""}0o${node.text}`; return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f272805ced2..edfbe639d25 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -742,9 +742,8 @@ namespace ts { return false; } - export function isMinusPrefixUnaryExpression(node: Node): boolean { - return node.kind === SyntaxKind.PrefixUnaryExpression && - (node as PrefixUnaryExpression).operator === SyntaxKind.MinusToken; + export function isPrefixUnaryExpression(node: Node): node is PrefixUnaryExpression { + return node.kind === SyntaxKind.PrefixUnaryExpression; } // Warning: This has the same semantics as the forEach family of functions, From 82be6d1746011f3a5e7a5fb0a2efa85a2a12226e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 11:03:20 +0900 Subject: [PATCH 109/125] Format destructuring by brace format option --- src/services/formatting/rules.ts | 12 ++++++++---- tests/cases/fourslash/formattingOptionsChange.ts | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index a6bec97ed53..7cb682e2ffa 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -292,10 +292,10 @@ namespace ts.formatting { this.SpaceBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. - this.SpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Space)); - this.SpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Space)); - this.NoSpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Delete)); - this.NoSpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Delete)); + this.SpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsBraceWrappedContext), RuleAction.Space)); + this.SpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsBraceWrappedContext), RuleAction.Space)); + this.NoSpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsBraceWrappedContext), RuleAction.Delete)); + this.NoSpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsBraceWrappedContext), RuleAction.Delete)); this.NoSpaceBetweenEmptyBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), RuleAction.Delete)); // Insert new line after { and before } in multi-line contexts. @@ -615,6 +615,10 @@ namespace ts.formatting { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); } + static IsBraceWrappedContext(context: FormattingContext): boolean { + return context.contextNode.kind === SyntaxKind.ObjectBindingPattern || Rules.IsSingleLineBlockContext(context); + } + // This check is done before an open brace in a control construct, a function, or a typescript block declaration static IsBeforeMultilineBlockContext(context: FormattingContext): boolean { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index 63d51eec0ca..5726a57da57 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -13,7 +13,7 @@ ////} /////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) { ////} -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; +/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' }; runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); @@ -26,7 +26,7 @@ runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }` runTest("InsertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 };", "{var t = 1};"); +runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' };", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'};"); function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) { From 273a0dbdfe4c609151c05b8c3efbc3ab060bdd44 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 12:33:50 +0900 Subject: [PATCH 110/125] add getOption --- src/harness/fourslash.ts | 4 ++++ tests/cases/fourslash/formattingOptionsChange.ts | 8 +++++--- tests/cases/fourslash/fourslash.ts | 7 ++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 653b87236fd..35fa7734a58 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3530,6 +3530,10 @@ namespace FourSlashInterface { public setOption(name: string, value: any): void { (this.state.formatCodeSettings)[name] = value; } + + public getOption(name: keyof ts.FormatCodeSettings) { + return this.state.formatCodeSettings[name]; + } } export class Cancellation { diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index 5726a57da57..b8d128acb79 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -13,7 +13,7 @@ ////} /////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) { ////} -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' }; +/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); @@ -26,9 +26,9 @@ runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }` runTest("InsertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' };", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'};"); - +runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}"); +const defaultFormatOption = format.copyFormatOptions(); function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) { // Go to the correct file goTo.marker(propertyName); @@ -52,4 +52,6 @@ function runTest(propertyName: string, expectedStringWhenTrue: string, expectedS // Verify goTo.marker(propertyName); verify.currentLineContentIs(expectedStringWhenTrue); + + format.setOption(propertyName, defaultFormatOption[propertyName]) } \ No newline at end of file diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 745a746db11..dcb8ca47200 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -294,9 +294,10 @@ declare namespace FourSlashInterface { setFormatOptions(options: FormatCodeOptions): any; selection(startMarker: string, endMarker: string): void; onType(posMarker: string, key: string): void; - setOption(name: string, value: number): any; - setOption(name: string, value: string): any; - setOption(name: string, value: boolean): any; + setOption(name: string, value: number): void; + setOption(name: string, value: string): void; + setOption(name: string, value: boolean): void; + getOption(name: string): number|string|boolean; } class cancellation { resetCancelled(): void; From ebf46a77e96b39291897f9787bcd92b8ef92b4f2 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 17 Dec 2016 13:21:34 +0900 Subject: [PATCH 111/125] merge conflict --- src/harness/fourslash.ts | 10 ++-- .../fourslash/formattingOptionsChange.ts | 48 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 35fa7734a58..0be7ecffc34 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3524,11 +3524,11 @@ namespace FourSlashInterface { this.state.formatOnType(this.state.getMarkerByName(posMarker).position, key); } - public setOption(name: string, value: number): void; - public setOption(name: string, value: string): void; - public setOption(name: string, value: boolean): void; - public setOption(name: string, value: any): void { - (this.state.formatCodeSettings)[name] = value; + public setOption(name: keyof ts.FormatCodeSettings, value: number): void; + public setOption(name: keyof ts.FormatCodeSettings, value: string): void; + public setOption(name: keyof ts.FormatCodeSettings, value: boolean): void; + public setOption(name: keyof ts.FormatCodeSettings, value: any): void { + this.state.formatCodeSettings[name] = value; } public getOption(name: keyof ts.FormatCodeSettings) { diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index b8d128acb79..f8f7c270cd8 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -1,32 +1,32 @@ /// -/////*InsertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ]; -/////*InsertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++); -/////*InsertSpaceBeforeAndAfterBinaryOperators*/1+2- 3 -/////*InsertSpaceAfterKeywordsInControlFlowStatements*/if (true) { } -/////*InsertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { }) -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 ) -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,]; -/////*InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }` -/////*InsertSpaceAfterTypeAssertion*/const bar = Thing.getFoo(); -/////*PlaceOpenBraceOnNewLineForFunctions*/class foo { +/////*insertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ]; +/////*insertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++); +/////*insertSpaceBeforeAndAfterBinaryOperators*/1+2- 3 +/////*insertSpaceAfterKeywordsInControlFlowStatements*/if (true) { } +/////*insertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { }) +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 ) +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,]; +/////*insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }` +/////*insertSpaceAfterTypeAssertion*/const bar = Thing.getFoo(); +/////*placeOpenBraceOnNewLineForFunctions*/class foo { ////} -/////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) { +/////*placeOpenBraceOnNewLineForControlBlocks*/if (true) { ////} -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } -runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); -runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); -runTest("InsertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); -runTest("InsertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }"); -runTest("InsertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); -runTest("InsertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); -runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); -runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}"); +runTest("insertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); +runTest("insertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); +runTest("insertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); +runTest("insertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }"); +runTest("insertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })"); +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)"); +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];"); +runTest("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); +runTest("insertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); +runTest("placeOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); +runTest("placeOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}"); const defaultFormatOption = format.copyFormatOptions(); function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) { From 6b48f3b551d56c0d88d4e94834f9ad9c0d555fd6 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 12:41:35 +0900 Subject: [PATCH 112/125] cancel getOption --- src/harness/fourslash.ts | 4 ---- tests/cases/fourslash/fourslash.ts | 5 +---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 0be7ecffc34..c28843327da 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3530,10 +3530,6 @@ namespace FourSlashInterface { public setOption(name: keyof ts.FormatCodeSettings, value: any): void { this.state.formatCodeSettings[name] = value; } - - public getOption(name: keyof ts.FormatCodeSettings) { - return this.state.formatCodeSettings[name]; - } } export class Cancellation { diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index dcb8ca47200..63b38c337d7 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -294,10 +294,7 @@ declare namespace FourSlashInterface { setFormatOptions(options: FormatCodeOptions): any; selection(startMarker: string, endMarker: string): void; onType(posMarker: string, key: string): void; - setOption(name: string, value: number): void; - setOption(name: string, value: string): void; - setOption(name: string, value: boolean): void; - getOption(name: string): number|string|boolean; + setOption(name: string, value: number | string | boolean): void; } class cancellation { resetCancelled(): void; From 5fb82496fb5a62fd7891d1604397455c77aa5e50 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 12:54:23 +0900 Subject: [PATCH 113/125] reposition defaultFormatOption --- src/server/utilities.ts | 1 + tests/cases/fourslash/formattingOptionsChange.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server/utilities.ts b/src/server/utilities.ts index 641ca128e63..d0790b93dba 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -86,6 +86,7 @@ namespace ts.server { insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, insertSpaceBeforeFunctionParenthesis: false, diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index f8f7c270cd8..0e731412ede 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -15,6 +15,8 @@ ////} /////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } +const defaultFormatOption = format.copyFormatOptions(); + runTest("insertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); runTest("insertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); runTest("insertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); @@ -25,10 +27,9 @@ runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[]; runTest("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); runTest("insertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); runTest("placeOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); -runTest("placeOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); +runTest("placeOpenBraceOnNewLineForControlBlocks", "if (true)", "if (true) {"); runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}"); -const defaultFormatOption = format.copyFormatOptions(); function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) { // Go to the correct file goTo.marker(propertyName); From 76c88b59cf0cedf959dbf7db6dda291a82227253 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 13:04:37 +0900 Subject: [PATCH 114/125] union --- src/harness/fourslash.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c28843327da..4c1a716bc0b 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3523,11 +3523,8 @@ namespace FourSlashInterface { public onType(posMarker: string, key: string) { this.state.formatOnType(this.state.getMarkerByName(posMarker).position, key); } - - public setOption(name: keyof ts.FormatCodeSettings, value: number): void; - public setOption(name: keyof ts.FormatCodeSettings, value: string): void; - public setOption(name: keyof ts.FormatCodeSettings, value: boolean): void; - public setOption(name: keyof ts.FormatCodeSettings, value: any): void { + + public setOption(name: keyof ts.FormatCodeSettings, value: number | string | boolean): void { this.state.formatCodeSettings[name] = value; } } From a1f88d2fcd52aaef52b5060f35b47c9738f7f2e2 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 15:23:50 +0900 Subject: [PATCH 115/125] format fourslash.ts --- src/harness/fourslash.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 4c1a716bc0b..2a0d37d190b 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -479,7 +479,7 @@ namespace FourSlash { endPos = endMarker.position; } - errors.forEach(function(error: ts.Diagnostic) { + errors.forEach(function (error: ts.Diagnostic) { if (predicate(error.start, error.start + error.length, startPos, endPos)) { exists = true; } @@ -496,7 +496,7 @@ namespace FourSlash { Harness.IO.log("Unexpected error(s) found. Error list is:"); } - errors.forEach(function(error: ts.Diagnostic) { + errors.forEach(function (error: ts.Diagnostic) { Harness.IO.log(" minChar: " + error.start + ", limChar: " + (error.start + error.length) + ", message: " + ts.flattenDiagnosticMessageText(error.messageText, Harness.IO.newLine()) + "\n"); @@ -3523,7 +3523,7 @@ namespace FourSlashInterface { public onType(posMarker: string, key: string) { this.state.formatOnType(this.state.getMarkerByName(posMarker).position, key); } - + public setOption(name: keyof ts.FormatCodeSettings, value: number | string | boolean): void { this.state.formatCodeSettings[name] = value; } From 4886b4248aaa933153617e2fb7619b7c68d525eb Mon Sep 17 00:00:00 2001 From: flowmemo Date: Thu, 22 Dec 2016 23:18:12 +0800 Subject: [PATCH 116/125] fix issue #13114 --- src/services/formatting/rules.ts | 4 +-- .../formattingSpaceBeforeCloseParen.ts | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 tests/cases/fourslash/formattingSpaceBeforeCloseParen.ts diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 2fac6c05555..e0268675e5a 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -264,12 +264,12 @@ namespace ts.formatting { this.SpaceAfterSemicolon = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); // Space after }. - this.SpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), RuleAction.Space)); + this.SpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromRange(SyntaxKind.FirstToken, SyntaxKind.LastToken, [SyntaxKind.CloseParenToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), RuleAction.Space)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied this.SpaceBetweenCloseBraceAndElse = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.ElseKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); this.SpaceBetweenCloseBraceAndWhile = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.WhileKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); - this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // No space for dot this.NoSpaceBeforeDot = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.DotToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); diff --git a/tests/cases/fourslash/formattingSpaceBeforeCloseParen.ts b/tests/cases/fourslash/formattingSpaceBeforeCloseParen.ts new file mode 100644 index 00000000000..fb2d648e211 --- /dev/null +++ b/tests/cases/fourslash/formattingSpaceBeforeCloseParen.ts @@ -0,0 +1,33 @@ +/// + +/////*1*/({}); +/////*2*/( {}); +/////*3*/({foo:42}); +/////*4*/( {foo:42} ); +/////*5*/var bar = (function (a) { }); + +format.setOption("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", true); +format.document(); +goTo.marker('1'); +verify.currentLineContentIs('( {} );'); +goTo.marker('2'); +verify.currentLineContentIs('( {} );'); +goTo.marker('3'); +verify.currentLineContentIs('( { foo: 42 } );'); +goTo.marker('4'); +verify.currentLineContentIs('( { foo: 42 } );'); +goTo.marker('5'); +verify.currentLineContentIs('var bar = ( function( a ) { } );'); + +format.setOption("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", false); +format.document(); +goTo.marker('1'); +verify.currentLineContentIs('({});'); +goTo.marker('2'); +verify.currentLineContentIs('({});'); +goTo.marker('3'); +verify.currentLineContentIs('({ foo: 42 });'); +goTo.marker('4'); +verify.currentLineContentIs('({ foo: 42 });'); +goTo.marker('5'); +verify.currentLineContentIs('var bar = (function(a) { });'); \ No newline at end of file From 31abc59d11e0056cac1e28f3a0af072b465a20a5 Mon Sep 17 00:00:00 2001 From: Alexander Rusakov Date: Thu, 22 Dec 2016 19:21:38 +0300 Subject: [PATCH 117/125] Disallow old style octal literals in enums --- src/compiler/checker.ts | 6 +++++- src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/utilities.ts | 4 ++-- .../es3-oldStyleOctalLiteralInEnums.errors.txt | 13 +++++++++++++ .../reference/es3-oldStyleOctalLiteralInEnums.js | 12 ++++++++++++ .../es3-oldStyleOctalLiteralTypes.errors.txt | 12 ++++++++++++ .../reference/es3-oldStyleOctalLiteralTypes.js | 8 ++++++++ .../es5-oldStyleOctalLiteralInEnums.errors.txt | 13 +++++++++++++ .../reference/es5-oldStyleOctalLiteralInEnums.js | 12 ++++++++++++ .../compiler/es3-oldStyleOctalLiteralInEnums.ts | 5 +++++ ...ralTypes.ts => es3-oldStyleOctalLiteralTypes.ts} | 0 .../compiler/es5-oldStyleOctalLiteralInEnums.ts | 5 +++++ 12 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.errors.txt create mode 100644 tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.js create mode 100644 tests/baselines/reference/es3-oldStyleOctalLiteralTypes.errors.txt create mode 100644 tests/baselines/reference/es3-oldStyleOctalLiteralTypes.js create mode 100644 tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.errors.txt create mode 100644 tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.js create mode 100644 tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts rename tests/cases/compiler/{oldStyleOctalLiteralTypes.ts => es3-oldStyleOctalLiteralTypes.ts} (100%) create mode 100644 tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a27e8ba524d..6a1edbf3cc6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18582,6 +18582,7 @@ namespace ts { } return undefined; case SyntaxKind.NumericLiteral: + checkGrammarNumericLiteral(e); return +(e).text; case SyntaxKind.ParenthesizedExpression: return evalConstant((e).expression); @@ -21885,9 +21886,12 @@ namespace ts { if (languageVersion >= ScriptTarget.ES5) { diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (isChildOfLiteralType(node)) { + else if (isChildOfNodeWithKind(node, SyntaxKind.LiteralType)) { diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } + else if (isChildOfNodeWithKind(node, SyntaxKind.EnumMember)) { + diagnosticMessage = Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } if (diagnosticMessage) { const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === SyntaxKind.MinusToken; const literal = `${withMinus ? "-" : ""}0o${node.text}`; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 7b2208e4ca1..8cf1313264f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3246,5 +3246,9 @@ "Octal literal types must use ES2015 syntax. Use the syntax '{0}'.": { "category": "Error", "code": 8017 + }, + "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'.": { + "category": "Error", + "code": 8018 } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index edfbe639d25..3c64c4d4a34 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -732,9 +732,9 @@ namespace ts { return false; } - export function isChildOfLiteralType(node: Node): boolean { + export function isChildOfNodeWithKind(node: Node, kind: SyntaxKind): boolean { while (node) { - if (node.kind === SyntaxKind.LiteralType) { + if (node.kind === kind) { return true; } node = node.parent; diff --git a/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.errors.txt b/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.errors.txt new file mode 100644 index 00000000000..137b76f660d --- /dev/null +++ b/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts(2,7): error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '-0o1'. +tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts(3,7): error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '0o2'. + + +==== tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts (2 errors) ==== + enum E { + x = -01, + ~~~ +!!! error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '-0o1'. + y = 02, + ~~ +!!! error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '0o2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.js b/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.js new file mode 100644 index 00000000000..0098d841f2a --- /dev/null +++ b/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.js @@ -0,0 +1,12 @@ +//// [es3-oldStyleOctalLiteralInEnums.ts] +enum E { + x = -01, + y = 02, +} + +//// [es3-oldStyleOctalLiteralInEnums.js] +var E; +(function (E) { + E[E["x"] = -1] = "x"; + E[E["y"] = 2] = "y"; +})(E || (E = {})); diff --git a/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.errors.txt b/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.errors.txt new file mode 100644 index 00000000000..5fc9843989c --- /dev/null +++ b/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts(1,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'. +tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts(2,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '-0o20'. + + +==== tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts (2 errors) ==== + let x: 010; + ~~~ +!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'. + let y: -020; + ~~~~ +!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '-0o20'. + \ No newline at end of file diff --git a/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.js b/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.js new file mode 100644 index 00000000000..5ac915400cd --- /dev/null +++ b/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.js @@ -0,0 +1,8 @@ +//// [es3-oldStyleOctalLiteralTypes.ts] +let x: 010; +let y: -020; + + +//// [es3-oldStyleOctalLiteralTypes.js] +var x; +var y; diff --git a/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.errors.txt b/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.errors.txt new file mode 100644 index 00000000000..a504568ce20 --- /dev/null +++ b/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts(2,7): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'. +tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts(3,7): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o2'. + + +==== tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts (2 errors) ==== + enum E { + x = -01, + ~~~ +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'. + y = 02, + ~~ +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.js b/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.js new file mode 100644 index 00000000000..71f718054fe --- /dev/null +++ b/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.js @@ -0,0 +1,12 @@ +//// [es5-oldStyleOctalLiteralInEnums.ts] +enum E { + x = -01, + y = 02, +} + +//// [es5-oldStyleOctalLiteralInEnums.js] +var E; +(function (E) { + E[E["x"] = -1] = "x"; + E[E["y"] = 2] = "y"; +})(E || (E = {})); diff --git a/tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts b/tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts new file mode 100644 index 00000000000..93489ee4820 --- /dev/null +++ b/tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts @@ -0,0 +1,5 @@ +// @target: ES3 +enum E { + x = -01, + y = 02, +} \ No newline at end of file diff --git a/tests/cases/compiler/oldStyleOctalLiteralTypes.ts b/tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts similarity index 100% rename from tests/cases/compiler/oldStyleOctalLiteralTypes.ts rename to tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts diff --git a/tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts b/tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts new file mode 100644 index 00000000000..42a95eff2a2 --- /dev/null +++ b/tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts @@ -0,0 +1,5 @@ +// @target: ES5 +enum E { + x = -01, + y = 02, +} \ No newline at end of file From decc7c220e43777d6d5acfe32ccee5014a6ef94e Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 22 Dec 2016 14:05:03 -0800 Subject: [PATCH 118/125] Fix non-thenable check for IndexedAccess types --- src/compiler/checker.ts | 17 +- .../reference/asyncFunctionReturnType.js | 142 ++++++++- .../reference/asyncFunctionReturnType.symbols | 271 +++++++++++++++++ .../reference/asyncFunctionReturnType.types | 284 ++++++++++++++++++ .../cases/compiler/asyncFunctionReturnType.ts | 66 ++++ 5 files changed, 773 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6a1edbf3cc6..d0923be003b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3074,10 +3074,6 @@ namespace ts { return type && (type.flags & TypeFlags.Any) !== 0; } - function isTypeNever(type: Type) { - return type && (type.flags & TypeFlags.Never) !== 0; - } - // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been // assigned by contextual typing. function getTypeForBindingElementParent(node: VariableLikeDeclaration) { @@ -16285,9 +16281,18 @@ namespace ts { } } - function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage) { + function isTypeOrConstraintAnyOrNever(type: Type) { + while (type.flags & TypeFlags.TypeVariable) { + const constraint = getConstraintOfTypeVariable(type); + if (!constraint) break; + type = getWidenedType(constraint); + } + return (type.flags & (TypeFlags.Any | TypeFlags.Never)) !== 0; + } + + function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage): Type { type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + if (!isTypeOrConstraintAnyOrNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; diff --git a/tests/baselines/reference/asyncFunctionReturnType.js b/tests/baselines/reference/asyncFunctionReturnType.js index dcdead47c6b..6e39e72ae4c 100644 --- a/tests/baselines/reference/asyncFunctionReturnType.js +++ b/tests/baselines/reference/asyncFunctionReturnType.js @@ -8,7 +8,72 @@ async function fAsyncExplicit(): Promise<[number, boolean]> { // This is contextually typed as a tuple. return [1, true]; } - + +// https://github.com/Microsoft/TypeScript/issues/13128 +interface Obj { + stringProp: string; + anyProp: any; +} + +async function fIndexedTypeForStringProp(obj: Obj): Promise { + return obj.stringProp; +} + +async function fIndexedTypeForPromiseOfStringProp(obj: Obj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fIndexedTypeForExplicitPromiseOfStringProp(obj: Obj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fIndexedTypeForAnyProp(obj: Obj): Promise { + return obj.anyProp; +} + +async function fIndexedTypeForPromiseOfAnyProp(obj: Obj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fIndexedTypeForExplicitPromiseOfAnyProp(obj: Obj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForStringProp(obj: TObj): Promise { + return obj.stringProp; +} + +async function fGenericIndexedTypeForPromiseOfStringProp(obj: TObj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj: TObj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fGenericIndexedTypeForAnyProp(obj: TObj): Promise { + return obj.anyProp; +} + +async function fGenericIndexedTypeForPromiseOfAnyProp(obj: TObj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj: TObj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForKProp(obj: TObj, key: K): Promise { + return obj[key]; +} + +async function fGenericIndexedTypeForPromiseOfKProp(obj: TObj, key: K): Promise { + return Promise.resolve(obj[key]); +} + +async function fGenericIndexedTypeForExplicitPromiseOfKProp(obj: TObj, key: K): Promise { + return Promise.resolve(obj[key]); +} //// [asyncFunctionReturnType.js] var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { @@ -31,3 +96,78 @@ function fAsyncExplicit() { return [1, true]; }); } +function fIndexedTypeForStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return obj.stringProp; + }); +} +function fIndexedTypeForPromiseOfStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.stringProp); + }); +} +function fIndexedTypeForExplicitPromiseOfStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.stringProp); + }); +} +function fIndexedTypeForAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return obj.anyProp; + }); +} +function fIndexedTypeForPromiseOfAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.anyProp); + }); +} +function fIndexedTypeForExplicitPromiseOfAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.anyProp); + }); +} +function fGenericIndexedTypeForStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return obj.stringProp; + }); +} +function fGenericIndexedTypeForPromiseOfStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.stringProp); + }); +} +function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.stringProp); + }); +} +function fGenericIndexedTypeForAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return obj.anyProp; + }); +} +function fGenericIndexedTypeForPromiseOfAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.anyProp); + }); +} +function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.anyProp); + }); +} +function fGenericIndexedTypeForKProp(obj, key) { + return __awaiter(this, void 0, void 0, function* () { + return obj[key]; + }); +} +function fGenericIndexedTypeForPromiseOfKProp(obj, key) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj[key]); + }); +} +function fGenericIndexedTypeForExplicitPromiseOfKProp(obj, key) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj[key]); + }); +} diff --git a/tests/baselines/reference/asyncFunctionReturnType.symbols b/tests/baselines/reference/asyncFunctionReturnType.symbols index 75e456b6a8b..d5aa71c9e51 100644 --- a/tests/baselines/reference/asyncFunctionReturnType.symbols +++ b/tests/baselines/reference/asyncFunctionReturnType.symbols @@ -14,3 +14,274 @@ async function fAsyncExplicit(): Promise<[number, boolean]> { return [1, true]; } +// https://github.com/Microsoft/TypeScript/issues/13128 +interface Obj { +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + stringProp: string; +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) + + anyProp: any; +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fIndexedTypeForStringProp(obj: Obj): Promise { +>fIndexedTypeForStringProp : Symbol(fIndexedTypeForStringProp, Decl(asyncFunctionReturnType.ts, 14, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 16, 41)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return obj.stringProp; +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 16, 41)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fIndexedTypeForPromiseOfStringProp(obj: Obj): Promise { +>fIndexedTypeForPromiseOfStringProp : Symbol(fIndexedTypeForPromiseOfStringProp, Decl(asyncFunctionReturnType.ts, 18, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 20, 50)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return Promise.resolve(obj.stringProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 20, 50)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fIndexedTypeForExplicitPromiseOfStringProp(obj: Obj): Promise { +>fIndexedTypeForExplicitPromiseOfStringProp : Symbol(fIndexedTypeForExplicitPromiseOfStringProp, Decl(asyncFunctionReturnType.ts, 22, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 24, 58)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return Promise.resolve(obj.stringProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 24, 58)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fIndexedTypeForAnyProp(obj: Obj): Promise { +>fIndexedTypeForAnyProp : Symbol(fIndexedTypeForAnyProp, Decl(asyncFunctionReturnType.ts, 26, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 28, 38)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return obj.anyProp; +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 28, 38)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fIndexedTypeForPromiseOfAnyProp(obj: Obj): Promise { +>fIndexedTypeForPromiseOfAnyProp : Symbol(fIndexedTypeForPromiseOfAnyProp, Decl(asyncFunctionReturnType.ts, 30, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 32, 47)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return Promise.resolve(obj.anyProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 32, 47)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fIndexedTypeForExplicitPromiseOfAnyProp(obj: Obj): Promise { +>fIndexedTypeForExplicitPromiseOfAnyProp : Symbol(fIndexedTypeForExplicitPromiseOfAnyProp, Decl(asyncFunctionReturnType.ts, 34, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 36, 55)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return Promise.resolve(obj.anyProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 36, 55)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fGenericIndexedTypeForStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForStringProp : Symbol(fGenericIndexedTypeForStringProp, Decl(asyncFunctionReturnType.ts, 38, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 40, 48)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 40, 66)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 40, 48)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 40, 48)) + + return obj.stringProp; +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 40, 66)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fGenericIndexedTypeForPromiseOfStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForPromiseOfStringProp : Symbol(fGenericIndexedTypeForPromiseOfStringProp, Decl(asyncFunctionReturnType.ts, 42, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 44, 57)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 44, 75)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 44, 57)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 44, 57)) + + return Promise.resolve(obj.stringProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 44, 75)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForExplicitPromiseOfStringProp : Symbol(fGenericIndexedTypeForExplicitPromiseOfStringProp, Decl(asyncFunctionReturnType.ts, 46, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 48, 83)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) + + return Promise.resolve(obj.stringProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 48, 83)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fGenericIndexedTypeForAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForAnyProp : Symbol(fGenericIndexedTypeForAnyProp, Decl(asyncFunctionReturnType.ts, 50, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 52, 45)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 52, 63)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 52, 45)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 52, 45)) + + return obj.anyProp; +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 52, 63)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fGenericIndexedTypeForPromiseOfAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForPromiseOfAnyProp : Symbol(fGenericIndexedTypeForPromiseOfAnyProp, Decl(asyncFunctionReturnType.ts, 54, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 56, 54)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 56, 72)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 56, 54)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 56, 54)) + + return Promise.resolve(obj.anyProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 56, 72)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForExplicitPromiseOfAnyProp : Symbol(fGenericIndexedTypeForExplicitPromiseOfAnyProp, Decl(asyncFunctionReturnType.ts, 58, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 60, 80)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) + + return Promise.resolve(obj.anyProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 60, 80)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fGenericIndexedTypeForKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForKProp : Symbol(fGenericIndexedTypeForKProp, Decl(asyncFunctionReturnType.ts, 62, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 64, 43)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 64, 60)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 64, 43)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 64, 83)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 64, 43)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 64, 93)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 64, 60)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 64, 43)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 64, 60)) + + return obj[key]; +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 64, 83)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 64, 93)) +} + +async function fGenericIndexedTypeForPromiseOfKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForPromiseOfKProp : Symbol(fGenericIndexedTypeForPromiseOfKProp, Decl(asyncFunctionReturnType.ts, 66, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 68, 52)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 68, 69)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 68, 52)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 68, 92)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 68, 52)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 68, 102)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 68, 69)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 68, 52)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 68, 69)) + + return Promise.resolve(obj[key]); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 68, 92)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 68, 102)) +} + +async function fGenericIndexedTypeForExplicitPromiseOfKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForExplicitPromiseOfKProp : Symbol(fGenericIndexedTypeForExplicitPromiseOfKProp, Decl(asyncFunctionReturnType.ts, 70, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 72, 100)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 72, 110)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) + + return Promise.resolve(obj[key]); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 72, 100)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 72, 110)) +} diff --git a/tests/baselines/reference/asyncFunctionReturnType.types b/tests/baselines/reference/asyncFunctionReturnType.types index db9f8e42d52..d1dab14ba87 100644 --- a/tests/baselines/reference/asyncFunctionReturnType.types +++ b/tests/baselines/reference/asyncFunctionReturnType.types @@ -20,3 +20,287 @@ async function fAsyncExplicit(): Promise<[number, boolean]> { >true : true } +// https://github.com/Microsoft/TypeScript/issues/13128 +interface Obj { +>Obj : Obj + + stringProp: string; +>stringProp : string + + anyProp: any; +>anyProp : any +} + +async function fIndexedTypeForStringProp(obj: Obj): Promise { +>fIndexedTypeForStringProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return obj.stringProp; +>obj.stringProp : string +>obj : Obj +>stringProp : string +} + +async function fIndexedTypeForPromiseOfStringProp(obj: Obj): Promise { +>fIndexedTypeForPromiseOfStringProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return Promise.resolve(obj.stringProp); +>Promise.resolve(obj.stringProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>obj.stringProp : string +>obj : Obj +>stringProp : string +} + +async function fIndexedTypeForExplicitPromiseOfStringProp(obj: Obj): Promise { +>fIndexedTypeForExplicitPromiseOfStringProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return Promise.resolve(obj.stringProp); +>Promise.resolve(obj.stringProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Obj : Obj +>obj.stringProp : string +>obj : Obj +>stringProp : string +} + +async function fIndexedTypeForAnyProp(obj: Obj): Promise { +>fIndexedTypeForAnyProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return obj.anyProp; +>obj.anyProp : any +>obj : Obj +>anyProp : any +} + +async function fIndexedTypeForPromiseOfAnyProp(obj: Obj): Promise { +>fIndexedTypeForPromiseOfAnyProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return Promise.resolve(obj.anyProp); +>Promise.resolve(obj.anyProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>obj.anyProp : any +>obj : Obj +>anyProp : any +} + +async function fIndexedTypeForExplicitPromiseOfAnyProp(obj: Obj): Promise { +>fIndexedTypeForExplicitPromiseOfAnyProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return Promise.resolve(obj.anyProp); +>Promise.resolve(obj.anyProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Obj : Obj +>obj.anyProp : any +>obj : Obj +>anyProp : any +} + +async function fGenericIndexedTypeForStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForStringProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return obj.stringProp; +>obj.stringProp : string +>obj : TObj +>stringProp : string +} + +async function fGenericIndexedTypeForPromiseOfStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForPromiseOfStringProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return Promise.resolve(obj.stringProp); +>Promise.resolve(obj.stringProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>obj.stringProp : string +>obj : TObj +>stringProp : string +} + +async function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForExplicitPromiseOfStringProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return Promise.resolve(obj.stringProp); +>Promise.resolve(obj.stringProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>TObj : TObj +>obj.stringProp : string +>obj : TObj +>stringProp : string +} + +async function fGenericIndexedTypeForAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForAnyProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return obj.anyProp; +>obj.anyProp : any +>obj : TObj +>anyProp : any +} + +async function fGenericIndexedTypeForPromiseOfAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForPromiseOfAnyProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return Promise.resolve(obj.anyProp); +>Promise.resolve(obj.anyProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>obj.anyProp : any +>obj : TObj +>anyProp : any +} + +async function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForExplicitPromiseOfAnyProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return Promise.resolve(obj.anyProp); +>Promise.resolve(obj.anyProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>TObj : TObj +>obj.anyProp : any +>obj : TObj +>anyProp : any +} + +async function fGenericIndexedTypeForKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForKProp : (obj: TObj, key: K) => Promise +>TObj : TObj +>Obj : Obj +>K : K +>TObj : TObj +>obj : TObj +>TObj : TObj +>key : K +>K : K +>Promise : Promise +>TObj : TObj +>K : K + + return obj[key]; +>obj[key] : TObj[K] +>obj : TObj +>key : K +} + +async function fGenericIndexedTypeForPromiseOfKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForPromiseOfKProp : (obj: TObj, key: K) => Promise +>TObj : TObj +>Obj : Obj +>K : K +>TObj : TObj +>obj : TObj +>TObj : TObj +>key : K +>K : K +>Promise : Promise +>TObj : TObj +>K : K + + return Promise.resolve(obj[key]); +>Promise.resolve(obj[key]) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>obj[key] : TObj[K] +>obj : TObj +>key : K +} + +async function fGenericIndexedTypeForExplicitPromiseOfKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForExplicitPromiseOfKProp : (obj: TObj, key: K) => Promise +>TObj : TObj +>Obj : Obj +>K : K +>TObj : TObj +>obj : TObj +>TObj : TObj +>key : K +>K : K +>Promise : Promise +>TObj : TObj +>K : K + + return Promise.resolve(obj[key]); +>Promise.resolve(obj[key]) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>TObj : TObj +>K : K +>obj[key] : TObj[K] +>obj : TObj +>key : K +} diff --git a/tests/cases/compiler/asyncFunctionReturnType.ts b/tests/cases/compiler/asyncFunctionReturnType.ts index a1bcde38079..3bd7a0e998a 100644 --- a/tests/cases/compiler/asyncFunctionReturnType.ts +++ b/tests/cases/compiler/asyncFunctionReturnType.ts @@ -8,3 +8,69 @@ async function fAsyncExplicit(): Promise<[number, boolean]> { // This is contextually typed as a tuple. return [1, true]; } + +// https://github.com/Microsoft/TypeScript/issues/13128 +interface Obj { + stringProp: string; + anyProp: any; +} + +async function fIndexedTypeForStringProp(obj: Obj): Promise { + return obj.stringProp; +} + +async function fIndexedTypeForPromiseOfStringProp(obj: Obj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fIndexedTypeForExplicitPromiseOfStringProp(obj: Obj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fIndexedTypeForAnyProp(obj: Obj): Promise { + return obj.anyProp; +} + +async function fIndexedTypeForPromiseOfAnyProp(obj: Obj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fIndexedTypeForExplicitPromiseOfAnyProp(obj: Obj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForStringProp(obj: TObj): Promise { + return obj.stringProp; +} + +async function fGenericIndexedTypeForPromiseOfStringProp(obj: TObj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj: TObj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fGenericIndexedTypeForAnyProp(obj: TObj): Promise { + return obj.anyProp; +} + +async function fGenericIndexedTypeForPromiseOfAnyProp(obj: TObj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj: TObj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForKProp(obj: TObj, key: K): Promise { + return obj[key]; +} + +async function fGenericIndexedTypeForPromiseOfKProp(obj: TObj, key: K): Promise { + return Promise.resolve(obj[key]); +} + +async function fGenericIndexedTypeForExplicitPromiseOfKProp(obj: TObj, key: K): Promise { + return Promise.resolve(obj[key]); +} \ No newline at end of file From 9a0d9d77aa00d74183ff5079528deaa5e5baa2b5 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 22 Dec 2016 15:14:13 -0800 Subject: [PATCH 119/125] Check trace enabled befoe tracing --- src/compiler/moduleNameResolver.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index be8f4d6f0cb..da3630765a2 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,4 +1,4 @@ -/// +/// /// namespace ts { @@ -824,7 +824,9 @@ namespace ts { if (resolved) { return resolved; } - trace(state.host, Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + if (state.traceEnabled) { + trace(state.host, Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + } } const resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures, state); if (resolved) { From d0b7d4a93f07bfcb17161eb2c2aecab178c42932 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 22 Dec 2016 15:21:43 -0800 Subject: [PATCH 120/125] Switch to getApparentType --- src/compiler/checker.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d0923be003b..dcbd842cee3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16281,18 +16281,10 @@ namespace ts { } } - function isTypeOrConstraintAnyOrNever(type: Type) { - while (type.flags & TypeFlags.TypeVariable) { - const constraint = getConstraintOfTypeVariable(type); - if (!constraint) break; - type = getWidenedType(constraint); - } - return (type.flags & (TypeFlags.Any | TypeFlags.Never)) !== 0; - } - function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage): Type { type = getWidenedType(type); - if (!isTypeOrConstraintAnyOrNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + const apparentType = getApparentType(type); + if ((apparentType.flags & (TypeFlags.Any | TypeFlags.Never)) === 0 && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; From 20097d7961de7b7b1924bf8b05a92e5a405fcf85 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 22 Dec 2016 18:35:41 -0800 Subject: [PATCH 121/125] mark 'failedLookupLocations' as internal (#13139) --- src/compiler/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ee432b13240..f9b416fc4de 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3544,6 +3544,7 @@ namespace ts { export interface ResolvedModuleWithFailedLookupLocations { resolvedModule: ResolvedModuleFull | undefined; + /* @internal */ failedLookupLocations: string[]; } From e32c62039e443b19ccfa23533c4a0cbccb6ff9b0 Mon Sep 17 00:00:00 2001 From: flowmemo Date: Sat, 24 Dec 2016 00:20:46 +0800 Subject: [PATCH 122/125] fix #11676 --- src/services/formatting/rules.ts | 11 +++++++++++ .../formattingNonNullAssertionOperator.ts | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/cases/fourslash/formattingNonNullAssertionOperator.ts diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 5b1543b79f0..b9cf85b5b60 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -245,6 +245,9 @@ namespace ts.formatting { public NoSpaceAfterTypeAssertion: Rule; public SpaceAfterTypeAssertion: Rule; + // No space before non-null assertion operator + public NoSpaceBeforeNonNullAssertionOperator: Rule; + constructor() { /// /// Common Rules @@ -410,6 +413,9 @@ namespace ts.formatting { this.NoSpaceBeforeEqualInJsxAttribute = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.EqualsToken), RuleOperation.create2(new RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); this.NoSpaceAfterEqualInJsxAttribute = new Rule(RuleDescriptor.create3(SyntaxKind.EqualsToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + // No space before non-null assertion operator + this.NoSpaceBeforeNonNullAssertionOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.ExclamationToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), RuleAction.Delete)); + // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -456,6 +462,7 @@ namespace ts.formatting { this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, + this.NoSpaceBeforeNonNullAssertionOperator ]; // These rules are lower in priority than user-configurable rules. @@ -882,5 +889,9 @@ namespace ts.formatting { static IsYieldOrYieldStarWithOperand(context: FormattingContext): boolean { return context.contextNode.kind === SyntaxKind.YieldExpression && (context.contextNode).expression !== undefined; } + + static IsNonNullAssertionContext(context: FormattingContext): boolean { + return context.contextNode.kind === SyntaxKind.NonNullExpression; + } } } \ No newline at end of file diff --git a/tests/cases/fourslash/formattingNonNullAssertionOperator.ts b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts new file mode 100644 index 00000000000..3318ca7f4d6 --- /dev/null +++ b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts @@ -0,0 +1,19 @@ +/// + +/////*1*/'bar'!; +/////*2*/('bar')!; +/////*3*/'bar'[1]!; +/////*4*/var bar = 'bar'.foo!; +/////*5*/var foo = bar!; + +format.document(); +goTo.marker('1'); +verify.currentLineContentIs("'bar'!;"); +goTo.marker('2'); +verify.currentLineContentIs("('bar')!;"); +goTo.marker('3'); +verify.currentLineContentIs("'bar'[1]!;"); +goTo.marker('4'); +verify.currentLineContentIs("var bar = 'bar'.foo!;"); +goTo.marker('5'); +verify.currentLineContentIs("var foo = bar!;"); \ No newline at end of file From eb188d0e24ae3f2c720c16e333a7066942718be0 Mon Sep 17 00:00:00 2001 From: flowmemo Date: Sat, 24 Dec 2016 09:25:14 +0800 Subject: [PATCH 123/125] fix #11676 - lint test --- .../fourslash/formattingNonNullAssertionOperator.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/cases/fourslash/formattingNonNullAssertionOperator.ts b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts index 3318ca7f4d6..c6e79629998 100644 --- a/tests/cases/fourslash/formattingNonNullAssertionOperator.ts +++ b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts @@ -7,13 +7,13 @@ /////*5*/var foo = bar!; format.document(); -goTo.marker('1'); +goTo.marker("1"); verify.currentLineContentIs("'bar'!;"); -goTo.marker('2'); +goTo.marker("2"); verify.currentLineContentIs("('bar')!;"); -goTo.marker('3'); +goTo.marker("3"); verify.currentLineContentIs("'bar'[1]!;"); -goTo.marker('4'); +goTo.marker("4"); verify.currentLineContentIs("var bar = 'bar'.foo!;"); -goTo.marker('5'); +goTo.marker("5"); verify.currentLineContentIs("var foo = bar!;"); \ No newline at end of file From f0ad56d86eec4f95270c0f9a93df116623beeadf Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 26 Dec 2016 11:36:27 -0800 Subject: [PATCH 124/125] Ensure test input is unformatted --- .../fourslash/formattingNonNullAssertionOperator.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/cases/fourslash/formattingNonNullAssertionOperator.ts b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts index c6e79629998..2d8b96daaff 100644 --- a/tests/cases/fourslash/formattingNonNullAssertionOperator.ts +++ b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts @@ -1,10 +1,10 @@ /// -/////*1*/'bar'!; -/////*2*/('bar')!; -/////*3*/'bar'[1]!; -/////*4*/var bar = 'bar'.foo!; -/////*5*/var foo = bar!; +/////*1*/ 'bar' ! ; +/////*2*/ ( 'bar' ) ! ; +/////*3*/ 'bar' [ 1 ] ! ; +/////*4*/ var bar = 'bar' . foo ! ; +/////*5*/ var foo = bar ! ; format.document(); goTo.marker("1"); From 77a3dfbcfc37585da8e634e73032ee3f44fef1b3 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 27 Dec 2016 11:59:56 -0800 Subject: [PATCH 125/125] tsserver should use newline provided by the host (#13185) --- src/harness/unittests/compileOnSave.ts | 32 ++++++++++++++++++- .../unittests/tsserverProjectSystem.ts | 7 ++-- src/server/lsHost.ts | 4 +++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/harness/unittests/compileOnSave.ts b/src/harness/unittests/compileOnSave.ts index d7731a625fe..c8deb9e7554 100644 --- a/src/harness/unittests/compileOnSave.ts +++ b/src/harness/unittests/compileOnSave.ts @@ -467,6 +467,36 @@ namespace ts.projectSystem { }); describe("EmitFile test", () => { + it("should respect line endings", () => { + test("\n"); + test("\r\n"); + + function test(newLine: string) { + const lines = ["var x = 1;", "var y = 2;"]; + const path = "/a/app"; + const f = { + path: path + ".ts", + content: lines.join(newLine) + }; + const host = createServerHost([f], { newLine }); + const session = createSession(host); + session.executeCommand({ + seq: 1, + type: "request", + command: "open", + arguments: { file: f.path } + }); + session.executeCommand({ + seq: 2, + type: "request", + command: "compileOnSaveEmitFile", + arguments: { file: f.path } + }); + const emitOutput = host.readFile(path + ".js"); + assert.equal(emitOutput, f.content + newLine, "content of emit output should be identical with the input + newline"); + } + }) + it("should emit specified file", () => { const file1 = { path: "/a/b/f1.ts", @@ -480,7 +510,7 @@ namespace ts.projectSystem { path: "/a/b/tsconfig.json", content: `{}` }; - const host = createServerHost([file1, file2, configFile, libFile]); + const host = createServerHost([file1, file2, configFile, libFile], { newLine: "\r\n" }); const typingsInstaller = createTestTypingsInstaller(host); const session = new server.Session(host, nullCancellationToken, /*useSingleInferredProject*/ false, typingsInstaller, Utils.byteLength, process.hrtime, nullLogger, /*canUseEvents*/ false); diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index d379b5bbf9c..5b9f4332359 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -141,6 +141,7 @@ namespace ts.projectSystem { useCaseSensitiveFileNames?: boolean; executingFilePath?: string; currentDirectory?: string; + newLine?: string; } export function createServerHost(fileOrFolderList: FileOrFolder[], params?: TestServerHostCreationParameters): TestServerHost { @@ -151,7 +152,8 @@ namespace ts.projectSystem { params.useCaseSensitiveFileNames !== undefined ? params.useCaseSensitiveFileNames : false, params.executingFilePath || getExecutingFilePathFromLibFile(), params.currentDirectory || "/", - fileOrFolderList); + fileOrFolderList, + params.newLine); return host; } @@ -329,7 +331,6 @@ namespace ts.projectSystem { export class TestServerHost implements server.ServerHost { args: string[] = []; - newLine: "\n"; private fs: ts.FileMap; private getCanonicalFileName: (s: string) => string; @@ -342,7 +343,7 @@ namespace ts.projectSystem { private filesOrFolders: FileOrFolder[]; - constructor(public useCaseSensitiveFileNames: boolean, private executingFilePath: string, private currentDirectory: string, fileOrFolderList: FileOrFolder[]) { + constructor(public useCaseSensitiveFileNames: boolean, private executingFilePath: string, private currentDirectory: string, fileOrFolderList: FileOrFolder[], public readonly newLine = "\n") { this.getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); this.toPath = s => toPath(s, currentDirectory, this.getCanonicalFileName); diff --git a/src/server/lsHost.ts b/src/server/lsHost.ts index d73a31933f4..98b3dd9a8c0 100644 --- a/src/server/lsHost.ts +++ b/src/server/lsHost.ts @@ -135,6 +135,10 @@ namespace ts.server { } } + getNewLine() { + return this.host.newLine; + } + getProjectVersion() { return this.project.getProjectVersion(); }

= (func: HTML) => {}; + +declare var h: HTML; +h.div(h); \ No newline at end of file diff --git a/tests/cases/compiler/nestedFreshLiteral.ts b/tests/cases/compiler/nestedFreshLiteral.ts new file mode 100644 index 00000000000..bf3bf5df8d3 --- /dev/null +++ b/tests/cases/compiler/nestedFreshLiteral.ts @@ -0,0 +1,14 @@ +// @strictNullChecks: true +interface CSSProps { + color?: string +} +interface NestedCSSProps { + nested?: NestedSelector +} +interface NestedSelector { + prop: CSSProps; +} + +let stylen: NestedCSSProps = { + nested: { prop: { colour: 'red' } } +} \ No newline at end of file diff --git a/tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts b/tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts new file mode 100644 index 00000000000..25b351d62a1 --- /dev/null +++ b/tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts @@ -0,0 +1,13 @@ +// @target: es5 +function baz(x: any) { + return [[x, x]]; +} + +function foo(set: any) { + for (const [value, i] of baz(set.values)) { + const bar: any = []; + (() => bar); + + set.values.push(...[]); + } +}; \ No newline at end of file diff --git a/tests/cases/compiler/objectFreeze.ts b/tests/cases/compiler/objectFreeze.ts new file mode 100644 index 00000000000..5e8539831b1 --- /dev/null +++ b/tests/cases/compiler/objectFreeze.ts @@ -0,0 +1,12 @@ +const f = Object.freeze(function foo(a: number, b: string) { return false; }); +f(1, "") === false; + +class C { constructor(a: number) { } } +const c = Object.freeze(C); +new c(1); + +const a = Object.freeze([1, 2, 3]); +a[0] = a[2].toString(); + +const o = Object.freeze({ a: 1, b: "string" }); +o.b = o.a.toString(); diff --git a/tests/cases/compiler/restIntersection.ts b/tests/cases/compiler/restIntersection.ts new file mode 100644 index 00000000000..5fca2dafc36 --- /dev/null +++ b/tests/cases/compiler/restIntersection.ts @@ -0,0 +1,4 @@ +var intersection: { x: number, y: number } & { w: string, z: string }; + +var rest1: { y: number, w: string, z: string }; +var {x, ...rest1 } = intersection; diff --git a/tests/cases/compiler/restInvalidArgumentType.ts b/tests/cases/compiler/restInvalidArgumentType.ts new file mode 100644 index 00000000000..488f546e231 --- /dev/null +++ b/tests/cases/compiler/restInvalidArgumentType.ts @@ -0,0 +1,59 @@ +enum E { v1, v2 }; + +function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var {...r1} = p1; // Error, generic type paramterre + var {...r2} = p2; // OK + var {...r3} = t; // Error, generic type paramter + + var {...r4} = i; // Error, index access + var {...r5} = k; // Error, index + + var {...r6} = mapped_generic; // Error, generic mapped object type + var {...r7} = mapped; // OK, non-generic mapped type + + var {...r8} = union_generic; // Error, union with generic type parameter + var {...r9} = union_primitive; // Error, union with generic type parameter + + var {...r10} = intersection_generic; // Error, intersection with generic type parameter + var {...r11} = intersection_premitive; // Error, intersection with generic type parameter + + var {...r12} = num; // Error + var {...r13} = str; // Error + + var {...r14} = u; // OK + var {...r15} = n; // OK + + var {...r16} = a; // OK + + var {...r17} = literal_string; // Error + var {...r18} = literal_number; // Error + + var {...r19} = e; // Error, enum +} \ No newline at end of file diff --git a/tests/cases/compiler/restUnion.ts b/tests/cases/compiler/restUnion.ts new file mode 100644 index 00000000000..c838b37340f --- /dev/null +++ b/tests/cases/compiler/restUnion.ts @@ -0,0 +1,14 @@ +var union: { a: number, c: boolean } | { a: string, b: string }; + +var rest1: { c: boolean } | { b: string }; +var {a, ...rest1 } = union; + + +var undefinedUnion: { n: number } | undefined; +var rest2: {}; +var {n, ...rest2 } = undefinedUnion; + + +var nullUnion: { n: number } | null; +var rest3: {}; +var {n, ...rest3 } = nullUnion; diff --git a/tests/cases/compiler/restUnion2.ts b/tests/cases/compiler/restUnion2.ts new file mode 100644 index 00000000000..83d94e03a73 --- /dev/null +++ b/tests/cases/compiler/restUnion2.ts @@ -0,0 +1,19 @@ +// @strictNullChecks: true + +declare const undefinedUnion: { n: number } | undefined; +var rest2: { n: number }; +var {...rest2 } = undefinedUnion; + + +declare const nullUnion: { n: number } | null; +var rest3: { n: number }; +var {...rest3 } = nullUnion; + + +declare const nullAndUndefinedUnion: null | undefined; +var rest4: { }; +var {...rest4 } = nullAndUndefinedUnion; + +declare const unionWithIntersection: ({ n: number } & { s: string }) & undefined | null; +var rest5: { n: number, s: string }; +var {...rest5 } = unionWithIntersection; \ No newline at end of file diff --git a/tests/cases/compiler/selfReferencingSpreadInLoop.ts b/tests/cases/compiler/selfReferencingSpreadInLoop.ts new file mode 100644 index 00000000000..0900e6cad63 --- /dev/null +++ b/tests/cases/compiler/selfReferencingSpreadInLoop.ts @@ -0,0 +1,5 @@ +// @noImplicitAny: true +let additional = []; +for (const subcomponent of [1, 2, 3]) { + additional = [...additional, subcomponent]; +} diff --git a/tests/cases/compiler/spreadIntersection.ts b/tests/cases/compiler/spreadIntersection.ts new file mode 100644 index 00000000000..3b397dc40cc --- /dev/null +++ b/tests/cases/compiler/spreadIntersection.ts @@ -0,0 +1,7 @@ +var intersection: { a: number } & { b: string }; + +var o1: { a: number, b: string }; +var o1 = { ...intersection }; + +var o2: { a: number, b: string, c: boolean }; +var o2 = { ...intersection, c: false }; \ No newline at end of file diff --git a/tests/cases/compiler/spreadInvalidArgumentType.ts b/tests/cases/compiler/spreadInvalidArgumentType.ts new file mode 100644 index 00000000000..2ac6aa921f4 --- /dev/null +++ b/tests/cases/compiler/spreadInvalidArgumentType.ts @@ -0,0 +1,59 @@ +enum E { v1, v2 }; + +function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var o1 = { ...p1 }; // Error, generic type paramterre + var o2 = { ...p2 }; // OK + var o3 = { ...t }; // Error, generic type paramter + + var o4 = { ...i }; // Error, index access + var o5 = { ...k }; // Error, index + + var o6 = { ...mapped_generic }; // Error, generic mapped object type + var o7 = { ...mapped }; // OK, non-generic mapped type + + var o8 = { ...union_generic }; // Error, union with generic type parameter + var o9 = { ...union_primitive }; // Error, union with generic type parameter + + var o10 = { ...intersection_generic }; // Error, intersection with generic type parameter + var o11 = { ...intersection_premitive }; // Error, intersection with generic type parameter + + var o12 = { ...num }; // Error + var o13 = { ...str }; // Error + + var o14 = { ...u }; // OK + var o15 = { ...n }; // OK + + var o16 = { ...a }; // OK + + var o17 = { ...literal_string }; // Error + var o18 = { ...literal_number }; // Error + + var o19 = { ...e }; // Error, enum +} \ No newline at end of file diff --git a/tests/cases/compiler/spreadUnion.ts b/tests/cases/compiler/spreadUnion.ts new file mode 100644 index 00000000000..ef8440122ed --- /dev/null +++ b/tests/cases/compiler/spreadUnion.ts @@ -0,0 +1,10 @@ +var union: { a: number } | { b: string }; + +var o3: { a: number } | { b: string }; +var o3 = { ...union }; + +var o4: { a: boolean } | { b: string , a: boolean}; +var o4 = { ...union, a: false }; + +var o5: { a: number } | { b: string } | { a: number, b: string }; +var o5 = { ...union, ...union }; \ No newline at end of file diff --git a/tests/cases/compiler/spreadUnion2.ts b/tests/cases/compiler/spreadUnion2.ts new file mode 100644 index 00000000000..25dba81c0df --- /dev/null +++ b/tests/cases/compiler/spreadUnion2.ts @@ -0,0 +1,25 @@ +// @strictNullChecks: true + +declare const undefinedUnion: { a: number } | undefined; +declare const nullUnion: { b: number } | null; +declare const nullAndUndefinedUnion: null | undefined; + +var o1: { a: number }; +var o1 = { ...undefinedUnion }; + +var o2: { b: number }; +var o2 = { ...nullUnion }; + +var o3: { a: number, b: number }; +var o3 = { ...undefinedUnion, ...nullUnion }; +var o3 = { ...nullUnion, ...undefinedUnion }; + +var o4: { a: number }; +var o4 = { ...undefinedUnion, ...undefinedUnion }; + +var o5: { b: number }; +var o5 = { ...nullUnion, ...nullUnion }; + +var o6: { }; +var o6 = { ...nullAndUndefinedUnion, ...nullAndUndefinedUnion }; +var o6 = { ...nullAndUndefinedUnion }; \ No newline at end of file diff --git a/tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts b/tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts new file mode 100644 index 00000000000..fc5e9794500 --- /dev/null +++ b/tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts @@ -0,0 +1,15 @@ +class Base { + protected constructor() { } + public instance1 = new Base(); // allowed +} + +class Subclass extends Base { + public instance1_1 = new Base(); // allowed + public instance1_2 = new Subclass(); // allowed +} + +class SubclassOfSubclass extends Subclass { + public instance2_1 = new Base(); // allowed + public instance2_2 = new Subclass(); // allowed + public instance2_3 = new SubclassOfSubclass(); // allowed +} diff --git a/tests/cases/compiler/systemModuleTrailingComments.ts b/tests/cases/compiler/systemModuleTrailingComments.ts new file mode 100644 index 00000000000..32c29617832 --- /dev/null +++ b/tests/cases/compiler/systemModuleTrailingComments.ts @@ -0,0 +1,4 @@ +// @module: system +export const test = "TEST"; + +//some comment \ No newline at end of file diff --git a/tests/cases/compiler/unionTypeWithLeadingOperator.ts b/tests/cases/compiler/unionTypeWithLeadingOperator.ts new file mode 100644 index 00000000000..9f6d272ce7c --- /dev/null +++ b/tests/cases/compiler/unionTypeWithLeadingOperator.ts @@ -0,0 +1,6 @@ +type A = | string; +type B = + | { type: "INCREMENT" } + | { type: "DECREMENT" }; + +type C = [| 0 | 1, | "foo" | "bar"]; diff --git a/tests/cases/compiler/untypedModuleImport_withAugmentation2.ts b/tests/cases/compiler/untypedModuleImport_withAugmentation2.ts new file mode 100644 index 00000000000..8cbf75b662b --- /dev/null +++ b/tests/cases/compiler/untypedModuleImport_withAugmentation2.ts @@ -0,0 +1,14 @@ +// @noImplicitReferences: true +// This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`. + +// @Filename: /node_modules/augmenter/index.d.ts +declare module "js" { + export const j: number; +} +export {}; + +// @Filename: /node_modules/js/index.js +This file is not processed. + +// @Filename: /a.ts +import { } from "augmenter"; diff --git a/tests/cases/compiler/unusedLocalsAndObjectSpread.ts b/tests/cases/compiler/unusedLocalsAndObjectSpread.ts new file mode 100644 index 00000000000..b042b412c8e --- /dev/null +++ b/tests/cases/compiler/unusedLocalsAndObjectSpread.ts @@ -0,0 +1,31 @@ +//@noUnusedLocals:true + +declare var console: { log(a: any): void }; + +function one() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; + console.log(bar); +} + +function two() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; + console.log(bar); +} + +function three() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; // bar should be unused + //console.log(bar); +} + +function four() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; // bar should be unused + //console.log(bar); +} diff --git a/tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts b/tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts new file mode 100644 index 00000000000..c5cd486e0f0 --- /dev/null +++ b/tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts @@ -0,0 +1,7 @@ +// @target: es2017 +// @strictNullChecks: true +interface A extends Promise {} +declare var a: A; +async function f() { + await a; +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts b/tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts new file mode 100644 index 00000000000..2c59b6f93cc --- /dev/null +++ b/tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts @@ -0,0 +1,8 @@ +// @target: es5 + +abstract class A { + abstract get a(); + abstract get aa() { return 1; } // error + abstract set b(x: string); + abstract set bb(x: string) {} // error +} diff --git a/tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts b/tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts new file mode 100644 index 00000000000..9d5d4c8c895 --- /dev/null +++ b/tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts @@ -0,0 +1,15 @@ +class B { + constructor(x?: string) {} + x(): string { return ""; } +} +class C1 extends B { + constructor() { + super.x(); + super(); + } +} +class C2 extends B { + constructor() { + super(super.x()); + } +} \ No newline at end of file diff --git a/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts b/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts new file mode 100644 index 00000000000..b20a5a85dfb --- /dev/null +++ b/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts @@ -0,0 +1,34 @@ +// @target:es5 +// @experimentaldecorators: true +declare function dec1(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; +declare function dec2(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + +class A { + @dec1 get x() { return 0; } + set x(value: number) { } +} + +class B { + get x() { return 0; } + @dec2 set x(value: number) { } +} + +class C { + @dec1 set x(value: number) { } + get x() { return 0; } +} + +class D { + set x(value: number) { } + @dec2 get x() { return 0; } +} + +class E { + @dec1 get x() { return 0; } + @dec2 set x(value: number) { } +} + +class F { + @dec1 set x(value: number) { } + @dec2 get x() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts b/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts new file mode 100644 index 00000000000..3caf4b406d2 --- /dev/null +++ b/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts @@ -0,0 +1,32 @@ +// @target:es5 +// @experimentaldecorators: true +// @emitdecoratormetadata: true +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + +class A { + @dec get x() { return 0; } + set x(value: number) { } +} + +class B { + get x() { return 0; } + @dec set x(value: number) { } +} + +class C { + @dec set x(value: number) { } + get x() { return 0; } +} + +class D { + set x(value: number) { } + @dec get x() { return 0; } +} + +class E { + @dec get x() { return 0; } +} + +class F { + @dec set x(value: number) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts b/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts new file mode 100644 index 00000000000..55e3a1423fa --- /dev/null +++ b/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts @@ -0,0 +1,18 @@ +// @target: es5 +// @module: commonjs +// @experimentaldecorators: true +// @emitdecoratormetadata: true +declare var dec: any; + +@dec +class A { +} + +@dec +class B { + constructor(x: number) {} +} + +@dec +class C extends A { +} \ No newline at end of file diff --git a/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts b/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts new file mode 100644 index 00000000000..c01030c7fa9 --- /dev/null +++ b/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts @@ -0,0 +1,31 @@ +// @declaration: true + +type T1 = { + x: T1["x"]; // Error +}; + +type T2 = { + x: T2[K]; // Error + y: number; +} + +declare let x2: T2<"x">; +let x2x = x2.x; + +interface T3> { + x: T["x"]; // Error +} + +interface T4> { + x: T4["x"]; // Error +} + +class C1 { + x: C1["x"]; // Error +} + +class C2 { + x: this["y"]; // Error + y: this["z"]; // Error + z: this["x"]; // Error +} \ No newline at end of file diff --git a/tests/cases/conformance/types/keyof/keyofAndForIn.ts b/tests/cases/conformance/types/keyof/keyofAndForIn.ts new file mode 100644 index 00000000000..97b8587a243 --- /dev/null +++ b/tests/cases/conformance/types/keyof/keyofAndForIn.ts @@ -0,0 +1,36 @@ +// @declaration: true + +// Repro from #12513 + +function f1(obj: { [P in K]: T }, k: K) { + const b = k in obj; + let k1: K; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} + +function f2(obj: { [P in keyof T]: T[P] }, k: keyof T) { + const b = k in obj; + let k1: keyof T; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} + +function f3(obj: { [P in K]: T[P] }, k: K) { + const b = k in obj; + let k1: K; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index b0451b8d55c..ea6a3c2358a 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -1,3 +1,4 @@ +// @strictNullChecks: true // @declaration: true class Shape { @@ -21,11 +22,12 @@ class Options { } type Dictionary = { [x: string]: T }; +type NumericallyIndexed = { [x: number]: T }; const enum E { A, B, C } -type K00 = keyof any; // string | number -type K01 = keyof string; // number | "toString" | "charAt" | ... +type K00 = keyof any; // string +type K01 = keyof string; // "toString" | "charAt" | ... type K02 = keyof number; // "toString" | "toFixed" | "toExponential" | ... type K03 = keyof boolean; // "valueOf" type K04 = keyof void; // never @@ -34,19 +36,20 @@ type K06 = keyof null; // never type K07 = keyof never; // never type K10 = keyof Shape; // "name" | "width" | "height" | "visible" -type K11 = keyof Shape[]; // number | "length" | "toString" | ... -type K12 = keyof Dictionary; // string | number +type K11 = keyof Shape[]; // "length" | "toString" | ... +type K12 = keyof Dictionary; // string type K13 = keyof {}; // never type K14 = keyof Object; // "constructor" | "toString" | ... type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ... -type K16 = keyof [string, number]; // number | "0" | "1" | "length" | "toString" | ... +type K16 = keyof [string, number]; // "0" | "1" | "length" | "toString" | ... type K17 = keyof (Shape | Item); // "name" type K18 = keyof (Shape & Item); // "name" | "width" | "height" | "visible" | "price" +type K19 = keyof NumericallyIndexed // never type KeyOf = keyof T; type K20 = KeyOf; // "name" | "width" | "height" | "visible" -type K21 = KeyOf>; // string | number +type K21 = KeyOf>; // string type NAME = "name"; type WIDTH_OR_HEIGHT = "width" | "height"; @@ -217,6 +220,83 @@ function f60(source: T, target: T) { } } +function f70(func: (k1: keyof (T | U), k2: keyof (T & U)) => void) { + func<{ a: any, b: any }, { a: any, c: any }>('a', 'a'); + func<{ a: any, b: any }, { a: any, c: any }>('a', 'b'); + func<{ a: any, b: any }, { a: any, c: any }>('a', 'c'); +} + +function f71(func: (x: T, y: U) => Partial) { + let x = func({ a: 1, b: "hello" }, { c: true }); + x.a; // number | undefined + x.b; // string | undefined + x.c; // boolean | undefined +} + +function f72(func: (x: T, y: U, k: K) => (T & U)[K]) { + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} + +function f73(func: (x: T, y: U, k: K) => (T & U)[K]) { + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} + +function f74(func: (x: T, y: U, k: K) => (T | U)[K]) { + let a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean +} + +function f80(obj: T) { + let a1 = obj.a; // { x: any } + let a2 = obj['a']; // { x: any } + let a3 = obj['a'] as T['a']; // T["a"] + let x1 = obj.a.x; // any + let x2 = obj['a']['x']; // any + let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"] +} + +function f81(obj: T) { + return obj['a']['x'] as T['a']['x']; +} + +function f82() { + let x1 = f81({ a: { x: "hello" } }); // string + let x2 = f81({ a: { x: 42 } }); // number +} + +function f83(obj: T, key: K) { + return obj[key]['x'] as T[K]['x']; +} + +function f84() { + let x1 = f83({ foo: { x: "hello" } }, "foo"); // string + let x2 = f83({ bar: { x: 42 } }, "bar"); // number +} + +class C1 { + x: number; + get(key: K) { + return this[key]; + } + set(key: K, value: this[K]) { + this[key] = value; + } + foo() { + let x1 = this.x; // number + let x2 = this["x"]; // number + let x3 = this.get("x"); // this["x"] + let x4 = getProperty(this, "x"); // this["x"] + this.x = 42; + this["x"] = 42; + this.set("x", 42); + setProperty(this, "x", 42); + } +} + // Repros from #12011 class Base { @@ -247,4 +327,107 @@ class OtherPerson { getParts() { return getProperty(this, "parts") } -} \ No newline at end of file +} + +// Modified repro from #12544 + +function path(obj: T, key1: K1): T[K1]; +function path(obj: T, key1: K1, key2: K2): T[K1][K2]; +function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; +function path(obj: any, ...keys: (string | number)[]): any; +function path(obj: any, ...keys: (string | number)[]): any { + let result = obj; + for (let k of keys) { + result = result[k]; + } + return result; +} + +type Thing = { + a: { x: number, y: string }, + b: boolean +}; + + +function f1(thing: Thing) { + let x1 = path(thing, 'a'); // { x: number, y: string } + let x2 = path(thing, 'a', 'y'); // string + let x3 = path(thing, 'b'); // boolean + let x4 = path(thing, ...['a', 'x']); // any +} + +// Repro from comment in #12114 + +const assignTo2 = (object: T, key1: K1, key2: K2) => + (value: T[K1][K2]) => object[key1][key2] = value; + +// Modified repro from #12573 + +declare function one(handler: (t: T) => void): T +var empty = one(() => {}) // inferred as {}, expected + +type Handlers = { [K in keyof T]: (t: T[K]) => void } +declare function on(handlerHash: Handlers): T +var hashOfEmpty1 = on({ test: () => {} }); // {} +var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } + +// Repro from #12624 + +interface Options1 { + data?: Data + computed?: Computed; +} + +declare class Component1 { + constructor(options: Options1); + get(key: K): (Data & Computed)[K]; +} + +let c1 = new Component1({ + data: { + hello: "" + } +}); + +c1.get("hello"); + +// Repro from #12625 + +interface Options2 { + data?: Data + computed?: Computed; +} + +declare class Component2 { + constructor(options: Options2); + get(key: K): (Data & Computed)[K]; +} + +// Repro from #12641 + +interface R { + p: number; +} + +function f(p: K) { + let a: any; + a[p].add; // any +} + +// Repro from #12651 + +type MethodDescriptor = { + name: string; + args: any[]; + returnValue: any; +} + +declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; + +type SomeMethodDescriptor = { + name: "someMethod"; + args: [string, number]; + returnValue: string[]; +} + +let result = dispatchMethod("someMethod", ["hello", 35]); \ No newline at end of file diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts index bc2ddc31a19..cbbc9a52200 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts @@ -65,4 +65,15 @@ function f10(shape: Shape) { setProperty(shape, "name", "rectangle"); setProperty(shape, "size", 10); // Error setProperty(shape, cond ? "name" : "size", 10); // Error +} + +function f20(k1: keyof (T | U), k2: keyof (T & U), o1: T | U, o2: T & U) { + o1[k1]; + o1[k2]; // Error + o2[k1]; + o2[k2]; + o1 = o2; + o2 = o1; // Error + k1 = k2; // Error + k2 = k1; } \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts b/tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts new file mode 100644 index 00000000000..14bb765a840 --- /dev/null +++ b/tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts @@ -0,0 +1,155 @@ +// @strictNullChecks: true +// @noimplicitany: true +// @declaration: true + +type Box = { + value: T; +} + +type Boxified = { + [P in keyof T]: Box; +} + +function box(x: T): Box { + return { value: x }; +} + +function unbox(x: Box): T { + return x.value; +} + +function boxify(obj: T): Boxified { + let result = {} as Boxified; + for (let k in obj) { + result[k] = box(obj[k]); + } + return result; +} + +function unboxify(obj: Boxified): T { + let result = {} as T; + for (let k in obj) { + result[k] = unbox(obj[k]); + } + return result; +} + +function assignBoxified(obj: Boxified, values: T) { + for (let k in values) { + obj[k].value = values[k]; + } +} + +function f1() { + let v = { + a: 42, + b: "hello", + c: true + }; + let b = boxify(v); + let x: number = b.a.value; +} + +function f2() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + let v = unboxify(b); + let x: number = v.a; +} + +function f3() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + assignBoxified(b, { c: false }); +} + +function f4() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + b = boxify(unboxify(b)); + b = unboxify(boxify(b)); +} + +function makeRecord(obj: { [P in K]: T }) { + return obj; +} + +function f5(s: string) { + let b = makeRecord({ + a: box(42), + b: box("hello"), + c: box(true) + }); + let v = unboxify(b); + let x: string | number | boolean = v.a; +} + +function makeDictionary(obj: { [x: string]: T }) { + return obj; +} + +function f6(s: string) { + let b = makeDictionary({ + a: box(42), + b: box("hello"), + c: box(true) + }); + let v = unboxify(b); + let x: string | number | boolean = v[s]; +} + +declare function validate(obj: { [P in keyof T]?: T[P] }): T; +declare function clone(obj: { readonly [P in keyof T]: T[P] }): T; +declare function validateAndClone(obj: { readonly [P in keyof T]?: T[P] }): T; + +type Foo = { + a?: number; + readonly b: string; +} + +function f10(foo: Foo) { + let x = validate(foo); // { a: number, readonly b: string } + let y = clone(foo); // { a?: number, b: string } + let z = validateAndClone(foo); // { a: number, b: string } +} + +// Repro from #12606 + +type Func = (...args: any[]) => T; +type Spec = { + [P in keyof T]: Func | Spec ; +}; + +/** + * Given a spec object recursively mapping properties to functions, creates a function + * producing an object of the same structure, by mapping each property to the result + * of calling its associated function with the supplied arguments. + */ +declare function applySpec(obj: Spec): (...args: any[]) => T; + +// Infers g1: (...args: any[]) => { sum: number, nested: { mul: string } } +var g1 = applySpec({ + sum: (a: any) => 3, + nested: { + mul: (b: any) => "n" + } +}); + +// Infers g2: (...args: any[]) => { foo: { bar: { baz: boolean } } } +var g2 = applySpec({ foo: { bar: { baz: (x: any) => true } } }); + +// Repro from #12633 + +const foo = (object: T, partial: Partial) => object; +let o = {a: 5, b: 7}; +foo(o, {b: 9}); +o = foo(o, {b: 9}); \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts index b318cde3aab..4be6b6b098d 100644 --- a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts +++ b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts @@ -67,4 +67,61 @@ function f11() { function f12() { var x: { [P in keyof T]: T[P] }; var x: { [P in keyof T]: T[P][] }; // Error -} \ No newline at end of file +} + +// Check that inferences to mapped types are secondary + +declare function objAndReadonly(primary: T, secondary: Readonly): T; +declare function objAndPartial(primary: T, secondary: Partial): T; + +function f20() { + let x1 = objAndReadonly({ x: 0, y: 0 }, { x: 1 }); // Error + let x2 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} + +function f21() { + let x1 = objAndPartial({ x: 0, y: 0 }, { x: 1 }); + let x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} + +// Verify use of Pick for setState functions (#12793) + +interface Foo { + a: string; + b?: number; +} + +function setState(obj: T, props: Pick) { + for (let k in props) { + obj[k] = props[k]; + } +} + +let foo: Foo = { a: "hello", b: 42 }; +setState(foo, { a: "test", b: 43 }) +setState(foo, { a: "hi" }); +setState(foo, { b: undefined }); +setState(foo, { }); +setState(foo, foo); +setState(foo, { a: undefined }); // Error +setState(foo, { c: true }); // Error + +class C { + state: T; + setState(props: Pick) { + for (let k in props) { + this.state[k] = props[k]; + } + } +} + +let c = new C(); +c.setState({ a: "test", b: 43 }); +c.setState({ a: "hi" }); +c.setState({ b: undefined }); +c.setState({ }); +c.setState(foo); +c.setState({ a: undefined }); // Error +c.setState({ c: true }); // Error diff --git a/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts b/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts new file mode 100644 index 00000000000..1fe6872965c --- /dev/null +++ b/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts @@ -0,0 +1,77 @@ +// @strictNullChecks: true + +type T = { a: number, b: string }; +type TP = { a?: number, b?: string }; +type TR = { readonly a: number, readonly b: string }; +type TPR = { readonly a?: number, readonly b?: string }; + +var v00: "a" | "b"; +var v00: keyof T; +var v00: keyof TP; +var v00: keyof TR; +var v00: keyof TPR; + +var v01: T; +var v01: { [P in keyof T]: T[P] }; +var v01: Pick; +var v01: Pick, keyof T>; + +var v02: TP; +var v02: { [P in keyof T]?: T[P] }; +var v02: Partial; +var v02: { [P in keyof TP]: TP[P] } +var v02: Pick; + +var v03: TR; +var v03: { readonly [P in keyof T]: T[P] }; +var v03: Readonly; +var v03: { [P in keyof TR]: TR[P] } +var v03: Pick; + +var v04: TPR; +var v04: { readonly [P in keyof T]?: T[P] }; +var v04: Partial; +var v04: Readonly; +var v04: Partial>; +var v04: Readonly>; +var v04: { [P in keyof TPR]: TPR[P] } +var v04: Pick; + +type Boxified = { [P in keyof T]: { x: T[P] } }; + +type B = { a: { x: number }, b: { x: string } }; +type BP = { a?: { x: number }, b?: { x: string } }; +type BR = { readonly a: { x: number }, readonly b: { x: string } }; +type BPR = { readonly a?: { x: number }, readonly b?: { x: string } }; + +var b00: "a" | "b"; +var b00: keyof B; +var b00: keyof BP; +var b00: keyof BR; +var b00: keyof BPR; + +var b01: B; +var b01: { [P in keyof B]: B[P] }; +var b01: Pick; +var b01: Pick, keyof B>; + +var b02: BP; +var b02: { [P in keyof B]?: B[P] }; +var b02: Partial; +var b02: { [P in keyof BP]: BP[P] } +var b02: Pick; + +var b03: BR; +var b03: { readonly [P in keyof B]: B[P] }; +var b03: Readonly; +var b03: { [P in keyof BR]: BR[P] } +var b03: Pick; + +var b04: BPR; +var b04: { readonly [P in keyof B]?: B[P] }; +var b04: Partial
; +var b04: Readonly; +var b04: Partial>; +var b04: Readonly>; +var b04: { [P in keyof BPR]: BPR[P] } +var b04: Pick; \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/mappedTypes1.ts b/tests/cases/conformance/types/mapped/mappedTypes1.ts index d090b731518..b74872c2bfd 100644 --- a/tests/cases/conformance/types/mapped/mappedTypes1.ts +++ b/tests/cases/conformance/types/mapped/mappedTypes1.ts @@ -34,7 +34,9 @@ type T47 = { [P in string | "a" | "b" | "0" | "1"]: void }; declare function f1(): { [P in keyof T1]: void }; declare function f2(): { [P in keyof T1]: void }; declare function f3(): { [P in keyof T1]: void }; +declare function f4(): { [P in keyof T1]: void }; let x1 = f1(); let x2 = f2(); -let x3 = f3(); \ No newline at end of file +let x3 = f3(); +let x4 = f4(); \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/mappedTypes2.ts b/tests/cases/conformance/types/mapped/mappedTypes2.ts index e72a0c0a892..60db4c1383b 100644 --- a/tests/cases/conformance/types/mapped/mappedTypes2.ts +++ b/tests/cases/conformance/types/mapped/mappedTypes2.ts @@ -31,25 +31,30 @@ declare function pick(obj: T, ...keys: K[]): Pick; declare function mapObject(obj: Record, f: (x: T) => U): Record; declare function proxify(obj: T): Proxify; +interface Point { + x: number; + y: number; +} + interface Shape { name: string; width: number; height: number; - visible: boolean; + location: Point; } interface PartialShape { name?: string; width?: number; height?: number; - visible?: boolean; + location?: Point; } interface ReadonlyShape { readonly name: string; readonly width: number; readonly height: number; - readonly visible: boolean; + readonly location: Point; } function f0(s1: Shape, s2: Shape) { @@ -70,7 +75,7 @@ function f2(shape: Shape) { } function f3(shape: Shape) { - const x = pick(shape, "name", "visible"); // { name: string, visible: boolean } + const x = pick(shape, "name", "location"); // { name: string, location: Point } } function f4() { @@ -81,11 +86,11 @@ function f4() { function f5(shape: Shape) { const p = proxify(shape); let name = p.name.get(); - p.visible.set(false); + p.width.set(42); } function f6(shape: DeepReadonly) { - let name = shape.name; // DeepReadonly - let length = name.length; // DeepReadonly - let toString = length.toString; // DeepReadonly<(radix?: number) => string> + let name = shape.name; // string + let location = shape.location; // DeepReadonly + let x = location.x; // number } \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/mappedTypes4.ts b/tests/cases/conformance/types/mapped/mappedTypes4.ts new file mode 100644 index 00000000000..74b3e395f32 --- /dev/null +++ b/tests/cases/conformance/types/mapped/mappedTypes4.ts @@ -0,0 +1,62 @@ +// @strictNullChecks: true +// @declaration: true + +type Box = { +}; + +type Boxified = { + [P in keyof T]: Box; +}; + +function boxify(obj: T): Boxified { + if (typeof obj === "object") { + let result = {} as Boxified; + for (let k in obj) { + result[k] = { value: obj[k] }; + } + return result; + } + return obj; +} + +type A = { a: string }; +type B = { b: string }; +type C = { c: string }; + +function f1(x: A | B | C | undefined) { + return boxify(x); +} + +type T00 = Partial
; +type T01 = Readonly; +type T02 = Boxified +type T03 = Readonly; +type T04 = Boxified; +type T05 = Partial<"hello" | "world" | 42>; + +type BoxifiedWithSentinel = { + [P in keyof T]: Box | U; +} + +type T10 = BoxifiedWithSentinel; +type T11 = BoxifiedWithSentinel; +type T12 = BoxifiedWithSentinel; + +type DeepReadonly = { + readonly [P in keyof T]: DeepReadonly; +}; + +type Foo = { + x: number; + y: { a: string, b: number }; + z: boolean; +}; + +type DeepReadonlyFoo = { + readonly x: number; + readonly y: { readonly a: string, readonly b: number }; + readonly z: boolean; +}; + +var x1: DeepReadonly; +var x1: DeepReadonlyFoo; \ No newline at end of file diff --git a/tests/cases/conformance/types/rest/objectRest.ts b/tests/cases/conformance/types/rest/objectRest.ts index 3f7be177c7b..2fba5d0b6dc 100644 --- a/tests/cases/conformance/types/rest/objectRest.ts +++ b/tests/cases/conformance/types/rest/objectRest.ts @@ -36,3 +36,5 @@ let computed = 'b'; let computed2 = 'a'; var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o; ({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o); + +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes']; diff --git a/tests/cases/conformance/types/rest/objectRestNegative.ts b/tests/cases/conformance/types/rest/objectRestNegative.ts index c224c8cd30e..4f4667fe65a 100644 --- a/tests/cases/conformance/types/rest/objectRestNegative.ts +++ b/tests/cases/conformance/types/rest/objectRestNegative.ts @@ -1,3 +1,4 @@ +// @noImplicitAny: true let o = { a: 1, b: 'no' }; var { ...mustBeLast, a } = o; @@ -15,3 +16,5 @@ function generic(t: T) { let rest: { b: string } ({a, ...rest.b + rest.b} = o); + +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject.anythingGoes; diff --git a/tests/cases/conformance/types/spread/objectSpreadNegative.ts b/tests/cases/conformance/types/spread/objectSpreadNegative.ts index 3cd819d0613..6d1e0dde429 100644 --- a/tests/cases/conformance/types/spread/objectSpreadNegative.ts +++ b/tests/cases/conformance/types/spread/objectSpreadNegative.ts @@ -29,9 +29,7 @@ spread = b; // error, missing 's' let duplicated = { b: 'bad', ...o, b: 'bad', ...o2, b: 'bad' } let duplicatedSpread = { ...o, ...o } -// null, undefined and primitives are not allowed -let spreadNull = { ...null }; -let spreadUndefind = { ...undefined }; +// primitives are not allowed let spreadNum = { ...12 }; let spreadSum = { ...1 + 1 }; spreadSum.toFixed(); // error, no methods from number diff --git a/tests/cases/fourslash/basicClassMembers.ts b/tests/cases/fourslash/basicClassMembers.ts index 1407bf89be3..9fad6731973 100644 --- a/tests/cases/fourslash/basicClassMembers.ts +++ b/tests/cases/fourslash/basicClassMembers.ts @@ -7,6 +7,6 @@ goTo.eof(); edit.insert('t.'); -verify.memberListContains('x'); -verify.memberListContains('y'); -verify.not.memberListContains('z'); +verify.completionListContains('x'); +verify.completionListContains('y'); +verify.not.completionListContains('z'); diff --git a/tests/cases/fourslash/commentBraceCompletionPosition.ts b/tests/cases/fourslash/commentBraceCompletionPosition.ts index b92c49d3a14..3730a3466c9 100644 --- a/tests/cases/fourslash/commentBraceCompletionPosition.ts +++ b/tests/cases/fourslash/commentBraceCompletionPosition.ts @@ -14,10 +14,10 @@ //// } goTo.marker('1'); -verify.not.isValidBraceCompletionAtPosition('('); +verify.isValidBraceCompletionAtPosition('('); goTo.marker('2'); -verify.not.isValidBraceCompletionAtPosition('('); +verify.isValidBraceCompletionAtPosition('('); goTo.marker('3'); -verify.not.isValidBraceCompletionAtPosition('('); \ No newline at end of file +verify.isValidBraceCompletionAtPosition('('); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsClassMembers.ts b/tests/cases/fourslash/commentsClassMembers.ts index 6edb684caa6..1c34584a262 100644 --- a/tests/cases/fourslash/commentsClassMembers.ts +++ b/tests/cases/fourslash/commentsClassMembers.ts @@ -139,18 +139,18 @@ verify.quickInfos({ }); goTo.marker('4'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('5'); verify.completionListContains("b", "(parameter) b: number", "number to add"); @@ -158,18 +158,18 @@ verify.completionListContains("b", "(parameter) b: number", "number to add"); verify.quickInfoAt("6", "(property) c1.p3: number", "getter property 1\nsetter property 1"); goTo.marker('7'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('8'); verify.currentSignatureHelpDocCommentIs("sum with property"); @@ -177,48 +177,48 @@ verify.currentParameterHelpArgumentDocCommentIs("number to add"); verify.quickInfoAt("8q", "(method) c1.p2(b: number): number", "sum with property"); goTo.marker('9'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); verify.quickInfoAt("10", "(property) c1.p3: number", "getter property 1\nsetter property 1"); goTo.marker('11'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('12'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('13'); verify.currentSignatureHelpDocCommentIs("sum with property"); @@ -232,18 +232,18 @@ verify.quickInfos({ }); goTo.marker('16'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('17'); verify.completionListContains("b", "(parameter) b: number", "number to add"); @@ -251,18 +251,18 @@ verify.completionListContains("b", "(parameter) b: number", "number to add"); verify.quickInfoAt("18", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); goTo.marker('19'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('20'); verify.currentSignatureHelpDocCommentIs("sum with property"); @@ -270,48 +270,48 @@ verify.currentParameterHelpArgumentDocCommentIs("number to add"); verify.quickInfoAt("20q", "(method) c1.pp2(b: number): number", "sum with property"); goTo.marker('21'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); verify.quickInfoAt("22", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); goTo.marker('23'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('24'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('25'); verify.currentSignatureHelpDocCommentIs("sum with property"); @@ -329,12 +329,12 @@ goTo.marker('29'); verify.completionListContains("c1", "class c1", "This is comment for c1"); goTo.marker('30'); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); goTo.marker('31'); verify.completionListContains("b", "(parameter) b: number", "number to add"); @@ -345,12 +345,12 @@ goTo.marker('33'); verify.completionListContains("c1", "class c1", "This is comment for c1"); goTo.marker('34'); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); goTo.marker('35'); verify.currentSignatureHelpDocCommentIs("static sum with property"); @@ -359,12 +359,12 @@ verify.completionListContains("c1", "class c1", "This is comment for c1"); verify.quickInfoAt("35q", "(method) c1.s2(b: number): number", "static sum with property"); goTo.marker('36'); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); verify.quickInfoAt("37", "(property) c1.s3: number", "static getter property\nsetter property 3"); @@ -372,23 +372,23 @@ goTo.marker('38'); verify.completionListContains("c1", "class c1", "This is comment for c1"); goTo.marker('39'); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); goTo.marker('40'); verify.completionListContains("c1", "class c1", "This is comment for c1"); goTo.marker('41'); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); goTo.marker('42'); verify.currentSignatureHelpDocCommentIs("static sum with property"); @@ -477,12 +477,12 @@ verify.quickInfos({ goTo.marker("67"); verify.quickInfoIs("(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); verify.quickInfos({ 68: "var i1_f: (b: number) => number", @@ -526,12 +526,12 @@ verify.completionListContains("c1", "class c1", "This is comment for c1"); goTo.marker('88'); verify.quickInfoIs("(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); verify.quickInfos({ 89: "var i1_s_f: (b: number) => number", @@ -593,10 +593,10 @@ verify.completionListContains("i1_c", "var i1_c: typeof c1", ""); goTo.marker('110'); verify.quickInfoIs("(property) cProperties.p2: number", "setter only property"); -verify.memberListContains("p1", "(property) cProperties.p1: number", "getter only property"); -verify.memberListContains("p2", "(property) cProperties.p2: number", "setter only property"); -verify.memberListContains("nc_p1", "(property) cProperties.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(property) cProperties.nc_p2: number", ""); +verify.completionListContains("p1", "(property) cProperties.p1: number", "getter only property"); +verify.completionListContains("p2", "(property) cProperties.p2: number", "setter only property"); +verify.completionListContains("nc_p1", "(property) cProperties.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(property) cProperties.nc_p2: number", ""); verify.quickInfos({ 111: ["(property) cProperties.p1: number", "getter only property"], @@ -605,7 +605,7 @@ verify.quickInfos({ }); goTo.marker('114'); -verify.memberListContains("a", "(property) cWithConstructorProperty.a: number", "this is first parameter a\nmore info about a"); +verify.completionListContains("a", "(property) cWithConstructorProperty.a: number", "this is first parameter a\nmore info about a"); verify.quickInfoIs("(property) cWithConstructorProperty.a: number", "this is first parameter a\nmore info about a"); goTo.marker('115'); diff --git a/tests/cases/fourslash/commentsEnums.ts b/tests/cases/fourslash/commentsEnums.ts index 048c99c6e0c..bf0bc087372 100644 --- a/tests/cases/fourslash/commentsEnums.ts +++ b/tests/cases/fourslash/commentsEnums.ts @@ -22,11 +22,11 @@ verify.completionListContains("Colors", "enum Colors", "Enum of colors"); verify.quickInfoIs("enum Colors", "Enum of colors"); goTo.marker('6'); -verify.memberListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); -verify.memberListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); +verify.completionListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); +verify.completionListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); verify.quickInfoIs("(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); goTo.marker('7'); -verify.memberListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); -verify.memberListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); +verify.completionListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); +verify.completionListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); verify.quickInfoIs("(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsExternalModules.ts b/tests/cases/fourslash/commentsExternalModules.ts index d9773716369..4f1a82bc0ce 100644 --- a/tests/cases/fourslash/commentsExternalModules.ts +++ b/tests/cases/fourslash/commentsExternalModules.ts @@ -46,9 +46,9 @@ goTo.marker('4'); verify.completionListContains("m1", "namespace m1", "Namespace comment"); goTo.marker('5'); -verify.memberListContains("b", "var m1.b: number", "b's comment"); -verify.memberListContains("fooExport", "function m1.fooExport(): number", "exported function"); -verify.memberListContains("m2", "namespace m1.m2"); +verify.completionListContains("b", "var m1.b: number", "b's comment"); +verify.completionListContains("fooExport", "function m1.fooExport(): number", "exported function"); +verify.completionListContains("m2", "namespace m1.m2"); goTo.marker('6'); verify.currentSignatureHelpDocCommentIs("exported function"); @@ -57,8 +57,8 @@ verify.quickInfoAt("6q", "function m1.fooExport(): number", "exported function") verify.quickInfoAt("7", "var myvar: m1.m2.c"); goTo.marker('8'); -verify.memberListContains("c", "constructor m1.m2.c(): m1.m2.c", ""); -verify.memberListContains("i", "var m1.m2.i: m1.m2.c", "i"); +verify.completionListContains("c", "constructor m1.m2.c(): m1.m2.c", ""); +verify.completionListContains("i", "var m1.m2.i: m1.m2.c", "i"); goTo.file("commentsExternalModules_file1.ts"); verify.quickInfoAt("9", 'import extMod = require("./commentsExternalModules_file0")', "This is on import declaration"); @@ -67,12 +67,12 @@ goTo.marker('10'); verify.completionListContains("extMod", 'import extMod = require("./commentsExternalModules_file0")', "This is on import declaration"); goTo.marker('11'); -verify.memberListContains("m1", "namespace extMod.m1"); +verify.completionListContains("m1", "namespace extMod.m1"); goTo.marker('12'); -verify.memberListContains("b", "var extMod.m1.b: number", "b's comment"); -verify.memberListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function"); -verify.memberListContains("m2", "namespace extMod.m1.m2"); +verify.completionListContains("b", "var extMod.m1.b: number", "b's comment"); +verify.completionListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function"); +verify.completionListContains("m2", "namespace extMod.m1.m2"); goTo.marker('13'); verify.currentSignatureHelpDocCommentIs("exported function"); @@ -81,5 +81,5 @@ verify.quickInfoAt("13q", "function extMod.m1.fooExport(): number", "exported fu verify.quickInfoAt("14", "var newVar: extMod.m1.m2.c"); goTo.marker('15'); -verify.memberListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", ""); -verify.memberListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i"); +verify.completionListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", ""); +verify.completionListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i"); diff --git a/tests/cases/fourslash/commentsImportDeclaration.ts b/tests/cases/fourslash/commentsImportDeclaration.ts index 76f2c64a51d..cda983a9e5a 100644 --- a/tests/cases/fourslash/commentsImportDeclaration.ts +++ b/tests/cases/fourslash/commentsImportDeclaration.ts @@ -30,12 +30,12 @@ verify.quickInfos({ }); goTo.marker('6'); -verify.memberListContains("m1", "namespace extMod.m1"); +verify.completionListContains("m1", "namespace extMod.m1"); goTo.marker('7'); -verify.memberListContains("b", "var extMod.m1.b: number", "b's comment"); -verify.memberListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function"); -verify.memberListContains("m2", "namespace extMod.m1.m2"); +verify.completionListContains("b", "var extMod.m1.b: number", "b's comment"); +verify.completionListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function"); +verify.completionListContains("m2", "namespace extMod.m1.m2"); goTo.marker('8'); verify.currentSignatureHelpDocCommentIs("exported function"); @@ -45,5 +45,5 @@ verify.quickInfos({ }); goTo.marker('10'); -verify.memberListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", ""); -verify.memberListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i"); +verify.completionListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", ""); +verify.completionListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i"); diff --git a/tests/cases/fourslash/commentsInheritance.ts b/tests/cases/fourslash/commentsInheritance.ts index fd7aa12e805..6e3e92cfcff 100644 --- a/tests/cases/fourslash/commentsInheritance.ts +++ b/tests/cases/fourslash/commentsInheritance.ts @@ -221,18 +221,18 @@ ////} goTo.marker('1'); -verify.memberListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1"); -verify.memberListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1"); -verify.memberListContains("i1_l1", "(property) i1.i1_l1: () => void", ""); -verify.memberListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", ""); -verify.memberListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", ""); -verify.memberListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) i1.p1: number", ""); -verify.memberListContains("f1", "(method) i1.f1(): void", ""); -verify.memberListContains("l1", "(property) i1.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) i1.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) i1.nc_f1(): void", ""); -verify.memberListContains("nc_l1", "(property) i1.nc_l1: () => void", ""); +verify.completionListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1"); +verify.completionListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1"); +verify.completionListContains("i1_l1", "(property) i1.i1_l1: () => void", ""); +verify.completionListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", ""); +verify.completionListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", ""); +verify.completionListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) i1.p1: number", ""); +verify.completionListContains("f1", "(method) i1.f1(): void", ""); +verify.completionListContains("l1", "(property) i1.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) i1.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) i1.nc_f1(): void", ""); +verify.completionListContains("nc_l1", "(property) i1.nc_l1: () => void", ""); goTo.marker('2'); verify.currentSignatureHelpDocCommentIs("i1_f1"); goTo.marker('3'); @@ -263,18 +263,18 @@ verify.quickInfos({ }); goTo.marker('6'); -verify.memberListContains("i1_p1", "(property) c1.i1_p1: number", ""); -verify.memberListContains("i1_f1", "(method) c1.i1_f1(): void", ""); -verify.memberListContains("i1_l1", "(property) c1.i1_l1: () => void", ""); -verify.memberListContains("i1_nc_p1", "(property) c1.i1_nc_p1: number", ""); -verify.memberListContains("i1_nc_f1", "(method) c1.i1_nc_f1(): void", ""); -verify.memberListContains("i1_nc_l1", "(property) c1.i1_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) c1.p1: number", "c1_p1"); -verify.memberListContains("f1", "(method) c1.f1(): void", "c1_f1"); -verify.memberListContains("l1", "(property) c1.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "c1_nc_p1"); -verify.memberListContains("nc_f1", "(method) c1.nc_f1(): void", "c1_nc_f1"); -verify.memberListContains("nc_l1", "(property) c1.nc_l1: () => void", ""); +verify.completionListContains("i1_p1", "(property) c1.i1_p1: number", ""); +verify.completionListContains("i1_f1", "(method) c1.i1_f1(): void", ""); +verify.completionListContains("i1_l1", "(property) c1.i1_l1: () => void", ""); +verify.completionListContains("i1_nc_p1", "(property) c1.i1_nc_p1: number", ""); +verify.completionListContains("i1_nc_f1", "(method) c1.i1_nc_f1(): void", ""); +verify.completionListContains("i1_nc_l1", "(property) c1.i1_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "c1_p1"); +verify.completionListContains("f1", "(method) c1.f1(): void", "c1_f1"); +verify.completionListContains("l1", "(property) c1.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "c1_nc_p1"); +verify.completionListContains("nc_f1", "(method) c1.nc_f1(): void", "c1_nc_f1"); +verify.completionListContains("nc_l1", "(property) c1.nc_l1: () => void", ""); goTo.marker('7'); verify.currentSignatureHelpDocCommentIs(""); goTo.marker('8'); @@ -305,18 +305,18 @@ verify.quickInfos({ }); goTo.marker('11'); -verify.memberListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1"); -verify.memberListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1"); -verify.memberListContains("i1_l1", "(property) i1.i1_l1: () => void", ""); -verify.memberListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", ""); -verify.memberListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", ""); -verify.memberListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) i1.p1: number", ""); -verify.memberListContains("f1", "(method) i1.f1(): void", ""); -verify.memberListContains("l1", "(property) i1.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) i1.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) i1.nc_f1(): void", ""); -verify.memberListContains("nc_l1", "(property) i1.nc_l1: () => void", ""); +verify.completionListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1"); +verify.completionListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1"); +verify.completionListContains("i1_l1", "(property) i1.i1_l1: () => void", ""); +verify.completionListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", ""); +verify.completionListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", ""); +verify.completionListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) i1.p1: number", ""); +verify.completionListContains("f1", "(method) i1.f1(): void", ""); +verify.completionListContains("l1", "(property) i1.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) i1.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) i1.nc_f1(): void", ""); +verify.completionListContains("nc_l1", "(property) i1.nc_l1: () => void", ""); goTo.marker('12'); verify.currentSignatureHelpDocCommentIs("i1_f1"); goTo.marker('13'); @@ -376,18 +376,18 @@ verify.quickInfos({ }); goTo.marker('19'); -verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); -verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); -verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); -verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); -verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); -verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", ""); -verify.memberListContains("p1", "(property) c2.p1: number", "c2 p1"); -verify.memberListContains("f1", "(method) c2.f1(): void", "c2 f1"); -verify.memberListContains("prop", "(property) c2.prop: number", "c2 prop"); -verify.memberListContains("nc_p1", "(property) c2.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) c2.nc_f1(): void", ""); -verify.memberListContains("nc_prop", "(property) c2.nc_prop: number", ""); +verify.completionListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); +verify.completionListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); +verify.completionListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); +verify.completionListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); +verify.completionListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); +verify.completionListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", ""); +verify.completionListContains("p1", "(property) c2.p1: number", "c2 p1"); +verify.completionListContains("f1", "(method) c2.f1(): void", "c2 f1"); +verify.completionListContains("prop", "(property) c2.prop: number", "c2 prop"); +verify.completionListContains("nc_p1", "(property) c2.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) c2.nc_f1(): void", ""); +verify.completionListContains("nc_prop", "(property) c2.nc_prop: number", ""); goTo.marker('20'); verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); goTo.marker('21'); @@ -405,18 +405,18 @@ verify.quickInfos({ }); goTo.marker('24'); -verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); -verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); -verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); -verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); -verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); -verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", ""); -verify.memberListContains("p1", "(property) c3.p1: number", "c3 p1"); -verify.memberListContains("f1", "(method) c3.f1(): void", "c3 f1"); -verify.memberListContains("prop", "(property) c3.prop: number", "c3 prop"); -verify.memberListContains("nc_p1", "(property) c3.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) c3.nc_f1(): void", ""); -verify.memberListContains("nc_prop", "(property) c3.nc_prop: number", ""); +verify.completionListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); +verify.completionListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); +verify.completionListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); +verify.completionListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); +verify.completionListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); +verify.completionListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", ""); +verify.completionListContains("p1", "(property) c3.p1: number", "c3 p1"); +verify.completionListContains("f1", "(method) c3.f1(): void", "c3 f1"); +verify.completionListContains("prop", "(property) c3.prop: number", "c3 prop"); +verify.completionListContains("nc_p1", "(property) c3.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) c3.nc_f1(): void", ""); +verify.completionListContains("nc_prop", "(property) c3.nc_prop: number", ""); goTo.marker('25'); verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); goTo.marker('26'); @@ -434,18 +434,18 @@ verify.quickInfos({ }); goTo.marker('29'); -verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); -verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); -verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); -verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); -verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); -verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number"); -verify.memberListContains("p1", "(property) c2.p1: number", "c2 p1"); -verify.memberListContains("f1", "(method) c2.f1(): void", "c2 f1"); -verify.memberListContains("prop", "(property) c2.prop: number", "c2 prop"); -verify.memberListContains("nc_p1", "(property) c2.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) c2.nc_f1(): void", ""); -verify.memberListContains("nc_prop", "(property) c2.nc_prop: number", ""); +verify.completionListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); +verify.completionListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); +verify.completionListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); +verify.completionListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); +verify.completionListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); +verify.completionListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number"); +verify.completionListContains("p1", "(property) c2.p1: number", "c2 p1"); +verify.completionListContains("f1", "(method) c2.f1(): void", "c2 f1"); +verify.completionListContains("prop", "(property) c2.prop: number", "c2 prop"); +verify.completionListContains("nc_p1", "(property) c2.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) c2.nc_f1(): void", ""); +verify.completionListContains("nc_prop", "(property) c2.nc_prop: number", ""); goTo.marker('30'); verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); goTo.marker('31'); @@ -478,18 +478,18 @@ verify.completionListContains("c4", "class c4", ""); verify.completionListContains("c4_i", "var c4_i: c4", ""); goTo.marker('36'); -verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); -verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); -verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); -verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); -verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); -verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) i2.p1: number", "i2 p1"); -verify.memberListContains("f1", "(method) i2.f1(): void", "i2 f1"); -verify.memberListContains("l1", "(property) i2.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) i2.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) i2.nc_f1(): void", ""); -verify.memberListContains("nc_l1", "(property) i2.nc_l1: () => void", ""); +verify.completionListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); +verify.completionListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); +verify.completionListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); +verify.completionListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); +verify.completionListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); +verify.completionListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) i2.p1: number", "i2 p1"); +verify.completionListContains("f1", "(method) i2.f1(): void", "i2 f1"); +verify.completionListContains("l1", "(property) i2.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) i2.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) i2.nc_f1(): void", ""); +verify.completionListContains("nc_l1", "(property) i2.nc_l1: () => void", ""); goTo.marker('37'); verify.currentSignatureHelpDocCommentIs("i2_f1"); goTo.marker('38'); @@ -521,18 +521,18 @@ verify.quickInfos({ }); goTo.marker('41'); -verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); -verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); -verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); -verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); -verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); -verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) i3.p1: number", "i3 p1"); -verify.memberListContains("f1", "(method) i3.f1(): void", "i3 f1"); -verify.memberListContains("l1", "(property) i3.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) i3.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) i3.nc_f1(): void", ""); -verify.memberListContains("nc_l1", "(property) i3.nc_l1: () => void", ""); +verify.completionListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); +verify.completionListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); +verify.completionListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); +verify.completionListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); +verify.completionListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); +verify.completionListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) i3.p1: number", "i3 p1"); +verify.completionListContains("f1", "(method) i3.f1(): void", "i3 f1"); +verify.completionListContains("l1", "(property) i3.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) i3.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) i3.nc_f1(): void", ""); +verify.completionListContains("nc_l1", "(property) i3.nc_l1: () => void", ""); goTo.marker('42'); verify.currentSignatureHelpDocCommentIs("i2_f1"); goTo.marker('43'); @@ -562,18 +562,18 @@ verify.quickInfos({ }); goTo.marker('46'); -verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); -verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); -verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); -verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); -verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); -verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) i2.p1: number", "i2 p1"); -verify.memberListContains("f1", "(method) i2.f1(): void", "i2 f1"); -verify.memberListContains("l1", "(property) i2.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) i2.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) i2.nc_f1(): void", ""); -verify.memberListContains("nc_l1", "(property) i2.nc_l1: () => void", ""); +verify.completionListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); +verify.completionListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); +verify.completionListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); +verify.completionListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); +verify.completionListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); +verify.completionListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) i2.p1: number", "i2 p1"); +verify.completionListContains("f1", "(method) i2.f1(): void", "i2 f1"); +verify.completionListContains("l1", "(property) i2.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) i2.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) i2.nc_f1(): void", ""); +verify.completionListContains("nc_l1", "(property) i2.nc_l1: () => void", ""); goTo.marker('47'); verify.currentSignatureHelpDocCommentIs("i2_f1"); goTo.marker('48'); diff --git a/tests/cases/fourslash/commentsInterface.ts b/tests/cases/fourslash/commentsInterface.ts index 49928f0d086..472798fa8e1 100644 --- a/tests/cases/fourslash/commentsInterface.ts +++ b/tests/cases/fourslash/commentsInterface.ts @@ -80,12 +80,12 @@ verify.quickInfos({ goTo.marker('8'); verify.quickInfoIs("(property) i2.x: number", "this is x"); -verify.memberListContains("x", "(property) i2.x: number", "this is x"); -verify.memberListContains("foo", "(property) i2.foo: (b: number) => string", "this is foo"); -verify.memberListContains("nc_x", "(property) i2.nc_x: number", ""); -verify.memberListContains("nc_foo", "(property) i2.nc_foo: (b: number) => string", ""); -verify.memberListContains("fnfoo", "(method) i2.fnfoo(b: number): string", "this is fnfoo"); -verify.memberListContains("nc_fnfoo", "(method) i2.nc_fnfoo(b: number): string", ""); +verify.completionListContains("x", "(property) i2.x: number", "this is x"); +verify.completionListContains("foo", "(property) i2.foo: (b: number) => string", "this is foo"); +verify.completionListContains("nc_x", "(property) i2.nc_x: number", ""); +verify.completionListContains("nc_foo", "(property) i2.nc_foo: (b: number) => string", ""); +verify.completionListContains("fnfoo", "(method) i2.fnfoo(b: number): string", "this is fnfoo"); +verify.completionListContains("nc_fnfoo", "(method) i2.nc_fnfoo(b: number): string", ""); verify.quickInfos({ 9: "var i2_i_foo: (b: number) => string", @@ -199,12 +199,12 @@ verify.completionListContains("i3_i", "var i3_i: i3", ""); goTo.marker('41'); verify.quickInfoIs("(method) i3.f(a: number): string", "Function i3 f"); -verify.memberListContains("f", "(method) i3.f(a: number): string", "Function i3 f"); -verify.memberListContains("l", "(property) i3.l: (b: number) => string", ""); -verify.memberListContains("x", "(property) i3.x: number", "Comment i3 x"); -verify.memberListContains("nc_f", "(method) i3.nc_f(a: number): string", ""); -verify.memberListContains("nc_l", "(property) i3.nc_l: (b: number) => string", ""); -verify.memberListContains("nc_x", "(property) i3.nc_x: number", ""); +verify.completionListContains("f", "(method) i3.f(a: number): string", "Function i3 f"); +verify.completionListContains("l", "(property) i3.l: (b: number) => string", ""); +verify.completionListContains("x", "(property) i3.x: number", "Comment i3 x"); +verify.completionListContains("nc_f", "(method) i3.nc_f(a: number): string", ""); +verify.completionListContains("nc_l", "(property) i3.nc_l: (b: number) => string", ""); +verify.completionListContains("nc_x", "(property) i3.nc_x: number", ""); goTo.marker('42'); verify.currentSignatureHelpDocCommentIs("Function i3 f"); diff --git a/tests/cases/fourslash/commentsLinePreservation.ts b/tests/cases/fourslash/commentsLinePreservation.ts index 6d085f71f80..3f60bdbf43b 100644 --- a/tests/cases/fourslash/commentsLinePreservation.ts +++ b/tests/cases/fourslash/commentsLinePreservation.ts @@ -105,6 +105,14 @@ //// * second time information about the param again //// */ ////function /*l*/l(param1: string) { /*9*/param1 = "hello"; } +//// /** +//// * This is firstLine +//// This is second Line +//// [1]: third * line +//// @param param1 first Line text +//// second line text +//// */ +////function /*m*/m(param1: string) { /*10*/param1 = "hello"; } verify.quickInfos({ a: ["var a: string", "This is firstLine\nThis is second Line\n\nThis is fourth Line"], @@ -136,5 +144,8 @@ verify.quickInfos({ 8: ["(parameter) param1: string", "hello "], l: ["function l(param1: string): void", "This is firstLine\nThis is second Line"], - 9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"] + 9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"], + + m: ["function m(param1: string): void", "This is firstLine\nThis is second Line\n[1]: third * line"], + 10: ["(parameter) param1: string", "first Line text\nsecond line text"] }); diff --git a/tests/cases/fourslash/commentsModules.ts b/tests/cases/fourslash/commentsModules.ts index 5f9457d81f4..c0b8ccc5731 100644 --- a/tests/cases/fourslash/commentsModules.ts +++ b/tests/cases/fourslash/commentsModules.ts @@ -110,9 +110,9 @@ goTo.marker('4'); verify.completionListContains("m1", "namespace m1", "Namespace comment"); goTo.marker('5'); -verify.memberListContains("b", "var m1.b: number", "b's comment"); -verify.memberListContains("fooExport", "function m1.fooExport(): number", "exported function"); -verify.memberListContains("m2", "namespace m1.m2"); +verify.completionListContains("b", "var m1.b: number", "b's comment"); +verify.completionListContains("fooExport", "function m1.fooExport(): number", "exported function"); +verify.completionListContains("m2", "namespace m1.m2"); verify.quickInfoIs("function m1.fooExport(): number", "exported function"); goTo.marker('6'); @@ -122,55 +122,55 @@ verify.quickInfoAt("7", "var myvar: m1.m2.c"); goTo.marker('8'); verify.quickInfoIs("constructor m1.m2.c(): m1.m2.c"); -verify.memberListContains("c", "constructor m1.m2.c(): m1.m2.c", ""); -verify.memberListContains("i", "var m1.m2.i: m1.m2.c", "i"); +verify.completionListContains("c", "constructor m1.m2.c(): m1.m2.c", ""); +verify.completionListContains("i", "var m1.m2.i: m1.m2.c", "i"); goTo.marker('9'); verify.completionListContains("m2", "namespace m2", "namespace comment of m2.m3"); verify.quickInfoIs("namespace m2", "namespace comment of m2.m3"); goTo.marker('10'); -verify.memberListContains("m3", "namespace m2.m3"); +verify.completionListContains("m3", "namespace m2.m3"); verify.quickInfoIs("namespace m2.m3", "namespace comment of m2.m3"); goTo.marker('11'); verify.quickInfoIs("constructor m2.m3.c(): m2.m3.c"); -verify.memberListContains("c", "constructor m2.m3.c(): m2.m3.c", ""); +verify.completionListContains("c", "constructor m2.m3.c(): m2.m3.c", ""); goTo.marker('12'); verify.completionListContains("m3", "namespace m3", "namespace comment of m3.m4.m5"); verify.quickInfoIs("namespace m3", "namespace comment of m3.m4.m5"); goTo.marker('13'); -verify.memberListContains("m4", "namespace m3.m4", "namespace comment of m3.m4.m5"); +verify.completionListContains("m4", "namespace m3.m4", "namespace comment of m3.m4.m5"); verify.quickInfoIs("namespace m3.m4", "namespace comment of m3.m4.m5"); goTo.marker('14'); -verify.memberListContains("m5", "namespace m3.m4.m5"); +verify.completionListContains("m5", "namespace m3.m4.m5"); verify.quickInfoIs("namespace m3.m4.m5", "namespace comment of m3.m4.m5"); goTo.marker('15'); verify.quickInfoIs("constructor m3.m4.m5.c(): m3.m4.m5.c"); -verify.memberListContains("c", "constructor m3.m4.m5.c(): m3.m4.m5.c", ""); +verify.completionListContains("c", "constructor m3.m4.m5.c(): m3.m4.m5.c", ""); goTo.marker('16'); verify.completionListContains("m4", "namespace m4", "namespace comment of m4.m5.m6"); verify.quickInfoIs("namespace m4", "namespace comment of m4.m5.m6"); goTo.marker('17'); -verify.memberListContains("m5", "namespace m4.m5", "namespace comment of m4.m5.m6"); +verify.completionListContains("m5", "namespace m4.m5", "namespace comment of m4.m5.m6"); verify.quickInfoIs("namespace m4.m5", "namespace comment of m4.m5.m6"); goTo.marker('18'); -verify.memberListContains("m6", "namespace m4.m5.m6"); +verify.completionListContains("m6", "namespace m4.m5.m6"); verify.quickInfoIs("namespace m4.m5.m6", "namespace comment of m4.m5.m6"); goTo.marker('19'); -verify.memberListContains("m7", "namespace m4.m5.m6.m7"); +verify.completionListContains("m7", "namespace m4.m5.m6.m7"); verify.quickInfoIs("namespace m4.m5.m6.m7"); goTo.marker('20'); -verify.memberListContains("c", "constructor m4.m5.m6.m7.c(): m4.m5.m6.m7.c", ""); +verify.completionListContains("c", "constructor m4.m5.m6.m7.c(): m4.m5.m6.m7.c", ""); verify.quickInfoIs("constructor m4.m5.m6.m7.c(): m4.m5.m6.m7.c"); goTo.marker('21'); @@ -178,19 +178,19 @@ verify.completionListContains("m5", "namespace m5"); verify.quickInfoIs("namespace m5", "namespace comment of m5.m6.m7"); goTo.marker('22'); -verify.memberListContains("m6", "namespace m5.m6"); +verify.completionListContains("m6", "namespace m5.m6"); verify.quickInfoIs("namespace m5.m6", "namespace comment of m5.m6.m7"); goTo.marker('23'); -verify.memberListContains("m7", "namespace m5.m6.m7"); +verify.completionListContains("m7", "namespace m5.m6.m7"); verify.quickInfoIs("namespace m5.m6.m7", "namespace comment of m5.m6.m7"); goTo.marker('24'); -verify.memberListContains("m8", "namespace m5.m6.m7.m8"); +verify.completionListContains("m8", "namespace m5.m6.m7.m8"); verify.quickInfoIs("namespace m5.m6.m7.m8", "namespace m8 comment"); goTo.marker('25'); -verify.memberListContains("c", "constructor m5.m6.m7.m8.c(): m5.m6.m7.m8.c", ""); +verify.completionListContains("c", "constructor m5.m6.m7.m8.c(): m5.m6.m7.m8.c", ""); verify.quickInfoIs("constructor m5.m6.m7.m8.c(): m5.m6.m7.m8.c"); goTo.marker('26'); @@ -198,15 +198,15 @@ verify.completionListContains("m6", "namespace m6"); verify.quickInfoIs("namespace m6"); goTo.marker('27'); -verify.memberListContains("m7", "namespace m6.m7"); +verify.completionListContains("m7", "namespace m6.m7"); verify.quickInfoIs("namespace m6.m7"); goTo.marker('28'); -verify.memberListContains("m8", "namespace m6.m7.m8"); +verify.completionListContains("m8", "namespace m6.m7.m8"); verify.quickInfoIs("namespace m6.m7.m8"); goTo.marker('29'); -verify.memberListContains("c", "constructor m6.m7.m8.c(): m6.m7.m8.c", ""); +verify.completionListContains("c", "constructor m6.m7.m8.c(): m6.m7.m8.c", ""); verify.quickInfoIs("constructor m6.m7.m8.c(): m6.m7.m8.c"); goTo.marker('30'); @@ -214,15 +214,15 @@ verify.completionListContains("m7", "namespace m7"); verify.quickInfoIs("namespace m7"); goTo.marker('31'); -verify.memberListContains("m8", "namespace m7.m8"); +verify.completionListContains("m8", "namespace m7.m8"); verify.quickInfoIs("namespace m7.m8"); goTo.marker('32'); -verify.memberListContains("m9", "namespace m7.m8.m9"); +verify.completionListContains("m9", "namespace m7.m8.m9"); verify.quickInfoIs("namespace m7.m8.m9", "namespace m9 comment"); goTo.marker('33'); -verify.memberListContains("c", "constructor m7.m8.m9.c(): m7.m8.m9.c", ""); +verify.completionListContains("c", "constructor m7.m8.m9.c(): m7.m8.m9.c", ""); verify.quickInfoIs("constructor m7.m8.m9.c(): m7.m8.m9.c"); goTo.marker('34'); diff --git a/tests/cases/fourslash/commentsOverloads.ts b/tests/cases/fourslash/commentsOverloads.ts index 5cc03aa842a..ec4a63349f9 100644 --- a/tests/cases/fourslash/commentsOverloads.ts +++ b/tests/cases/fourslash/commentsOverloads.ts @@ -326,10 +326,10 @@ goTo.marker('22q'); verify.quickInfoAt("22q", "var i1_i: i1(b: string) => number (+1 overload)", "this is signature 2"); goTo.marker('23'); -verify.memberListContains('foo', '(method) i1.foo(a: number): number (+1 overload)', 'foo 1'); -verify.memberListContains('foo2', '(method) i1.foo2(a: number): number (+1 overload)', ''); -verify.memberListContains('foo3', '(method) i1.foo3(a: number): number (+1 overload)', ''); -verify.memberListContains('foo4', '(method) i1.foo4(a: number): number (+1 overload)', 'foo4 1'); +verify.completionListContains('foo', '(method) i1.foo(a: number): number (+1 overload)', 'foo 1'); +verify.completionListContains('foo2', '(method) i1.foo2(a: number): number (+1 overload)', ''); +verify.completionListContains('foo3', '(method) i1.foo3(a: number): number (+1 overload)', ''); +verify.completionListContains('foo4', '(method) i1.foo4(a: number): number (+1 overload)', 'foo4 1'); goTo.marker('24'); verify.currentSignatureHelpDocCommentIs("foo 1"); @@ -432,11 +432,11 @@ verify.currentParameterHelpArgumentDocCommentIs(""); verify.quickInfoAt("43q", "var i4_i: i4(b: string) => number (+1 overload)"); goTo.marker('44'); -verify.memberListContains('prop1', '(method) c.prop1(a: number): number (+1 overload)', ''); -verify.memberListContains('prop2', '(method) c.prop2(a: number): number (+1 overload)', 'prop2 1'); -verify.memberListContains('prop3', '(method) c.prop3(a: number): number (+1 overload)', ''); -verify.memberListContains('prop4', '(method) c.prop4(a: number): number (+1 overload)', 'prop4 1'); -verify.memberListContains('prop5', '(method) c.prop5(a: number): number (+1 overload)', 'prop5 1'); +verify.completionListContains('prop1', '(method) c.prop1(a: number): number (+1 overload)', ''); +verify.completionListContains('prop2', '(method) c.prop2(a: number): number (+1 overload)', 'prop2 1'); +verify.completionListContains('prop3', '(method) c.prop3(a: number): number (+1 overload)', ''); +verify.completionListContains('prop4', '(method) c.prop4(a: number): number (+1 overload)', 'prop4 1'); +verify.completionListContains('prop5', '(method) c.prop5(a: number): number (+1 overload)', 'prop5 1'); goTo.marker('45'); verify.currentSignatureHelpDocCommentIs(""); diff --git a/tests/cases/fourslash/completionEntryForUnionProperty.ts b/tests/cases/fourslash/completionEntryForUnionProperty.ts index bc0f9405a1b..0ffc184693c 100644 --- a/tests/cases/fourslash/completionEntryForUnionProperty.ts +++ b/tests/cases/fourslash/completionEntryForUnionProperty.ts @@ -15,6 +15,6 @@ ////x./**/ goTo.marker(); -verify.memberListContains("commonProperty", "(property) commonProperty: string | number"); -verify.memberListContains("commonFunction", "(method) commonFunction(): number"); -verify.memberListCount(2); \ No newline at end of file +verify.completionListContains("commonProperty", "(property) commonProperty: string | number"); +verify.completionListContains("commonFunction", "(method) commonFunction(): number"); +verify.completionListCount(2); \ No newline at end of file diff --git a/tests/cases/fourslash/completionEntryForUnionProperty2.ts b/tests/cases/fourslash/completionEntryForUnionProperty2.ts index c2d7bc406a5..604052ff1b5 100644 --- a/tests/cases/fourslash/completionEntryForUnionProperty2.ts +++ b/tests/cases/fourslash/completionEntryForUnionProperty2.ts @@ -15,6 +15,6 @@ ////x.commonProperty./**/ goTo.marker(); -verify.memberListContains("toString", "(method) toString(): string"); -verify.memberListContains("valueOf", "(method) valueOf(): string | number"); -verify.memberListCount(2); \ No newline at end of file +verify.completionListContains("toString", "(method) toString(): string"); +verify.completionListContains("valueOf", "(method) valueOf(): string | number"); +verify.completionListCount(2); \ No newline at end of file diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts index 7faebc1474b..15f5901113b 100644 --- a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts @@ -16,9 +16,9 @@ goTo.marker('0'); verify.completionListContains("jspm"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(1); +verify.completionListCount(1); goTo.marker('1'); verify.completionListContains("jspm:dev"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(4); +verify.completionListCount(4); diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts index 4ba88e7dd2a..1d20b57e2a1 100644 --- a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts @@ -22,9 +22,9 @@ goTo.marker('0'); verify.completionListContains("jspm"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(1); +verify.completionListCount(1); goTo.marker('1'); verify.completionListContains("jspm:dev"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(4); +verify.completionListCount(4); diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts index 238606520e3..764011d90c1 100644 --- a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts @@ -18,9 +18,9 @@ goTo.marker('0'); verify.completionListContains("jspm"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(1); +verify.completionListCount(1); goTo.marker('1'); verify.completionListContains("jspm:browser"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(2); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts index 9855bb8c502..e785a1a7657 100644 --- a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts @@ -16,9 +16,9 @@ goTo.marker('0'); verify.completionListContains("jspm"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(1); +verify.completionListCount(1); goTo.marker('1'); verify.completionListContains("jspm:dev"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(4); +verify.completionListCount(4); diff --git a/tests/cases/fourslash/completionForStringLiteral.ts b/tests/cases/fourslash/completionForStringLiteral.ts index cdbe1589f73..7a14f6b6519 100644 --- a/tests/cases/fourslash/completionForStringLiteral.ts +++ b/tests/cases/fourslash/completionForStringLiteral.ts @@ -8,8 +8,8 @@ goTo.marker('1'); verify.completionListContains("Option 1"); -verify.memberListCount(3); +verify.completionListCount(3); goTo.marker('2'); verify.completionListContains("Option 2"); -verify.memberListCount(3); +verify.completionListCount(3); diff --git a/tests/cases/fourslash/completionForStringLiteral2.ts b/tests/cases/fourslash/completionForStringLiteral2.ts index 6f0768d6c6b..9b00208c729 100644 --- a/tests/cases/fourslash/completionForStringLiteral2.ts +++ b/tests/cases/fourslash/completionForStringLiteral2.ts @@ -12,9 +12,9 @@ goTo.marker('1'); verify.completionListContains("foo"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(3); +verify.completionListCount(3); goTo.marker('2'); verify.completionListContains("some other name"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(3); +verify.completionListCount(3); diff --git a/tests/cases/fourslash/completionForStringLiteral3.ts b/tests/cases/fourslash/completionForStringLiteral3.ts index 8c1a7cab2ed..238ba74b4d8 100644 --- a/tests/cases/fourslash/completionForStringLiteral3.ts +++ b/tests/cases/fourslash/completionForStringLiteral3.ts @@ -12,9 +12,9 @@ goTo.marker('1'); verify.completionListContains("A"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(3); +verify.completionListCount(3); goTo.marker('2'); verify.completionListContains("A"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(3); +verify.completionListCount(3); diff --git a/tests/cases/fourslash/completionForStringLiteral4.ts b/tests/cases/fourslash/completionForStringLiteral4.ts index 11ae699eab8..5629926bd18 100644 --- a/tests/cases/fourslash/completionForStringLiteral4.ts +++ b/tests/cases/fourslash/completionForStringLiteral4.ts @@ -20,4 +20,4 @@ verify.quickInfoIs('function f(p1: "literal", p2: "literal", p3: "other1" | "oth goTo.marker('2'); verify.completionListContains("other1"); verify.completionListContains("other2"); -verify.memberListCount(2); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/completionInJsDoc.ts b/tests/cases/fourslash/completionInJsDoc.ts index e5cc7a3d2b6..8ab9dbd0131 100644 --- a/tests/cases/fourslash/completionInJsDoc.ts +++ b/tests/cases/fourslash/completionInJsDoc.ts @@ -30,6 +30,7 @@ goTo.marker('1'); verify.completionListContains("constructor"); verify.completionListContains("param"); verify.completionListContains("type"); +verify.completionListContains("method"); goTo.marker('2'); verify.completionListContains("constructor"); diff --git a/tests/cases/fourslash/completionListAfterAnyType.ts b/tests/cases/fourslash/completionListAfterAnyType.ts index 7ab945e14cc..f7222675a0f 100644 --- a/tests/cases/fourslash/completionListAfterAnyType.ts +++ b/tests/cases/fourslash/completionListAfterAnyType.ts @@ -9,5 +9,5 @@ //// } goTo.marker(); -verify.memberListContains("charAt"); -verify.memberListCount(1); +verify.completionListContains("charAt"); +verify.completionListCount(1); diff --git a/tests/cases/fourslash/completionListAfterInvalidCharacter.ts b/tests/cases/fourslash/completionListAfterInvalidCharacter.ts index d5512e60bf7..ece28e5e3a0 100644 --- a/tests/cases/fourslash/completionListAfterInvalidCharacter.ts +++ b/tests/cases/fourslash/completionListAfterInvalidCharacter.ts @@ -8,4 +8,4 @@ ////testModule./**/ goTo.marker(); -verify.memberListContains("foo"); +verify.completionListContains("foo"); diff --git a/tests/cases/fourslash/completionListAfterObjectLiteral1.ts b/tests/cases/fourslash/completionListAfterObjectLiteral1.ts index f761aad2495..7296ce057b4 100644 --- a/tests/cases/fourslash/completionListAfterObjectLiteral1.ts +++ b/tests/cases/fourslash/completionListAfterObjectLiteral1.ts @@ -3,5 +3,5 @@ ////var v = { x: 4, y: 3 }./**/ goTo.marker(); -verify.not.memberListContains('a'); -verify.memberListContains('x'); \ No newline at end of file +verify.not.completionListContains('a'); +verify.completionListContains('x'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAfterRegularExpressionLiteral01.ts b/tests/cases/fourslash/completionListAfterRegularExpressionLiteral01.ts index ac8568d13f5..759a3f9c2a4 100644 --- a/tests/cases/fourslash/completionListAfterRegularExpressionLiteral01.ts +++ b/tests/cases/fourslash/completionListAfterRegularExpressionLiteral01.ts @@ -4,5 +4,5 @@ /////a/./**/ goTo.marker(); -verify.not.memberListContains('v'); -verify.memberListContains('compile'); \ No newline at end of file +verify.not.completionListContains('v'); +verify.completionListContains('compile'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAfterRegularExpressionLiteral1.ts b/tests/cases/fourslash/completionListAfterRegularExpressionLiteral1.ts index 558b4d1e791..465c676c714 100644 --- a/tests/cases/fourslash/completionListAfterRegularExpressionLiteral1.ts +++ b/tests/cases/fourslash/completionListAfterRegularExpressionLiteral1.ts @@ -3,5 +3,5 @@ /////a/./**/ goTo.marker(); -verify.not.memberListContains('alert'); -verify.memberListContains('compile'); \ No newline at end of file +verify.not.completionListContains('alert'); +verify.completionListContains('compile'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAfterStringLiteral1.ts b/tests/cases/fourslash/completionListAfterStringLiteral1.ts index 1391b3ae80d..533b428cdf5 100644 --- a/tests/cases/fourslash/completionListAfterStringLiteral1.ts +++ b/tests/cases/fourslash/completionListAfterStringLiteral1.ts @@ -3,5 +3,5 @@ ////"a"./**/ goTo.marker(); -verify.not.memberListContains('alert'); -verify.memberListContains('charAt'); \ No newline at end of file +verify.not.completionListContains('alert'); +verify.completionListContains('charAt'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts b/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts index c3ee033bf54..d0517d87279 100644 --- a/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts +++ b/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts @@ -15,4 +15,4 @@ goTo.marker(); verify.completionListIsEmpty(); -verify.memberListIsEmpty(); \ No newline at end of file +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts b/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts index f0287a0baea..a40c68e8b15 100644 --- a/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts +++ b/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts @@ -15,4 +15,4 @@ goTo.marker(); verify.completionListIsEmpty(); -verify.memberListIsEmpty(); \ No newline at end of file +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAtEOF1.ts b/tests/cases/fourslash/completionListAtEOF1.ts index 1e903119462..3a7cfe95316 100644 --- a/tests/cases/fourslash/completionListAtEOF1.ts +++ b/tests/cases/fourslash/completionListAtEOF1.ts @@ -3,4 +3,4 @@ //// if(0 === ''. goTo.eof(); -verify.memberListContains("charAt"); +verify.completionListContains("charAt"); diff --git a/tests/cases/fourslash/completionListAtEOF2.ts b/tests/cases/fourslash/completionListAtEOF2.ts index d83d29ab599..8ba6a9d8e65 100644 --- a/tests/cases/fourslash/completionListAtEOF2.ts +++ b/tests/cases/fourslash/completionListAtEOF2.ts @@ -8,4 +8,4 @@ ////var p = = new .length: number", /*docComments*/ undefined, /*kind*/ "property"); -verify.memberListContains('toString', "(method) Array.toString(): string", /*docComments*/ undefined, /*kind*/ "method"); +verify.completionListContains('length', "(property) Array.length: number", /*docComments*/ undefined, /*kind*/ "property"); +verify.completionListContains('toString', "(method) Array.toString(): string", /*docComments*/ undefined, /*kind*/ "method"); diff --git a/tests/cases/fourslash/completionListOfSplitInterface.ts b/tests/cases/fourslash/completionListOfSplitInterface.ts index 61eae0da072..9bc635d8f8b 100644 --- a/tests/cases/fourslash/completionListOfSplitInterface.ts +++ b/tests/cases/fourslash/completionListOfSplitInterface.ts @@ -33,18 +33,18 @@ ////ci1./*2*/b; goTo.marker('1'); -verify.memberListCount(6); -verify.memberListContains("a"); -verify.memberListContains("b"); -verify.memberListContains("c"); -verify.memberListContains("i1"); -verify.memberListContains("i2"); -verify.memberListContains("i3"); +verify.completionListCount(6); +verify.completionListContains("a"); +verify.completionListContains("b"); +verify.completionListContains("c"); +verify.completionListContains("i1"); +verify.completionListContains("i2"); +verify.completionListContains("i3"); goTo.marker('2'); -verify.memberListCount(5); -verify.memberListContains("a"); -verify.memberListContains("b"); -verify.memberListContains("b1"); -verify.memberListContains("i11"); -verify.memberListContains("i12"); +verify.completionListCount(5); +verify.completionListContains("a"); +verify.completionListContains("b"); +verify.completionListContains("b1"); +verify.completionListContains("i11"); +verify.completionListContains("i12"); diff --git a/tests/cases/fourslash/completionListOnAliases.ts b/tests/cases/fourslash/completionListOnAliases.ts index 3d9026c3036..c15e5284c06 100644 --- a/tests/cases/fourslash/completionListOnAliases.ts +++ b/tests/cases/fourslash/completionListOnAliases.ts @@ -9,7 +9,7 @@ ////} goTo.marker("1"); -verify.memberListContains("x", "import x = M", undefined); +verify.completionListContains("x", "import x = M", undefined); goTo.marker("2"); -verify.memberListContains("value"); +verify.completionListContains("value"); diff --git a/tests/cases/fourslash/completionListOnAliases2.ts b/tests/cases/fourslash/completionListOnAliases2.ts index 6a74f3a525b..7ff50a1a2b5 100644 --- a/tests/cases/fourslash/completionListOnAliases2.ts +++ b/tests/cases/fourslash/completionListOnAliases2.ts @@ -35,40 +35,40 @@ // Module m goTo.marker("1"); -verify.memberListContains("I"); -verify.memberListContains("C"); -verify.memberListContains("E"); -verify.memberListContains("N"); -verify.memberListContains("V"); -verify.memberListContains("F"); -verify.memberListContains("A"); +verify.completionListContains("I"); +verify.completionListContains("C"); +verify.completionListContains("E"); +verify.completionListContains("N"); +verify.completionListContains("V"); +verify.completionListContains("F"); +verify.completionListContains("A"); // Class C goTo.marker("2"); -verify.memberListContains("property"); +verify.completionListContains("property"); // Enum E goTo.marker("3"); -verify.memberListContains("value"); +verify.completionListContains("value"); // Module N goTo.marker("4"); -verify.memberListContains("v"); +verify.completionListContains("v"); // var V goTo.marker("5"); -verify.memberListContains("toFixed"); +verify.completionListContains("toFixed"); // function F goTo.marker("6"); -verify.memberListContains("call"); +verify.completionListContains("call"); // alias a goTo.marker("7"); -verify.memberListContains("I"); -verify.memberListContains("C"); -verify.memberListContains("E"); -verify.memberListContains("N"); -verify.memberListContains("V"); -verify.memberListContains("F"); -verify.memberListContains("A"); +verify.completionListContains("I"); +verify.completionListContains("C"); +verify.completionListContains("E"); +verify.completionListContains("N"); +verify.completionListContains("V"); +verify.completionListContains("F"); +verify.completionListContains("A"); diff --git a/tests/cases/fourslash/completionListOnAliases3.ts b/tests/cases/fourslash/completionListOnAliases3.ts index 8c5194af968..3eab00e2ed9 100644 --- a/tests/cases/fourslash/completionListOnAliases3.ts +++ b/tests/cases/fourslash/completionListOnAliases3.ts @@ -10,4 +10,4 @@ // Q does not show up in member list of x goTo.marker("1"); -verify.memberListContains("Q"); +verify.completionListContains("Q"); diff --git a/tests/cases/fourslash/completionListOnFunctionCallWithOptionalArgument.ts b/tests/cases/fourslash/completionListOnFunctionCallWithOptionalArgument.ts index 9cab9589406..cec7bf87aec 100644 --- a/tests/cases/fourslash/completionListOnFunctionCallWithOptionalArgument.ts +++ b/tests/cases/fourslash/completionListOnFunctionCallWithOptionalArgument.ts @@ -4,4 +4,4 @@ //// Foo(function () { } )./**/; goTo.marker(); -verify.memberListContains('q'); +verify.completionListContains('q'); diff --git a/tests/cases/fourslash/completionListOnParam.ts b/tests/cases/fourslash/completionListOnParam.ts index 8b686535927..ad2bbcde1b8 100644 --- a/tests/cases/fourslash/completionListOnParam.ts +++ b/tests/cases/fourslash/completionListOnParam.ts @@ -9,4 +9,4 @@ ////} goTo.marker(); -verify.memberListContains('Blah'); \ No newline at end of file +verify.completionListContains('Blah'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListOnParamOfGenericType1.ts b/tests/cases/fourslash/completionListOnParamOfGenericType1.ts index 1b0fdba8ff8..c55b48bf7e9 100644 --- a/tests/cases/fourslash/completionListOnParamOfGenericType1.ts +++ b/tests/cases/fourslash/completionListOnParamOfGenericType1.ts @@ -9,14 +9,14 @@ ////} goTo.marker('1'); -verify.memberListContains('next'); -verify.memberListContains('prev'); -verify.memberListContains('pushEntry'); +verify.completionListContains('next'); +verify.completionListContains('prev'); +verify.completionListContains('pushEntry'); edit.insert('next.'); -verify.memberListContains('next'); -verify.memberListContains('prev'); -verify.memberListContains('pushEntry'); +verify.completionListContains('next'); +verify.completionListContains('prev'); +verify.completionListContains('pushEntry'); edit.insert('prev.'); -verify.memberListContains('next'); -verify.memberListContains('prev'); -verify.memberListContains('pushEntry'); +verify.completionListContains('next'); +verify.completionListContains('prev'); +verify.completionListContains('pushEntry'); diff --git a/tests/cases/fourslash/completionListOnSuper.ts b/tests/cases/fourslash/completionListOnSuper.ts index 3ca997cf1bb..2b3c0ef75fa 100644 --- a/tests/cases/fourslash/completionListOnSuper.ts +++ b/tests/cases/fourslash/completionListOnSuper.ts @@ -17,6 +17,6 @@ ////} goTo.marker(); -verify.memberListContains('foo'); -verify.memberListContains('bar'); -verify.memberListCount(2); +verify.completionListContains('foo'); +verify.completionListContains('bar'); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/completionListOnVarBetweenModules.ts b/tests/cases/fourslash/completionListOnVarBetweenModules.ts index 6f907e5f75b..b0205e3428c 100644 --- a/tests/cases/fourslash/completionListOnVarBetweenModules.ts +++ b/tests/cases/fourslash/completionListOnVarBetweenModules.ts @@ -13,5 +13,5 @@ ////} goTo.marker(); -verify.memberListContains("C1"); -verify.memberListContains("C2"); +verify.completionListContains("C1"); +verify.completionListContains("C2"); diff --git a/tests/cases/fourslash/completionListPrimitives.ts b/tests/cases/fourslash/completionListPrimitives.ts index fd1d0670f2e..21a34659c4e 100644 --- a/tests/cases/fourslash/completionListPrimitives.ts +++ b/tests/cases/fourslash/completionListPrimitives.ts @@ -3,10 +3,10 @@ /////**/ goTo.marker(); -verify.memberListContains("any"); -verify.memberListContains("boolean"); -verify.memberListContains("null"); -verify.memberListContains("number"); -verify.memberListContains("string"); -verify.memberListContains("undefined"); -verify.memberListContains("void"); \ No newline at end of file +verify.completionListContains("any"); +verify.completionListContains("boolean"); +verify.completionListContains("null"); +verify.completionListContains("number"); +verify.completionListContains("string"); +verify.completionListContains("undefined"); +verify.completionListContains("void"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListPrivateMembers.ts b/tests/cases/fourslash/completionListPrivateMembers.ts index 772491a391e..e5e494d521d 100644 --- a/tests/cases/fourslash/completionListPrivateMembers.ts +++ b/tests/cases/fourslash/completionListPrivateMembers.ts @@ -13,5 +13,5 @@ goTo.marker(); -verify.memberListContains("y"); -verify.not.memberListContains("x"); +verify.completionListContains("y"); +verify.not.completionListContains("x"); diff --git a/tests/cases/fourslash/completionListPrivateMembers2.ts b/tests/cases/fourslash/completionListPrivateMembers2.ts index 1b19d042cbe..1a04df1d823 100644 --- a/tests/cases/fourslash/completionListPrivateMembers2.ts +++ b/tests/cases/fourslash/completionListPrivateMembers2.ts @@ -9,9 +9,9 @@ ////f./*2*/ goTo.marker("1"); -verify.memberListContains("y"); -verify.memberListContains("x"); +verify.completionListContains("y"); +verify.completionListContains("x"); goTo.marker("2"); -verify.not.memberListContains("x"); -verify.not.memberListContains("y"); \ No newline at end of file +verify.not.completionListContains("x"); +verify.not.completionListContains("y"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListPrivateMembers3.ts b/tests/cases/fourslash/completionListPrivateMembers3.ts index 69f7456d7b5..999ab8fa5e6 100644 --- a/tests/cases/fourslash/completionListPrivateMembers3.ts +++ b/tests/cases/fourslash/completionListPrivateMembers3.ts @@ -19,13 +19,13 @@ ////} goTo.marker("1"); -verify.memberListContains("p"); -verify.memberListCount(1); +verify.completionListContains("p"); +verify.completionListCount(1); goTo.marker("2"); -verify.memberListContains("p"); -verify.memberListCount(1); +verify.completionListContains("p"); +verify.completionListCount(1); goTo.marker("2"); -verify.memberListContains("p"); -verify.memberListCount(1); +verify.completionListContains("p"); +verify.completionListCount(1); diff --git a/tests/cases/fourslash/completionListProtectedMembers.ts b/tests/cases/fourslash/completionListProtectedMembers.ts index 4715a9fb714..20cb990405d 100644 --- a/tests/cases/fourslash/completionListProtectedMembers.ts +++ b/tests/cases/fourslash/completionListProtectedMembers.ts @@ -19,26 +19,26 @@ ////f./*5*/ goTo.marker("1"); -verify.memberListContains("y"); -verify.memberListContains("x"); -verify.not.memberListContains("z"); +verify.completionListContains("y"); +verify.completionListContains("x"); +verify.not.completionListContains("z"); goTo.marker("2"); -verify.memberListContains("y"); -verify.memberListContains("x"); -verify.memberListContains("z"); +verify.completionListContains("y"); +verify.completionListContains("x"); +verify.completionListContains("z"); goTo.marker("3"); -verify.memberListContains("y"); -verify.memberListContains("x"); -verify.not.memberListContains("z"); +verify.completionListContains("y"); +verify.completionListContains("x"); +verify.not.completionListContains("z"); goTo.marker("4"); -verify.memberListContains("y"); -verify.memberListContains("x"); -verify.memberListContains("z"); +verify.completionListContains("y"); +verify.completionListContains("x"); +verify.completionListContains("z"); goTo.marker("5"); -verify.not.memberListContains("x"); -verify.not.memberListContains("y"); -verify.not.memberListContains("z"); +verify.not.completionListContains("x"); +verify.not.completionListContains("y"); +verify.not.completionListContains("z"); diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers.ts b/tests/cases/fourslash/completionListStaticProtectedMembers.ts index d72859570aa..ae79387fbe7 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers.ts @@ -28,32 +28,32 @@ // Same class, everything is visible goTo.marker("1"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.completionListContains('privateMethod'); +verify.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); goTo.marker("2"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.completionListContains('privateMethod'); +verify.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); // Can not access protected properties overridden in subclass goTo.marker("3"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); \ No newline at end of file +verify.completionListContains('privateMethod'); +verify.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.not.completionListContains('protectedOverriddenMethod'); +verify.not.completionListContains('protectedOverriddenProperty'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers2.ts b/tests/cases/fourslash/completionListStaticProtectedMembers2.ts index 44cf9f73fd5..c6c64c5c6eb 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers2.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers2.ts @@ -29,42 +29,42 @@ // Same class, everything is visible goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); goTo.marker("3"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); // only public and protected methods of the base class are accessible through super goTo.marker("4"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.not.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); \ No newline at end of file +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.not.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.not.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.not.completionListContains('protectedOverriddenProperty'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers3.ts b/tests/cases/fourslash/completionListStaticProtectedMembers3.ts index c955f23fa32..0cb916c181f 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers3.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers3.ts @@ -25,21 +25,21 @@ // Only public properties are visible outside the class goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.not.completionListContains('protectedMethod'); +verify.not.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.not.completionListContains('protectedOverriddenMethod'); +verify.not.completionListContains('protectedOverriddenProperty'); goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); \ No newline at end of file +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.not.completionListContains('protectedMethod'); +verify.not.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.not.completionListContains('protectedOverriddenMethod'); +verify.not.completionListContains('protectedOverriddenProperty'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers4.ts b/tests/cases/fourslash/completionListStaticProtectedMembers4.ts index 817d2c4829c..14c460d6873 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers4.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers4.ts @@ -28,22 +28,22 @@ // Sub class, everything but private is visible goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); // Can see protected methods elevated to public goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.not.completionListContains('protectedMethod'); +verify.not.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); diff --git a/tests/cases/fourslash/completionListSuperMembers.ts b/tests/cases/fourslash/completionListSuperMembers.ts index 6c7ddd5c7b3..ae6195601a3 100644 --- a/tests/cases/fourslash/completionListSuperMembers.ts +++ b/tests/cases/fourslash/completionListSuperMembers.ts @@ -25,11 +25,11 @@ goTo.marker(); -verify.not.memberListContains("publicProperty"); -verify.memberListContains("publicInstanceMethod"); +verify.not.completionListContains("publicProperty"); +verify.completionListContains("publicInstanceMethod"); // No statics -verify.not.memberListContains("publicStaticProperty"); -verify.not.memberListContains("publicStaticMethod"); +verify.not.completionListContains("publicStaticProperty"); +verify.not.completionListContains("publicStaticMethod"); // No privates -verify.not.memberListContains("privateProperty"); -verify.not.memberListContains("privateInstanceMethod"); \ No newline at end of file +verify.not.completionListContains("privateProperty"); +verify.not.completionListContains("privateInstanceMethod"); \ No newline at end of file diff --git a/tests/cases/fourslash/exportEqualTypes.ts b/tests/cases/fourslash/exportEqualTypes.ts index 1b8593893dd..b03e21b5f99 100644 --- a/tests/cases/fourslash/exportEqualTypes.ts +++ b/tests/cases/fourslash/exportEqualTypes.ts @@ -20,5 +20,5 @@ verify.quickInfos({ 3: "var r2: string" }); goTo.marker('4'); -verify.memberListContains('foo'); +verify.completionListContains('foo'); verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash/extendArrayInterface.ts b/tests/cases/fourslash/extendArrayInterface.ts index 4402dc39b88..d2322b37df0 100644 --- a/tests/cases/fourslash/extendArrayInterface.ts +++ b/tests/cases/fourslash/extendArrayInterface.ts @@ -8,7 +8,7 @@ goTo.marker("1"); -verify.memberListContains("concat"); +verify.completionListContains("concat"); // foo doesn't exist, so both references should be in error verify.errorExistsBetweenMarkers("2", "3"); diff --git a/tests/cases/fourslash/externalModuleIntellisense.ts b/tests/cases/fourslash/externalModuleIntellisense.ts index 93c7143a9c6..8577e0686bf 100644 --- a/tests/cases/fourslash/externalModuleIntellisense.ts +++ b/tests/cases/fourslash/externalModuleIntellisense.ts @@ -23,4 +23,4 @@ goTo.eof(); edit.insert("x."); verify.completionListContains('enable'); verify.completionListContains('post'); -verify.memberListCount(2); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/externalModuleRefernceResolutionOrderInImportDeclaration.ts b/tests/cases/fourslash/externalModuleRefernceResolutionOrderInImportDeclaration.ts index 257c6cf3455..a1d503a657a 100644 --- a/tests/cases/fourslash/externalModuleRefernceResolutionOrderInImportDeclaration.ts +++ b/tests/cases/fourslash/externalModuleRefernceResolutionOrderInImportDeclaration.ts @@ -16,5 +16,5 @@ goTo.marker('1'); edit.insert("file1."); -verify.memberListContains("bar"); -verify.not.memberListContains("foo"); \ No newline at end of file +verify.completionListContains("bar"); +verify.not.completionListContains("foo"); \ No newline at end of file diff --git a/tests/cases/fourslash/forwardReference.ts b/tests/cases/fourslash/forwardReference.ts index 3c2e2c6393c..355eda9113c 100644 --- a/tests/cases/fourslash/forwardReference.ts +++ b/tests/cases/fourslash/forwardReference.ts @@ -9,4 +9,4 @@ ////} goTo.marker(); -verify.memberListContains('n'); +verify.completionListContains('n'); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 35c68b49fd8..745a746db11 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -121,13 +121,11 @@ declare namespace FourSlashInterface { private negative; not: verifyNegatable; constructor(negative?: boolean); - memberListContains(symbol: string, text?: string, documenation?: string, kind?: string): void; - memberListCount(expectedCount: number): void; + completionListCount(expectedCount: number): void; completionListContains(symbol: string, text?: string, documentation?: string, kind?: string, spanIndex?: number): void; completionListItemsCountIsGreaterThan(count: number): void; completionListIsEmpty(): void; completionListAllowsNewIdentifier(): void; - memberListIsEmpty(): void; signatureHelpPresent(): void; errorExistsBetweenMarkers(startMarker: string, endMarker: string): void; errorExistsAfterMarker(markerName?: string): void; @@ -279,7 +277,6 @@ declare namespace FourSlashInterface { printCurrentFileStateWithoutCaret(): void; printCurrentQuickInfo(): void; printCurrentSignatureHelp(): void; - printMemberListMembers(): void; printCompletionListMembers(): void; printBreakpointLocation(pos: number): void; printBreakpointAtCurrentLocation(): void; diff --git a/tests/cases/fourslash/functionTypes.ts b/tests/cases/fourslash/functionTypes.ts index 0baccba286e..813dfa8cdcb 100644 --- a/tests/cases/fourslash/functionTypes.ts +++ b/tests/cases/fourslash/functionTypes.ts @@ -23,7 +23,7 @@ verify.numberOfErrorsInCurrentFile(0); for (var i = 1; i <= 7; i++) { goTo.marker('' + i); - verify.memberListCount(8); + verify.completionListCount(8); verify.completionListContains('apply'); verify.completionListContains('arguments'); verify.completionListContains('bind'); diff --git a/tests/cases/fourslash/getJavaScriptCompletions20.ts b/tests/cases/fourslash/getJavaScriptCompletions20.ts index d254705bb91..3ca27fa288a 100644 --- a/tests/cases/fourslash/getJavaScriptCompletions20.ts +++ b/tests/cases/fourslash/getJavaScriptCompletions20.ts @@ -18,4 +18,4 @@ //// Person.getNa/**/ = 10; goTo.marker(); -verify.not.memberListContains('getNa'); +verify.not.completionListContains('getNa'); diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo8.ts b/tests/cases/fourslash/getJavaScriptQuickInfo8.ts index 09ac27ce595..958dec3765d 100644 --- a/tests/cases/fourslash/getJavaScriptQuickInfo8.ts +++ b/tests/cases/fourslash/getJavaScriptQuickInfo8.ts @@ -21,9 +21,9 @@ goTo.marker('1'); edit.insert('.'); -verify.memberListContains('toFixed', undefined, undefined, 'method'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); edit.backspace(); goTo.marker('2'); edit.insert('.'); -verify.memberListContains('substr', undefined, undefined, 'method'); +verify.completionListContains('substr', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptModules13.ts b/tests/cases/fourslash/javaScriptModules13.ts index bcf263a4b8c..5e3eead3b6c 100644 --- a/tests/cases/fourslash/javaScriptModules13.ts +++ b/tests/cases/fourslash/javaScriptModules13.ts @@ -23,6 +23,6 @@ verify.completionListContains('y'); verify.not.completionListContains('invisible'); edit.insert('x.'); -verify.memberListContains('a', undefined, undefined, 'property'); +verify.completionListContains('a', undefined, undefined, 'property'); edit.insert('a.'); -verify.memberListContains('toFixed', undefined, undefined, 'method'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptModules19.ts b/tests/cases/fourslash/javaScriptModules19.ts index 564cbea722f..56ee5a2a2e5 100644 --- a/tests/cases/fourslash/javaScriptModules19.ts +++ b/tests/cases/fourslash/javaScriptModules19.ts @@ -21,6 +21,6 @@ verify.completionListContains('y'); verify.not.completionListContains('invisible'); edit.insert('x.'); -verify.memberListContains('a', undefined, undefined, 'property'); +verify.completionListContains('a', undefined, undefined, 'property'); edit.insert('a.'); -verify.memberListContains('toFixed', undefined, undefined, 'method'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptPrototype1.ts b/tests/cases/fourslash/javaScriptPrototype1.ts index c9c454cfb2c..8b2d6f3fb84 100644 --- a/tests/cases/fourslash/javaScriptPrototype1.ts +++ b/tests/cases/fourslash/javaScriptPrototype1.ts @@ -22,25 +22,25 @@ // Members of the class instance goTo.marker('1'); edit.insert('.'); -verify.memberListContains('foo', undefined, undefined, 'property'); -verify.memberListContains('bar', undefined, undefined, 'property'); +verify.completionListContains('foo', undefined, undefined, 'property'); +verify.completionListContains('bar', undefined, undefined, 'property'); edit.backspace(); // Members of a class method (1) goTo.marker('2'); edit.insert('.'); -verify.memberListContains('length', undefined, undefined, 'property'); +verify.completionListContains('length', undefined, undefined, 'property'); edit.backspace(); // Members of the invocation of a class method (1) goTo.marker('3'); edit.insert('.'); -verify.memberListContains('toFixed', undefined, undefined, 'method'); -verify.not.memberListContains('substr', undefined, undefined, 'method'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); +verify.not.completionListContains('substr', undefined, undefined, 'method'); edit.backspace(); // Members of the invocation of a class method (2) goTo.marker('4'); edit.insert('.'); -verify.memberListContains('substr', undefined, undefined, 'method'); -verify.not.memberListContains('toFixed', undefined, undefined, 'method'); +verify.completionListContains('substr', undefined, undefined, 'method'); +verify.not.completionListContains('toFixed', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/jsDocFunctionSignatures3.ts b/tests/cases/fourslash/jsDocFunctionSignatures3.ts index 3679035d31d..87efaec3308 100644 --- a/tests/cases/fourslash/jsDocFunctionSignatures3.ts +++ b/tests/cases/fourslash/jsDocFunctionSignatures3.ts @@ -23,10 +23,10 @@ goTo.marker('1'); edit.insert('.'); -verify.memberListContains('substr', undefined, undefined, 'method'); +verify.completionListContains('substr', undefined, undefined, 'method'); edit.backspace(); goTo.marker('2'); edit.insert('.'); -verify.memberListContains('toFixed', undefined, undefined, 'method'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); edit.backspace(); diff --git a/tests/cases/fourslash/jsDocGenerics1.ts b/tests/cases/fourslash/jsDocGenerics1.ts index 61358e3f490..e5570937ba4 100644 --- a/tests/cases/fourslash/jsDocGenerics1.ts +++ b/tests/cases/fourslash/jsDocGenerics1.ts @@ -25,10 +25,10 @@ goTo.marker('1'); -verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); goTo.marker('2'); -verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); goTo.marker('3'); -verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/jsdocNullableUnion.ts b/tests/cases/fourslash/jsdocNullableUnion.ts index 19dc9818d69..50b929b1912 100644 --- a/tests/cases/fourslash/jsdocNullableUnion.ts +++ b/tests/cases/fourslash/jsdocNullableUnion.ts @@ -14,10 +14,10 @@ ////} goTo.marker('1'); -verify.memberListContains("x"); +verify.completionListContains("x"); goTo.marker('2'); -verify.memberListContains("y"); +verify.completionListContains("y"); goTo.marker('3'); -verify.memberListContains("z"); +verify.completionListContains("z"); diff --git a/tests/cases/fourslash/lambdaThisMembers.ts b/tests/cases/fourslash/lambdaThisMembers.ts index 1e80a5a47df..1a5aa112a6c 100644 --- a/tests/cases/fourslash/lambdaThisMembers.ts +++ b/tests/cases/fourslash/lambdaThisMembers.ts @@ -12,5 +12,5 @@ goTo.marker(); verify.completionListContains("a"); verify.completionListContains("b"); -verify.memberListCount(2); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/memberCompletionFromFunctionCall.ts b/tests/cases/fourslash/memberCompletionFromFunctionCall.ts index 56629a3b510..9bd59e1dc9f 100644 --- a/tests/cases/fourslash/memberCompletionFromFunctionCall.ts +++ b/tests/cases/fourslash/memberCompletionFromFunctionCall.ts @@ -8,5 +8,5 @@ goTo.marker(); edit.insert("."); -verify.not.memberListIsEmpty(); -verify.memberListContains("text"); \ No newline at end of file +verify.not.completionListIsEmpty(); +verify.completionListContains("text"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberCompletionInForEach1.ts b/tests/cases/fourslash/memberCompletionInForEach1.ts index 2af0393283f..b90da43c119 100644 --- a/tests/cases/fourslash/memberCompletionInForEach1.ts +++ b/tests/cases/fourslash/memberCompletionInForEach1.ts @@ -6,11 +6,11 @@ goTo.marker('1'); edit.insert('.'); -verify.memberListContains('trim'); -verify.memberListCount(21); +verify.completionListContains('trim'); +verify.completionListCount(21); edit.insert('});'); // need the following lines to not have parse errors in order for completion list to appear goTo.marker('2'); edit.insert('.'); -verify.memberListContains('trim'); -verify.memberListCount(21); +verify.completionListContains('trim'); +verify.completionListCount(21); diff --git a/tests/cases/fourslash/memberCompletionOnTypeParameters.ts b/tests/cases/fourslash/memberCompletionOnTypeParameters.ts index 6092e1e280a..cc3fc92a31a 100644 --- a/tests/cases/fourslash/memberCompletionOnTypeParameters.ts +++ b/tests/cases/fourslash/memberCompletionOnTypeParameters.ts @@ -14,21 +14,21 @@ ////} goTo.marker("S"); -verify.memberListIsEmpty(); +verify.completionListIsEmpty(); goTo.marker("T"); -verify.memberListContains("x", "(property) IFoo.x: number"); -verify.memberListContains("y", "(property) IFoo.y: string"); -verify.memberListCount(2); +verify.completionListContains("x", "(property) IFoo.x: number"); +verify.completionListContains("y", "(property) IFoo.y: string"); +verify.completionListCount(2); goTo.marker("U"); -verify.memberListContains("toString", "(method) Object.toString(): string"); -verify.memberListCount(7); // constructor, toString, toLocaleString, valueOf, hasOwnProperty, isPrototypeOf, propertyIsEnumerable +verify.completionListContains("toString", "(method) Object.toString(): string"); +verify.completionListCount(7); // constructor, toString, toLocaleString, valueOf, hasOwnProperty, isPrototypeOf, propertyIsEnumerable goTo.marker("V"); -verify.memberListContains("x", "(property) IFoo.x: number"); -verify.memberListContains("y", "(property) IFoo.y: string"); -verify.memberListCount(2); +verify.completionListContains("x", "(property) IFoo.x: number"); +verify.completionListContains("y", "(property) IFoo.y: string"); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/memberCompletionOnTypeParameters2.ts b/tests/cases/fourslash/memberCompletionOnTypeParameters2.ts index e7f6c5c6519..f77a8b0c612 100644 --- a/tests/cases/fourslash/memberCompletionOnTypeParameters2.ts +++ b/tests/cases/fourslash/memberCompletionOnTypeParameters2.ts @@ -17,5 +17,5 @@ goTo.marker(); -verify.memberListContains("foo"); -verify.memberListCount(1); +verify.completionListContains("foo"); +verify.completionListCount(1); diff --git a/tests/cases/fourslash/memberListAfterDoubleDot.ts b/tests/cases/fourslash/memberListAfterDoubleDot.ts index 21a1ad913ea..489e7c3b105 100644 --- a/tests/cases/fourslash/memberListAfterDoubleDot.ts +++ b/tests/cases/fourslash/memberListAfterDoubleDot.ts @@ -3,4 +3,4 @@ ////../**/ goTo.marker(); -verify.memberListIsEmpty(); \ No newline at end of file +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListAfterSingleDot.ts b/tests/cases/fourslash/memberListAfterSingleDot.ts index 62edf3b8c9e..ba0cdb1a1eb 100644 --- a/tests/cases/fourslash/memberListAfterSingleDot.ts +++ b/tests/cases/fourslash/memberListAfterSingleDot.ts @@ -3,4 +3,4 @@ ////./**/ goTo.marker(); -verify.memberListIsEmpty(); \ No newline at end of file +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListErrorRecovery.ts b/tests/cases/fourslash/memberListErrorRecovery.ts index 74bd25464f6..ee1fdf9193c 100644 --- a/tests/cases/fourslash/memberListErrorRecovery.ts +++ b/tests/cases/fourslash/memberListErrorRecovery.ts @@ -6,5 +6,5 @@ /////*1*/var bar; goTo.marker(); -verify.memberListContains("fun"); +verify.completionListContains("fun"); verify.not.errorExistsAfterMarker("1"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListInFunctionCall.ts b/tests/cases/fourslash/memberListInFunctionCall.ts index 3c8c8e9ceb1..82e05bc4a00 100644 --- a/tests/cases/fourslash/memberListInFunctionCall.ts +++ b/tests/cases/fourslash/memberListInFunctionCall.ts @@ -11,5 +11,5 @@ goTo.marker(); edit.insert('.'); -verify.memberListContains('charAt'); +verify.completionListContains('charAt'); diff --git a/tests/cases/fourslash/memberListInReopenedEnum.ts b/tests/cases/fourslash/memberListInReopenedEnum.ts index 5101cb46f89..a03ee39041c 100644 --- a/tests/cases/fourslash/memberListInReopenedEnum.ts +++ b/tests/cases/fourslash/memberListInReopenedEnum.ts @@ -12,7 +12,7 @@ goTo.marker('1'); -verify.memberListContains('A', '(enum member) E.A = 0'); -verify.memberListContains('B', '(enum member) E.B = 1'); -verify.memberListContains('C', '(enum member) E.C = 0'); -verify.memberListContains('D', '(enum member) E.D = 1'); \ No newline at end of file +verify.completionListContains('A', '(enum member) E.A = 0'); +verify.completionListContains('B', '(enum member) E.B = 1'); +verify.completionListContains('C', '(enum member) E.C = 0'); +verify.completionListContains('D', '(enum member) E.D = 1'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListInWithBlock.ts b/tests/cases/fourslash/memberListInWithBlock.ts index a37c20dadfa..5253e924ff3 100644 --- a/tests/cases/fourslash/memberListInWithBlock.ts +++ b/tests/cases/fourslash/memberListInWithBlock.ts @@ -12,7 +12,7 @@ ////} goTo.marker('1'); -verify.memberListIsEmpty(); +verify.completionListIsEmpty(); goTo.marker('2'); // Only keywords should show in completion, no members or types diff --git a/tests/cases/fourslash/memberListInWithBlock2.ts b/tests/cases/fourslash/memberListInWithBlock2.ts index 72bccb6926c..534cd12a416 100644 --- a/tests/cases/fourslash/memberListInWithBlock2.ts +++ b/tests/cases/fourslash/memberListInWithBlock2.ts @@ -9,4 +9,4 @@ ////} goTo.marker('1'); -verify.memberListIsEmpty(); \ No newline at end of file +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListInWithBlock3.ts b/tests/cases/fourslash/memberListInWithBlock3.ts index a007b08cd02..b30ceed9897 100644 --- a/tests/cases/fourslash/memberListInWithBlock3.ts +++ b/tests/cases/fourslash/memberListInWithBlock3.ts @@ -4,4 +4,4 @@ ////with(x./*1*/ goTo.marker('1'); -verify.memberListContains("a"); +verify.completionListContains("a"); diff --git a/tests/cases/fourslash/memberListInsideObjectLiterals.ts b/tests/cases/fourslash/memberListInsideObjectLiterals.ts index 99d62cbc6e5..875fb2c7fc9 100644 --- a/tests/cases/fourslash/memberListInsideObjectLiterals.ts +++ b/tests/cases/fourslash/memberListInsideObjectLiterals.ts @@ -26,16 +26,16 @@ // Literal member completion inside empty literal. goTo.marker("1"); -verify.memberListContains("x1", "(property) MyPoint.x1: number"); -verify.memberListContains("y1", "(property) MyPoint.y1: number"); +verify.completionListContains("x1", "(property) MyPoint.x1: number"); +verify.completionListContains("y1", "(property) MyPoint.y1: number"); // Literal member completion for 2nd member name. goTo.marker("2"); -verify.memberListContains("y1", "(property) MyPoint.y1: number"); +verify.completionListContains("y1", "(property) MyPoint.y1: number"); // Literal member completion at existing member name location. goTo.marker("3"); -verify.memberListContains("y1", "(property) MyPoint.y1: number"); +verify.completionListContains("y1", "(property) MyPoint.y1: number"); goTo.marker("4"); -verify.memberListContains("x1", "(property) MyPoint.x1: number"); \ No newline at end of file +verify.completionListContains("x1", "(property) MyPoint.x1: number"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfClass.ts b/tests/cases/fourslash/memberListOfClass.ts index 6c93a0536d9..3355109e4a7 100644 --- a/tests/cases/fourslash/memberListOfClass.ts +++ b/tests/cases/fourslash/memberListOfClass.ts @@ -10,6 +10,6 @@ ////f./**/ goTo.marker(); -verify.memberListCount(2); -verify.memberListContains('pubMeth', '(method) C1.pubMeth(): void'); -verify.memberListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file +verify.completionListCount(2); +verify.completionListContains('pubMeth', '(method) C1.pubMeth(): void'); +verify.completionListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts b/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts index 42171ff2e8b..5caaf5d9c23 100644 --- a/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts +++ b/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts @@ -10,4 +10,4 @@ goTo.file("memberListOfEnumFromExternalModule_file1.ts"); goTo.marker('1'); -verify.memberListContains("One"); \ No newline at end of file +verify.completionListContains("One"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfEnumInModule.ts b/tests/cases/fourslash/memberListOfEnumInModule.ts index f92c5d43ea8..0a3887e3304 100644 --- a/tests/cases/fourslash/memberListOfEnumInModule.ts +++ b/tests/cases/fourslash/memberListOfEnumInModule.ts @@ -9,5 +9,5 @@ ////} goTo.marker(); -verify.memberListContains("bar"); -verify.memberListContains("baz"); \ No newline at end of file +verify.completionListContains("bar"); +verify.completionListContains("baz"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfExportedClass.ts b/tests/cases/fourslash/memberListOfExportedClass.ts index f6632bfe7b0..3c9fe36358b 100644 --- a/tests/cases/fourslash/memberListOfExportedClass.ts +++ b/tests/cases/fourslash/memberListOfExportedClass.ts @@ -11,5 +11,5 @@ ////c./**/ // test on c. goTo.marker(); -verify.memberListCount(1); -verify.memberListContains('pub', '(property) M.C.pub: number'); \ No newline at end of file +verify.completionListCount(1); +verify.completionListContains('pub', '(property) M.C.pub: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfModule.ts b/tests/cases/fourslash/memberListOfModule.ts index f09dfd67dbd..4724691c0a7 100644 --- a/tests/cases/fourslash/memberListOfModule.ts +++ b/tests/cases/fourslash/memberListOfModule.ts @@ -14,6 +14,6 @@ ////var x: Foo./**/ goTo.marker(); -verify.memberListCount(2); -verify.memberListContains('Bar'); -verify.memberListContains('Blah'); \ No newline at end of file +verify.completionListCount(2); +verify.completionListContains('Bar'); +verify.completionListContains('Blah'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfVarInArrowExpression.ts b/tests/cases/fourslash/memberListOfVarInArrowExpression.ts index 03da06989ae..b1a91ae3cb2 100644 --- a/tests/cases/fourslash/memberListOfVarInArrowExpression.ts +++ b/tests/cases/fourslash/memberListOfVarInArrowExpression.ts @@ -15,4 +15,4 @@ goTo.marker('1'); verify.quickInfoIs("(property) a1: string"); -verify.memberListContains("a1", "(property) a1: string"); \ No newline at end of file +verify.completionListContains("a1", "(property) a1: string"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOnContextualThis.ts b/tests/cases/fourslash/memberListOnContextualThis.ts index 7eeb67dc620..e17600cad98 100644 --- a/tests/cases/fourslash/memberListOnContextualThis.ts +++ b/tests/cases/fourslash/memberListOnContextualThis.ts @@ -8,5 +8,5 @@ goTo.marker('1'); verify.quickInfoIs("this: A"); goTo.marker('2'); -verify.memberListContains('a', '(property) A.a: string'); +verify.completionListContains('a', '(property) A.a: string'); diff --git a/tests/cases/fourslash/memberListOnExplicitThis.ts b/tests/cases/fourslash/memberListOnExplicitThis.ts index b776a7c0641..425eb17f8ba 100644 --- a/tests/cases/fourslash/memberListOnExplicitThis.ts +++ b/tests/cases/fourslash/memberListOnExplicitThis.ts @@ -13,17 +13,17 @@ ////function g(this: Restricted) {this./*4*/} goTo.marker('1'); -verify.memberListContains('f', '(method) C1.f(this: this): void'); -verify.memberListContains('g', '(method) C1.g(this: Restricted): void'); -verify.memberListContains('n', '(property) C1.n: number'); -verify.memberListContains('m', '(property) C1.m: number'); +verify.completionListContains('f', '(method) C1.f(this: this): void'); +verify.completionListContains('g', '(method) C1.g(this: Restricted): void'); +verify.completionListContains('n', '(property) C1.n: number'); +verify.completionListContains('m', '(property) C1.m: number'); goTo.marker('2'); -verify.memberListContains('n', '(property) Restricted.n: number'); +verify.completionListContains('n', '(property) Restricted.n: number'); goTo.marker('3'); -verify.memberListIsEmpty(); +verify.completionListIsEmpty(); goTo.marker('4'); -verify.memberListContains('n', '(property) Restricted.n: number'); +verify.completionListContains('n', '(property) Restricted.n: number'); diff --git a/tests/cases/fourslash/memberListOnFunctionParameter.ts b/tests/cases/fourslash/memberListOnFunctionParameter.ts index ee33cdc95e5..52daacb3573 100644 --- a/tests/cases/fourslash/memberListOnFunctionParameter.ts +++ b/tests/cases/fourslash/memberListOnFunctionParameter.ts @@ -6,8 +6,8 @@ ////} goTo.marker(); -verify.memberListContains("charAt"); -verify.memberListContains("charCodeAt"); -verify.memberListContains("length"); -verify.memberListContains("concat"); -verify.not.memberListContains("toFixed"); \ No newline at end of file +verify.completionListContains("charAt"); +verify.completionListContains("charCodeAt"); +verify.completionListContains("length"); +verify.completionListContains("concat"); +verify.not.completionListContains("toFixed"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts b/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts index 341605e391c..c44835f6882 100644 --- a/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts +++ b/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts @@ -8,6 +8,6 @@ ////} goTo.marker(); -verify.memberListContains('privMeth', '(method) C1.privMeth(): void'); -verify.memberListContains('pubMeth', '(method) C1.pubMeth(): void'); -verify.memberListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file +verify.completionListContains('privMeth', '(method) C1.privMeth(): void'); +verify.completionListContains('pubMeth', '(method) C1.pubMeth(): void'); +verify.completionListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberlistOnDDot.ts b/tests/cases/fourslash/memberlistOnDDot.ts index 604bf531fc7..11efdd5d523 100644 --- a/tests/cases/fourslash/memberlistOnDDot.ts +++ b/tests/cases/fourslash/memberlistOnDDot.ts @@ -6,4 +6,4 @@ goTo.marker(); edit.insert('.'); edit.insert('.'); -//verify.not.memberListContains('charAt'); \ No newline at end of file +//verify.not.completionListContains('charAt'); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts b/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts index cfeaabfbb86..25e6cd4c68e 100644 --- a/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts +++ b/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts @@ -64,12 +64,12 @@ verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: strin goTo.marker('7'); verify.quickInfoIs('var m.exportedStrOrNum: string | number'); -verify.memberListContains("exportedStrOrNum", "var m.exportedStrOrNum: string | number"); +verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: string | number"); goTo.marker('8'); verify.quickInfoIs('var m.exportedStrOrNum: number'); -verify.memberListContains("exportedStrOrNum", "var m.exportedStrOrNum: number"); +verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: number"); goTo.marker('9'); verify.quickInfoIs('var m.exportedStrOrNum: string'); -verify.memberListContains("exportedStrOrNum", "var m.exportedStrOrNum: string"); \ No newline at end of file +verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: string"); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts b/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts index 3ae0533d340..e11af2beda4 100644 --- a/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts +++ b/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts @@ -17,8 +17,8 @@ verify.quickInfos({ }); goTo.marker('3'); -verify.memberListContains("x", "(property) x: number", undefined); -verify.memberListContains("b", "(property) b: number", undefined); +verify.completionListContains("x", "(property) x: number", undefined); +verify.completionListContains("b", "(property) b: number", undefined); verify.quickInfoIs("(property) x: number"); verify.quickInfoAt("4", "var point: {\n b: number;\n x: number;\n}"); diff --git a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts index 7beaf5548fb..f592b255ac0 100644 --- a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts +++ b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts @@ -14,6 +14,6 @@ verify.quickInfos({ }); goTo.marker('3'); -verify.memberListContains("x", "(property) x: number", undefined); +verify.completionListContains("x", "(property) x: number", undefined); verify.quickInfoAt("4", "var point: {\n readonly x: number;\n}"); diff --git a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts index 95a304329f2..d66626cc99d 100644 --- a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts +++ b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts @@ -12,8 +12,8 @@ verify.quickInfoAt("1", "function makePoint(x: number): {\n b: number;\n x: number;\n}"); goTo.marker('2'); -verify.memberListContains("x", "(property) x: number", undefined); -verify.memberListContains("b", "(property) b: number", undefined); +verify.completionListContains("x", "(property) x: number", undefined); +verify.completionListContains("b", "(property) b: number", undefined); verify.quickInfoIs("(property) x: number"); verify.quickInfoAt("3", "var point: {\n b: number;\n x: number;\n}"); diff --git a/tests/cases/fourslash/quickInfoWithNestedDestructuredParameterInLambda.ts b/tests/cases/fourslash/quickInfoWithNestedDestructuredParameterInLambda.ts new file mode 100644 index 00000000000..39453ba8cdc --- /dev/null +++ b/tests/cases/fourslash/quickInfoWithNestedDestructuredParameterInLambda.ts @@ -0,0 +1,15 @@ +/// + +// @filename: a.tsx +////import * as React from 'react'; +////interface SomeInterface { +//// someBoolean: boolean, +//// someString: string; +////} +////interface SomeProps { +//// someProp: SomeInterface; +////} +////export const /*1*/SomeStatelessComponent = ({someProp: { someBoolean, someString}}: SomeProps) => (